@manybitsbyte/nesplayer-svelte 0.8.0 → 0.9.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
@@ -13,8 +13,24 @@ npm install @manybitsbyte/nesplayer-svelte
13
13
  ```svelte
14
14
  <script>
15
15
  import { Screen } from '@manybitsbyte/nesplayer-svelte';
16
+ </script>
17
+
18
+ <Screen style="width: 512px; height: 480px;" />
19
+ ```
20
+
21
+ That's it. The built-in controls overlay includes a file picker — hover the right edge of the player and click the disk icon to load a `.nes` ROM.
16
22
 
17
- let romBytes = $state(null); // Uint8Array of a .nes file
23
+ The component fills its container. Set width/height on the element or a wrapping div. The canvas maintains the correct NES aspect ratio (8:7 pixel, ~1.167:1) and letter-boxes within the available space.
24
+
25
+ ### Loading a ROM programmatically
26
+
27
+ If you want to serve ROMs from your own UI (a game library, a URL fetch, etc.), pass the bytes via the `rom` prop:
28
+
29
+ ```svelte
30
+ <script>
31
+ import { Screen } from '@manybitsbyte/nesplayer-svelte';
32
+
33
+ let romBytes = $state(null);
18
34
 
19
35
  async function loadRom() {
20
36
  const res = await fetch('/roms/game.nes');
@@ -22,13 +38,10 @@ npm install @manybitsbyte/nesplayer-svelte
22
38
  }
23
39
  </script>
24
40
 
25
- <button onclick={loadRom}>Load ROM</button>
26
-
41
+ <button onclick={loadRom}>Load game</button>
27
42
  <Screen rom={romBytes} romName="game" style="width: 512px; height: 480px;" />
28
43
  ```
29
44
 
30
- The component fills its container. Set width/height on the element or a wrapping div. The canvas maintains the correct NES aspect ratio (8:7 pixel, ~1.167:1) and letter-boxes within the available space.
31
-
32
45
  ## Props
33
46
 
34
47
  | Prop | Type | Default | Bindable | Description |
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export const version: "0.8.0";
1
+ export const version: "0.9.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.8.0';
1
+ export const version = '0.9.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manybitsbyte/nesplayer-svelte",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",