castle-web-cli 0.4.6 → 0.4.8

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/init.js CHANGED
@@ -224,7 +224,12 @@ export async function init(dir, opts = {}) {
224
224
  // handles the background spawn internally; init doesn't shell out.
225
225
  // Bind all interfaces by default so a tailnet / LAN browser can reach
226
226
  // the served page; users can override host on a subsequent serve call.
227
- await serve(projectDir, { host: '0.0.0.0', detach: true });
227
+ // Open in the user's default browser unless we're clearly headless (SSH
228
+ // session) or the user has opted out via CASTLE_WEB_CLI_NO_OPEN=1.
229
+ const noOpen = process.env.CASTLE_WEB_CLI_NO_OPEN === '1' ||
230
+ !!process.env.SSH_CONNECTION ||
231
+ !!process.env.SSH_TTY;
232
+ await serve(projectDir, { host: '0.0.0.0', detach: true, open: !noOpen });
228
233
  return;
229
234
  }
230
235
  console.log('');
@@ -63,7 +63,7 @@ A fresh `Behavior` instance is constructed per actor per frame from the actor's
63
63
  "id": "paddle",
64
64
  "components": {
65
65
  "Layout": { "x": 210, "y": 640, "width": 80, "height": 12 },
66
- "Drawing": { "file": "drawings/floor.drawing" },
66
+ "Drawing": { "file": "drawings/block.drawing" },
67
67
  "Collider": { "kind": "solid", "width": 80, "height": 12 },
68
68
  "Paddle": { "speed": 360 }
69
69
  }
@@ -77,7 +77,7 @@ Rules: every actor needs a unique `id` (any string) and almost always a `Layout`
77
77
  ## Built-in behaviors
78
78
 
79
79
  - **Layout** — `{ x, y, width, height, z?, rotation? }`. Every actor needs one. `z` orders draw (low first). `rotation` is degrees about the center.
80
- - **Drawing** — `{ file: "drawings/foo.drawing", tint?: "#rrggbbaa" }`. Renders the pixel-art file scaled into the Layout box. `tint` multiplies; use white (`#ffffffff`) or omit for the original colors. For a solid-color rectangle, point `file` at `drawings/floor.drawing` (an 8×8 white pixel sprite) and set `tint` to your color.
80
+ - **Drawing** — `{ file: "drawings/foo.drawing", tint?: "#rrggbbaa" }`. Renders the pixel-art file scaled into the Layout box. `tint` multiplies; use white (`#ffffffff`) or omit for the original colors. For a solid-color rectangle, point `file` at `drawings/block.drawing` (an 8×8 white pixel sprite) and set `tint` to your color.
81
81
  - **Collider** — `{ kind: 'solid'|'pickup', width, height, offsetX?, offsetY?, debug? }`. Just a rect; the framework does NOT auto-resolve collisions for you. Use it as data:
82
82
 
83
83
  ```jsx
@@ -6,7 +6,7 @@ export class Drawing {
6
6
  static behaviorName = 'Drawing';
7
7
 
8
8
  static defaultProps = {
9
- file: 'drawings/floor.drawing',
9
+ file: 'drawings/block.drawing',
10
10
  tint: '#ffffffff',
11
11
  };
12
12
 
@@ -1,107 +1,32 @@
1
1
  {
2
- "name": "Main Scene",
3
2
  "background": "#1b2030",
4
3
  "actors": [
5
4
  {
6
- "id": "actor_1",
5
+ "id": "block_tl",
7
6
  "components": {
8
- "Layout": {
9
- "x": 80,
10
- "y": 115,
11
- "width": 64,
12
- "height": 64,
13
- "z": 0,
14
- "rotation": 0
15
- },
16
- "Drawing": {
17
- "file": "drawings/floor.drawing",
18
- "tint": "#ff6b6bff"
19
- }
7
+ "Layout": { "x": 150, "y": 250, "width": 80, "height": 80 },
8
+ "Drawing": { "file": "drawings/block.drawing", "tint": "#ff6b6bff" }
20
9
  }
21
10
  },
22
11
  {
23
- "id": "actor_2",
12
+ "id": "block_tr",
24
13
  "components": {
25
- "Layout": {
26
- "x": 172,
27
- "y": 160,
28
- "width": 48,
29
- "height": 48,
30
- "z": 0,
31
- "rotation": 0
32
- },
33
- "Drawing": {
34
- "file": "drawings/floor.drawing",
35
- "tint": "#ffd166ff"
36
- }
14
+ "Layout": { "x": 270, "y": 250, "width": 80, "height": 80 },
15
+ "Drawing": { "file": "drawings/block.drawing", "tint": "#ffd166ff" }
37
16
  }
38
17
  },
39
18
  {
40
- "id": "actor_3",
19
+ "id": "block_bl",
41
20
  "components": {
42
- "Layout": {
43
- "x": 229,
44
- "y": 63,
45
- "width": 80,
46
- "height": 56,
47
- "z": 0,
48
- "rotation": 0
49
- },
50
- "Drawing": {
51
- "file": "drawings/floor.drawing",
52
- "tint": "#06d6a0ff"
53
- }
21
+ "Layout": { "x": 150, "y": 370, "width": 80, "height": 80 },
22
+ "Drawing": { "file": "drawings/block.drawing", "tint": "#06d6a0ff" }
54
23
  }
55
24
  },
56
25
  {
57
- "id": "actor_4",
26
+ "id": "block_br",
58
27
  "components": {
59
- "Layout": {
60
- "x": 184,
61
- "y": 239,
62
- "width": 56,
63
- "height": 56,
64
- "z": 0,
65
- "rotation": 0
66
- },
67
- "Drawing": {
68
- "file": "drawings/floor.drawing",
69
- "tint": "#4dabf7ff"
70
- }
71
- }
72
- },
73
- {
74
- "id": "actor_5",
75
- "components": {
76
- "Layout": {
77
- "x": 324,
78
- "y": 259,
79
- "width": 64,
80
- "height": 80,
81
- "z": 0,
82
- "rotation": 0
83
- },
84
- "Drawing": {
85
- "file": "drawings/floor.drawing",
86
- "tint": "#b197fcff"
87
- }
88
- }
89
- },
90
- {
91
- "id": "actor_6",
92
- "components": {
93
- "Layout": {
94
- "x": 292,
95
- "y": 389,
96
- "width": 96,
97
- "height": 64,
98
- "z": 0,
99
- "rotation": 0
100
- },
101
- "Drawing": {
102
- "file": "drawings/floor.drawing",
103
- "tint": "#f06595ff"
104
- }
28
+ "Layout": { "x": 270, "y": 370, "width": 80, "height": 80 },
29
+ "Drawing": { "file": "drawings/block.drawing", "tint": "#4dabf7ff" }
105
30
  }
106
31
  }
107
32
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"