castle-web-cli 0.4.114 → 0.4.116
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 +2 -2
- package/dist/agent.d.ts +9 -9
- package/dist/agent.js +590 -589
- package/dist/castleJson.d.ts +7 -0
- package/dist/castleJson.js +10 -0
- package/dist/editorConfig.d.ts +34 -0
- package/dist/editorConfig.js +125 -0
- package/dist/ide.js +245 -120
- package/dist/imports.d.ts +10 -0
- package/dist/imports.js +149 -17
- package/dist/init.d.ts +3 -0
- package/dist/init.js +113 -88
- package/dist/install.d.ts +1 -1
- package/dist/install.js +26 -24
- package/dist/serve.js +16 -0
- package/dist/shell/assets/index-DiPlPGyg.js +144 -0
- package/dist/shell/assets/index-Y6cJRRCX.css +1 -0
- package/dist/shell/index.html +2 -2
- package/dist/unsupportedMedia.d.ts +1 -0
- package/dist/unsupportedMedia.js +54 -0
- package/dist/vitePlugins.js +13 -20
- package/kits/basic-2d/castle.json +1 -1
- package/kits/basic-2d/editors/behaviorRegistry.js +5 -7
- package/kits/physics-2d/CLAUDE.md +65 -34
- package/kits/physics-2d/{physics/behaviors → behaviors}/AnalogStick.jsx +3 -3
- package/kits/physics-2d/behaviors/Collider.jsx +1 -1
- package/kits/physics-2d/{physics/behaviors → behaviors}/Draggable.jsx +3 -3
- package/kits/physics-2d/{physics/behaviors → behaviors}/Joints.jsx +5 -5
- package/kits/physics-2d/{physics/behaviors → behaviors}/RigidBody.jsx +2 -2
- package/kits/physics-2d/{physics/behaviors → behaviors}/Slingshot.jsx +3 -3
- package/kits/physics-2d/behaviors/Sound.jsx +152 -0
- package/kits/physics-2d/behaviors/Sprite.jsx +112 -42
- package/kits/physics-2d/behaviors/Tone.jsx +83 -0
- package/kits/physics-2d/behaviors/Video.jsx +111 -0
- package/kits/physics-2d/behaviors/tint.js +24 -9
- package/kits/physics-2d/blueprints/ball.scene +1 -1
- package/kits/physics-2d/blueprints/block.scene +1 -1
- package/kits/physics-2d/blueprints/cauldron.scene +1 -1
- package/kits/physics-2d/blueprints/crate.scene +1 -1
- package/kits/physics-2d/castle.json +74 -4
- package/kits/physics-2d/docs/pxart-format.md +537 -51
- package/kits/physics-2d/editors/BlueprintLibrary.jsx +7 -3
- package/kits/physics-2d/editors/ImageViewer.jsx +206 -0
- package/kits/physics-2d/editors/MediaPlayer.jsx +57 -0
- package/kits/physics-2d/editors/PxArtEditor.jsx +1794 -65
- package/kits/physics-2d/editors/SceneEditor.jsx +7 -3
- package/kits/physics-2d/editors/SingleEditor.jsx +8 -0
- package/kits/physics-2d/editors/behaviorRegistry.js +5 -7
- package/kits/physics-2d/editors/brushFit.js +535 -0
- package/kits/physics-2d/editors/brushShapes.js +140 -0
- package/kits/physics-2d/editors/mediaFile.js +31 -0
- package/kits/physics-2d/editors/mediaViewer.module.css +128 -0
- package/kits/physics-2d/editors/pathOverlay.js +340 -0
- package/kits/physics-2d/editors/pathTools.js +1906 -0
- package/kits/physics-2d/editors/pixelCanvas.js +13 -0
- package/kits/physics-2d/editors/pixelEditorChrome.jsx +2 -2
- package/kits/physics-2d/editors/pixelGeometry.js +4 -2
- package/kits/physics-2d/editors/pixelInspector.jsx +410 -37
- package/kits/physics-2d/editors/pxArtEditorModel.js +172 -16
- package/kits/physics-2d/editors/pxArtTimeline.jsx +163 -43
- package/kits/physics-2d/editors/pxArtTimeline.module.css +31 -5
- package/kits/physics-2d/engine/ScenePlayer.jsx +1 -0
- package/kits/physics-2d/engine/art.js +105 -0
- package/kits/physics-2d/engine/assets.js +12 -4
- package/kits/physics-2d/engine/audioContext.js +34 -0
- package/kits/physics-2d/engine/blueprint.js +3 -3
- package/kits/physics-2d/engine/collider.js +28 -17
- package/kits/physics-2d/engine/files.js +77 -1
- package/kits/physics-2d/engine/liveReload.js +1 -1
- package/kits/physics-2d/engine/media.js +212 -0
- package/kits/physics-2d/{physics → engine/physics}/PhysicsSystem.js +1 -1
- package/kits/physics-2d/{physics → engine/physics}/jointArt.js +3 -4
- package/kits/physics-2d/{physics → engine/physics}/matterBridge.js +2 -9
- package/kits/physics-2d/engine/pxart.js +153 -35
- package/kits/physics-2d/engine/pxartPath.js +1356 -0
- package/kits/physics-2d/engine/pxartSmooth.js +276 -125
- package/kits/physics-2d/engine/scene.js +12 -0
- package/kits/physics-2d/engine/tone.js +112 -0
- package/kits/physics-2d/engine/ui.jsx +22 -1
- package/kits/physics-2d/engine/ui.module.css +36 -12
- package/kits/physics-2d/package-lock.json +1 -1
- package/kits/physics-2d/scripts/draw.mjs +7 -7
- package/kits/physics-2d/scripts/import-svg.mjs +1231 -0
- package/kits/physics-2d/scripts/svg-emission-guide.md +92 -0
- package/kits/physics-2d/systems/media.js +34 -0
- package/kits/physics-2d/systems/physics.js +12 -3
- package/package.json +1 -1
- package/dist/shell/assets/index-CqpY1xZR.js +0 -144
- package/dist/shell/assets/index-DCwVFL5u.css +0 -1
- package/kits/physics-2d/physics/index.js +0 -26
- /package/kits/physics-2d/drawings/{block.pxart → block.sprite} +0 -0
- /package/kits/physics-2d/drawings/{cauldron.pxart → cauldron.sprite} +0 -0
- /package/kits/physics-2d/drawings/{joint-rope.pxart → joint-rope.sprite} +0 -0
- /package/kits/physics-2d/{physics → engine/physics}/controls.js +0 -0
- /package/kits/physics-2d/{physics → engine/physics}/joints.js +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
faArrowsAltH,
|
|
6
6
|
faArrowsAltV,
|
|
7
7
|
faBars,
|
|
8
|
+
faBezierCurve,
|
|
8
9
|
faChevronDown,
|
|
9
10
|
faChevronRight,
|
|
10
11
|
faChevronUp,
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
faClone,
|
|
13
14
|
faCode,
|
|
14
15
|
faCodeBranch,
|
|
16
|
+
faDotCircle,
|
|
17
|
+
faDrawPolygon,
|
|
15
18
|
faEraser,
|
|
16
19
|
faExpand,
|
|
17
20
|
faExternalLinkAlt,
|
|
@@ -22,9 +25,12 @@ import {
|
|
|
22
25
|
faGlobe,
|
|
23
26
|
faImage,
|
|
24
27
|
faLayerGroup,
|
|
28
|
+
faLocationArrow,
|
|
25
29
|
faObjectGroup,
|
|
30
|
+
faPaintBrush,
|
|
26
31
|
faPalette,
|
|
27
32
|
faPencilAlt,
|
|
33
|
+
faPenNib,
|
|
28
34
|
faPlay,
|
|
29
35
|
faPlus,
|
|
30
36
|
faRedo,
|
|
@@ -37,6 +43,7 @@ import {
|
|
|
37
43
|
faStamp,
|
|
38
44
|
faStop,
|
|
39
45
|
faSyncAlt,
|
|
46
|
+
faTh,
|
|
40
47
|
faTimes,
|
|
41
48
|
faTrash,
|
|
42
49
|
faUndo,
|
|
@@ -190,6 +197,7 @@ export function IconButton({ icon, label, active = false, variant = '', ...props
|
|
|
190
197
|
}
|
|
191
198
|
const icons = {
|
|
192
199
|
bars: faBars,
|
|
200
|
+
'bezier-curve': faBezierCurve,
|
|
193
201
|
camera: faVideo,
|
|
194
202
|
'chevron-down': faChevronDown,
|
|
195
203
|
'chevron-right': faChevronRight,
|
|
@@ -199,6 +207,8 @@ const icons = {
|
|
|
199
207
|
code: faCode,
|
|
200
208
|
// FA5 has no faCodeFork (that's the FA6 name); faCodeBranch is the fork glyph.
|
|
201
209
|
'code-fork': faCodeBranch,
|
|
210
|
+
'dot-circle': faDotCircle,
|
|
211
|
+
'draw-polygon': faDrawPolygon,
|
|
202
212
|
eraser: faEraser,
|
|
203
213
|
expand: faExpand,
|
|
204
214
|
external: faExternalLinkAlt,
|
|
@@ -209,13 +219,18 @@ const icons = {
|
|
|
209
219
|
file: faFile,
|
|
210
220
|
film: faFilm,
|
|
211
221
|
globe: faGlobe,
|
|
222
|
+
grid: faTh,
|
|
212
223
|
image: faImage,
|
|
213
224
|
'layer-group': faLayerGroup,
|
|
225
|
+
// FA's location-arrow points up-right; flip it for a path-select cursor feel.
|
|
226
|
+
'location-arrow': { ...faLocationArrow, flipX: true },
|
|
214
227
|
marquee: faVectorSquare,
|
|
215
228
|
move: faArrowsAlt,
|
|
216
229
|
'object-group': faObjectGroup,
|
|
230
|
+
paintbrush: faPaintBrush,
|
|
217
231
|
palette: faPalette,
|
|
218
232
|
pencil: faPencilAlt,
|
|
233
|
+
'pen-nib': faPenNib,
|
|
219
234
|
play: faPlay,
|
|
220
235
|
plus: faPlus,
|
|
221
236
|
redo: faRedo,
|
|
@@ -244,7 +259,13 @@ export function Icon({ name }) {
|
|
|
244
259
|
<svg
|
|
245
260
|
viewBox={`0 0 ${width} ${height}`}
|
|
246
261
|
aria-hidden="true"
|
|
247
|
-
style={{
|
|
262
|
+
style={{
|
|
263
|
+
width: '1em',
|
|
264
|
+
height: '1em',
|
|
265
|
+
display: 'inline-block',
|
|
266
|
+
fill: 'currentColor',
|
|
267
|
+
...(def.flipX ? { transform: 'scaleX(-1)' } : {}),
|
|
268
|
+
}}>
|
|
248
269
|
<path d={d} />
|
|
249
270
|
</svg>
|
|
250
271
|
);
|
|
@@ -1591,7 +1591,7 @@
|
|
|
1591
1591
|
color: var(--castle-inspector-muted);
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
1594
|
-
.
|
|
1594
|
+
.finishBar {
|
|
1595
1595
|
display: flex;
|
|
1596
1596
|
align-items: center;
|
|
1597
1597
|
gap: 6px;
|
|
@@ -1600,21 +1600,23 @@
|
|
|
1600
1600
|
color: var(--castle-inspector-muted);
|
|
1601
1601
|
}
|
|
1602
1602
|
|
|
1603
|
-
/*
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
.cornerRadiusSegments {
|
|
1603
|
+
/* Finish segmented control (square / ¼ / ½ / circle) — bordered row of
|
|
1604
|
+
short text + icon segments. */
|
|
1605
|
+
.finishSegments {
|
|
1607
1606
|
display: flex;
|
|
1608
1607
|
border: 1px solid var(--castle-inspector-border);
|
|
1609
1608
|
border-radius: var(--castle-radius);
|
|
1610
1609
|
overflow: hidden;
|
|
1611
1610
|
}
|
|
1612
1611
|
|
|
1613
|
-
.
|
|
1612
|
+
.finishSegments > * + * {
|
|
1614
1613
|
border-left: 1px solid var(--castle-inspector-border);
|
|
1615
1614
|
}
|
|
1616
1615
|
|
|
1617
|
-
.
|
|
1616
|
+
.finishSegment {
|
|
1617
|
+
display: inline-flex;
|
|
1618
|
+
align-items: center;
|
|
1619
|
+
justify-content: center;
|
|
1618
1620
|
min-width: 28px;
|
|
1619
1621
|
padding: 3px 8px;
|
|
1620
1622
|
border: 0;
|
|
@@ -1626,15 +1628,15 @@
|
|
|
1626
1628
|
line-height: 1.35;
|
|
1627
1629
|
}
|
|
1628
1630
|
|
|
1629
|
-
.
|
|
1631
|
+
.finishSegment:hover {
|
|
1630
1632
|
background: var(--castle-inspector-input-bg);
|
|
1631
1633
|
}
|
|
1632
1634
|
|
|
1633
|
-
/* Compound selector (not a bare `.
|
|
1635
|
+
/* Compound selector (not a bare `.finishSegmentOn`) for the same reason
|
|
1634
1636
|
documented above `.drawingToolButton.drawingToolSelected`: it must beat
|
|
1635
|
-
`.
|
|
1636
|
-
.
|
|
1637
|
-
.
|
|
1637
|
+
`.finishSegment:hover` on specificity no matter source order. */
|
|
1638
|
+
.finishSegment.finishSegmentOn,
|
|
1639
|
+
.finishSegment.finishSegmentOn:hover {
|
|
1638
1640
|
background: var(--castle-selected);
|
|
1639
1641
|
color: var(--castle-selected-ink);
|
|
1640
1642
|
}
|
|
@@ -1873,6 +1875,7 @@
|
|
|
1873
1875
|
height: 100%;
|
|
1874
1876
|
pointer-events: none;
|
|
1875
1877
|
z-index: -1;
|
|
1878
|
+
image-rendering: auto;
|
|
1876
1879
|
}
|
|
1877
1880
|
|
|
1878
1881
|
.drawingCanvas {
|
|
@@ -1888,6 +1891,19 @@
|
|
|
1888
1891
|
outline: none;
|
|
1889
1892
|
}
|
|
1890
1893
|
|
|
1894
|
+
/* Smooth/rounded finish: the main canvas is transparent (smooth layer below).
|
|
1895
|
+
Pixelated upscaling of the native grid would paint a visible cell lattice
|
|
1896
|
+
over the whole artboard — use auto scaling instead. */
|
|
1897
|
+
.drawingCanvasSmooth {
|
|
1898
|
+
image-rendering: auto;
|
|
1899
|
+
position: absolute;
|
|
1900
|
+
inset: 0;
|
|
1901
|
+
width: 100%;
|
|
1902
|
+
height: 100%;
|
|
1903
|
+
flex: 0 0 auto;
|
|
1904
|
+
outline: none;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1891
1907
|
.palette {
|
|
1892
1908
|
display: grid;
|
|
1893
1909
|
grid-template-columns: repeat(12, minmax(0, 1fr));
|
|
@@ -2010,6 +2026,14 @@
|
|
|
2010
2026
|
color: var(--castle-selected-ink);
|
|
2011
2027
|
}
|
|
2012
2028
|
|
|
2029
|
+
/* Groups of shape-action rows (fill/stroke · transform · punch/delete). */
|
|
2030
|
+
.drawingShapeModeGroups {
|
|
2031
|
+
display: flex;
|
|
2032
|
+
flex-wrap: wrap;
|
|
2033
|
+
gap: 8px;
|
|
2034
|
+
align-items: flex-start;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2013
2037
|
/* Horizontal segmented row of shape sub-mode buttons in the wide-layout Tool
|
|
2014
2038
|
Settings panel. Reuses .drawingToolButton glyph buttons with shared borders. */
|
|
2015
2039
|
.drawingShapeModeRow {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Reads an <svg> with one <rect> per pixel from stdin (or `--from <file>`),
|
|
4
4
|
// decodes + palette-quantizes it onto the agent 16-color subset, and writes a
|
|
5
|
-
// single-frame `drawings/<name>.
|
|
5
|
+
// single-frame `drawings/<name>.sprite` in the deck (the script's cwd).
|
|
6
6
|
//
|
|
7
7
|
// This is a kit-layer concern: the `.pxart` format lives entirely in the kit
|
|
8
8
|
// (engine/pxart.js); the harness has no knowledge of it.
|
|
@@ -31,19 +31,19 @@ function readStdin() {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// Normalize a requested sprite name into a relative `drawings/<...>.
|
|
35
|
-
// path. Tolerates a leading `drawings/` and/or a trailing `.pxart`/`.px.json`
|
|
36
|
-
// so `draw ship`, `draw ship.
|
|
34
|
+
// Normalize a requested sprite name into a relative `drawings/<...>.sprite`
|
|
35
|
+
// path. Tolerates a leading `drawings/` and/or a trailing `.sprite`/`.pxart`/`.px.json`
|
|
36
|
+
// so `draw ship`, `draw ship.sprite`, and `draw drawings/ship.pxart` all land in
|
|
37
37
|
// the same place.
|
|
38
38
|
function resolveSpritePath(dir, name) {
|
|
39
39
|
let rel = name.trim().replace(/\\/g, '/');
|
|
40
40
|
rel = rel.replace(/^\.?\/*/, '');
|
|
41
41
|
if (rel.startsWith('drawings/')) rel = rel.slice('drawings/'.length);
|
|
42
|
-
rel = rel.replace(/\.px\.json$/i, '').replace(/\.pxart$/i, '');
|
|
42
|
+
rel = rel.replace(/\.px\.json$/i, '').replace(/\.(?:pxart|sprite)$/i, '');
|
|
43
43
|
if (!rel) return null;
|
|
44
44
|
|
|
45
45
|
const drawingsDir = path.resolve(dir, 'drawings');
|
|
46
|
-
const filepath = path.resolve(drawingsDir, `${rel}.
|
|
46
|
+
const filepath = path.resolve(drawingsDir, `${rel}.sprite`);
|
|
47
47
|
const within = path.relative(drawingsDir, filepath);
|
|
48
48
|
if (within.startsWith('..') || path.isAbsolute(within)) return null;
|
|
49
49
|
return filepath;
|
|
@@ -72,7 +72,7 @@ function positionals() {
|
|
|
72
72
|
async function main() {
|
|
73
73
|
const name = positionals()[0];
|
|
74
74
|
if (!name) {
|
|
75
|
-
console.error('Usage: npm run draw -- <name> [--from FILE] (svg-rect on stdin -> drawings/<name>.
|
|
75
|
+
console.error('Usage: npm run draw -- <name> [--from FILE] (svg-rect on stdin -> drawings/<name>.sprite)');
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
|