castle-web-cli 0.4.198 → 0.4.200
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/castle-host/host.js +22 -0
- package/dist/init.js +1 -1
- package/dist/serve.js +3 -0
- package/dist/shell/assets/{index-B9lbHsWz.js → index-DJSLmPmw.js} +3 -3
- package/dist/shell/assets/index-uXcYGwQC.css +1 -0
- package/dist/shell/index.html +2 -2
- package/kits/base/CLAUDE.md +1 -1
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +48 -18
- package/kits/base/sdk/castle.d.ts +2 -0
- package/kits/base/sdk/castle.js +1 -0
- package/kits/base/sdk/commands.d.ts +10 -0
- package/kits/base/sdk/paramsRegistry.d.ts +6 -4
- package/kits/base/sdk/paramsRegistry.js +28 -11
- package/kits/base/sdk/snapshots.d.ts +12 -0
- package/kits/base/sdk/snapshots.js +128 -0
- package/kits/base/sdk/transport.js +1 -0
- package/kits/multiplayer-2d/castle.json +4 -4
- package/kits/multiplayer-2d/code/systems/multiplayer.js +48 -12
- package/kits/multiplayer-2d/package-lock.json +1 -1
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/systems/multiplayer.js +40 -6
- package/kits/multiplayer-3d/package-lock.json +1 -1
- package/kits/physics-2d/CLAUDE.md +5 -4
- package/kits/physics-2d/behaviors/Collider.jsx +3 -3
- package/kits/physics-2d/behaviors/Joints.jsx +2 -2
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/editors/SceneEditor.jsx +5 -5
- package/kits/physics-2d/editors/pxArtTimeline.jsx +1 -1
- package/kits/physics-2d/editors/pxArtTimeline.module.css +73 -73
- package/kits/physics-2d/editors/themeEditor.module.css +17 -17
- package/kits/physics-2d/engine/castle-tokens.css +64 -0
- package/kits/physics-2d/engine/fields/fields.module.css +43 -37
- package/kits/physics-2d/engine/ui.jsx +1 -0
- package/kits/physics-2d/engine/ui.module.css +262 -288
- package/kits/physics-2d/package-lock.json +6 -1
- package/kits/physics-3d/behaviors/Player.jsx +12 -3
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/package-lock.json +1 -1
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/package-lock.json +1 -1
- package/kits/turn-based/castle.json +3 -3
- package/kits/turn-based/package-lock.json +1 -1
- package/package.json +1 -1
- package/dist/shell/assets/index-p8e-uehb.css +0 -1
package/dist/castle-host/host.js
CHANGED
|
@@ -28,6 +28,7 @@ const COMMAND_NAMES = [
|
|
|
28
28
|
"time.getServerTime",
|
|
29
29
|
"pass.has",
|
|
30
30
|
"pass.offer",
|
|
31
|
+
"snapshot.offer",
|
|
31
32
|
"portal.open",
|
|
32
33
|
"portal.prefetch",
|
|
33
34
|
"haptics.play",
|
|
@@ -54,6 +55,7 @@ const COMMAND_NAMES = [
|
|
|
54
55
|
// host's concern, never a deck-facing gate.
|
|
55
56
|
const PLATFORM_COMMAND_NAMES = [
|
|
56
57
|
"pass.offer",
|
|
58
|
+
"snapshot.offer",
|
|
57
59
|
"portal.open",
|
|
58
60
|
"portal.prefetch",
|
|
59
61
|
"haptics.play",
|
|
@@ -163,6 +165,7 @@ function runCommand(ctx, command, params, caps) {
|
|
|
163
165
|
// Platform commands are handled above; listed here to keep the switch
|
|
164
166
|
// exhaustive over CommandName.
|
|
165
167
|
case "pass.offer":
|
|
168
|
+
case "snapshot.offer":
|
|
166
169
|
case "portal.open":
|
|
167
170
|
case "portal.prefetch":
|
|
168
171
|
case "haptics.play":
|
|
@@ -223,6 +226,8 @@ async function runPlatformCommand(ctx, command, params, caps) {
|
|
|
223
226
|
switch (command) {
|
|
224
227
|
case "pass.offer":
|
|
225
228
|
return passesOffer(ctx, params, caps);
|
|
229
|
+
case "snapshot.offer":
|
|
230
|
+
return snapshotOffer(ctx, params, caps);
|
|
226
231
|
case "portal.open":
|
|
227
232
|
return portalOpen(ctx, params, caps);
|
|
228
233
|
case "portal.prefetch":
|
|
@@ -275,6 +280,23 @@ function normalizePassOutcome(value) {
|
|
|
275
280
|
}
|
|
276
281
|
return { status: "cancelled" };
|
|
277
282
|
}
|
|
283
|
+
async function snapshotOffer(ctx, params, caps) {
|
|
284
|
+
const title = typeof params.title === "string" ? params.title : "";
|
|
285
|
+
const description = typeof params.description === "string" ? params.description : "";
|
|
286
|
+
const bricksPrice = typeof params.bricksPrice === "number" ? params.bricksPrice : 0;
|
|
287
|
+
// Hosts with no collect card (the dev CLI) get a normalized unavailable.
|
|
288
|
+
if (!caps.platformHandler)
|
|
289
|
+
return { status: "unavailable" };
|
|
290
|
+
// The item belongs to a deck, so a trusted deckId is required before handing off.
|
|
291
|
+
const deckId = requireDeckId(ctx, "snapshot.offer");
|
|
292
|
+
const outcome = await caps.platformHandler("snapshot.offer", { deckId, title, description, bricksPrice }, ctx);
|
|
293
|
+
const status = outcome?.status;
|
|
294
|
+
const valid = ["collected", "cancelled", "unavailable"];
|
|
295
|
+
if (typeof status === "string" && valid.includes(status)) {
|
|
296
|
+
return { status: status };
|
|
297
|
+
}
|
|
298
|
+
return { status: "cancelled" };
|
|
299
|
+
}
|
|
278
300
|
async function portalOpen(ctx, params, caps) {
|
|
279
301
|
const targetDeckId = asString(params.targetDeckId, "targetDeckId", "portal.open");
|
|
280
302
|
// Hosts that can't navigate the feed (dev CLI — no handler; editor) get a
|
package/dist/init.js
CHANGED
|
@@ -56,7 +56,7 @@ if (!(await mountEditorRoute())) startGame(initCard());
|
|
|
56
56
|
// Registry version of castle-web-sdk to inject when scaffolding from a
|
|
57
57
|
// globally-installed castle-web (not from inside the workspace). Bumped
|
|
58
58
|
// alongside cli/sdk version bumps.
|
|
59
|
-
const PUBLISHED_SDK_VERSION = '0.4.
|
|
59
|
+
const PUBLISHED_SDK_VERSION = '0.4.31';
|
|
60
60
|
// Range, not a pin: `castle-web-fonts` is its own package precisely so a tenth
|
|
61
61
|
// face can ship without a cli release, and a caret range means an existing
|
|
62
62
|
// deck's next install picks it up. Nothing here has to move when it does.
|
package/dist/serve.js
CHANGED
|
@@ -654,6 +654,9 @@ window.__castleShellOrigin=(function(){
|
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
656
|
if (content) {
|
|
657
|
+
// The JS Self-Profiling API is gated on this document policy. A deck
|
|
658
|
+
// that samples itself on a local serve needs it on its own document.
|
|
659
|
+
res.setHeader('Document-Policy', 'js-profiling');
|
|
657
660
|
if (reqPath === '/')
|
|
658
661
|
req.url = `/index.html${req.url?.includes('?') ? req.url.slice(req.url.indexOf('?')) : ''}`;
|
|
659
662
|
const allowedFilesRequest = isAllowedContentFilesRequest(contentRole, req.method, reqPath);
|