castle-web-cli 0.4.172 → 0.4.173

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 (57) hide show
  1. package/dist/assetCompression.d.ts +3 -0
  2. package/dist/assetCompression.js +30 -0
  3. package/dist/castleJson.d.ts +1 -1
  4. package/dist/castleJson.js +2 -2
  5. package/dist/imports.js +2 -2
  6. package/dist/init.js +4 -4
  7. package/dist/serve.js +2 -0
  8. package/dist/serveSecurity.d.ts +2 -0
  9. package/dist/serveSecurity.js +17 -3
  10. package/kits/multiplayer-2d/castle.json +2 -2
  11. package/kits/multiplayer-2d/code/server/sceneBodies.js +1 -1
  12. package/kits/multiplayer-2d/code/server/world.js +2 -2
  13. package/kits/multiplayer-2d/code/systems/multiplayer.js +12 -0
  14. package/kits/multiplayer-2d/fonts.generated.js +1 -1
  15. package/kits/multiplayer-2d/package-lock.json +1 -1
  16. package/kits/multiplayer-3d/CLAUDE.md +5 -4
  17. package/kits/multiplayer-3d/castle.json +3 -3
  18. package/kits/multiplayer-3d/code/client/avatars.js +47 -18
  19. package/kits/multiplayer-3d/code/client/nameTags.js +16 -35
  20. package/kits/multiplayer-3d/code/server/sceneBodies.js +1 -1
  21. package/kits/multiplayer-3d/code/systems/multiplayer.js +14 -1
  22. package/kits/multiplayer-3d/fonts.generated.js +1 -1
  23. package/kits/multiplayer-3d/package-lock.json +1 -1
  24. package/kits/physics-2d/CLAUDE.md +7 -6
  25. package/kits/physics-2d/behaviors/Collider.jsx +7 -1
  26. package/kits/physics-2d/behaviors/RigidBody.jsx +6 -3
  27. package/kits/physics-2d/castle.json +2 -2
  28. package/kits/physics-2d/editors/SceneEditor.jsx +1 -0
  29. package/kits/physics-2d/editors/SingleEditor.jsx +4 -4
  30. package/kits/physics-2d/editors/{StyleEditor.jsx → ThemeEditor.jsx} +8 -8
  31. package/kits/physics-2d/editors/deckFont.js +2 -2
  32. package/kits/physics-2d/editors/{styleEditor.module.css → themeEditor.module.css} +2 -2
  33. package/kits/physics-2d/engine/avatarArt.js +108 -14
  34. package/kits/physics-2d/engine/files.js +2 -2
  35. package/kits/physics-2d/engine/physics/matterBridge.js +2 -2
  36. package/kits/physics-2d/engine/scene.js +1 -1
  37. package/kits/physics-2d/fonts.generated.js +1 -1
  38. package/kits/physics-2d/package-lock.json +1 -1
  39. package/kits/physics-3d/behaviors/Body.jsx +10 -1
  40. package/kits/physics-3d/behaviors/Door.jsx +5 -0
  41. package/kits/physics-3d/behaviors/Lookable.jsx +3 -0
  42. package/kits/physics-3d/behaviors/Model.jsx +4 -0
  43. package/kits/physics-3d/behaviors/Pickup.jsx +4 -0
  44. package/kits/physics-3d/behaviors/Player.jsx +7 -0
  45. package/kits/physics-3d/behaviors/Shape.jsx +13 -0
  46. package/kits/physics-3d/castle.json +1 -1
  47. package/kits/physics-3d/engine3d/editor3dInspector.jsx +1 -0
  48. package/kits/physics-3d/fonts.generated.js +1 -1
  49. package/kits/physics-3d/package-lock.json +1 -1
  50. package/kits/real-time/castle.json +1 -1
  51. package/kits/real-time/code/client/connection.js +11 -2
  52. package/kits/real-time/package-lock.json +1 -1
  53. package/kits/turn-based/castle.json +1 -1
  54. package/kits/turn-based/fonts.generated.js +1 -1
  55. package/kits/turn-based/package-lock.json +1 -1
  56. package/package.json +3 -1
  57. /package/kits/physics-2d/editors/{styleTheme.js → theme.js} +0 -0
@@ -15,5 +15,5 @@
15
15
  "autoUpdateWhenImported": true,
16
16
  "deckId": "xFVr-afOLuUQ",
17
17
  "cardId": "w6G45sy3_P_m",
18
- "publishedVersion": "2026-09-10T20:28:42.134Z"
18
+ "publishedVersion": "2026-09-10T22:05:27.337Z"
19
19
  }
@@ -91,7 +91,16 @@ export async function connectSession({ onLog = () => {} } = {}) {
91
91
  sendMove(net, pose, owned, claims, releases, state),
92
92
 
93
93
  // Send deck-specific data. The server routes these to `code/server/game.js`.
94
- send: (data) => net.connection.send(data),
94
+ send: (data) => {
95
+ if (connection.state !== 'closed') {
96
+ net.connection.send(data);
97
+ }
98
+ },
99
+
100
+ // Whether the session has ended under this connection: the server was
101
+ // replaced, the platform closed it, or `close` was called. Nothing is sent
102
+ // on it again; the client system joins afresh.
103
+ closed: () => connection.state === 'closed',
95
104
 
96
105
  // Connection and presence data for a deck status line.
97
106
  status: () => ({
@@ -127,7 +136,7 @@ function sendMove(net, pose, owned, claims, releases, state) {
127
136
  net.releases.add(id);
128
137
  }
129
138
  const now = performance.now();
130
- if (now - net.sentAt < SEND_MS) {
139
+ if (now - net.sentAt < SEND_MS || net.connection.state === 'closed') {
131
140
  return false;
132
141
  }
133
142
  net.sentAt = now;
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "../../sdk": {
18
18
  "name": "castle-web-sdk",
19
- "version": "0.4.27",
19
+ "version": "0.4.28",
20
20
  "dev": true,
21
21
  "devDependencies": {
22
22
  "eslint": "^9.0.0",
@@ -28,7 +28,7 @@
28
28
  "autoUpdateWhenImported": true,
29
29
  "deckId": "K6-Xs7dCoMVi",
30
30
  "cardId": "Kh_08IYATpC3",
31
- "publishedVersion": "2026-09-10T20:28:55.394Z",
31
+ "publishedVersion": "2026-09-10T22:05:30.856Z",
32
32
  "server": {
33
33
  "main": "code/server/index.js",
34
34
  "maxPlayers": 8,
@@ -1,4 +1,4 @@
1
- // Generated by the Style editor. Do not edit -- picking a font rewrites it.
1
+ // Generated by the Theme editor. Do not edit -- picking a font rewrites it.
2
2
  //
3
3
  // `theme.style` records that this deck's font is DMSans; this module is what
4
4
  // puts DMSans's bytes in the published bundle. It has to name the face in a
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "../../sdk": {
30
30
  "name": "castle-web-sdk",
31
- "version": "0.4.26",
31
+ "version": "0.4.28",
32
32
  "dev": true,
33
33
  "devDependencies": {
34
34
  "eslint": "^9.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.172",
3
+ "version": "0.4.173",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"
@@ -41,6 +41,7 @@
41
41
  "@xterm/headless": "^6.0.0",
42
42
  "@xterm/xterm": "^6.0.0",
43
43
  "codemirror": "^6.0.2",
44
+ "compression": "^1.8.1",
44
45
  "html2canvas": "^1.4.1",
45
46
  "marked": "^18.0.5",
46
47
  "nanoid": "^5.1.7",
@@ -54,6 +55,7 @@
54
55
  "ws": "^8.20.0"
55
56
  },
56
57
  "devDependencies": {
58
+ "@types/compression": "^1.8.1",
57
59
  "@types/node": "^20.0.0",
58
60
  "@types/picomatch": "^4.0.2",
59
61
  "@types/react": "^18.3.31",