hudini 0.18.1 → 0.19.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/README.md +57 -0
- package/dist/hudini.js +183 -2
- package/dist/hudini.min.js +1 -1
- package/dist/scene/index.d.ts +1 -0
- package/dist/scene/index.d.ts.map +1 -1
- package/dist/scene/index.js +1 -0
- package/dist/scene/index.js.map +1 -1
- package/dist/scene/scene-with-hudini.d.ts +24 -1
- package/dist/scene/scene-with-hudini.d.ts.map +1 -1
- package/dist/scene/scene-with-hudini.js +24 -1
- package/dist/scene/scene-with-hudini.js.map +1 -1
- package/dist/scene/with-hudini.d.ts +35 -0
- package/dist/scene/with-hudini.d.ts.map +1 -0
- package/dist/scene/with-hudini.js +33 -0
- package/dist/scene/with-hudini.js.map +1 -0
- package/package.json +2 -2
package/dist/scene/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
|
package/dist/scene/index.js
CHANGED
package/dist/scene/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scene/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { BaseThemeConfig, SceneWithPhaserWind } from 'phaser-wind';
|
|
2
2
|
import { HudiniPlugin } from '../plugin/plugin';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link withHudini} instead.
|
|
5
|
+
*
|
|
6
|
+
* Forces single inheritance, which conflicts with any user-defined `BaseScene`
|
|
7
|
+
* or other libraries that ship their own scene base class. It also relies on a
|
|
8
|
+
* non-null assertion (`hudini!`) that lies to TypeScript about when the plugin
|
|
9
|
+
* is available — touching `this.hudini` before the plugin mounts throws at
|
|
10
|
+
* runtime.
|
|
11
|
+
*
|
|
12
|
+
* Prefer the `withHudini(scene)` accessor:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { withHudini } from 'hudini';
|
|
16
|
+
* import type { ThemeType } from './theme';
|
|
17
|
+
*
|
|
18
|
+
* class MyScene extends Phaser.Scene {
|
|
19
|
+
* create() {
|
|
20
|
+
* const hudini = withHudini<ThemeType>(this);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Kept exported to avoid breaking existing consumers.
|
|
26
|
+
*/
|
|
3
27
|
export declare abstract class SceneWithHudini<T extends BaseThemeConfig = BaseThemeConfig> extends SceneWithPhaserWind<T> {
|
|
4
28
|
/**
|
|
5
|
-
*
|
|
6
29
|
* @param config The scene key or scene specific configuration settings.
|
|
7
30
|
*/
|
|
8
31
|
constructor(config?: string | Phaser.Types.Scenes.SettingsConfig);
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,8BAAsB,eAAe,CACnC,CAAC,SAAS,eAAe,GAAG,eAAe,CAC3C,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B;;OAEG;gBACS,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc;IAIzD,MAAM,EAAG,YAAY,CAAC,CAAC,CAAC,CAAC;CACjC"}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import { SceneWithPhaserWind } from 'phaser-wind';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link withHudini} instead.
|
|
4
|
+
*
|
|
5
|
+
* Forces single inheritance, which conflicts with any user-defined `BaseScene`
|
|
6
|
+
* or other libraries that ship their own scene base class. It also relies on a
|
|
7
|
+
* non-null assertion (`hudini!`) that lies to TypeScript about when the plugin
|
|
8
|
+
* is available — touching `this.hudini` before the plugin mounts throws at
|
|
9
|
+
* runtime.
|
|
10
|
+
*
|
|
11
|
+
* Prefer the `withHudini(scene)` accessor:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { withHudini } from 'hudini';
|
|
15
|
+
* import type { ThemeType } from './theme';
|
|
16
|
+
*
|
|
17
|
+
* class MyScene extends Phaser.Scene {
|
|
18
|
+
* create() {
|
|
19
|
+
* const hudini = withHudini<ThemeType>(this);
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Kept exported to avoid breaking existing consumers.
|
|
25
|
+
*/
|
|
2
26
|
export class SceneWithHudini extends SceneWithPhaserWind {
|
|
3
27
|
/**
|
|
4
|
-
*
|
|
5
28
|
* @param config The scene key or scene specific configuration settings.
|
|
6
29
|
*/
|
|
7
30
|
constructor(config) {
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAgB,eAEpB,SAAQ,mBAAsB;IAC9B;;OAEG;IACH,YAAY,MAAoD;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,MAAM,CAAmB;CACjC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Scene } from 'phaser';
|
|
2
|
+
import type { BaseThemeConfig } from 'phaser-wind';
|
|
3
|
+
import { HudiniPlugin } from '../plugin/plugin';
|
|
4
|
+
/**
|
|
5
|
+
* Accessor for the Hudini plugin from within a Phaser scene.
|
|
6
|
+
*
|
|
7
|
+
* Preferred over {@link SceneWithHudini} (inheritance) and over module
|
|
8
|
+
* augmentation of `Phaser.Scene`, because it:
|
|
9
|
+
* - Composes with any existing base scene (no forced inheritance).
|
|
10
|
+
* - Keeps the theme type explicit at the call site (no silent `any`).
|
|
11
|
+
* - Doesn't rely on non-null assertions that lie about lifecycle.
|
|
12
|
+
*
|
|
13
|
+
* Call it inside `create()` / `update()` (after the plugin has been installed).
|
|
14
|
+
*
|
|
15
|
+
* @typeParam T - The theme config type. Pass your `ThemeType` to get
|
|
16
|
+
* type-narrowed access to your custom tokens (through `hudini.pw`).
|
|
17
|
+
* @param scene - The Phaser scene instance.
|
|
18
|
+
* @returns The Hudini plugin instance bound to the given theme type.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { withHudini } from 'hudini';
|
|
23
|
+
* import type { ThemeType } from './theme';
|
|
24
|
+
*
|
|
25
|
+
* class MyScene extends Phaser.Scene {
|
|
26
|
+
* create() {
|
|
27
|
+
* const hudini = withHudini<ThemeType>(this);
|
|
28
|
+
* const pw = hudini.pw;
|
|
29
|
+
* this.cameras.main.setBackgroundColor(pw.color.rgb('background'));
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const withHudini: <T extends BaseThemeConfig = BaseThemeConfig>(scene: Scene) => HudiniPlugin<T>;
|
|
35
|
+
//# sourceMappingURL=with-hudini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-hudini.d.ts","sourceRoot":"","sources":["../../src/scene/with-hudini.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAc,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EACpE,OAAO,KAAK,KACX,YAAY,CAAC,CAAC,CAC4C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HUDINI_KEY } from '../plugin/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Accessor for the Hudini plugin from within a Phaser scene.
|
|
4
|
+
*
|
|
5
|
+
* Preferred over {@link SceneWithHudini} (inheritance) and over module
|
|
6
|
+
* augmentation of `Phaser.Scene`, because it:
|
|
7
|
+
* - Composes with any existing base scene (no forced inheritance).
|
|
8
|
+
* - Keeps the theme type explicit at the call site (no silent `any`).
|
|
9
|
+
* - Doesn't rely on non-null assertions that lie about lifecycle.
|
|
10
|
+
*
|
|
11
|
+
* Call it inside `create()` / `update()` (after the plugin has been installed).
|
|
12
|
+
*
|
|
13
|
+
* @typeParam T - The theme config type. Pass your `ThemeType` to get
|
|
14
|
+
* type-narrowed access to your custom tokens (through `hudini.pw`).
|
|
15
|
+
* @param scene - The Phaser scene instance.
|
|
16
|
+
* @returns The Hudini plugin instance bound to the given theme type.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { withHudini } from 'hudini';
|
|
21
|
+
* import type { ThemeType } from './theme';
|
|
22
|
+
*
|
|
23
|
+
* class MyScene extends Phaser.Scene {
|
|
24
|
+
* create() {
|
|
25
|
+
* const hudini = withHudini<ThemeType>(this);
|
|
26
|
+
* const pw = hudini.pw;
|
|
27
|
+
* this.cameras.main.setBackgroundColor(pw.color.rgb('background'));
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const withHudini = (scene) => scene.plugins.get(HUDINI_KEY);
|
|
33
|
+
//# sourceMappingURL=with-hudini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-hudini.js","sourceRoot":"","sources":["../../src/scene/with-hudini.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAY,EACK,EAAE,CACnB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hudini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "🎩 Magical Phaser UI components - Reusable HUD elements for game development. Is magic, like a wizard",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"vitest": "^3.2.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"phaser-wind": "0.
|
|
65
|
+
"phaser-wind": "0.10.0",
|
|
66
66
|
"font-awesome-for-phaser": "0.10.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|