castle-web-cli 0.4.162 → 0.4.164
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/devSessionChild.js +23 -0
- package/dist/devSessionServer.js +49 -4
- package/dist/headlessCover.js +12 -1
- package/dist/init.js +1 -1
- package/dist/platformDoc.js +5 -1
- package/dist/save-deck.d.ts +2 -0
- package/dist/save-deck.js +53 -20
- package/dist/shell/assets/index-CIRBt1qf.css +1 -0
- package/dist/shell/assets/index-QtCau5vM.js +444 -0
- package/dist/shell/index.html +2 -2
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +13 -1
- package/kits/base/sdk/multiplayer.d.ts +2 -0
- package/kits/base/sdk/multiplayer.js +59 -16
- package/kits/base/sdk/multiplayerProtocol.d.ts +3 -0
- package/kits/base/sdk/multiplayerProtocol.js +13 -0
- package/kits/base/sdk/server/platformHandle.d.ts +3 -0
- package/kits/base/sdk/server/wrapper.d.ts +3 -0
- package/kits/base/sdk/server/wrapper.js +42 -0
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-2d/engine/ui.jsx +24 -0
- package/kits/physics-2d/engine/ui.module.css +5 -0
- package/package.json +3 -2
- package/dist/shell/assets/index--_Rr2xwM.js +0 -441
- package/dist/shell/assets/index-DfZmu3XC.css +0 -1
- package/kits/base/node_modules/.package-lock.json +0 -28
- package/kits/base/node_modules/castle-web-fonts/README.md +0 -114
- package/kits/base/node_modules/castle-web-fonts/dist/catalog.d.ts +0 -18
- package/kits/base/node_modules/castle-web-fonts/dist/catalog.js +0 -142
- package/kits/base/node_modules/castle-web-fonts/dist/face.d.ts +0 -1
- package/kits/base/node_modules/castle-web-fonts/dist/face.js +0 -52
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Bore.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Bore.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/CourierPrime.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/CourierPrime.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/DMSans.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/DMSans.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Glacier.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Glacier.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/HelicoCentrica.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/HelicoCentrica.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Piazzolla.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Piazzolla.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Synco.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Synco.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Tektur.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/Tektur.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/faces/YatraOne.d.ts +0 -3
- package/kits/base/node_modules/castle-web-fonts/dist/faces/YatraOne.js +0 -10
- package/kits/base/node_modules/castle-web-fonts/dist/index.d.ts +0 -16
- package/kits/base/node_modules/castle-web-fonts/dist/index.js +0 -15
- package/kits/base/node_modules/castle-web-fonts/licenses/CC-BY-ND-4.0.txt +0 -393
- package/kits/base/node_modules/castle-web-fonts/licenses/FONTS.md +0 -64
- package/kits/base/node_modules/castle-web-fonts/licenses/OFL-1.1.txt +0 -95
- package/kits/base/node_modules/castle-web-fonts/package.json +0 -47
- package/kits/base/node_modules/castle-web-fonts/woff2/Bore.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/CourierPrime.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/DMSans.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/Glacier.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/HelicoCentrica.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/Piazzolla.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/SOURCE.txt +0 -2
- package/kits/base/node_modules/castle-web-fonts/woff2/Synco.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/Tektur.woff2 +0 -0
- package/kits/base/node_modules/castle-web-fonts/woff2/YatraOne.woff2 +0 -0
package/dist/shell/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<link rel="icon" type="image/png" sizes="32x32" href="/__castle/ide/favicon-32x32.png" />
|
|
11
11
|
<link rel="icon" type="image/png" sizes="16x16" href="/__castle/ide/favicon-16x16.png" />
|
|
12
12
|
<link rel="icon" href="/__castle/ide/favicon.ico" sizes="any" />
|
|
13
|
-
<script type="module" crossorigin src="/__castle/ide/assets/index
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/__castle/ide/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/__castle/ide/assets/index-QtCau5vM.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/__castle/ide/assets/index-CIRBt1qf.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
package/kits/base/castle.json
CHANGED
package/kits/base/sdk/README.md
CHANGED
|
@@ -54,7 +54,19 @@ metadata distinguishes a server `bye`, a replaced server version, an explicit
|
|
|
54
54
|
|
|
55
55
|
When Castle selects solo fallback, the returned connection has `isSolo === true`,
|
|
56
56
|
a one-player roster, and no server process. Calls to `send` are accepted but do
|
|
57
|
-
nothing. Client frames are limited to
|
|
57
|
+
nothing. Client→server frames are limited to 16 KB on the wire.
|
|
58
|
+
|
|
59
|
+
### Binary messages
|
|
60
|
+
|
|
61
|
+
Pass any typed array, `DataView`, or `ArrayBuffer` to client `send`, server `send`,
|
|
62
|
+
or server `broadcast` to send its raw bytes. Receivers always get those bytes as a
|
|
63
|
+
`Uint8Array`; reconstruct another view type such as `Float32Array` on receipt.
|
|
64
|
+
Multi-byte values use the sender platform's byte order. Every other payload uses
|
|
65
|
+
JSON. Client→server messages are capped at 16 KB and server→client messages at
|
|
66
|
+
64 KB, for both JSON and binary frames. Both caps are on the frame, and a binary
|
|
67
|
+
frame includes a one-byte protocol tag, so the largest payload is one byte under the
|
|
68
|
+
cap. A published server bundle on an older runtime throws
|
|
69
|
+
`TypeError: This Castle runtime does not support binary multiplayer messages yet.`
|
|
58
70
|
|
|
59
71
|
Server callbacks are the default export from the deck's server entry. They are
|
|
60
72
|
session-first and receive only platform-trusted player identities:
|
|
@@ -31,7 +31,9 @@ export interface MultiplayerConnection {
|
|
|
31
31
|
readonly playerId: string;
|
|
32
32
|
readonly sessionId: string;
|
|
33
33
|
readonly isSolo: boolean;
|
|
34
|
+
/** Sends byte payloads as binary frames and all other payloads as JSON. */
|
|
34
35
|
send(data: unknown): void;
|
|
36
|
+
/** Receives binary payloads as Uint8Array values and JSON payloads otherwise. */
|
|
35
37
|
onMessage(callback: (data: unknown) => void): () => void;
|
|
36
38
|
onRoster(callback: (roster: MultiplayerRoster) => void): () => void;
|
|
37
39
|
onStateChange(callback: (state: MultiplayerConnectionState, metadata?: MultiplayerStateMetadata) => void): () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CastleError } from "./errors";
|
|
2
|
-
import { MAX_CLIENT_FRAME_BYTES, } from "./multiplayerProtocol";
|
|
2
|
+
import { BINARY_MESSAGE_TAG, isBinaryPayload, MAX_CLIENT_FRAME_BYTES, toUint8Array, } from "./multiplayerProtocol";
|
|
3
3
|
import { hostRequest } from "./transport";
|
|
4
4
|
const KEEPALIVE_INTERVAL_MS = 25_000;
|
|
5
5
|
const HELLO_TIMEOUT_MS = 10_000;
|
|
@@ -70,7 +70,9 @@ class MultiplayerConnectionImpl {
|
|
|
70
70
|
// has no useful branch to take meanwhile, so those messages are dropped.
|
|
71
71
|
// State arrives in whole snapshots, so the next send past recovery is current.
|
|
72
72
|
send(data) {
|
|
73
|
-
const
|
|
73
|
+
const payload = isBinaryPayload(data)
|
|
74
|
+
? serializeClientBinaryMessage(data)
|
|
75
|
+
: serializeClientMessage(data);
|
|
74
76
|
if (this.currentState === "closed") {
|
|
75
77
|
throw multiplayerError("MULTIPLAYER_NOT_CONNECTED", "Multiplayer.send requires a connected session.", "Multiplayer.send");
|
|
76
78
|
}
|
|
@@ -78,7 +80,7 @@ class MultiplayerConnectionImpl {
|
|
|
78
80
|
return;
|
|
79
81
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
80
82
|
return;
|
|
81
|
-
this.socket.send(
|
|
83
|
+
this.socket.send(payload);
|
|
82
84
|
}
|
|
83
85
|
onMessage(callback) {
|
|
84
86
|
this.messages.add(callback);
|
|
@@ -132,27 +134,48 @@ class MultiplayerConnectionImpl {
|
|
|
132
134
|
openSocket(credential, value) {
|
|
133
135
|
const attempt = ++this.socketAttempt;
|
|
134
136
|
const socket = new WebSocket(authenticatedUrl(this.baseUrl, credential, value));
|
|
137
|
+
socket.binaryType = "arraybuffer";
|
|
135
138
|
this.socket = socket;
|
|
136
139
|
return new Promise((resolve, reject) => {
|
|
137
140
|
let greeted = false;
|
|
141
|
+
let inbound = Promise.resolve();
|
|
142
|
+
const isCurrent = () => this.socketAttempt === attempt &&
|
|
143
|
+
this.currentState !== "closed" &&
|
|
144
|
+
this.socket === socket;
|
|
138
145
|
const timeout = setTimeout(() => {
|
|
139
146
|
reject(new SocketClosedError(1006));
|
|
140
147
|
closeSocket(socket, 1000, "hello timeout");
|
|
141
148
|
}, HELLO_TIMEOUT_MS);
|
|
142
149
|
socket.onmessage = (event) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
const data = event.data;
|
|
151
|
+
inbound = inbound
|
|
152
|
+
.then(async () => {
|
|
153
|
+
if (!isCurrent())
|
|
154
|
+
return;
|
|
155
|
+
if (data instanceof ArrayBuffer) {
|
|
156
|
+
this.dispatchBinary(data, greeted);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (typeof Blob !== "undefined" && data instanceof Blob) {
|
|
160
|
+
const buffer = await data.arrayBuffer();
|
|
161
|
+
if (!isCurrent())
|
|
162
|
+
return;
|
|
163
|
+
this.dispatchBinary(buffer, greeted);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const frame = parsePlatformFrame(data);
|
|
167
|
+
if (!frame)
|
|
168
|
+
return;
|
|
169
|
+
if (frame.t === "hello") {
|
|
170
|
+
greeted = true;
|
|
171
|
+
clearTimeout(timeout);
|
|
172
|
+
this.acceptHello(frame);
|
|
173
|
+
resolve();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
this.handleFrame(frame);
|
|
177
|
+
})
|
|
178
|
+
.catch(() => { });
|
|
156
179
|
};
|
|
157
180
|
socket.onclose = (event) => {
|
|
158
181
|
clearTimeout(timeout);
|
|
@@ -210,6 +233,16 @@ class MultiplayerConnectionImpl {
|
|
|
210
233
|
break;
|
|
211
234
|
}
|
|
212
235
|
}
|
|
236
|
+
dispatchBinary(buffer, greeted) {
|
|
237
|
+
if (!greeted)
|
|
238
|
+
return;
|
|
239
|
+
const bytes = new Uint8Array(buffer);
|
|
240
|
+
if (bytes.byteLength < 1 || bytes[0] !== BINARY_MESSAGE_TAG)
|
|
241
|
+
return;
|
|
242
|
+
const payload = new Uint8Array(buffer, 1);
|
|
243
|
+
for (const callback of this.messages)
|
|
244
|
+
callListener(callback, payload);
|
|
245
|
+
}
|
|
213
246
|
acceptRoster(frame) {
|
|
214
247
|
const players = frame.players.slice();
|
|
215
248
|
const you = players.find((player) => player.playerId === this.currentPlayerId) ?? null;
|
|
@@ -363,6 +396,16 @@ function serializeClientMessage(data) {
|
|
|
363
396
|
}
|
|
364
397
|
return text;
|
|
365
398
|
}
|
|
399
|
+
function serializeClientBinaryMessage(data) {
|
|
400
|
+
const payload = toUint8Array(data);
|
|
401
|
+
if (payload.byteLength + 1 > MAX_CLIENT_FRAME_BYTES) {
|
|
402
|
+
throw multiplayerError("MULTIPLAYER_MESSAGE_TOO_LARGE", `Multiplayer.send messages are limited to ${MAX_CLIENT_FRAME_BYTES} bytes.`, "Multiplayer.send");
|
|
403
|
+
}
|
|
404
|
+
const frame = new Uint8Array(payload.byteLength + 1);
|
|
405
|
+
frame[0] = BINARY_MESSAGE_TAG;
|
|
406
|
+
frame.set(payload, 1);
|
|
407
|
+
return frame;
|
|
408
|
+
}
|
|
366
409
|
function authenticatedUrl(baseUrl, credential, value) {
|
|
367
410
|
const fallback = typeof window === "undefined" ? undefined : window.location.href;
|
|
368
411
|
const url = new URL(baseUrl, fallback);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const MAX_CLIENT_FRAME_BYTES: number;
|
|
2
2
|
export declare const MAX_PLAYERS_CAP = 24;
|
|
3
|
+
export declare const BINARY_MESSAGE_TAG = 1;
|
|
4
|
+
export declare function isBinaryPayload(value: unknown): value is ArrayBuffer | ArrayBufferView;
|
|
5
|
+
export declare function toUint8Array(value: ArrayBuffer | ArrayBufferView): Uint8Array;
|
|
3
6
|
export type SessionType = "named" | "party" | "public";
|
|
4
7
|
export interface PlayerIdentity {
|
|
5
8
|
userId: string;
|
|
@@ -3,3 +3,16 @@
|
|
|
3
3
|
// published and must not pull the server package into deck bundles.
|
|
4
4
|
export const MAX_CLIENT_FRAME_BYTES = 16 * 1024;
|
|
5
5
|
export const MAX_PLAYERS_CAP = 24;
|
|
6
|
+
// Binary client wire frames are one tag byte (0x01) followed by the opaque
|
|
7
|
+
// author payload. The frame-size limit includes both the tag and payload.
|
|
8
|
+
export const BINARY_MESSAGE_TAG = 0x01;
|
|
9
|
+
// ArrayBuffer and every ArrayBufferView (typed arrays and DataView) are sent as
|
|
10
|
+
// their raw bytes. Receivers always see a Uint8Array over those bytes.
|
|
11
|
+
export function isBinaryPayload(value) {
|
|
12
|
+
return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
|
|
13
|
+
}
|
|
14
|
+
export function toUint8Array(value) {
|
|
15
|
+
return value instanceof ArrayBuffer
|
|
16
|
+
? new Uint8Array(value)
|
|
17
|
+
: new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
18
|
+
}
|
|
@@ -15,10 +15,13 @@ export interface PlatformSessionConfig {
|
|
|
15
15
|
export interface PlatformHandle {
|
|
16
16
|
send(connId: string, text: string): void;
|
|
17
17
|
broadcast(text: string): void;
|
|
18
|
+
sendBinary?(connId: string, bytes: Uint8Array | ArrayBuffer): void;
|
|
19
|
+
broadcastBinary?(bytes: Uint8Array | ArrayBuffer): void;
|
|
18
20
|
disconnect(connId: string, code: string | number): void;
|
|
19
21
|
on(event: "join", callback: (connId: string, player: PlayerIdentity) => unknown): void;
|
|
20
22
|
on(event: "leave", callback: (connId: string) => unknown): void;
|
|
21
23
|
on(event: "message", callback: (connId: string, text: string) => unknown): void;
|
|
24
|
+
on(event: "binaryMessage", callback: (connId: string, bytes: Uint8Array) => unknown): void;
|
|
22
25
|
on(event: "replaced", callback: () => unknown): void;
|
|
23
26
|
on(event: "shutdown", callback: (reason?: string) => unknown): void;
|
|
24
27
|
readonly config: PlatformSessionConfig;
|
|
@@ -11,7 +11,9 @@ export interface MultiplayerServerSession {
|
|
|
11
11
|
readonly sessionId: string;
|
|
12
12
|
readonly deckId: string;
|
|
13
13
|
readonly mode: MultiplayerSessionMode;
|
|
14
|
+
/** Sends bytes as a binary message and all other payloads as JSON. */
|
|
14
15
|
send(playerId: string, data: unknown): void;
|
|
16
|
+
/** Broadcasts bytes as a binary message and all other payloads as JSON. */
|
|
15
17
|
broadcast(data: unknown, options?: MultiplayerBroadcastOptions): void;
|
|
16
18
|
disconnect(playerId: string, reason?: string): void;
|
|
17
19
|
}
|
|
@@ -20,6 +22,7 @@ export interface MultiplayerServerCallbacks {
|
|
|
20
22
|
onStart?: (session: MultiplayerServerSession) => CallbackResult;
|
|
21
23
|
onPlayerJoin?: (session: MultiplayerServerSession, player: MultiplayerServerPlayer) => CallbackResult;
|
|
22
24
|
onPlayerLeave?: (session: MultiplayerServerSession, player: MultiplayerServerPlayer) => CallbackResult;
|
|
25
|
+
/** Receives binary messages as Uint8Array values and JSON messages otherwise. */
|
|
23
26
|
onMessage?: (session: MultiplayerServerSession, player: MultiplayerServerPlayer, data: unknown) => CallbackResult;
|
|
24
27
|
onTick?: (session: MultiplayerServerSession) => CallbackResult;
|
|
25
28
|
onReplaced?: (session: MultiplayerServerSession) => CallbackResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isBinaryPayload, toUint8Array, } from "../multiplayerProtocol";
|
|
1
2
|
// The publish bundler binds the author's default callbacks export once and
|
|
2
3
|
// exports the returned one-argument function as `__castleBootSession`.
|
|
3
4
|
export function createCastleSessionBoot(callbacks) {
|
|
@@ -29,6 +30,17 @@ async function bootSession(platformHandle, callbacks) {
|
|
|
29
30
|
return;
|
|
30
31
|
await callbacks.onMessage?.(session, player, parseHandleMessage(text));
|
|
31
32
|
});
|
|
33
|
+
try {
|
|
34
|
+
platformHandle.on("binaryMessage", async (connId, bytes) => {
|
|
35
|
+
const player = players.get(connId);
|
|
36
|
+
if (!player)
|
|
37
|
+
return;
|
|
38
|
+
await callbacks.onMessage?.(session, player, bytes);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Older shims may reject event names they do not recognize.
|
|
43
|
+
}
|
|
32
44
|
platformHandle.on("replaced", async () => {
|
|
33
45
|
await callbacks.onReplaced?.(session);
|
|
34
46
|
});
|
|
@@ -54,9 +66,28 @@ function createAuthorSession(platformHandle, players) {
|
|
|
54
66
|
deckId: platformHandle.config.deckId,
|
|
55
67
|
mode: platformHandle.config.mode,
|
|
56
68
|
send(playerId, data) {
|
|
69
|
+
if (isBinaryPayload(data)) {
|
|
70
|
+
requireSendBinary(platformHandle);
|
|
71
|
+
platformHandle.sendBinary(playerId, toUint8Array(data));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
57
74
|
platformHandle.send(playerId, stringifyHandleMessage(data));
|
|
58
75
|
},
|
|
59
76
|
broadcast(data, options) {
|
|
77
|
+
if (isBinaryPayload(data)) {
|
|
78
|
+
const bytes = toUint8Array(data);
|
|
79
|
+
if (!options?.except) {
|
|
80
|
+
requireBroadcastBinary(platformHandle);
|
|
81
|
+
platformHandle.broadcastBinary(bytes);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
requireSendBinary(platformHandle);
|
|
85
|
+
for (const playerId of players.keys()) {
|
|
86
|
+
if (playerId !== options.except)
|
|
87
|
+
platformHandle.sendBinary(playerId, bytes);
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
60
91
|
const text = stringifyHandleMessage(data);
|
|
61
92
|
if (!options?.except) {
|
|
62
93
|
platformHandle.broadcast(text);
|
|
@@ -72,6 +103,17 @@ function createAuthorSession(platformHandle, players) {
|
|
|
72
103
|
},
|
|
73
104
|
};
|
|
74
105
|
}
|
|
106
|
+
function requireSendBinary(platformHandle) {
|
|
107
|
+
if (typeof platformHandle.sendBinary !== "function")
|
|
108
|
+
unsupportedBinaryRuntime();
|
|
109
|
+
}
|
|
110
|
+
function requireBroadcastBinary(platformHandle) {
|
|
111
|
+
if (typeof platformHandle.broadcastBinary !== "function")
|
|
112
|
+
unsupportedBinaryRuntime();
|
|
113
|
+
}
|
|
114
|
+
function unsupportedBinaryRuntime() {
|
|
115
|
+
throw new TypeError("This Castle runtime does not support binary multiplayer messages yet.");
|
|
116
|
+
}
|
|
75
117
|
function joinedPlayer(connId, identity) {
|
|
76
118
|
if (typeof connId === "string")
|
|
77
119
|
return { ...identity, playerId: connId };
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"main": "main.jsx",
|
|
133
133
|
"autoUpdateWhenImported": true,
|
|
134
134
|
"title": "physics-2d",
|
|
135
|
-
"publishedVersion": "2026-09-
|
|
135
|
+
"publishedVersion": "2026-09-04T00:11:30.979Z",
|
|
136
136
|
"imports": {
|
|
137
137
|
"castle.base": {
|
|
138
138
|
"deckId": "yRcmH4_aYllE",
|
|
@@ -466,6 +466,30 @@ export function Panel({ title, action, children, overridden = false }) {
|
|
|
466
466
|
</section>
|
|
467
467
|
);
|
|
468
468
|
}
|
|
469
|
+
// ---------------------------------------------------------------------------
|
|
470
|
+
// THE FIELD SET BELOW IS COPIED INTO THE SHELL. Keep the two in sync by hand.
|
|
471
|
+
//
|
|
472
|
+
// `FieldRow`, `TextField`, `NumberField` (with `NumpadSheet`,
|
|
473
|
+
// `NumberInlineInput`, `snapToStep` and the SCRUB_* constants), `CheckboxField`,
|
|
474
|
+
// `ColorField` and `FieldNote` are ported into
|
|
475
|
+
// `cli/src/shell/paramFields.tsx`, which renders the Params view over a source
|
|
476
|
+
// file's PARAMS object -- so a param scrubs exactly like a behavior prop. Their
|
|
477
|
+
// styles are copied the same way, from `ui.module.css` into
|
|
478
|
+
// `cli/src/shell/kitPanels.css`.
|
|
479
|
+
//
|
|
480
|
+
// It is a copy because there is no seam to share through: the shell cannot
|
|
481
|
+
// import kit code, kits have no shared package, and the SDK ships runtime
|
|
482
|
+
// services with no React in it. Nothing enforces the mirroring, so a change here
|
|
483
|
+
// -- a new field type, a scrub-feel tweak, a fix -- has to be made there too, or
|
|
484
|
+
// the two inspectors drift apart.
|
|
485
|
+
//
|
|
486
|
+
// The shell copy deliberately drops the instance-override chrome (`overridden`,
|
|
487
|
+
// the "Default: X [Reset]" sub-line): a module-level constant has no template to
|
|
488
|
+
// override. Don't port that part back.
|
|
489
|
+
//
|
|
490
|
+
// If you find yourself making this a THIRD copy, make it a shared source instead.
|
|
491
|
+
// ---------------------------------------------------------------------------
|
|
492
|
+
|
|
469
493
|
// Render the "Default: X" value in an instance override's sub-line.
|
|
470
494
|
function formatFieldDefault(value) {
|
|
471
495
|
if (typeof value === 'boolean') return value ? 'On' : 'Off';
|
|
@@ -1729,6 +1729,11 @@
|
|
|
1729
1729
|
padding: 8px 16px 4px;
|
|
1730
1730
|
}
|
|
1731
1731
|
|
|
1732
|
+
/* The field styles from here down (.fieldRow through the numpad and checkbox
|
|
1733
|
+
rules) are COPIED into cli/src/shell/kitPanels.css, scoped there to
|
|
1734
|
+
.castle-params-panel, so the shell's Params view renders identically to this
|
|
1735
|
+
inspector. Nothing enforces it -- change one, change the other. See the
|
|
1736
|
+
matching note above the field components in ui.jsx. */
|
|
1732
1737
|
.fieldRow {
|
|
1733
1738
|
display: grid;
|
|
1734
1739
|
grid-template-columns: minmax(82px, 0.5fr) minmax(0, 1fr);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "castle-web-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.164",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"castle-web": "./dist/index.js"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"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",
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
|
-
"check": "eslint . && jscpd && tsc --noEmit && tsc --noEmit -p src/shell/tsconfig.json"
|
|
11
|
+
"check": "node ../scripts/sync-tokens.mjs --check && eslint . && jscpd && tsc --noEmit && tsc --noEmit -p src/shell/tsconfig.json"
|
|
12
12
|
},
|
|
13
13
|
"jscpd": {
|
|
14
14
|
"path": [
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@codemirror/state": "^6.6.0",
|
|
33
33
|
"@codemirror/view": "^6.41.1",
|
|
34
34
|
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
|
35
|
+
"@lezer/common": "^1.5.2",
|
|
35
36
|
"@lezer/highlight": "^1.2.3",
|
|
36
37
|
"@lydell/node-pty": "^1.2.0-beta.12",
|
|
37
38
|
"@xterm/addon-fit": "^0.11.0",
|