hudini 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 CassinoDev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ <img src="data/hudini.png" alt="hudini" />
2
+
3
+ # ๐ŸŽฉ Hudini
4
+
5
+ > _Magical Phaser UI components that appear when you need them most_
6
+
7
+ **Hudini** is a collection of reusable, themeable UI components for Phaser games. Named after the famous magician Houdini and HUD (Head-Up Display), it provides a magical toolkit for building consistent game interfaces.
8
+
9
+ ## โœจ Features
10
+
11
+ - ๐ŸŽจ **Themeable** - Dark/light themes with full customization
12
+ - ๐Ÿ”Š **Sound Integration** - Built-in sound effects for interactions
13
+ - ๐Ÿ“ฆ **Zero Dependencies** - Only requires Phaser as peer dependency
14
+ - ๐ŸŽฏ **TypeScript First** - Full type safety and IntelliSense
15
+ - ๐Ÿงช **Tested** - Comprehensive test coverage
16
+
17
+ ## ๐Ÿš€ Quick Start
18
+
19
+ ```bash
20
+ npm i --save hudini
21
+ # or
22
+ yarn add hudini
23
+ # or
24
+ pnpm add hudini
25
+ ```
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assert.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.spec.d.ts","sourceRoot":"","sources":["../src/assert.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ describe('assert', () => {
3
+ it('should be defined', () => {
4
+ expect(true).toBe(true);
5
+ });
6
+ });
7
+ //# sourceMappingURL=assert.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.spec.js","sourceRoot":"","sources":["../src/assert.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from 'phaser-wind';
2
+ //# sourceMappingURL=exports-phaser-wind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-phaser-wind.d.ts","sourceRoot":"","sources":["../src/exports-phaser-wind.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from 'phaser-wind';
2
+ //# sourceMappingURL=exports-phaser-wind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-phaser-wind.js","sourceRoot":"","sources":["../src/exports-phaser-wind.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './exports-phaser-wind';
2
+ export * from './plugin';
3
+ export * from './scene';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './exports-phaser-wind';
2
+ export * from './plugin';
3
+ export * from './scene';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './plugin';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './plugin';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { Plugins } from 'phaser';
2
+ import { BaseThemeConfig, PhaserWindPlugin, ThemeOverride } from 'phaser-wind';
3
+ export declare const HUDINI_KEY: string;
4
+ /**
5
+ * Plugin configuration data type.
6
+ *
7
+ * @typedef {Object} HudiniPluginData
8
+ * @property {BaseThemeConfig} [theme] - Custom theme created using createTheme(). If not provided,
9
+ * the default light theme will be used
10
+ * @property {boolean} [darkMode=false] - When true, uses the default dark theme. Only takes effect
11
+ * if no custom theme is provided
12
+ */
13
+ export type HudiniPluginData<T = ThemeOverride> = {
14
+ theme?: T;
15
+ darkMode?: boolean;
16
+ phaserWindMappingKey?: string;
17
+ };
18
+ /**
19
+ * Phaser Wind Plugin class that manages theme configuration
20
+ * @extends Plugins.BasePlugin
21
+ */
22
+ export declare class HudiniPlugin<T extends BaseThemeConfig> extends Plugins.BasePlugin {
23
+ /**
24
+ * The mapping key for the PhaserWind plugin
25
+ * @internal
26
+ * @deprecated Do not modify this value unless you know what you're doing.
27
+ * Changing this value can break the plugin's functionality.
28
+ */
29
+ private phaserWindMappingKey;
30
+ /**
31
+ * Creates an instance of HudiniPlugin
32
+ * @param pluginManager - Phaser plugin manager instance
33
+ */
34
+ constructor(pluginManager: Plugins.PluginManager);
35
+ /**
36
+ * Initializes the plugin with theme configuration
37
+ * @param theme - Custom theme configuration
38
+ * @param darkMode - Whether to use dark mode theme when no custom theme provided
39
+ * @example
40
+ * ```typescript
41
+ * const game = new Phaser.Game({
42
+ * plugins: {
43
+ * global: [
44
+ * {
45
+ * key: HUDINI_KEY,
46
+ * plugin: HudiniPlugin,
47
+ * mapping: HUDINI_KEY,
48
+ * data: { theme: defaultLightTheme, }
49
+ * },
50
+ * ],
51
+ * },
52
+ * });
53
+ * ```
54
+ */
55
+ init({ theme, darkMode,
56
+ /**
57
+ * @internal
58
+ * @deprecated Do not modify this value unless you know what you're doing.
59
+ * Changing this value can break the plugin's functionality.
60
+ */
61
+ phaserWindMappingKey, }: HudiniPluginData<T>): void;
62
+ /**
63
+ * Returns the PhaserWind plugin instance
64
+ * @returns PhaserWind plugin instance
65
+ */
66
+ get pw(): PhaserWindPlugin<T>;
67
+ }
68
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,eAAe,EAIf,gBAAgB,EAChB,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,UAAU,EAAE,MAAiB,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,aAAa,IAAI;IAChD,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,eAAe,CACzB,SAAQ,OAAO,CAAC,UAAU;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB,CAA2B;IAEvD;;;OAGG;gBACS,aAAa,EAAE,OAAO,CAAC,aAAa;IAIhD;;;;;;;;;;;;;;;;;;;OAmBG;IAGM,IAAI,CAAC,EACZ,KAAK,EACL,QAAgB;IAChB;;;;OAIG;IACH,oBAAsC,GACvC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI;IAqB7B;;;OAGG;IACH,IAAW,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAInC;CACF"}
@@ -0,0 +1,69 @@
1
+ import { Plugins } from 'phaser';
2
+ import { defaultDarkTheme, defaultLightTheme, PHASER_WIND_KEY, PhaserWindPlugin, } from 'phaser-wind';
3
+ export const HUDINI_KEY = 'hudini';
4
+ /**
5
+ * Phaser Wind Plugin class that manages theme configuration
6
+ * @extends Plugins.BasePlugin
7
+ */
8
+ export class HudiniPlugin extends Plugins.BasePlugin {
9
+ /**
10
+ * The mapping key for the PhaserWind plugin
11
+ * @internal
12
+ * @deprecated Do not modify this value unless you know what you're doing.
13
+ * Changing this value can break the plugin's functionality.
14
+ */
15
+ phaserWindMappingKey = PHASER_WIND_KEY;
16
+ /**
17
+ * Creates an instance of HudiniPlugin
18
+ * @param pluginManager - Phaser plugin manager instance
19
+ */
20
+ constructor(pluginManager) {
21
+ super(pluginManager);
22
+ }
23
+ /**
24
+ * Initializes the plugin with theme configuration
25
+ * @param theme - Custom theme configuration
26
+ * @param darkMode - Whether to use dark mode theme when no custom theme provided
27
+ * @example
28
+ * ```typescript
29
+ * const game = new Phaser.Game({
30
+ * plugins: {
31
+ * global: [
32
+ * {
33
+ * key: HUDINI_KEY,
34
+ * plugin: HudiniPlugin,
35
+ * mapping: HUDINI_KEY,
36
+ * data: { theme: defaultLightTheme, }
37
+ * },
38
+ * ],
39
+ * },
40
+ * });
41
+ * ```
42
+ */
43
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
+ init({ theme, darkMode = false,
45
+ /**
46
+ * @internal
47
+ * @deprecated Do not modify this value unless you know what you're doing.
48
+ * Changing this value can break the plugin's functionality.
49
+ */
50
+ phaserWindMappingKey = PHASER_WIND_KEY, }) {
51
+ this.phaserWindMappingKey = phaserWindMappingKey;
52
+ // If the phaser-wind plugin is not installed, install it
53
+ if (!this.pluginManager.get(PHASER_WIND_KEY)) {
54
+ const chosenTheme = theme ?? (darkMode ? defaultDarkTheme : defaultLightTheme);
55
+ this.pluginManager.install(PHASER_WIND_KEY, PhaserWindPlugin, true, phaserWindMappingKey, {
56
+ theme: chosenTheme,
57
+ darkMode,
58
+ });
59
+ }
60
+ }
61
+ /**
62
+ * Returns the PhaserWind plugin instance
63
+ * @returns PhaserWind plugin instance
64
+ */
65
+ get pw() {
66
+ return this.pluginManager.get(this.phaserWindMappingKey);
67
+ }
68
+ }
69
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,UAAU,GAAW,QAAQ,CAAC;AAiB3C;;;GAGG;AACH,MAAM,OAAO,YAEX,SAAQ,OAAO,CAAC,UAAU;IAC1B;;;;;OAKG;IACK,oBAAoB,GAAW,eAAe,CAAC;IAEvD;;;OAGG;IACH,YAAY,aAAoC;QAC9C,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IAEH,6DAA6D;IACpD,IAAI,CAAC,EACZ,KAAK,EACL,QAAQ,GAAG,KAAK;IAChB;;;;OAIG;IACH,oBAAoB,GAAG,eAAe,GAClB;QACpB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QAEjD,yDAAyD;QACzD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;YAC7C,MAAM,WAAW,GACf,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;YAE7D,IAAI,CAAC,aAAa,CAAC,OAAO,CACxB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,oBAAoB,EACpB;gBACE,KAAK,EAAE,WAAW;gBAClB,QAAQ;aACT,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAC3B,IAAI,CAAC,oBAAoB,CACH,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from './scene-with-hudini';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './scene-with-hudini';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { BaseThemeConfig, SceneWithPhaserWind } from 'phaser-wind';
2
+ import { HudiniPlugin } from '../plugin/plugin';
3
+ export declare abstract class SceneWithHudini<T extends BaseThemeConfig = BaseThemeConfig> extends SceneWithPhaserWind<T> {
4
+ /**
5
+ *
6
+ * @param config The scene key or scene specific configuration settings.
7
+ */
8
+ constructor(config?: string | Phaser.Types.Scenes.SettingsConfig);
9
+ hudini: HudiniPlugin<T>;
10
+ }
11
+ //# sourceMappingURL=scene-with-hudini.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-with-hudini.d.ts","sourceRoot":"","sources":["../../src/scene/scene-with-hudini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,8BAAsB,eAAe,CACnC,CAAC,SAAS,eAAe,GAAG,eAAe,CAC3C,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B;;;OAGG;gBACS,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc;IAIzD,MAAM,EAAG,YAAY,CAAC,CAAC,CAAC,CAAC;CACjC"}
@@ -0,0 +1,12 @@
1
+ import { SceneWithPhaserWind } from 'phaser-wind';
2
+ export class SceneWithHudini extends SceneWithPhaserWind {
3
+ /**
4
+ *
5
+ * @param config The scene key or scene specific configuration settings.
6
+ */
7
+ constructor(config) {
8
+ super(config);
9
+ }
10
+ hudini;
11
+ }
12
+ //# sourceMappingURL=scene-with-hudini.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-with-hudini.js","sourceRoot":"","sources":["../../src/scene/scene-with-hudini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAInE,MAAM,OAAgB,eAEpB,SAAQ,mBAAsB;IAC9B;;;OAGG;IACH,YAAY,MAAoD;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,MAAM,CAAmB;CACjC"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "hudini",
3
+ "version": "0.1.0",
4
+ "description": "๐ŸŽฉ Magical Phaser UI components - Reusable HUD elements for game development. Is magic, like a wizard",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "keywords": [
19
+ "phaser",
20
+ "ui",
21
+ "components",
22
+ "hud",
23
+ "game-development",
24
+ "typescript",
25
+ "button",
26
+ "modal",
27
+ "panel"
28
+ ],
29
+ "author": "CassinoDev",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/renatocassino/phaser-toolkit.git",
34
+ "directory": "packages/hudini"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/renatocassino/phaser-toolkit/issues"
38
+ },
39
+ "homepage": "https://github.com/renatocassino/phaser-toolkit/tree/main/packages/hudini#readme",
40
+ "devDependencies": {
41
+ "@eslint-recommended/eslint-config": "^28.0.0",
42
+ "@types/node": "^24.2.1",
43
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
44
+ "@typescript-eslint/parser": "^6.15.0",
45
+ "eslint": "^8.55.0",
46
+ "eslint-config-prettier": "^9.1.0",
47
+ "eslint-plugin-import": "^2.29.1",
48
+ "eslint-plugin-node": "^11.1.0",
49
+ "eslint-plugin-prefer-arrow": "^1.2.3",
50
+ "eslint-plugin-promise": "^6.1.1",
51
+ "eslint-plugin-security": "^1.7.1",
52
+ "eslint-plugin-sonarjs": "^0.23.0",
53
+ "eslint-plugin-unicorn": "^50.0.1",
54
+ "tsx": "^4.20.3",
55
+ "typescript": "^5.3.0",
56
+ "vitest": "^3.2.4"
57
+ },
58
+ "dependencies": {
59
+ "phaser-wind": "*",
60
+ "font-awesome-for-phaser": "*"
61
+ },
62
+ "peerDependencies": {
63
+ "phaser": "*"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "scripts": {
69
+ "build": "tsc --build",
70
+ "dev": "tsc --build --watch",
71
+ "clean": "rm -rf dist",
72
+ "test": "vitest run",
73
+ "test:watch": "vitest",
74
+ "typecheck": "tsc --noEmit",
75
+ "lint": "eslint src --ext .ts,.tsx --max-warnings 0",
76
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
77
+ "lint:report": "eslint src --ext .ts,.tsx --format html --output-file eslint-report.html",
78
+ "validate": "pnpm run lint && pnpm run typecheck && pnpm run test && lint-staged"
79
+ }
80
+ }