@thewhateverapp/tile-sdk 0.13.35 → 0.13.36

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.
@@ -1,17 +1,14 @@
1
1
  /**
2
- * PixiGame - A wrapper component that abstracts @pixi/react v8's Application boilerplate
2
+ * PixiGame - A wrapper component that abstracts @pixi/react v7's Stage boilerplate
3
3
  *
4
- * @pixi/react v8 requires:
5
- * 1. Importing pixi.js classes
6
- * 2. Calling extend() to register them
7
- * 3. Using them as <pixi*> JSX elements (e.g., <pixiContainer>, <pixiSprite>)
8
- * 4. Hooks like useTick must be used INSIDE the Application tree
4
+ * @pixi/react v7 uses the Stage component which provides the Application context.
5
+ * Hooks like useTick must be used INSIDE the Stage tree.
9
6
  *
10
7
  * This component handles all of that setup automatically.
11
8
  *
12
9
  * @example
13
10
  * ```tsx
14
- * import { PixiGame, useGameLoop } from '@thewhateverapp/tile-sdk';
11
+ * import { PixiGame, useGameLoop, Container, Graphics } from '@thewhateverapp/tile-sdk';
15
12
  *
16
13
  * function MyGame() {
17
14
  * return (
@@ -29,19 +26,22 @@
29
26
  * playerRef.current.x += 1 * delta;
30
27
  * });
31
28
  *
32
- * // Use lowercase 'pixi' prefix for pixi.js elements
33
29
  * return (
34
- * <pixiContainer>
35
- * <pixiSprite texture={texture} x={playerRef.current.x} />
36
- * </pixiContainer>
30
+ * <Container>
31
+ * <Graphics draw={(g) => {
32
+ * g.beginFill(0xff0000);
33
+ * g.drawRect(playerRef.current.x, playerRef.current.y, 32, 32);
34
+ * g.endFill();
35
+ * }} />
36
+ * </Container>
37
37
  * );
38
38
  * }
39
39
  * ```
40
40
  */
41
41
  import React, { ReactNode } from 'react';
42
- import { useApplication, extend } from '@pixi/react';
43
- export { extend };
44
- export { useApplication };
42
+ import { Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane, useApp } from '@pixi/react';
43
+ export { Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane };
44
+ export { useApp };
45
45
  /**
46
46
  * Tile dimensions - standard tile size
47
47
  */
@@ -54,34 +54,36 @@ export interface PixiGameProps {
54
54
  /** Height in pixels (default: 554 for tile) */
55
55
  height?: number;
56
56
  /** Background color (default: black) */
57
- background?: string | number;
58
- /** Whether to use antialiasing (default: true) */
59
- antialias?: boolean;
60
- /** Resolution/pixel ratio (default: window.devicePixelRatio || 1) */
61
- resolution?: number;
57
+ background?: number;
58
+ /** Stage options */
59
+ options?: {
60
+ antialias?: boolean;
61
+ resolution?: number;
62
+ autoDensity?: boolean;
63
+ };
62
64
  /** Whether game is paused */
63
65
  paused?: boolean;
64
66
  /** Callback when Application is ready */
65
- onReady?: () => void;
67
+ onMount?: (app: any) => void;
66
68
  }
67
69
  /**
68
70
  * PixiGame - Main wrapper component for pixi.js games
69
71
  *
70
- * Provides the Application context that @pixi/react hooks need.
72
+ * Provides the Stage/Application context that @pixi/react hooks need.
71
73
  * All game content should be rendered as children of this component.
72
74
  *
73
- * After importing PixiGame, use pixi.js elements with the 'pixi' prefix:
74
- * - <pixiContainer> - Container for grouping elements
75
- * - <pixiSprite texture={...}> - Sprite with texture
76
- * - <pixiGraphics draw={...}> - Graphics with draw callback
77
- * - <pixiText text="..." style={...}> - Text element
75
+ * Use pixi components directly:
76
+ * - <Container> - Container for grouping elements
77
+ * - <Sprite texture={...}> - Sprite with texture
78
+ * - <Graphics draw={...}> - Graphics with draw callback
79
+ * - <Text text="..." style={...}> - Text element
78
80
  */
79
- export declare function PixiGame({ children, width, height, background, antialias, resolution, paused, onReady, }: PixiGameProps): React.JSX.Element;
81
+ export declare function PixiGame({ children, width, height, background, options, paused, onMount, }: PixiGameProps): React.JSX.Element;
80
82
  /**
81
83
  * useGameLoop - A more intuitive name for useTick
82
84
  *
83
85
  * Runs a callback every frame with delta time.
84
- * Must be used inside a PixiGame component (or any @pixi/react Application).
86
+ * Must be used inside a PixiGame component (or any @pixi/react Stage).
85
87
  *
86
88
  * @param callback - Function called every frame with delta time (in frames, ~1 at 60fps)
87
89
  * @param enabled - Whether the loop is active (default: true)
@@ -96,13 +98,11 @@ export declare function PixiGame({ children, width, height, background, antialia
96
98
  * if (posRef.current.x > 256) posRef.current.x = 0;
97
99
  * });
98
100
  *
99
- * return <pixiSprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
101
+ * return <Sprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
100
102
  * }
101
103
  * ```
102
104
  */
103
- export declare function useGameLoop(callback: (ticker: {
104
- deltaTime: number;
105
- }) => void, enabled?: boolean): void;
105
+ export declare function useGameLoop(callback: (delta: number) => void, enabled?: boolean): void;
106
106
  /**
107
107
  * useGameState - Helper for managing game state with refs
108
108
  *
@@ -120,12 +120,12 @@ export declare function useGameLoop(callback: (ticker: {
120
120
  *
121
121
  * useGameLoop((delta) => {
122
122
  * state.current.playerX += 1 * delta;
123
- * if (state.current.score !== previousScore) {
123
+ * if (scoreChanged) {
124
124
  * forceUpdate(); // Only re-render when score changes
125
125
  * }
126
126
  * });
127
127
  *
128
- * return <pixiText text={`Score: ${state.current.score}`} />;
128
+ * return <Text text={`Score: ${state.current.score}`} />;
129
129
  * }
130
130
  * ```
131
131
  */
@@ -148,7 +148,7 @@ export declare function useGameState<T extends object>(initialState: T): [React.
148
148
  * if (keys.current[' ']) jump(); // Space key
149
149
  * });
150
150
  *
151
- * return <pixiSprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
151
+ * return <Sprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
152
152
  * }
153
153
  * ```
154
154
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PixiGame.d.ts","sourceRoot":"","sources":["../../src/react/PixiGame.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AACzE,OAAO,EAAe,cAAc,EAAW,MAAM,EAAE,MAAM,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;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,OAAO,GAAE,OAAc,QAGxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,YAAY,EAAE,CAAC,GACd,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CASzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,oDAwB3B"}
@@ -1,18 +1,15 @@
1
1
  'use client';
2
2
  /**
3
- * PixiGame - A wrapper component that abstracts @pixi/react v8's Application boilerplate
3
+ * PixiGame - A wrapper component that abstracts @pixi/react v7's Stage boilerplate
4
4
  *
5
- * @pixi/react v8 requires:
6
- * 1. Importing pixi.js classes
7
- * 2. Calling extend() to register them
8
- * 3. Using them as <pixi*> JSX elements (e.g., <pixiContainer>, <pixiSprite>)
9
- * 4. Hooks like useTick must be used INSIDE the Application tree
5
+ * @pixi/react v7 uses the Stage component which provides the Application context.
6
+ * Hooks like useTick must be used INSIDE the Stage tree.
10
7
  *
11
8
  * This component handles all of that setup automatically.
12
9
  *
13
10
  * @example
14
11
  * ```tsx
15
- * import { PixiGame, useGameLoop } from '@thewhateverapp/tile-sdk';
12
+ * import { PixiGame, useGameLoop, Container, Graphics } from '@thewhateverapp/tile-sdk';
16
13
  *
17
14
  * function MyGame() {
18
15
  * return (
@@ -30,34 +27,24 @@
30
27
  * playerRef.current.x += 1 * delta;
31
28
  * });
32
29
  *
33
- * // Use lowercase 'pixi' prefix for pixi.js elements
34
30
  * return (
35
- * <pixiContainer>
36
- * <pixiSprite texture={texture} x={playerRef.current.x} />
37
- * </pixiContainer>
31
+ * <Container>
32
+ * <Graphics draw={(g) => {
33
+ * g.beginFill(0xff0000);
34
+ * g.drawRect(playerRef.current.x, playerRef.current.y, 32, 32);
35
+ * g.endFill();
36
+ * }} />
37
+ * </Container>
38
38
  * );
39
39
  * }
40
40
  * ```
41
41
  */
42
42
  import React, { useCallback, useRef, useEffect } from 'react';
43
- import { Application, useApplication, useTick, extend } from '@pixi/react';
44
- import { Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSliceSprite, Mesh, } from 'pixi.js';
45
- // Register all common pixi.js classes so they're available as JSX elements
46
- // After this, you can use <pixiContainer>, <pixiSprite>, <pixiGraphics>, etc.
47
- extend({
48
- Container,
49
- Sprite,
50
- Graphics,
51
- Text,
52
- AnimatedSprite,
53
- TilingSprite,
54
- NineSliceSprite,
55
- Mesh,
56
- });
57
- // Re-export the extend function for advanced use cases
58
- export { extend };
59
- // Re-export useApplication for advanced use cases
60
- export { useApplication };
43
+ import { Stage, Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane, useTick, useApp, } from '@pixi/react';
44
+ // Re-export @pixi/react components for convenience
45
+ export { Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane };
46
+ // Re-export useApp for advanced use cases
47
+ export { useApp };
61
48
  /**
62
49
  * Tile dimensions - standard tile size
63
50
  */
@@ -66,27 +53,30 @@ export const TILE_HEIGHT = 554;
66
53
  /**
67
54
  * PixiGame - Main wrapper component for pixi.js games
68
55
  *
69
- * Provides the Application context that @pixi/react hooks need.
56
+ * Provides the Stage/Application context that @pixi/react hooks need.
70
57
  * All game content should be rendered as children of this component.
71
58
  *
72
- * After importing PixiGame, use pixi.js elements with the 'pixi' prefix:
73
- * - <pixiContainer> - Container for grouping elements
74
- * - <pixiSprite texture={...}> - Sprite with texture
75
- * - <pixiGraphics draw={...}> - Graphics with draw callback
76
- * - <pixiText text="..." style={...}> - Text element
59
+ * Use pixi components directly:
60
+ * - <Container> - Container for grouping elements
61
+ * - <Sprite texture={...}> - Sprite with texture
62
+ * - <Graphics draw={...}> - Graphics with draw callback
63
+ * - <Text text="..." style={...}> - Text element
77
64
  */
78
- export function PixiGame({ children, width = TILE_WIDTH, height = TILE_HEIGHT, background = 0x000000, antialias = true, resolution, paused = false, onReady, }) {
79
- const handleReady = useCallback(() => {
80
- onReady?.();
81
- }, [onReady]);
82
- return (React.createElement(Application, { width: width, height: height, background: background, antialias: antialias, resolution: resolution ?? (typeof window !== 'undefined' ? window.devicePixelRatio : 1), onInit: handleReady },
65
+ export function PixiGame({ children, width = TILE_WIDTH, height = TILE_HEIGHT, background = 0x000000, options = {}, paused = false, onMount, }) {
66
+ const stageOptions = {
67
+ antialias: options.antialias ?? true,
68
+ resolution: options.resolution ?? (typeof window !== 'undefined' ? window.devicePixelRatio : 1),
69
+ autoDensity: options.autoDensity ?? true,
70
+ backgroundColor: background,
71
+ };
72
+ return (React.createElement(Stage, { width: width, height: height, options: stageOptions, onMount: onMount },
83
73
  React.createElement(GameWrapper, { paused: paused }, children)));
84
74
  }
85
75
  /**
86
76
  * Internal wrapper that provides pause functionality
87
77
  */
88
78
  function GameWrapper({ children, paused, }) {
89
- const { app } = useApplication();
79
+ const app = useApp();
90
80
  useEffect(() => {
91
81
  if (app?.ticker) {
92
82
  if (paused) {
@@ -103,7 +93,7 @@ function GameWrapper({ children, paused, }) {
103
93
  * useGameLoop - A more intuitive name for useTick
104
94
  *
105
95
  * Runs a callback every frame with delta time.
106
- * Must be used inside a PixiGame component (or any @pixi/react Application).
96
+ * Must be used inside a PixiGame component (or any @pixi/react Stage).
107
97
  *
108
98
  * @param callback - Function called every frame with delta time (in frames, ~1 at 60fps)
109
99
  * @param enabled - Whether the loop is active (default: true)
@@ -118,15 +108,12 @@ function GameWrapper({ children, paused, }) {
118
108
  * if (posRef.current.x > 256) posRef.current.x = 0;
119
109
  * });
120
110
  *
121
- * return <pixiSprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
111
+ * return <Sprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
122
112
  * }
123
113
  * ```
124
114
  */
125
115
  export function useGameLoop(callback, enabled = true) {
126
- useTick({
127
- callback: (ticker) => callback(ticker),
128
- isEnabled: enabled,
129
- });
116
+ useTick(callback, enabled);
130
117
  }
131
118
  /**
132
119
  * useGameState - Helper for managing game state with refs
@@ -145,12 +132,12 @@ export function useGameLoop(callback, enabled = true) {
145
132
  *
146
133
  * useGameLoop((delta) => {
147
134
  * state.current.playerX += 1 * delta;
148
- * if (state.current.score !== previousScore) {
135
+ * if (scoreChanged) {
149
136
  * forceUpdate(); // Only re-render when score changes
150
137
  * }
151
138
  * });
152
139
  *
153
- * return <pixiText text={`Score: ${state.current.score}`} />;
140
+ * return <Text text={`Score: ${state.current.score}`} />;
154
141
  * }
155
142
  * ```
156
143
  */
@@ -180,7 +167,7 @@ export function useGameState(initialState) {
180
167
  * if (keys.current[' ']) jump(); // Space key
181
168
  * });
182
169
  *
183
- * return <pixiSprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
170
+ * return <Sprite x={posRef.current.x} y={posRef.current.y} texture={...} />;
184
171
  * }
185
172
  * ```
186
173
  */
@@ -4,7 +4,7 @@ export { useTile } from './useTile';
4
4
  export { useKeyboard } from './useKeyboard';
5
5
  export { TileContainer } from './TileContainer';
6
6
  export { withTile } from './withTile';
7
- export { PixiGame, useGameLoop, useGameState, useGameInput, extend, useApplication, TILE_WIDTH, TILE_HEIGHT, } from './PixiGame';
7
+ export { PixiGame, useGameLoop, useGameState, useGameInput, Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane, useApp, TILE_WIDTH, TILE_HEIGHT, } from './PixiGame';
8
8
  export type { PixiGameProps } from './PixiGame';
9
9
  export * from './overlay';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,MAAM,EACN,cAAc,EAEd,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,cAAc,EACd,MAAM,EAEN,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,cAAc,WAAW,CAAC"}
@@ -5,10 +5,10 @@ export { useKeyboard } from './useKeyboard';
5
5
  export { TileContainer } from './TileContainer';
6
6
  export { withTile } from './withTile';
7
7
  // TileInitializer removed - router should be injected directly into TileProvider
8
- // PixiGame wrapper for @pixi/react games - abstracts Application context boilerplate
8
+ // PixiGame wrapper for @pixi/react games - abstracts Stage context boilerplate
9
9
  export { PixiGame, useGameLoop, useGameState, useGameInput,
10
- // Re-exported from @pixi/react
11
- extend, useApplication,
10
+ // Re-exported @pixi/react components
11
+ Container, Sprite, Graphics, Text, AnimatedSprite, TilingSprite, NineSlicePlane, useApp,
12
12
  // Constants
13
13
  TILE_WIDTH, TILE_HEIGHT, } from './PixiGame';
14
14
  // Overlay components for hybrid tiles (video/image with interactive overlays)
@@ -28,10 +28,10 @@ declare const ActionSchema: z.ZodObject<{
28
28
  $action: z.ZodEnum<["emit", "setState", "sequence", "openTile", "openFull", "navigate", "dismiss", "fx"]>;
29
29
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
30
30
  }, "strip", z.ZodTypeAny, {
31
- $action: "navigate" | "emit" | "setState" | "sequence" | "openTile" | "openFull" | "dismiss" | "fx";
31
+ $action: "navigate" | "setState" | "emit" | "sequence" | "openTile" | "openFull" | "dismiss" | "fx";
32
32
  payload?: Record<string, unknown> | undefined;
33
33
  }, {
34
- $action: "navigate" | "emit" | "setState" | "sequence" | "openTile" | "openFull" | "dismiss" | "fx";
34
+ $action: "navigate" | "setState" | "emit" | "sequence" | "openTile" | "openFull" | "dismiss" | "fx";
35
35
  payload?: Record<string, unknown> | undefined;
36
36
  }>;
37
37
  declare const PropValueSchema: z.ZodType<unknown>;
@@ -61,20 +61,20 @@ declare const CaptionTrackSchema: z.ZodObject<{
61
61
  }, "strip", z.ZodTypeAny, {
62
62
  position: "center" | "bottom" | "top";
63
63
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
64
- color?: string | undefined;
65
64
  background?: "none" | "solid" | "gradient" | undefined;
65
+ color?: string | undefined;
66
66
  }, {
67
67
  position: "center" | "bottom" | "top";
68
68
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
69
- color?: string | undefined;
70
69
  background?: "none" | "solid" | "gradient" | undefined;
70
+ color?: string | undefined;
71
71
  }>;
72
72
  }, "strip", z.ZodTypeAny, {
73
73
  style: {
74
74
  position: "center" | "bottom" | "top";
75
75
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
76
- color?: string | undefined;
77
76
  background?: "none" | "solid" | "gradient" | undefined;
77
+ color?: string | undefined;
78
78
  };
79
79
  segments: {
80
80
  text: string;
@@ -86,8 +86,8 @@ declare const CaptionTrackSchema: z.ZodObject<{
86
86
  style: {
87
87
  position: "center" | "bottom" | "top";
88
88
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
89
- color?: string | undefined;
90
89
  background?: "none" | "solid" | "gradient" | undefined;
90
+ color?: string | undefined;
91
91
  };
92
92
  segments: {
93
93
  text: string;
@@ -347,11 +347,11 @@ export declare const OverlaySpecSchema: z.ZodObject<{
347
347
  offsetMs: z.ZodOptional<z.ZodNumber>;
348
348
  scale: z.ZodOptional<z.ZodNumber>;
349
349
  }, "strip", z.ZodTypeAny, {
350
- scale?: number | undefined;
351
350
  offsetMs?: number | undefined;
352
- }, {
353
351
  scale?: number | undefined;
352
+ }, {
354
353
  offsetMs?: number | undefined;
354
+ scale?: number | undefined;
355
355
  }>>;
356
356
  freezeWhen: z.ZodOptional<z.ZodType<unknown, z.ZodTypeDef, unknown>>;
357
357
  }, "strip", z.ZodTypeAny, {
@@ -360,8 +360,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
360
360
  toleranceMs: number;
361
361
  onSeek: "recompute";
362
362
  transform?: {
363
- scale?: number | undefined;
364
363
  offsetMs?: number | undefined;
364
+ scale?: number | undefined;
365
365
  } | undefined;
366
366
  freezeWhen?: unknown;
367
367
  }, {
@@ -370,8 +370,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
370
370
  toleranceMs: number;
371
371
  onSeek: "recompute";
372
372
  transform?: {
373
- scale?: number | undefined;
374
373
  offsetMs?: number | undefined;
374
+ scale?: number | undefined;
375
375
  } | undefined;
376
376
  freezeWhen?: unknown;
377
377
  }>;
@@ -408,20 +408,20 @@ export declare const OverlaySpecSchema: z.ZodObject<{
408
408
  }, "strip", z.ZodTypeAny, {
409
409
  position: "center" | "bottom" | "top";
410
410
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
411
- color?: string | undefined;
412
411
  background?: "none" | "solid" | "gradient" | undefined;
412
+ color?: string | undefined;
413
413
  }, {
414
414
  position: "center" | "bottom" | "top";
415
415
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
416
- color?: string | undefined;
417
416
  background?: "none" | "solid" | "gradient" | undefined;
417
+ color?: string | undefined;
418
418
  }>;
419
419
  }, "strip", z.ZodTypeAny, {
420
420
  style: {
421
421
  position: "center" | "bottom" | "top";
422
422
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
423
- color?: string | undefined;
424
423
  background?: "none" | "solid" | "gradient" | undefined;
424
+ color?: string | undefined;
425
425
  };
426
426
  segments: {
427
427
  text: string;
@@ -433,8 +433,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
433
433
  style: {
434
434
  position: "center" | "bottom" | "top";
435
435
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
436
- color?: string | undefined;
437
436
  background?: "none" | "solid" | "gradient" | undefined;
437
+ color?: string | undefined;
438
438
  };
439
439
  segments: {
440
440
  text: string;
@@ -636,8 +636,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
636
636
  style: {
637
637
  position: "center" | "bottom" | "top";
638
638
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
639
- color?: string | undefined;
640
639
  background?: "none" | "solid" | "gradient" | undefined;
640
+ color?: string | undefined;
641
641
  };
642
642
  segments: {
643
643
  text: string;
@@ -683,8 +683,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
683
683
  style: {
684
684
  position: "center" | "bottom" | "top";
685
685
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
686
- color?: string | undefined;
687
686
  background?: "none" | "solid" | "gradient" | undefined;
687
+ color?: string | undefined;
688
688
  };
689
689
  segments: {
690
690
  text: string;
@@ -726,8 +726,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
726
726
  toleranceMs: number;
727
727
  onSeek: "recompute";
728
728
  transform?: {
729
- scale?: number | undefined;
730
729
  offsetMs?: number | undefined;
730
+ scale?: number | undefined;
731
731
  } | undefined;
732
732
  freezeWhen?: unknown;
733
733
  };
@@ -768,8 +768,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
768
768
  style: {
769
769
  position: "center" | "bottom" | "top";
770
770
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
771
- color?: string | undefined;
772
771
  background?: "none" | "solid" | "gradient" | undefined;
772
+ color?: string | undefined;
773
773
  };
774
774
  segments: {
775
775
  text: string;
@@ -805,8 +805,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
805
805
  toleranceMs: number;
806
806
  onSeek: "recompute";
807
807
  transform?: {
808
- scale?: number | undefined;
809
808
  offsetMs?: number | undefined;
809
+ scale?: number | undefined;
810
810
  } | undefined;
811
811
  freezeWhen?: unknown;
812
812
  };
@@ -847,8 +847,8 @@ export declare const OverlaySpecSchema: z.ZodObject<{
847
847
  style: {
848
848
  position: "center" | "bottom" | "top";
849
849
  size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
850
- color?: string | undefined;
851
850
  background?: "none" | "solid" | "gradient" | undefined;
851
+ color?: string | undefined;
852
852
  };
853
853
  segments: {
854
854
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thewhateverapp/tile-sdk",
3
- "version": "0.13.35",
3
+ "version": "0.13.36",
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",
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": "^18.0.0",
63
- "@pixi/react": "^8.0.0",
64
- "pixi.js": "^8.0.0"
63
+ "@pixi/react": "^7.0.0",
64
+ "pixi.js": "^7.0.0"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@pixi/react": {
@@ -72,12 +72,12 @@
72
72
  }
73
73
  },
74
74
  "devDependencies": {
75
- "@pixi/react": "^8.0.0",
75
+ "@pixi/react": "^7.1.2",
76
76
  "@types/node": "^20.0.0",
77
77
  "@types/react": "^18.2.48",
78
78
  "eslint": "^9.39.1",
79
79
  "next": "^14.2.0",
80
- "pixi.js": "^8.0.0",
80
+ "pixi.js": "^7.4.2",
81
81
  "typescript": "^5.3.3"
82
82
  }
83
83
  }