castle-web-cli 0.4.129 → 0.4.131

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.
Files changed (144) hide show
  1. package/dist/agent-prompts.js +4 -4
  2. package/dist/filesChanged.d.ts +2 -0
  3. package/dist/filesChanged.js +6 -2
  4. package/dist/ide.js +15 -4
  5. package/dist/importBrowse.js +1 -0
  6. package/dist/index.js +10 -4
  7. package/dist/init.js +63 -15
  8. package/dist/native/loop.js +1 -1
  9. package/dist/native/tools.js +1 -1
  10. package/dist/serve.d.ts +1 -0
  11. package/dist/serve.js +20 -1
  12. package/dist/shell/assets/index-BpOLUyVO.js +441 -0
  13. package/dist/shell/assets/{index-CAq6f9B5.css → index-D6K-0YDB.css} +1 -1
  14. package/dist/shell/index.html +2 -2
  15. package/kits/physics-2d/CLAUDE.md +9 -10
  16. package/kits/physics-2d/castle.json +1 -1
  17. package/kits/physics-2d/editors/PlayOnly.jsx +16 -6
  18. package/kits/physics-2d/editors/PxArtEditor.jsx +95 -31
  19. package/kits/physics-2d/editors/SceneEditor.jsx +10 -10
  20. package/kits/physics-2d/editors/SingleEditor.jsx +37 -8
  21. package/kits/physics-2d/editors/StyleEditor.jsx +7 -4
  22. package/kits/physics-2d/editors/pixelEditorChrome.jsx +7 -7
  23. package/kits/physics-2d/editors/pixelInspector.jsx +13 -7
  24. package/kits/physics-2d/editors/pxArtTimeline.jsx +29 -11
  25. package/kits/physics-2d/editors/pxArtTimeline.module.css +11 -0
  26. package/kits/physics-2d/engine/ScenePlayer.jsx +2 -2
  27. package/kits/physics-2d/engine/blueprint.js +23 -5
  28. package/kits/physics-2d/engine/liveReload.js +33 -21
  29. package/kits/physics-2d/engine/scene.js +17 -5
  30. package/kits/physics-2d/engine/systemRegistry.js +1 -1
  31. package/kits/physics-2d/engine/ui.jsx +2 -2
  32. package/kits/physics-2d/engine/ui.module.css +42 -0
  33. package/kits/physics-3d/CLAUDE.md +108 -0
  34. package/kits/physics-3d/behaviors/Body.jsx +51 -0
  35. package/kits/physics-3d/behaviors/Door.jsx +31 -0
  36. package/kits/physics-3d/behaviors/Lookable.jsx +11 -0
  37. package/kits/physics-3d/behaviors/Model.jsx +14 -0
  38. package/kits/physics-3d/behaviors/Pickup.jsx +39 -0
  39. package/kits/physics-3d/behaviors/Player.jsx +172 -0
  40. package/kits/physics-3d/behaviors/Shape.jsx +75 -0
  41. package/kits/physics-3d/behaviors/Solid.jsx +11 -0
  42. package/kits/physics-3d/behaviors/Transform.jsx +24 -0
  43. package/kits/physics-3d/blueprints/barrel.scene +15 -0
  44. package/kits/physics-3d/blueprints/crate.scene +29 -0
  45. package/kits/physics-3d/blueprints/door.scene +35 -0
  46. package/kits/physics-3d/blueprints/gem.scene +26 -0
  47. package/kits/physics-3d/blueprints/pillar.scene +25 -0
  48. package/kits/physics-3d/blueprints/platform.scene +23 -0
  49. package/kits/physics-3d/blueprints/player.scene +29 -0
  50. package/kits/physics-3d/blueprints/rock.scene +14 -0
  51. package/kits/physics-3d/blueprints/statue.scene +26 -0
  52. package/kits/physics-3d/blueprints/tree.scene +14 -0
  53. package/kits/physics-3d/blueprints/wall.scene +26 -0
  54. package/kits/{basic-2d → physics-3d}/castle.json +23 -5
  55. package/kits/physics-3d/docs/pxmodel-format.md +111 -0
  56. package/kits/physics-3d/drawings/crate.pxart +26 -0
  57. package/kits/physics-3d/drawings/door-edge.pxart +26 -0
  58. package/kits/physics-3d/drawings/door.pxart +27 -0
  59. package/kits/physics-3d/drawings/face.pxart +26 -0
  60. package/kits/physics-3d/drawings/floor.pxart +27 -0
  61. package/kits/physics-3d/drawings/platform.pxart +27 -0
  62. package/kits/physics-3d/drawings/statue.pxart +27 -0
  63. package/kits/physics-3d/drawings/wall.pxart +27 -0
  64. package/kits/physics-3d/engine3d/PlayOnly3D.jsx +36 -0
  65. package/kits/physics-3d/engine3d/PxModelEditor.jsx +619 -0
  66. package/kits/physics-3d/engine3d/Scene3DEditor.jsx +618 -0
  67. package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +309 -0
  68. package/kits/physics-3d/engine3d/editor3dData.js +114 -0
  69. package/kits/physics-3d/engine3d/editor3dInspector.jsx +404 -0
  70. package/kits/physics-3d/engine3d/editorChrome.jsx +218 -0
  71. package/kits/physics-3d/engine3d/editorWorld.js +249 -0
  72. package/kits/physics-3d/engine3d/materials.js +174 -0
  73. package/kits/physics-3d/engine3d/meshops.js +123 -0
  74. package/kits/physics-3d/engine3d/modelEditorWorld.js +439 -0
  75. package/kits/physics-3d/engine3d/modelFiles.js +136 -0
  76. package/kits/physics-3d/engine3d/pxmodel.js +265 -0
  77. package/kits/physics-3d/engine3d/thumbnails.js +137 -0
  78. package/kits/physics-3d/engine3d/world3d.js +216 -0
  79. package/kits/{basic-2d → physics-3d}/eslint.config.js +10 -25
  80. package/kits/physics-3d/index.html +20 -0
  81. package/kits/physics-3d/main.jsx +30 -0
  82. package/kits/physics-3d/models/barrel.pxmodel +10 -0
  83. package/kits/physics-3d/models/player.pxmodel +222 -0
  84. package/kits/physics-3d/models/rock.pxmodel +30 -0
  85. package/kits/physics-3d/models/tree.pxmodel +10 -0
  86. package/kits/{basic-2d → physics-3d}/package-lock.json +140 -119
  87. package/kits/{basic-2d → physics-3d}/package.json +11 -9
  88. package/kits/{basic-2d → physics-3d}/pnpm-lock.yaml +162 -137
  89. package/kits/physics-3d/scenes/main.scene +398 -0
  90. package/kits/physics-3d/scenes/model-lab.scene +111 -0
  91. package/kits/physics-3d/systems/physics3d.js +356 -0
  92. package/package.json +5 -2
  93. package/dist/shell/assets/index-DKu9ejyh.js +0 -436
  94. package/kits/basic-2d/CLAUDE.md +0 -221
  95. package/kits/basic-2d/behaviors/Camera.jsx +0 -43
  96. package/kits/basic-2d/behaviors/Collider.jsx +0 -213
  97. package/kits/basic-2d/behaviors/Layout.jsx +0 -53
  98. package/kits/basic-2d/behaviors/Sprite.jsx +0 -357
  99. package/kits/basic-2d/behaviors/tint.js +0 -47
  100. package/kits/basic-2d/blueprints/cauldron.scene +0 -20
  101. package/kits/basic-2d/docs/pxart-format.md +0 -377
  102. package/kits/basic-2d/drawings/cauldron.pxart +0 -113
  103. package/kits/basic-2d/editors/BlueprintLibrary.jsx +0 -270
  104. package/kits/basic-2d/editors/ErrorBoundary.jsx +0 -59
  105. package/kits/basic-2d/editors/PlayOnly.jsx +0 -31
  106. package/kits/basic-2d/editors/PxArtEditor.jsx +0 -1092
  107. package/kits/basic-2d/editors/SceneEditor.jsx +0 -1780
  108. package/kits/basic-2d/editors/SelectionOverlay.jsx +0 -909
  109. package/kits/basic-2d/editors/SingleEditor.jsx +0 -122
  110. package/kits/basic-2d/editors/behaviorRegistry.js +0 -34
  111. package/kits/basic-2d/editors/editorHistory.js +0 -157
  112. package/kits/basic-2d/editors/inspectorSheet.js +0 -13
  113. package/kits/basic-2d/editors/pixelCanvas.js +0 -11
  114. package/kits/basic-2d/editors/pixelEditorChrome.jsx +0 -74
  115. package/kits/basic-2d/editors/pixelGeometry.js +0 -140
  116. package/kits/basic-2d/editors/pixelInspector.jsx +0 -633
  117. package/kits/basic-2d/editors/pxArtEditorModel.js +0 -732
  118. package/kits/basic-2d/editors/pxArtPlayback.js +0 -92
  119. package/kits/basic-2d/editors/pxArtTimeline.jsx +0 -752
  120. package/kits/basic-2d/editors/pxArtTimeline.module.css +0 -506
  121. package/kits/basic-2d/editors/pxArtTools.js +0 -232
  122. package/kits/basic-2d/editors/useArtboardFit.js +0 -105
  123. package/kits/basic-2d/engine/ScenePlayer.jsx +0 -209
  124. package/kits/basic-2d/engine/SceneUI.jsx +0 -59
  125. package/kits/basic-2d/engine/assets.js +0 -15
  126. package/kits/basic-2d/engine/autoInspector.jsx +0 -70
  127. package/kits/basic-2d/engine/behaviorExtensions.js +0 -32
  128. package/kits/basic-2d/engine/blueprint.js +0 -557
  129. package/kits/basic-2d/engine/collider.js +0 -200
  130. package/kits/basic-2d/engine/files.js +0 -141
  131. package/kits/basic-2d/engine/liveReload.js +0 -88
  132. package/kits/basic-2d/engine/pxart.js +0 -1032
  133. package/kits/basic-2d/engine/pxartSmooth.js +0 -222
  134. package/kits/basic-2d/engine/scene.js +0 -696
  135. package/kits/basic-2d/engine/spriteGeometry.js +0 -32
  136. package/kits/basic-2d/engine/systemRegistry.js +0 -16
  137. package/kits/basic-2d/engine/ui.jsx +0 -695
  138. package/kits/basic-2d/engine/ui.module.css +0 -2287
  139. package/kits/basic-2d/index.html +0 -24
  140. package/kits/basic-2d/main.jsx +0 -24
  141. package/kits/basic-2d/scenes/main.scene +0 -16
  142. package/kits/basic-2d/scripts/draw.mjs +0 -121
  143. /package/kits/{basic-2d → physics-3d}/.prettierrc +0 -0
  144. /package/kits/{basic-2d → physics-3d}/vite.config.js +0 -0
@@ -0,0 +1,20 @@
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 Physics 3D Kit</title>
7
+ <!-- Dark scheme declared statically so the frame never paints light first
8
+ (see the physics-2d kit's index.html for the Safari repaint story). -->
9
+ <style>
10
+ html {
11
+ color-scheme: dark;
12
+ background: #0a0a0a;
13
+ }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <div id="root"></div>
18
+ <script type="module" src="./main.jsx"></script>
19
+ </body>
20
+ </html>
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { isEdit, setup } from 'castle-web-sdk';
4
+ import { PlayOnly3D } from './engine3d/PlayOnly3D';
5
+ import { Scene3DEditor } from './engine3d/Scene3DEditor';
6
+ import { PxModelEditor } from './engine3d/PxModelEditor';
7
+ import { SingleEditor } from '@imports/castle.physics-2d/editors/SingleEditor';
8
+ import { ErrorBoundary } from '@imports/castle.physics-2d/editors/ErrorBoundary';
9
+
10
+ document.body.dataset.castleScreenshotTarget = 'viewport';
11
+ setup();
12
+ const root = document.getElementById('root');
13
+ if (!root) throw new Error('Missing root element');
14
+
15
+ // Route on URL params, same shape as the physics-2d kit's entry:
16
+ // (no edit / ?edit=0) -> play the deck (playtest panel)
17
+ // ?file=<path>[&editor=<id>] -> a single rich editor for that file
18
+ // `.scene` opens the kit's own 3d scene editor; `.pxart` (and media viewers)
19
+ // reuse the imported physics-2d kit's editors.
20
+ const params = new URLSearchParams(window.location.search);
21
+ function pick() {
22
+ const initialScene = params.get('scene') ?? undefined;
23
+ if (!isEdit()) return <PlayOnly3D initialScene={initialScene} />;
24
+ const file = params.get('file');
25
+ if (file?.endsWith('.scene')) return <Scene3DEditor path={file} />;
26
+ if (file?.endsWith('.pxmodel')) return <PxModelEditor path={file} />;
27
+ if (file) return <SingleEditor path={file} editor={params.get('editor') ?? undefined} />;
28
+ return <PlayOnly3D initialScene={initialScene} />;
29
+ }
30
+ createRoot(root).render(<ErrorBoundary>{pick()}</ErrorBoundary>);
@@ -0,0 +1,10 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "Barrel",
4
+ "parts": [
5
+ { "id": "body", "kind": "cylinder", "radius": 0.38, "height": 0.85, "position": [0, 0.45, 0], "color": "#8a4836", "roughness": 0.85 },
6
+ { "id": "bandTop", "parent": "body", "kind": "cylinder", "radius": 0.4, "height": 0.06, "position": [0, 0.28, 0], "color": "#657392", "metalness": 0.5, "roughness": 0.5 },
7
+ { "id": "bandBottom", "parent": "body", "kind": "cylinder", "radius": 0.4, "height": 0.06, "position": [0, -0.28, 0], "color": "#657392", "metalness": 0.5, "roughness": 0.5 },
8
+ { "id": "lid", "parent": "body", "kind": "cylinder", "radius": 0.33, "height": 0.05, "position": [0, 0.43, 0], "color": "#bf6f4a", "roughness": 0.85 }
9
+ ]
10
+ }
@@ -0,0 +1,222 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "Player",
4
+ "parts": [
5
+ {
6
+ "id": "legL",
7
+ "position": [
8
+ 0.11,
9
+ 0.46,
10
+ 0
11
+ ],
12
+ "offset": [
13
+ 0,
14
+ -0.22,
15
+ 0
16
+ ],
17
+ "size": [
18
+ 0.15,
19
+ 0.44,
20
+ 0.17
21
+ ],
22
+ "color": "#45444f"
23
+ },
24
+ {
25
+ "id": "legR",
26
+ "position": [
27
+ -0.11,
28
+ 0.46,
29
+ 0
30
+ ],
31
+ "offset": [
32
+ 0,
33
+ -0.22,
34
+ 0
35
+ ],
36
+ "size": [
37
+ 0.15,
38
+ 0.44,
39
+ 0.17
40
+ ],
41
+ "color": "#45444f"
42
+ },
43
+ {
44
+ "id": "torso",
45
+ "position": [
46
+ 0,
47
+ 0.69,
48
+ 0
49
+ ],
50
+ "size": [
51
+ 0.5,
52
+ 0.52,
53
+ 0.3
54
+ ],
55
+ "color": "#4b80ca"
56
+ },
57
+ {
58
+ "id": "armL",
59
+ "parent": "torso",
60
+ "position": [
61
+ 0.32,
62
+ 0.21,
63
+ 0
64
+ ],
65
+ "offset": [
66
+ 0,
67
+ -0.19,
68
+ 0
69
+ ],
70
+ "size": [
71
+ 0.12,
72
+ 0.42,
73
+ 0.14
74
+ ],
75
+ "color": "#4b80ca"
76
+ },
77
+ {
78
+ "id": "armR",
79
+ "parent": "torso",
80
+ "position": [
81
+ -0.32,
82
+ 0.21,
83
+ 0
84
+ ],
85
+ "offset": [
86
+ 0,
87
+ -0.19,
88
+ 0
89
+ ],
90
+ "size": [
91
+ 0.12,
92
+ 0.42,
93
+ 0.14
94
+ ],
95
+ "color": "#4b80ca"
96
+ },
97
+ {
98
+ "id": "head",
99
+ "parent": "torso",
100
+ "position": [
101
+ 0,
102
+ 0.49,
103
+ 0
104
+ ],
105
+ "size": [
106
+ 0.44,
107
+ 0.42,
108
+ 0.42
109
+ ],
110
+ "color": "#e5ceb4",
111
+ "art": {
112
+ "front": "drawings/face.pxart"
113
+ }
114
+ },
115
+ {
116
+ "id": "cap",
117
+ "parent": "head",
118
+ "kind": "mesh",
119
+ "position": [
120
+ 0,
121
+ 0.24,
122
+ 0
123
+ ],
124
+ "vertices": [
125
+ [
126
+ -0.24,
127
+ -0.06,
128
+ -0.24
129
+ ],
130
+ [
131
+ 0.24,
132
+ -0.06,
133
+ -0.24
134
+ ],
135
+ [
136
+ 0.24,
137
+ 0.06,
138
+ -0.24
139
+ ],
140
+ [
141
+ -0.24,
142
+ 0.06,
143
+ -0.24
144
+ ],
145
+ [
146
+ -0.24,
147
+ -0.06,
148
+ 0.24
149
+ ],
150
+ [
151
+ 0.24,
152
+ -0.06,
153
+ 0.24
154
+ ],
155
+ [
156
+ 0.24,
157
+ 0.06,
158
+ 0.24
159
+ ],
160
+ [
161
+ -0.24,
162
+ 0.06,
163
+ 0.24
164
+ ]
165
+ ],
166
+ "faces": [
167
+ [
168
+ 3,
169
+ 2,
170
+ 1,
171
+ 0
172
+ ],
173
+ [
174
+ 4,
175
+ 5,
176
+ 6,
177
+ 7
178
+ ],
179
+ [
180
+ 1,
181
+ 2,
182
+ 6,
183
+ 5
184
+ ],
185
+ [
186
+ 0,
187
+ 4,
188
+ 7,
189
+ 3
190
+ ],
191
+ [
192
+ 3,
193
+ 7,
194
+ 6,
195
+ 2
196
+ ],
197
+ [
198
+ 0,
199
+ 1,
200
+ 5,
201
+ 4
202
+ ]
203
+ ],
204
+ "color": "#b45252"
205
+ },
206
+ {
207
+ "id": "brim",
208
+ "parent": "head",
209
+ "position": [
210
+ 0,
211
+ 0.2,
212
+ 0.3
213
+ ],
214
+ "size": [
215
+ 0.46,
216
+ 0.05,
217
+ 0.18
218
+ ],
219
+ "color": "#b45252"
220
+ }
221
+ ]
222
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "Rock",
4
+ "parts": [
5
+ {
6
+ "id": "boulder",
7
+ "kind": "mesh",
8
+ "color": "#868188",
9
+ "roughness": 0.95,
10
+ "vertices": [
11
+ [-0.5, 0, -0.45],
12
+ [0.55, 0, -0.5],
13
+ [0.42, 0.8, -0.33],
14
+ [-0.34, 0.66, -0.3],
15
+ [-0.46, 0, 0.52],
16
+ [0.5, 0, 0.48],
17
+ [0.47, 0.62, 0.36],
18
+ [-0.3, 0.72, 0.4]
19
+ ],
20
+ "faces": [
21
+ [3, 2, 1, 0],
22
+ [4, 5, 6, 7],
23
+ [1, 2, 6, 5],
24
+ [0, 4, 7, 3],
25
+ [3, 7, 6, 2],
26
+ [0, 1, 5, 4]
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "format": "pxmodel",
3
+ "name": "Tree",
4
+ "parts": [
5
+ { "id": "trunk", "kind": "cylinder", "radius": 0.18, "height": 1.2, "position": [0, 0.6, 0], "color": "#8a4836", "roughness": 0.9 },
6
+ { "id": "canopy", "parent": "trunk", "kind": "sphere", "radius": 0.75, "position": [0, 0.95, 0], "color": "#1e6f50", "roughness": 0.9 },
7
+ { "id": "canopyHigh", "parent": "trunk", "kind": "sphere", "radius": 0.5, "position": [0.22, 1.45, 0.1], "color": "#5ac54f", "roughness": 0.9 },
8
+ { "id": "canopySide", "parent": "trunk", "kind": "sphere", "radius": 0.45, "position": [-0.35, 1.1, -0.2], "color": "#1e6f50", "roughness": 0.9 }
9
+ ]
10
+ }