maze-blockly-wrapper 0.4.0 → 0.5.0

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.
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * Test component for graphics configuration URL switching
4
+ * This component allows testing switching between different image URLs
5
+ * and provides logging for graphics configuration changes
6
+ */
7
+ declare const GraphicsConfigTest: React.FC;
8
+ export default GraphicsConfigTest;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface GraphicsImageProps {
3
+ src?: string;
4
+ alt: string;
5
+ fallback: string;
6
+ style?: React.CSSProperties;
7
+ className?: string;
8
+ size?: number;
9
+ onLoadError?: () => void;
10
+ onLoadSuccess?: () => void;
11
+ }
12
+ /**
13
+ * Component for rendering graphics images with fallback support
14
+ * Handles image loading failures gracefully and provides visual feedback
15
+ */
16
+ declare const GraphicsImage: React.FC<GraphicsImageProps>;
17
+ export default GraphicsImage;
@@ -17,6 +17,7 @@ export default class MazeBlocklyContainer extends Component<MazeBlocklyContainer
17
17
  componentDidMount(): void;
18
18
  componentDidUpdate(prevProps: MazeBlocklyContainerProps): void;
19
19
  componentWillUnmount(): void;
20
+ private static isInitializing;
20
21
  private readonly instanceId;
21
22
  private workspace;
22
23
  private blocklyDivRef;
@@ -8,6 +8,7 @@ interface SpiderProps {
8
8
  isExecuting?: boolean;
9
9
  }
10
10
  export default class Spider extends Component<SpiderProps> {
11
+ componentDidUpdate(prevProps: SpiderProps): void;
11
12
  private renderImagePlayer;
12
13
  render(): import("react/jsx-runtime").JSX.Element;
13
14
  }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface UrlTesterProps {
3
+ onUrlTested?: (url: string, isValid: boolean) => void;
4
+ }
5
+ /**
6
+ * Component for testing image URLs and validating their accessibility
7
+ */
8
+ declare const UrlTester: React.FC<UrlTesterProps>;
9
+ export default UrlTester;
@@ -3,6 +3,11 @@ import type { GraphicsConfig, PlayerGraphicsProps } from './types';
3
3
  /**
4
4
  * Default graphics configuration for the maze game
5
5
  * This provides fallback values when no custom graphics are provided
6
+ *
7
+ * URL Support:
8
+ * - player.imageUrl: URL to player character image (SVG, PNG, JPG, etc.)
9
+ * - blocks.*.imageUrl: URL to block element images
10
+ * - All imageUrl properties are optional and fall back to character/text rendering
6
11
  */
7
12
  export declare const defaultGraphicsConfig: GraphicsConfig;
8
13
  /**
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Graphics Configuration DTOs and Examples
3
+ *
4
+ * This file provides clear DTOs (Data Transfer Objects) for all graphics configuration
5
+ * types, making it easy to understand the structure when implementing custom graphics.
6
+ */
7
+ import type { BlockGraphics, GraphicsConfig, MazeGraphics, PlayerGraphics } from './types';
8
+ /**
9
+ * Complete graphics configuration DTO
10
+ * Use this as the main interface for graphics configuration
11
+ */
12
+ export type GraphicsConfigDTO = GraphicsConfig;
13
+ /**
14
+ * Player graphics configuration DTO
15
+ * Controls the appearance and behavior of the player character
16
+ */
17
+ export type PlayerGraphicsDTO = PlayerGraphics;
18
+ /**
19
+ * Block graphics configuration DTO
20
+ * Controls the appearance of all maze block elements
21
+ */
22
+ export type BlockGraphicsDTO = BlockGraphics;
23
+ /**
24
+ * Maze graphics configuration DTO
25
+ * Controls the appearance of the maze grid and cells
26
+ */
27
+ export type MazeGraphicsDTO = MazeGraphics;
28
+ /**
29
+ * Example: Custom graphics using image URLs
30
+ * This shows how to use imageUrl properties for all elements
31
+ */
32
+ export declare const exampleImageBasedConfig: GraphicsConfigDTO;
33
+ /**
34
+ * Example: Emoji-based graphics configuration
35
+ * This shows how to use character properties with emojis
36
+ */
37
+ export declare const exampleEmojiConfig: GraphicsConfigDTO;
38
+ /**
39
+ * Example: Minimal configuration with custom styling
40
+ * This shows how to use customStyles for advanced customization
41
+ */
42
+ export declare const exampleCustomStyledConfig: GraphicsConfigDTO;
43
+ /**
44
+ * Example: Mixed configuration (some images, some characters)
45
+ * This shows how to mix imageUrl and character properties
46
+ */
47
+ export declare const exampleMixedConfig: GraphicsConfigDTO;
48
+ /**
49
+ * Type for valid image URL formats
50
+ */
51
+ export type ImageUrl = string;
52
+ /**
53
+ * Type for valid character formats (emoji or text)
54
+ */
55
+ export type Character = string;
56
+ /**
57
+ * Type for valid size values (0.0 to 1.0)
58
+ */
59
+ export type RelativeSize = number;
60
+ /**
61
+ * Type for valid color values (CSS color strings)
62
+ */
63
+ export type Color = string;
64
+ /**
65
+ * Type for valid transition duration values
66
+ */
67
+ export type TransitionDuration = string;
68
+ /**
69
+ * Validates if a string is a valid image URL
70
+ */
71
+ export declare function isValidImageUrl(url: string): boolean;
72
+ /**
73
+ * Validates if a size value is within valid range (0.0 to 1.0)
74
+ */
75
+ export declare function isValidSize(size: number): boolean;
76
+ /**
77
+ * Validates if a color string is a valid CSS color
78
+ */
79
+ export declare function isValidColor(color: string): boolean;
80
+ /**
81
+ * Validates a complete graphics configuration
82
+ */
83
+ export declare function validateGraphicsConfig(config: GraphicsConfigDTO): {
84
+ isValid: boolean;
85
+ errors: string[];
86
+ warnings: string[];
87
+ };
@@ -5,5 +5,9 @@ export { default as Spider } from './Spider';
5
5
  export { default as EditableMazeGrid } from './EditableMazeGrid';
6
6
  export { default as MazeTabs } from './MazeTabs';
7
7
  export { default as GameControls } from './GameControls';
8
+ export { default as GraphicsConfigTest } from './GraphicsConfigTest';
9
+ export { default as UrlTester } from './UrlTester';
10
+ export { default as GraphicsImage } from './GraphicsImage';
8
11
  export { defaultGraphicsConfig, mergeGraphicsConfig, DefaultSpider } from './graphicsConfig';
12
+ export { type GraphicsConfigDTO, type PlayerGraphicsDTO, type BlockGraphicsDTO, type MazeGraphicsDTO, exampleImageBasedConfig, exampleEmojiConfig, exampleCustomStyledConfig, exampleMixedConfig, type ImageUrl, type Character, type RelativeSize, type Color, type TransitionDuration, isValidImageUrl, isValidSize, isValidColor, validateGraphicsConfig } from './graphicsDTOs';
9
13
  export * from './types';