@starweb-libs/menus 0.0.1

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) 2026 Starweb Libraries, Mason L'Etoile
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,24 @@
1
+ # Starweb Menus
2
+ Composable canvas menu screens for browser games, built with TypeScript.
3
+
4
+ [![CI](https://github.com/starweb-libs/menus/actions/workflows/ci.yml/badge.svg)](https://github.com/starweb-libs/menus/actions/workflows/ci.yml)
5
+ [![Library Version](https://img.shields.io/npm/v/@starweb-libs/menus)](https://www.npmjs.com/package/@starweb-libs/menus)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](./LICENSE)
7
+
8
+ ## Tech Stack
9
+ <p align="left">
10
+ <img height="35" src="https://img.shields.io/badge/TypeScript-%23007ACC?logo=typescript&logoColor=white&style=for-the-badge"/>
11
+ </p>
12
+
13
+ ## Modules
14
+ | Module | Description |
15
+ | ------ | ----------- |
16
+ | `transition.js` | Plays the button sound, runs an optional callback, and flushes pointer + keyboard input between screens. |
17
+
18
+ ## Installation
19
+ ```bash
20
+ npm install github:starweb-libs/menus
21
+ ```
22
+
23
+ ## License
24
+ MIT License - see [LICENSE](./LICENSE) for details.
@@ -0,0 +1,6 @@
1
+ import { Audio } from "@starweb-libs/audio/audio.js";
2
+ //#region src/transition.d.ts
3
+ declare function transition<T>(frame: T, audio: Audio, fn?: () => void): T;
4
+ //#endregion
5
+ export { transition };
6
+ //# sourceMappingURL=transition.d.mts.map
@@ -0,0 +1,14 @@
1
+ import { flushPointer } from "@starweb-libs/engine/input/pointer.js";
2
+ import { flushKeyboard } from "@starweb-libs/engine/input/keyboard.js";
3
+ //#region src/transition.ts
4
+ function transition(frame, audio, fn) {
5
+ audio.playSound("button");
6
+ fn?.();
7
+ flushPointer();
8
+ flushKeyboard();
9
+ return frame;
10
+ }
11
+ //#endregion
12
+ export { transition };
13
+
14
+ //# sourceMappingURL=transition.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transition.mjs","names":[],"sources":["../src/transition.ts"],"sourcesContent":["import { flushPointer } from \"@starweb-libs/engine/input/pointer.js\";\nimport { flushKeyboard } from \"@starweb-libs/engine/input/keyboard.js\";\nimport type { Audio } from \"@starweb-libs/audio/audio.js\";\n\nexport function transition<T>(frame: T, audio: Audio, fn?: () => void): T {\n audio.playSound(\"button\");\n fn?.();\n flushPointer();\n flushKeyboard();\n return frame;\n}\n"],"mappings":";;;AAIA,SAAgB,WAAc,OAAU,OAAc,IAAoB;CACxE,MAAM,UAAU,QAAQ;CACxB,KAAK;CACL,aAAa;CACb,cAAc;CACd,OAAO;AACT"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@starweb-libs/menus",
3
+ "description": "Composable canvas menu screens for browser games",
4
+ "author": "Mason L'Etoile",
5
+ "version": "0.0.1",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/starweb-libs/menus.git"
10
+ },
11
+ "homepage": "https://github.com/starweb-libs/menus#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/starweb-libs/menus/issues"
14
+ },
15
+ "keywords": [
16
+ "menus",
17
+ "canvas",
18
+ "ui",
19
+ "2d",
20
+ "typescript",
21
+ "browser",
22
+ "starweb"
23
+ ],
24
+ "type": "module",
25
+ "devDependencies": {
26
+ "typescript": "~6.0.2",
27
+ "tsdown": "^0.22.0"
28
+ },
29
+ "dependencies": {
30
+ "@starweb-libs/engine": "^0.0.7",
31
+ "@starweb-libs/audio": "^0.0.3",
32
+ "@starweb-libs/ui": "^0.0.2"
33
+ },
34
+ "overrides": { "yuku-parser": "0.6.5" },
35
+ "scripts": {
36
+ "typecheck": "tsc --noEmit",
37
+ "build": "tsdown",
38
+ "prepare": "npm run build"
39
+ },
40
+ "files": ["dist"],
41
+ "exports": {
42
+ "./transition.js": {
43
+ "types": "./dist/transition.d.mts",
44
+ "@starweb-libs/source": "./src/transition.ts",
45
+ "import": "./dist/transition.mjs"
46
+ }
47
+ }
48
+ }