@thewhateverapp/tile-sdk 0.14.6 → 0.14.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.
@@ -35,6 +35,8 @@ export interface EntityState {
35
35
  * Player-specific state for dash games
36
36
  */
37
37
  export interface PlayerState {
38
+ /** Has the game started (waiting for first jump) */
39
+ started: boolean;
38
40
  /** Is player on ground */
39
41
  grounded: boolean;
40
42
  /** Is player dead */
@@ -1 +1 @@
1
- {"version":3,"file":"SceneContext.d.ts","sourceRoot":"","sources":["../../src/scene/SceneContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,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I,CAAC;IACnD,6BAA6B;IAC7B,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IACnD,kCAAkC;IAClC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,wBAAwB;IACxB,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,mCAAmC;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAE1E;;GAEG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAgB7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAgB/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAQpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAM7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAOnD"}
@@ -39,6 +39,7 @@ export function createEntityState(entity) {
39
39
  */
40
40
  export function createPlayerState() {
41
41
  return {
42
+ started: false,
42
43
  grounded: false,
43
44
  dead: false,
44
45
  jumpCount: 0,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type SceneRendererProps } from './SceneRenderer.js';
2
+ import type { SceneRendererProps } from './SceneRenderer.js';
3
3
  /**
4
4
  * Props for SceneFromJson
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SceneFromJson.d.ts","sourceRoot":"","sources":["../../src/scene/SceneFromJson.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAC1E,4DAA4D;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACtC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,UAAiB,EACjB,OAAO,EACP,SAAkB,EAClB,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAiFpB"}
1
+ {"version":3,"file":"SceneFromJson.d.ts","sourceRoot":"","sources":["../../src/scene/SceneFromJson.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAC1E,4DAA4D;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACtC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,UAAiB,EACjB,OAAO,EACP,SAAkB,EAClB,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAuHpB"}
@@ -1,7 +1,6 @@
1
1
  'use client';
2
- import React from 'react';
2
+ import React, { useState, useEffect, useMemo } from 'react';
3
3
  import { validateScene } from '@thewhateverapp/scene-sdk';
4
- import { SceneRenderer } from './SceneRenderer.js';
5
4
  /**
6
5
  * SceneFromJson - Renders a scene from a JSON object with validation
7
6
  *
@@ -17,6 +16,16 @@ import { SceneRenderer } from './SceneRenderer.js';
17
16
  * ```
18
17
  */
19
18
  export function SceneFromJson({ json, showErrors = true, onEvent, container = 'tile', ...props }) {
19
+ // SSR detection - only render SceneRenderer on client
20
+ const [isClient, setIsClient] = useState(false);
21
+ const [SceneRenderer, setSceneRenderer] = useState(null);
22
+ // Load SceneRenderer dynamically on client only (pixi.js requires browser APIs)
23
+ useEffect(() => {
24
+ setIsClient(true);
25
+ import('./SceneRenderer.js').then((mod) => {
26
+ setSceneRenderer(() => mod.SceneRenderer);
27
+ });
28
+ }, []);
20
29
  // Container styles based on mode
21
30
  const containerStyle = container === 'none'
22
31
  ? undefined
@@ -25,7 +34,7 @@ export function SceneFromJson({ json, showErrors = true, onEvent, container = 't
25
34
  height: container === 'page' ? '100vh' : '100%',
26
35
  };
27
36
  // Validate the JSON
28
- const validationResult = React.useMemo(() => {
37
+ const validationResult = useMemo(() => {
29
38
  try {
30
39
  return validateScene(json);
31
40
  }
@@ -38,7 +47,7 @@ export function SceneFromJson({ json, showErrors = true, onEvent, container = 't
38
47
  }
39
48
  }, [json]);
40
49
  // Report validation errors to agent for correction
41
- React.useEffect(() => {
50
+ useEffect(() => {
42
51
  if (!validationResult.valid) {
43
52
  const errorMessage = `Scene Validation Errors:\n${validationResult.errors
44
53
  .map((e) => `${e.path}: ${e.message}`)
@@ -49,6 +58,20 @@ export function SceneFromJson({ json, showErrors = true, onEvent, container = 't
49
58
  }
50
59
  }
51
60
  }, [validationResult]);
61
+ // Loading placeholder for SSR and dynamic import
62
+ const loadingPlaceholder = (React.createElement("div", { style: {
63
+ width: '100%',
64
+ height: '100%',
65
+ backgroundColor: '#0a0a1a',
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ justifyContent: 'center',
69
+ } },
70
+ React.createElement("div", { style: {
71
+ color: '#666',
72
+ fontSize: 14,
73
+ fontFamily: 'system-ui, sans-serif',
74
+ } }, "Loading...")));
52
75
  // Show errors if validation failed
53
76
  if (!validationResult.valid) {
54
77
  if (showErrors) {
@@ -75,9 +98,13 @@ export function SceneFromJson({ json, showErrors = true, onEvent, container = 't
75
98
  throw new Error(`Scene validation failed: ${validationResult.errors.map((e) => e.message).join(', ')}`);
76
99
  }
77
100
  // Show warnings in console
78
- if (validationResult.warnings.length > 0) {
101
+ if (validationResult.warnings.length > 0 && isClient) {
79
102
  console.warn('Scene validation warnings:', validationResult.warnings);
80
103
  }
104
+ // Wait for client-side rendering and dynamic import
105
+ if (!isClient || !SceneRenderer) {
106
+ return containerStyle ? React.createElement("div", { style: containerStyle }, loadingPlaceholder) : loadingPlaceholder;
107
+ }
81
108
  const sceneContent = (React.createElement(SceneRenderer, { spec: json, onEvent: onEvent, ...props }));
82
109
  return containerStyle ? React.createElement("div", { style: containerStyle }, sceneContent) : sceneContent;
83
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SceneRenderer.d.ts","sourceRoot":"","sources":["../../src/scene/SceneRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,2BAA2B,CAAC;AAqDrE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,kCAAkC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EAAE,SAAS,EACf,OAAO,EACP,MAAc,EACd,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAa,GACd,EAAE,kBAAkB,qBA0CpB;AAqPD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"SceneRenderer.d.ts","sourceRoot":"","sources":["../../src/scene/SceneRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,2BAA2B,CAAC;AAqDrE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,kCAAkC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EAAE,SAAS,EACf,OAAO,EACP,MAAc,EACd,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAa,GACd,EAAE,kBAAkB,qBA0CpB;AA8PD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -206,10 +206,17 @@ function SceneContent({ spec, onEvent, paused, width, height, debug, }) {
206
206
  useGameLoop((delta) => {
207
207
  if (paused)
208
208
  return;
209
- // Update timeline elapsed time
210
- const now = Date.now();
211
- timelineRef.current.elapsedMs = now - startTimeRef.current;
212
- timelineRef.current.currentBeat = (timelineRef.current.elapsedMs / 1000) * (bpm / 60);
209
+ const playerState = playerRef.current;
210
+ // Update timeline elapsed time (only when game has started)
211
+ if (playerState.started) {
212
+ // Adjust start time on first frame after starting
213
+ if (timelineRef.current.elapsedMs === 0) {
214
+ startTimeRef.current = Date.now();
215
+ }
216
+ const now = Date.now();
217
+ timelineRef.current.elapsedMs = now - startTimeRef.current;
218
+ timelineRef.current.currentBeat = (timelineRef.current.elapsedMs / 1000) * (bpm / 60);
219
+ }
213
220
  }, !paused);
214
221
  // Render entities grouped by layer
215
222
  const renderLayers = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../../src/scene/camera/CameraController.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAsFf"}
1
+ {"version":3,"file":"CameraController.d.ts","sourceRoot":"","sources":["../../../src/scene/camera/CameraController.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QA6Ff"}
@@ -20,7 +20,13 @@ export function useCameraController(context, width, height) {
20
20
  break;
21
21
  }
22
22
  case 'scroll': {
23
- // Auto-scroll camera
23
+ // Auto-scroll camera (only when game has started)
24
+ if (!playerState.started) {
25
+ // Initialize camera position when not started
26
+ cameraState.x = cameraConfig?.initialX ?? width / 2;
27
+ cameraState.y = cameraConfig?.initialY ?? height / 2;
28
+ break;
29
+ }
24
30
  const scrollSpeed = (cameraConfig?.scrollSpeed ?? 320) * playerState.speedMultiplier;
25
31
  const direction = cameraConfig?.scrollDirection ?? 'right';
26
32
  switch (direction) {
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentRunner.d.ts","sourceRoot":"","sources":["../../../src/scene/components/ComponentRunner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAazE;;GAEG;AACH,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,KAAK,gBAAgB,GAAG,CACtB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;AAcV;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,QAkB5D;AA+MD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,QAExE"}
1
+ {"version":3,"file":"ComponentRunner.d.ts","sourceRoot":"","sources":["../../../src/scene/components/ComponentRunner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAazE;;GAEG;AACH,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,KAAK,gBAAgB,GAAG,CACtB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;AAcV;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,QAkB5D;AA4ND;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,QAExE"}
@@ -125,6 +125,21 @@ function handleFollow(state, component, context, delta) {
125
125
  function handleDashPlayer(state, component, context, delta) {
126
126
  const { player, camera, emitEvent, respawnPlayer } = context;
127
127
  const playerState = player.current;
128
+ // Handle jump input (check before started check so we can start the game)
129
+ const jumpPressed = isJumpPressed(context);
130
+ const wasJumpPressed = state.componentState.wasJumpPressed ?? false;
131
+ const justPressed = jumpPressed && !wasJumpPressed;
132
+ state.componentState.wasJumpPressed = jumpPressed;
133
+ // Start the game on first jump
134
+ if (!playerState.started && justPressed) {
135
+ playerState.started = true;
136
+ emitEvent('game.started');
137
+ return; // Don't process jump on the start frame
138
+ }
139
+ // Don't run game logic until started
140
+ if (!playerState.started) {
141
+ return;
142
+ }
128
143
  // Handle death
129
144
  if (playerState.dead) {
130
145
  // Wait a moment then respawn
@@ -138,11 +153,7 @@ function handleDashPlayer(state, component, context, delta) {
138
153
  }
139
154
  return;
140
155
  }
141
- // Handle jump input
142
- const jumpPressed = isJumpPressed(context);
143
- const wasJumpPressed = state.componentState.wasJumpPressed ?? false;
144
- const justPressed = jumpPressed && !wasJumpPressed;
145
- state.componentState.wasJumpPressed = jumpPressed;
156
+ // Handle jump (only after game started)
146
157
  if (justPressed) {
147
158
  // Check if touching an orb
148
159
  if (playerState.touchingOrb) {
@@ -1 +1 @@
1
- {"version":3,"file":"TimelineExecutor.d.ts","sourceRoot":"","sources":["../../../src/scene/timeline/TimelineExecutor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,oBAAoB,CAAC;AAIzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,QAsC7D"}
1
+ {"version":3,"file":"TimelineExecutor.d.ts","sourceRoot":"","sources":["../../../src/scene/timeline/TimelineExecutor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,oBAAoB,CAAC;AAIzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,QA4C7D"}
@@ -5,12 +5,17 @@ import { getEasing } from '@thewhateverapp/scene-sdk';
5
5
  * Hook to execute timeline events
6
6
  */
7
7
  export function useTimelineExecutor(context) {
8
- const { spec, timeline, entities, camera, emitEvent, spawnEntity, bpm } = context;
8
+ const { spec, timeline, entities, camera, emitEvent, spawnEntity, bpm, player } = context;
9
9
  const timelineEvents = spec.timeline ?? [];
10
10
  useGameLoop((delta) => {
11
11
  const state = timeline.current;
12
+ const playerState = player.current;
12
13
  const elapsedMs = state.elapsedMs;
13
14
  const currentBeat = state.currentBeat;
15
+ // Don't process timeline until game has started
16
+ if (!playerState.started) {
17
+ return;
18
+ }
14
19
  // Process pending timeline events
15
20
  while (state.nextEventIndex < timelineEvents.length) {
16
21
  const event = timelineEvents[state.nextEventIndex];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thewhateverapp/tile-sdk",
3
- "version": "0.14.6",
3
+ "version": "0.14.8",
4
4
  "description": "SDK for building interactive tiles on The Whatever App platform",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",