castle-web-cli 0.4.129 → 0.4.130
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 -4
- package/dist/filesChanged.d.ts +2 -0
- package/dist/filesChanged.js +6 -2
- package/dist/ide.js +15 -4
- package/dist/importBrowse.js +1 -0
- package/dist/index.js +10 -4
- package/dist/init.js +63 -15
- package/dist/native/loop.js +1 -1
- package/dist/native/tools.js +1 -1
- package/dist/serve.d.ts +1 -0
- package/dist/serve.js +20 -1
- package/dist/shell/assets/index-BpOLUyVO.js +441 -0
- package/dist/shell/assets/{index-CAq6f9B5.css → index-D6K-0YDB.css} +1 -1
- package/dist/shell/index.html +2 -2
- package/kits/physics-2d/CLAUDE.md +9 -10
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-2d/editors/PlayOnly.jsx +15 -6
- package/kits/physics-2d/editors/PxArtEditor.jsx +95 -31
- package/kits/physics-2d/editors/SceneEditor.jsx +5 -5
- package/kits/physics-2d/editors/SingleEditor.jsx +37 -8
- package/kits/physics-2d/editors/StyleEditor.jsx +7 -4
- package/kits/physics-2d/editors/pixelEditorChrome.jsx +7 -7
- package/kits/physics-2d/editors/pixelInspector.jsx +13 -7
- package/kits/physics-2d/editors/pxArtTimeline.jsx +29 -11
- package/kits/physics-2d/editors/pxArtTimeline.module.css +11 -0
- package/kits/physics-2d/engine/blueprint.js +15 -3
- package/kits/physics-2d/engine/liveReload.js +33 -21
- package/kits/physics-2d/engine/systemRegistry.js +1 -1
- package/kits/physics-2d/engine/ui.jsx +2 -2
- package/kits/physics-2d/engine/ui.module.css +42 -0
- package/kits/physics-3d/CLAUDE.md +109 -0
- package/kits/physics-3d/behaviors/Body.jsx +51 -0
- package/kits/physics-3d/behaviors/Door.jsx +31 -0
- package/kits/physics-3d/behaviors/Lookable.jsx +11 -0
- package/kits/physics-3d/behaviors/Model.jsx +14 -0
- package/kits/physics-3d/behaviors/Pickup.jsx +39 -0
- package/kits/physics-3d/behaviors/Player.jsx +172 -0
- package/kits/physics-3d/behaviors/Portal.jsx +19 -0
- package/kits/physics-3d/behaviors/Shape.jsx +75 -0
- package/kits/physics-3d/behaviors/Solid.jsx +11 -0
- package/kits/physics-3d/behaviors/Transform.jsx +24 -0
- package/kits/physics-3d/blueprints/barrel.scene +15 -0
- package/kits/physics-3d/blueprints/crate.scene +29 -0
- package/kits/physics-3d/blueprints/door.scene +35 -0
- package/kits/physics-3d/blueprints/gem.scene +26 -0
- package/kits/physics-3d/blueprints/pillar.scene +25 -0
- package/kits/physics-3d/blueprints/platform.scene +23 -0
- package/kits/physics-3d/blueprints/player.scene +29 -0
- package/kits/physics-3d/blueprints/portal.scene +21 -0
- package/kits/physics-3d/blueprints/rock.scene +14 -0
- package/kits/physics-3d/blueprints/statue.scene +26 -0
- package/kits/physics-3d/blueprints/tree.scene +14 -0
- package/kits/physics-3d/blueprints/wall.scene +26 -0
- package/kits/{basic-2d → physics-3d}/castle.json +23 -5
- package/kits/physics-3d/docs/pxmodel-format.md +111 -0
- package/kits/physics-3d/drawings/crate.pxart +26 -0
- package/kits/physics-3d/drawings/door-edge.pxart +26 -0
- package/kits/physics-3d/drawings/door.pxart +27 -0
- package/kits/physics-3d/drawings/face.pxart +26 -0
- package/kits/physics-3d/drawings/floor.pxart +27 -0
- package/kits/physics-3d/drawings/platform.pxart +27 -0
- package/kits/physics-3d/drawings/statue.pxart +27 -0
- package/kits/physics-3d/drawings/wall.pxart +27 -0
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +32 -0
- package/kits/physics-3d/engine3d/PxModelEditor.jsx +619 -0
- package/kits/physics-3d/engine3d/Scene3DEditor.jsx +618 -0
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +309 -0
- package/kits/physics-3d/engine3d/editor3dData.js +114 -0
- package/kits/physics-3d/engine3d/editor3dInspector.jsx +404 -0
- package/kits/physics-3d/engine3d/editorChrome.jsx +218 -0
- package/kits/physics-3d/engine3d/editorWorld.js +249 -0
- package/kits/physics-3d/engine3d/materials.js +174 -0
- package/kits/physics-3d/engine3d/meshops.js +123 -0
- package/kits/physics-3d/engine3d/modelEditorWorld.js +439 -0
- package/kits/physics-3d/engine3d/modelFiles.js +139 -0
- package/kits/physics-3d/engine3d/pxmodel.js +265 -0
- package/kits/physics-3d/engine3d/thumbnails.js +137 -0
- package/kits/physics-3d/engine3d/world3d.js +216 -0
- package/kits/{basic-2d → physics-3d}/eslint.config.js +10 -25
- package/kits/physics-3d/index.html +20 -0
- package/kits/physics-3d/main.jsx +30 -0
- package/kits/physics-3d/models/barrel.pxmodel +10 -0
- package/kits/physics-3d/models/player.pxmodel +222 -0
- package/kits/physics-3d/models/rock.pxmodel +30 -0
- package/kits/physics-3d/models/tree.pxmodel +10 -0
- package/kits/{basic-2d → physics-3d}/package-lock.json +140 -119
- package/kits/{basic-2d → physics-3d}/package.json +11 -9
- package/kits/{basic-2d → physics-3d}/pnpm-lock.yaml +162 -137
- package/kits/physics-3d/scenes/main.scene +414 -0
- package/kits/physics-3d/scenes/model-lab.scene +127 -0
- package/kits/physics-3d/systems/physics3d.js +356 -0
- package/package.json +5 -2
- package/dist/shell/assets/index-DKu9ejyh.js +0 -436
- package/kits/basic-2d/CLAUDE.md +0 -221
- package/kits/basic-2d/behaviors/Camera.jsx +0 -43
- package/kits/basic-2d/behaviors/Collider.jsx +0 -213
- package/kits/basic-2d/behaviors/Layout.jsx +0 -53
- package/kits/basic-2d/behaviors/Sprite.jsx +0 -357
- package/kits/basic-2d/behaviors/tint.js +0 -47
- package/kits/basic-2d/blueprints/cauldron.scene +0 -20
- package/kits/basic-2d/docs/pxart-format.md +0 -377
- package/kits/basic-2d/drawings/cauldron.pxart +0 -113
- package/kits/basic-2d/editors/BlueprintLibrary.jsx +0 -270
- package/kits/basic-2d/editors/ErrorBoundary.jsx +0 -59
- package/kits/basic-2d/editors/PlayOnly.jsx +0 -31
- package/kits/basic-2d/editors/PxArtEditor.jsx +0 -1092
- package/kits/basic-2d/editors/SceneEditor.jsx +0 -1780
- package/kits/basic-2d/editors/SelectionOverlay.jsx +0 -909
- package/kits/basic-2d/editors/SingleEditor.jsx +0 -122
- package/kits/basic-2d/editors/behaviorRegistry.js +0 -34
- package/kits/basic-2d/editors/editorHistory.js +0 -157
- package/kits/basic-2d/editors/inspectorSheet.js +0 -13
- package/kits/basic-2d/editors/pixelCanvas.js +0 -11
- package/kits/basic-2d/editors/pixelEditorChrome.jsx +0 -74
- package/kits/basic-2d/editors/pixelGeometry.js +0 -140
- package/kits/basic-2d/editors/pixelInspector.jsx +0 -633
- package/kits/basic-2d/editors/pxArtEditorModel.js +0 -732
- package/kits/basic-2d/editors/pxArtPlayback.js +0 -92
- package/kits/basic-2d/editors/pxArtTimeline.jsx +0 -752
- package/kits/basic-2d/editors/pxArtTimeline.module.css +0 -506
- package/kits/basic-2d/editors/pxArtTools.js +0 -232
- package/kits/basic-2d/editors/useArtboardFit.js +0 -105
- package/kits/basic-2d/engine/ScenePlayer.jsx +0 -209
- package/kits/basic-2d/engine/SceneUI.jsx +0 -59
- package/kits/basic-2d/engine/assets.js +0 -15
- package/kits/basic-2d/engine/autoInspector.jsx +0 -70
- package/kits/basic-2d/engine/behaviorExtensions.js +0 -32
- package/kits/basic-2d/engine/blueprint.js +0 -557
- package/kits/basic-2d/engine/collider.js +0 -200
- package/kits/basic-2d/engine/files.js +0 -141
- package/kits/basic-2d/engine/liveReload.js +0 -88
- package/kits/basic-2d/engine/pxart.js +0 -1032
- package/kits/basic-2d/engine/pxartSmooth.js +0 -222
- package/kits/basic-2d/engine/scene.js +0 -696
- package/kits/basic-2d/engine/spriteGeometry.js +0 -32
- package/kits/basic-2d/engine/systemRegistry.js +0 -16
- package/kits/basic-2d/engine/ui.jsx +0 -695
- package/kits/basic-2d/engine/ui.module.css +0 -2287
- package/kits/basic-2d/index.html +0 -24
- package/kits/basic-2d/main.jsx +0 -24
- package/kits/basic-2d/scenes/main.scene +0 -16
- package/kits/basic-2d/scripts/draw.mjs +0 -121
- /package/kits/{basic-2d → physics-3d}/.prettierrc +0 -0
- /package/kits/{basic-2d → physics-3d}/vite.config.js +0 -0
package/kits/basic-2d/index.html
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
|
5
|
-
<meta name="color-scheme" content="dark" />
|
|
6
|
-
<title>Castle Basic 2D JS Kit</title>
|
|
7
|
-
<!-- Declare the dark scheme + opaque dark background statically, before the
|
|
8
|
-
JS-imported CSS module loads. Otherwise this frame paints with the
|
|
9
|
-
default (light) scheme first and only switches to dark once the module
|
|
10
|
-
applies -- and Safari fails to repaint a composited iframe on a
|
|
11
|
-
color-scheme change (WebKit bug 309097), leaving static panels like the
|
|
12
|
-
file list blank until a forced repaint (e.g. opening devtools). -->
|
|
13
|
-
<style>
|
|
14
|
-
html {
|
|
15
|
-
color-scheme: dark;
|
|
16
|
-
background: #0a0a0a;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div id="root"></div>
|
|
22
|
-
<script type="module" src="/main.jsx"></script>
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
package/kits/basic-2d/main.jsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { isEdit, setup } from 'castle-web-sdk';
|
|
4
|
-
import { PlayOnly } from './editors/PlayOnly';
|
|
5
|
-
import { ErrorBoundary } from './editors/ErrorBoundary';
|
|
6
|
-
import { SingleEditor } from './editors/SingleEditor';
|
|
7
|
-
document.body.dataset.castleScreenshotTarget = 'viewport';
|
|
8
|
-
setup();
|
|
9
|
-
const root = document.getElementById('root');
|
|
10
|
-
if (!root) throw new Error('Missing root element');
|
|
11
|
-
// Route on URL params so the shell can mount each piece in its own panel iframe.
|
|
12
|
-
// File browsing and the code/text editor are now builtin shell panels, so the
|
|
13
|
-
// kit only renders the deck (play) and its rich per-file editors (scene/pxart):
|
|
14
|
-
// (no edit / ?edit=0) -> play the deck (playtest panel)
|
|
15
|
-
// ?file=<path>[&editor=<id>] -> a single rich editor for that file
|
|
16
|
-
const params = new URLSearchParams(window.location.search);
|
|
17
|
-
function pick() {
|
|
18
|
-
const initialScene = params.get('scene') ?? undefined;
|
|
19
|
-
if (!isEdit()) return <PlayOnly initialScene={initialScene} />;
|
|
20
|
-
const file = params.get('file');
|
|
21
|
-
if (file) return <SingleEditor path={file} editor={params.get('editor') ?? undefined} />;
|
|
22
|
-
return <PlayOnly initialScene={initialScene} />;
|
|
23
|
-
}
|
|
24
|
-
createRoot(root).render(<ErrorBoundary>{pick()}</ErrorBoundary>);
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
// `npm run draw -- <name>` — turn a terse svg-rect emission into a sprite.
|
|
2
|
-
//
|
|
3
|
-
// Reads an <svg> with one <rect> per pixel from stdin (or `--from <file>`),
|
|
4
|
-
// decodes + palette-quantizes it onto the agent 16-color subset, and writes a
|
|
5
|
-
// single-frame `drawings/<name>.pxart` in the deck (the script's cwd).
|
|
6
|
-
//
|
|
7
|
-
// This is a kit-layer concern: the `.pxart` format lives entirely in the kit
|
|
8
|
-
// (engine/pxart.js); the harness has no knowledge of it.
|
|
9
|
-
|
|
10
|
-
import * as fs from 'fs';
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
import {
|
|
13
|
-
svgRectToPxArt,
|
|
14
|
-
serializeCompact,
|
|
15
|
-
AGENT_PALETTE_16,
|
|
16
|
-
DEFAULT_RESOLUTION,
|
|
17
|
-
} from '../engine/pxart.js';
|
|
18
|
-
|
|
19
|
-
// Read all of stdin as a UTF-8 string. Resolves '' if stdin is a TTY with no
|
|
20
|
-
// piped input so we can give a clear "no input" error instead of hanging.
|
|
21
|
-
function readStdin() {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
if (process.stdin.isTTY) {
|
|
24
|
-
resolve('');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const chunks = [];
|
|
28
|
-
process.stdin.on('data', (c) => chunks.push(c));
|
|
29
|
-
process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
|
|
30
|
-
process.stdin.on('error', reject);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Normalize a requested sprite name into a relative `drawings/<...>.pxart`
|
|
35
|
-
// path. Tolerates a leading `drawings/` and/or a trailing `.pxart`/`.px.json`
|
|
36
|
-
// so `draw ship`, `draw ship.pxart`, and `draw drawings/ship.pxart` all land in
|
|
37
|
-
// the same place.
|
|
38
|
-
function resolveSpritePath(dir, name) {
|
|
39
|
-
let rel = name.trim().replace(/\\/g, '/');
|
|
40
|
-
rel = rel.replace(/^\.?\/*/, '');
|
|
41
|
-
if (rel.startsWith('drawings/')) rel = rel.slice('drawings/'.length);
|
|
42
|
-
rel = rel.replace(/\.px\.json$/i, '').replace(/\.pxart$/i, '');
|
|
43
|
-
if (!rel) return null;
|
|
44
|
-
|
|
45
|
-
const drawingsDir = path.resolve(dir, 'drawings');
|
|
46
|
-
const filepath = path.resolve(drawingsDir, `${rel}.pxart`);
|
|
47
|
-
const within = path.relative(drawingsDir, filepath);
|
|
48
|
-
if (within.startsWith('..') || path.isAbsolute(within)) return null;
|
|
49
|
-
return filepath;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function getFlagValue(flag) {
|
|
53
|
-
const idx = process.argv.indexOf(flag);
|
|
54
|
-
return idx >= 0 ? process.argv[idx + 1] : undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// All positional (non-flag) args after the script, in order.
|
|
58
|
-
function positionals() {
|
|
59
|
-
const args = process.argv.slice(2);
|
|
60
|
-
const withValues = new Set(['--from']);
|
|
61
|
-
const out = [];
|
|
62
|
-
for (let i = 0; i < args.length; i++) {
|
|
63
|
-
if (args[i].startsWith('--')) {
|
|
64
|
-
if (withValues.has(args[i])) i++;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
out.push(args[i]);
|
|
68
|
-
}
|
|
69
|
-
return out;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async function main() {
|
|
73
|
-
const name = positionals()[0];
|
|
74
|
-
if (!name) {
|
|
75
|
-
console.error('Usage: npm run draw -- <name> [--from FILE] (svg-rect on stdin -> drawings/<name>.pxart)');
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// The script's cwd is the deck; sprites land under <deck>/drawings/.
|
|
80
|
-
const dir = process.cwd();
|
|
81
|
-
const filepath = resolveSpritePath(dir, name);
|
|
82
|
-
if (!filepath) {
|
|
83
|
-
console.error(`Invalid sprite name: ${name}`);
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const fromFile = getFlagValue('--from');
|
|
88
|
-
let svg;
|
|
89
|
-
if (fromFile) {
|
|
90
|
-
try {
|
|
91
|
-
svg = fs.readFileSync(path.resolve(fromFile), 'utf-8');
|
|
92
|
-
} catch (e) {
|
|
93
|
-
console.error(`Could not read --from file ${fromFile}: ${e instanceof Error ? e.message : String(e)}`);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
svg = await readStdin();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!svg.trim()) {
|
|
101
|
-
console.error('No svg-rect input. Pipe an <svg> with <rect> cells via stdin or pass --from <file>.');
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const art = svgRectToPxArt(svg, { resolution: DEFAULT_RESOLUTION, palette: AGENT_PALETTE_16 });
|
|
106
|
-
if (!art) {
|
|
107
|
-
console.error('Could not decode any pixels from the svg-rect input (no usable <rect fill="...">). Emit one <rect> per filled pixel on a 16x16 viewBox.');
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
fs.mkdirSync(path.dirname(filepath), { recursive: true });
|
|
112
|
-
fs.writeFileSync(filepath, serializeCompact(art), 'utf-8');
|
|
113
|
-
|
|
114
|
-
const rel = path.relative(path.resolve(dir), filepath);
|
|
115
|
-
console.log(`Wrote ${rel}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
main().catch((e) => {
|
|
119
|
-
console.error(e instanceof Error ? e.message : String(e));
|
|
120
|
-
process.exit(1);
|
|
121
|
-
});
|
|
File without changes
|
|
File without changes
|