@melonjs/debug-plugin 14.6.4 → 14.7.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 CHANGED
@@ -2,6 +2,8 @@
2
2
  ![melonJS Logo](https://github.com/melonjs/melonJS/raw/master/media/Banner/Banner%20-%20Billboard%20-%20Original%20Logo%20-%20horizontal.png)
3
3
 
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/melonjs/es6-boilerplate/blob/master/LICENSE)
5
+ [![NPM Package](https://img.shields.io/npm/v/@melonjs/debug-plugin)](https://www.npmjs.com/package/@melonjs/debug-plugin)
6
+ [![jsDeliver](https://data.jsdelivr.com/v1/package/npm/@melonjs/debug-plugin/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@melonjs/debug-plugin)
5
7
 
6
8
  Installation
7
9
  -------------------------------------------------------------------------------
@@ -24,8 +24,14 @@
24
24
  * @augments plugin.BasePlugin
25
25
  */
26
26
  export class DebugPanelPlugin extends plugin.BasePlugin {
27
- constructor(debugToggle: any);
27
+ /**
28
+ * @param {number} [debugToggle=input.KEY.S] - a default key to toggle the debug panel visibility state
29
+ * @see input.KEY for default key options
30
+ */
31
+ constructor(debugToggle?: number | undefined);
32
+ debugToggle: number;
28
33
  panel: DebugPanel;
34
+ keyHandler: import("eventemitter3").EventEmitter<string | symbol, any>;
29
35
  /**
30
36
  * show the debug panel
31
37
  */
@@ -41,7 +47,7 @@ export class DebugPanelPlugin extends plugin.BasePlugin {
41
47
  }
42
48
  import { plugin } from 'melonjs';
43
49
  declare class DebugPanel extends Renderable {
44
- constructor(debugToggle?: number);
50
+ constructor(debugToggle: any);
45
51
  checkbox: {};
46
52
  counters: Counters;
47
53
  visible: boolean;
@@ -52,8 +58,7 @@ declare class DebugPanel extends Renderable {
52
58
  font_size: number;
53
59
  mod: number;
54
60
  font: BitmapText;
55
- debugToggle: number;
56
- keyHandler: import("eventemitter3").EventEmitter<string | symbol, any>;
61
+ debugToggle: any;
57
62
  help_str: string;
58
63
  help_str_len: number;
59
64
  fps_str_len: number;
@@ -1,11 +1,109 @@
1
1
  /*!
2
- * melonJS debug plugin - v14.6.4
2
+ * melonJS debug plugin - v14.7.0
3
3
  * http://www.melonjs.org
4
4
  * @melonjs/debug-plugin is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
6
6
  * @copyright (C) 2011 - 2023 Olivier Biot (AltByte Pte Ltd)
7
7
  */
8
- import { Renderable, video, utils, BitmapText, Rect, event, plugins, input, plugin, Container, Entity, Text, Camera2d, ImageLayer, game, timer, collision, Math, pool } from 'melonjs';
8
+ import { Renderable, video, utils, BitmapText, Rect, event, plugin, Container, Entity, Text, Camera2d, ImageLayer, game, input, timer, collision, Math, pool } from 'melonjs';
9
+
10
+ var name = "@melonjs/debug-plugin";
11
+ var version = "14.7.0";
12
+ var description = "melonJS debug plugin";
13
+ var homepage = "https://github.com/melonjs/debug-plugin#readme";
14
+ var type = "module";
15
+ var keywords = [
16
+ "2D",
17
+ "HTML5",
18
+ "javascript",
19
+ "TypeScript",
20
+ "es6",
21
+ "Canvas",
22
+ "WebGL",
23
+ "WebGL2",
24
+ "WebAudio",
25
+ "game",
26
+ "engine",
27
+ "tiled",
28
+ "tileset",
29
+ "mapeditor",
30
+ "browser",
31
+ "electron",
32
+ "mobile",
33
+ "cordova"
34
+ ];
35
+ var repository = {
36
+ type: "git",
37
+ url: "git+https://github.com/melonjs/debug-plugin.git"
38
+ };
39
+ var bugs = {
40
+ url: "https://github.com/melonjs/debug-plugin/issues"
41
+ };
42
+ var license = "MIT";
43
+ var author = "Olivier Biot (AltByte Pte Ltd)";
44
+ var funding = "https://github.com/sponsors/melonjs";
45
+ var engines = {
46
+ node: ">= 19"
47
+ };
48
+ var main = "dist/@melonjs/debug-plugin.js";
49
+ var module = "dist/@melonjs/debug-plugin.js";
50
+ var types = "dist/@melonjs/debug-plugin.d.ts";
51
+ var sideEffects = false;
52
+ var files = [
53
+ "dist/",
54
+ "src/",
55
+ "package.json",
56
+ "README.md",
57
+ "LICENSE"
58
+ ];
59
+ var peerDependencies = {
60
+ melonjs: "15.5.0"
61
+ };
62
+ var devDependencies = {
63
+ "@babel/eslint-parser": "^7.22.15",
64
+ "@babel/plugin-syntax-import-assertions": "^7.22.5",
65
+ "@rollup/plugin-commonjs": "^25.0.4",
66
+ "@rollup/plugin-image": "^3.0.2",
67
+ "@rollup/plugin-json": "^6.0.0",
68
+ "@rollup/plugin-node-resolve": "^15.2.1",
69
+ "@rollup/plugin-replace": "^5.0.2",
70
+ "del-cli": "^5.1.0",
71
+ eslint: "^8.49.0",
72
+ "eslint-plugin-jsdoc": "^46.5.1",
73
+ rollup: "^3.29.0",
74
+ "rollup-plugin-bundle-size": "^1.0.3",
75
+ "rollup-plugin-string": "^3.0.0",
76
+ typescript: "^5.2.2"
77
+ };
78
+ var scripts = {
79
+ build: "npm run lint && rollup -c --silent && npm run types",
80
+ lint: "eslint src/**.js rollup.config.mjs",
81
+ prepublishOnly: "npm run build",
82
+ clean: "del-cli --force dist/*",
83
+ types: "tsc"
84
+ };
85
+ var _package = {
86
+ name: name,
87
+ version: version,
88
+ description: description,
89
+ homepage: homepage,
90
+ type: type,
91
+ keywords: keywords,
92
+ repository: repository,
93
+ bugs: bugs,
94
+ license: license,
95
+ author: author,
96
+ funding: funding,
97
+ engines: engines,
98
+ main: main,
99
+ module: module,
100
+ types: types,
101
+ sideEffects: sideEffects,
102
+ files: files,
103
+ peerDependencies: peerDependencies,
104
+ devDependencies: devDependencies,
105
+ scripts: scripts
106
+ };
9
107
 
10
108
  class Counters {
11
109
  constructor() {
@@ -31,7 +129,7 @@ var fontDataSource = "info face=PressStart2P size=10 bold=0 italic=0 charset= un
31
129
  const DEBUG_HEIGHT = 50;
32
130
 
33
131
  class DebugPanel extends Renderable {
34
- constructor(debugToggle = input.KEY.S) {
132
+ constructor(debugToggle) {
35
133
  // call the super constructor
36
134
  super(0, 0, video.renderer.getWidth(), DEBUG_HEIGHT );
37
135
 
@@ -71,7 +169,7 @@ class DebugPanel extends Renderable {
71
169
  this.name = "debugPanel";
72
170
 
73
171
  // the debug panel version
74
- this.version = "14.6.4";
172
+ this.version = "14.7.0";
75
173
 
76
174
  // persistent
77
175
  this.isPersistent = true;
@@ -118,11 +216,6 @@ class DebugPanel extends Renderable {
118
216
 
119
217
  // add some keyboard shortcuts
120
218
  this.debugToggle = debugToggle;
121
- this.keyHandler = event.on(event.KEYDOWN, (action, keyCode) => {
122
- if (keyCode === this.debugToggle) {
123
- plugins.debugPanel.toggle();
124
- }
125
- });
126
219
 
127
220
  // some internal string/length
128
221
  this.help_str = "["+String.fromCharCode(32 + this.debugToggle)+"]show/hide";
@@ -560,8 +653,6 @@ class DebugPanel extends Renderable {
560
653
  onDestroyEvent() {
561
654
  // hide the panel
562
655
  this.hide();
563
- // unbind keys event
564
- input.unbindKey(this.toggleKey);
565
656
  }
566
657
  }
567
658
 
@@ -591,16 +682,30 @@ class DebugPanel extends Renderable {
591
682
  * @augments plugin.BasePlugin
592
683
  */
593
684
  class DebugPanelPlugin extends plugin.BasePlugin {
594
-
595
- constructor(debugToggle) {
685
+ /**
686
+ * @param {number} [debugToggle=input.KEY.S] - a default key to toggle the debug panel visibility state
687
+ * @see input.KEY for default key options
688
+ */
689
+ constructor(debugToggle = input.KEY.S) {
596
690
  // call the super constructor
597
691
  super();
598
692
 
599
693
  // minimum melonJS version expected
600
- this.version = "15.2.0";
694
+ this.version = peerDependencies["melonjs"];
695
+
696
+ // hello world
697
+ console.log(`${name} ${version} | ${homepage}`);
698
+
699
+ this.debugToggle = debugToggle;
601
700
 
602
701
  this.panel = new DebugPanel(debugToggle);
603
702
 
703
+ this.keyHandler = event.on(event.KEYDOWN, (action, keyCode) => {
704
+ if (keyCode === this.debugToggle) {
705
+ this.toggle();
706
+ }
707
+ });
708
+
604
709
  // if "#debug" is present in the URL
605
710
  if (utils.getUriFragment().debug === true) {
606
711
  this.show();
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@melonjs/debug-plugin",
3
- "version": "14.6.4",
3
+ "version": "14.7.0",
4
4
  "description": "melonJS debug plugin",
5
+ "homepage": "https://github.com/melonjs/debug-plugin#readme",
5
6
  "type": "module",
6
7
  "keywords": [
7
8
  "2D",
@@ -48,22 +49,23 @@
48
49
  "LICENSE"
49
50
  ],
50
51
  "peerDependencies": {
51
- "melonjs": "^15.2.0"
52
+ "melonjs": "15.5.0"
52
53
  },
53
54
  "devDependencies": {
54
- "@babel/eslint-parser": "^7.21.8",
55
- "@babel/plugin-syntax-import-assertions": "^7.20.0",
56
- "@rollup/plugin-commonjs": "^24.1.0",
55
+ "@babel/eslint-parser": "^7.22.15",
56
+ "@babel/plugin-syntax-import-assertions": "^7.22.5",
57
+ "@rollup/plugin-commonjs": "^25.0.4",
57
58
  "@rollup/plugin-image": "^3.0.2",
58
- "@rollup/plugin-node-resolve": "^15.0.2",
59
+ "@rollup/plugin-json": "^6.0.0",
60
+ "@rollup/plugin-node-resolve": "^15.2.1",
59
61
  "@rollup/plugin-replace": "^5.0.2",
60
- "del-cli": "^5.0.0",
61
- "eslint": "^8.40.0",
62
- "eslint-plugin-jsdoc": "^44.2.3",
63
- "rollup": "^3.21.6",
62
+ "del-cli": "^5.1.0",
63
+ "eslint": "^8.49.0",
64
+ "eslint-plugin-jsdoc": "^46.5.1",
65
+ "rollup": "^3.29.0",
64
66
  "rollup-plugin-bundle-size": "^1.0.3",
65
67
  "rollup-plugin-string": "^3.0.0",
66
- "typescript": "^5.0.4"
68
+ "typescript": "^5.2.2"
67
69
  },
68
70
  "scripts": {
69
71
  "build": "npm run lint && rollup -c --silent && npm run types",
package/src/debugPanel.js CHANGED
@@ -6,7 +6,6 @@ import {
6
6
  Rect,
7
7
  event,
8
8
  plugin,
9
- plugins,
10
9
  Entity,
11
10
  Container,
12
11
  Camera2d,
@@ -27,7 +26,7 @@ import fontDataSource from "./font/PressStart2P.fnt";
27
26
  const DEBUG_HEIGHT = 50;
28
27
 
29
28
  export class DebugPanel extends Renderable {
30
- constructor(debugToggle = input.KEY.S) {
29
+ constructor(debugToggle) {
31
30
  // call the super constructor
32
31
  super(0, 0, video.renderer.getWidth(), DEBUG_HEIGHT );
33
32
 
@@ -114,11 +113,6 @@ export class DebugPanel extends Renderable {
114
113
 
115
114
  // add some keyboard shortcuts
116
115
  this.debugToggle = debugToggle;
117
- this.keyHandler = event.on(event.KEYDOWN, (action, keyCode) => {
118
- if (keyCode === this.debugToggle) {
119
- plugins.debugPanel.toggle();
120
- }
121
- });
122
116
 
123
117
  // some internal string/length
124
118
  this.help_str = "["+String.fromCharCode(32 + this.debugToggle)+"]show/hide";
@@ -556,7 +550,5 @@ export class DebugPanel extends Renderable {
556
550
  onDestroyEvent() {
557
551
  // hide the panel
558
552
  this.hide();
559
- // unbind keys event
560
- input.unbindKey(this.toggleKey);
561
553
  }
562
554
  }
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
- import { utils, plugin } from "melonjs";
1
+ import { utils, plugin, input, event } from "melonjs";
2
+ import { name, version, homepage, peerDependencies } from "../package.json";
2
3
  import { DebugPanel } from "./debugPanel";
3
4
 
4
5
  /**
@@ -27,16 +28,30 @@ import { DebugPanel } from "./debugPanel";
27
28
  * @augments plugin.BasePlugin
28
29
  */
29
30
  export class DebugPanelPlugin extends plugin.BasePlugin {
30
-
31
- constructor(debugToggle) {
31
+ /**
32
+ * @param {number} [debugToggle=input.KEY.S] - a default key to toggle the debug panel visibility state
33
+ * @see input.KEY for default key options
34
+ */
35
+ constructor(debugToggle = input.KEY.S) {
32
36
  // call the super constructor
33
37
  super();
34
38
 
35
39
  // minimum melonJS version expected
36
- this.version = "15.2.0";
40
+ this.version = peerDependencies["melonjs"];
41
+
42
+ // hello world
43
+ console.log(`${name} ${version} | ${homepage}`);
44
+
45
+ this.debugToggle = debugToggle;
37
46
 
38
47
  this.panel = new DebugPanel(debugToggle);
39
48
 
49
+ this.keyHandler = event.on(event.KEYDOWN, (action, keyCode) => {
50
+ if (keyCode === this.debugToggle) {
51
+ this.toggle();
52
+ }
53
+ });
54
+
40
55
  // if "#debug" is present in the URL
41
56
  if (utils.getUriFragment().debug === true) {
42
57
  this.show();