kaplay-ui 0.20.7 → 0.20.9
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/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/README.md +108 -22
- package/docs/_config.yml +4 -0
- package/docs/_includes/nav.html +125 -0
- package/docs/_layouts/default.html +74 -0
- package/docs/about.md +47 -0
- package/docs/assets/favicon-128.png +0 -0
- package/docs/assets/favicon-256.png +0 -0
- package/docs/assets/favicon-32.png +0 -0
- package/docs/assets/favicon-48.png +0 -0
- package/docs/assets/favicon-64.png +0 -0
- package/docs/assets/favicon.ico +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/assets/social-preview.png +0 -0
- package/docs/assets/style.css +219 -0
- package/docs/faq.md +78 -0
- package/docs/index.md +130 -0
- package/package.json +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
package/README.md
CHANGED
|
@@ -8,22 +8,17 @@ _A simple and customizable UI plugin library for building interfaces in https://
|
|
|
8
8
|
|
|
9
9
|
Kaplay UI provides a game‑oriented **UI plugin** designed specifically for KAPLAY.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
For now it helps you build Game Objects like text buttons and labels — without reinventing the wheel.
|
|
12
12
|
|
|
13
13
|
> ⚠️ **Note**
|
|
14
|
-
> The currently published stable version (`0.20.
|
|
14
|
+
> The currently published stable version (`0.20.9`) is being replaced by a complete redesign.
|
|
15
|
+
>
|
|
15
16
|
> A new **v1** version is under active development and can be installed in prerelease form (see below).
|
|
16
17
|
|
|
17
18
|
---
|
|
18
19
|
|
|
19
20
|
## 📦 Installation
|
|
20
21
|
|
|
21
|
-
### Stable release
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm install kaplay-ui
|
|
25
|
-
```
|
|
26
|
-
|
|
27
22
|
### Prerelease (new v1 work)
|
|
28
23
|
|
|
29
24
|
```bash
|
|
@@ -36,9 +31,9 @@ This gives you the latest `1.0.0‑alpha.*` builds.
|
|
|
36
31
|
|
|
37
32
|
## 🚀 Usage
|
|
38
33
|
|
|
39
|
-
Kaplay UI exports a plugin for adding UI Game Objects.
|
|
34
|
+
**Kaplay UI** exports a plugin for adding UI Game Objects.
|
|
40
35
|
|
|
41
|
-
The plugin is exported from the package root:
|
|
36
|
+
The `kaplayUI` plugin is exported from the package root:
|
|
42
37
|
|
|
43
38
|
```ts
|
|
44
39
|
import kaplay from "kaplay";
|
|
@@ -47,36 +42,127 @@ import kaplayUI from "kaplay-ui";
|
|
|
47
42
|
const k = kaplay({
|
|
48
43
|
plugins: [kaplayUI],
|
|
49
44
|
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
You now have access to the UI helpers via your `k` instance:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const btn = k.addTextButton("Play", 200, 100);
|
|
51
|
+
const label = k.addLabel("Score: 0");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🧩 Game Objects (_**1.0.0‑alpha.\* version**_)
|
|
57
|
+
|
|
58
|
+
### 🔤 **Text Button** (`addTextButton()`)
|
|
59
|
+
|
|
60
|
+
Creates a button-like GameObj with centered text and some convenient defaults.
|
|
61
|
+
|
|
62
|
+
#### _**Signature**_
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
addTextButton(
|
|
66
|
+
txt?: string,
|
|
67
|
+
width?: number,
|
|
68
|
+
height?: number
|
|
69
|
+
): GameObj
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### _**Default values**_
|
|
50
73
|
|
|
74
|
+
| Parameter | Default |
|
|
75
|
+
| --------- | ---------- |
|
|
76
|
+
| `txt` | `"Button"` |
|
|
77
|
+
| `width` | `200` |
|
|
78
|
+
| `height` | `100` |
|
|
79
|
+
|
|
80
|
+
#### _**Default styling**_
|
|
81
|
+
|
|
82
|
+
When created, the button includes:
|
|
83
|
+
|
|
84
|
+
- k.outline(3)
|
|
85
|
+
- k.pos(0, 0)
|
|
86
|
+
- k.anchor("topleft")
|
|
87
|
+
- k.area() — for click/hover detection
|
|
88
|
+
|
|
89
|
+
#### _**Examples**_
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
// Default button
|
|
93
|
+
const btn1 = k.addTextButton();
|
|
94
|
+
|
|
95
|
+
// Custom label
|
|
96
|
+
const btn2 = k.addTextButton("Start");
|
|
97
|
+
|
|
98
|
+
// Custom size
|
|
99
|
+
const btn3 = k.addTextButton("Start", 150, 75);
|
|
100
|
+
|
|
101
|
+
// Add interactivity
|
|
102
|
+
btn2.onClick(() => {
|
|
103
|
+
console.log("Button clicked!");
|
|
104
|
+
});
|
|
51
105
|
```
|
|
52
106
|
|
|
53
107
|
---
|
|
54
108
|
|
|
55
|
-
|
|
109
|
+
### 🏷️ **Label** (`addLabel()`)
|
|
56
110
|
|
|
57
|
-
|
|
111
|
+
A lightweight text-based UI element — ideal for HUD counters, tooltips, status text, or titles.
|
|
58
112
|
|
|
59
|
-
|
|
113
|
+
#### _**Signature**_
|
|
60
114
|
|
|
61
115
|
```ts
|
|
62
|
-
|
|
63
|
-
|
|
116
|
+
addLabel(
|
|
117
|
+
txt: string,
|
|
118
|
+
width: number
|
|
119
|
+
height: number
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### _**Default values**_
|
|
124
|
+
|
|
125
|
+
| Parameter | Default |
|
|
126
|
+
| --------- | ------- |
|
|
127
|
+
| `txt` | `""` |
|
|
128
|
+
| `width` | `160` |
|
|
129
|
+
| `height` | `96` |
|
|
130
|
+
|
|
131
|
+
#### _**Examples**_
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
// Default button
|
|
135
|
+
const lbl1 = k.addLabel();
|
|
64
136
|
|
|
65
|
-
//
|
|
66
|
-
const
|
|
137
|
+
// Basic label
|
|
138
|
+
const lbl2 = k.addLabel("Score: 0");
|
|
67
139
|
|
|
68
|
-
//
|
|
69
|
-
const
|
|
140
|
+
// Custom size
|
|
141
|
+
const lbl3 = k.addLabel("Start", 100, 50);
|
|
70
142
|
|
|
71
|
-
//
|
|
72
|
-
|
|
143
|
+
// Update label text example
|
|
144
|
+
let score = 0;
|
|
145
|
+
const scoreLabel = k.addLabel(`Score: ${score}`);
|
|
146
|
+
|
|
147
|
+
k.wait(2, () => {
|
|
148
|
+
score++;
|
|
149
|
+
scoreLabel.children[0].text = `Score: ${score}`;
|
|
150
|
+
});
|
|
73
151
|
```
|
|
74
152
|
|
|
153
|
+
#### _**Common use cases**_
|
|
154
|
+
|
|
155
|
+
- HUD overlays
|
|
156
|
+
- Score counters
|
|
157
|
+
- Time and health displays
|
|
158
|
+
- UI section headings
|
|
159
|
+
- Tooltips and indicators
|
|
160
|
+
|
|
75
161
|
---
|
|
76
162
|
|
|
77
163
|
## 🛣️ Roadmap
|
|
78
164
|
|
|
79
|
-
|
|
165
|
+
_See evolving roadmap at: https://github.com/jbakchr/kaplay-ui/blob/v1/ROADMAP.md_
|
|
80
166
|
|
|
81
167
|
---
|
|
82
168
|
|
package/docs/_config.yml
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<!-- Reusable Navigation Block -->
|
|
2
|
+
<style>
|
|
3
|
+
/* --------------------------------------------------
|
|
4
|
+
Sticky Navbar Base Styles
|
|
5
|
+
-------------------------------------------------- */
|
|
6
|
+
.navbar {
|
|
7
|
+
position: sticky;
|
|
8
|
+
top: 0;
|
|
9
|
+
z-index: 1000;
|
|
10
|
+
background: var(--bg-box);
|
|
11
|
+
padding: 0.75rem 1.25rem;
|
|
12
|
+
border-bottom: 2px solid var(--kaplay-yellow);
|
|
13
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.nav-inner {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Brand */
|
|
23
|
+
.nav-brand {
|
|
24
|
+
font-size: 1.3rem;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
color: var(--text-dark-green);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Desktop menu */
|
|
31
|
+
.nav-menu {
|
|
32
|
+
list-style: none;
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 1.5rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nav-menu a {
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
color: var(--text-purple);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nav-menu a:hover {
|
|
44
|
+
color: var(--kaplay-salmon);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* --------------------------------------------------
|
|
48
|
+
Mobile Styles
|
|
49
|
+
-------------------------------------------------- */
|
|
50
|
+
|
|
51
|
+
/* Hide checkbox */
|
|
52
|
+
.nav-toggle {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Hamburger icon */
|
|
57
|
+
.nav-toggle-label {
|
|
58
|
+
display: none;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
gap: 5px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nav-toggle-label span {
|
|
65
|
+
display: block;
|
|
66
|
+
width: 26px;
|
|
67
|
+
height: 3px;
|
|
68
|
+
background: var(--kaplay-purple);
|
|
69
|
+
border-radius: 3px;
|
|
70
|
+
transition: 0.3s;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (max-width: 650px) {
|
|
74
|
+
.nav-toggle-label {
|
|
75
|
+
display: flex;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.nav-menu {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 60px;
|
|
81
|
+
left: 0;
|
|
82
|
+
right: 0;
|
|
83
|
+
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-width: 100vw;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
|
|
88
|
+
background: var(--bg-box);
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
padding: 1rem;
|
|
91
|
+
display: none;
|
|
92
|
+
border-bottom: 2px solid var(--kaplay-purple);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nav-menu li {
|
|
96
|
+
margin: 0.75rem 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.nav-toggle:checked ~ .nav-menu {
|
|
100
|
+
display: flex;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
104
|
+
|
|
105
|
+
<nav class="navbar">
|
|
106
|
+
<div class="nav-inner">
|
|
107
|
+
<!-- Logo / Title -->
|
|
108
|
+
<a class="nav-brand" href="./index.html">kaplay‑ui</a>
|
|
109
|
+
|
|
110
|
+
<!-- Hamburger -->
|
|
111
|
+
<input type="checkbox" id="nav-toggle" class="nav-toggle" />
|
|
112
|
+
<label for="nav-toggle" class="nav-toggle-label">
|
|
113
|
+
<span></span>
|
|
114
|
+
<span></span>
|
|
115
|
+
<span></span>
|
|
116
|
+
</label>
|
|
117
|
+
|
|
118
|
+
<!-- Menu -->
|
|
119
|
+
<ul class="nav-menu">
|
|
120
|
+
<li><a href="./index.html">Home</a></li>
|
|
121
|
+
<li><a href="./faq.html">FAQ</a></li>
|
|
122
|
+
<li><a href="./about.html">About</a></li>
|
|
123
|
+
</ul>
|
|
124
|
+
</div>
|
|
125
|
+
</nav>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
|
|
8
|
+
<meta name="description" content="Game-ready user interfaces for KAPLAY" />
|
|
9
|
+
|
|
10
|
+
<meta name="robots" content="index, follow" />
|
|
11
|
+
|
|
12
|
+
<meta name="author" content="Jonas Bak Phillipson" />
|
|
13
|
+
|
|
14
|
+
<title>{{ page.title }}</title>
|
|
15
|
+
|
|
16
|
+
<!-- Favicons -->
|
|
17
|
+
<link
|
|
18
|
+
rel="icon"
|
|
19
|
+
type="image/png"
|
|
20
|
+
sizes="32x32"
|
|
21
|
+
href="{{ '/assets/favicon-32.png' | relative_url }}"
|
|
22
|
+
/>
|
|
23
|
+
<link
|
|
24
|
+
rel="icon"
|
|
25
|
+
type="image/png"
|
|
26
|
+
sizes="64x64"
|
|
27
|
+
href="{{ '/assets/favicon-64.png' | relative_url }}"
|
|
28
|
+
/>
|
|
29
|
+
<link
|
|
30
|
+
rel="icon"
|
|
31
|
+
type="image/png"
|
|
32
|
+
sizes="128x128"
|
|
33
|
+
href="{{ '/assets/favicon-128.png' | relative_url }}"
|
|
34
|
+
/>
|
|
35
|
+
<link
|
|
36
|
+
rel="icon"
|
|
37
|
+
type="image/png"
|
|
38
|
+
sizes="256x256"
|
|
39
|
+
href="{{ '/assets/favicon-256.png' | relative_url }}"
|
|
40
|
+
/>
|
|
41
|
+
<link
|
|
42
|
+
rel="icon"
|
|
43
|
+
type="image/x-icon"
|
|
44
|
+
href="{{ '/assets/favicon.ico' | relative_url }}"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<!-- Load custom stylesheet -->
|
|
48
|
+
<link rel="stylesheet" href="{{ '/assets/style.css' | relative_url }}" />
|
|
49
|
+
|
|
50
|
+
<!-- Open Graph (Facebook, LinkedIn, Discord, Slack) -->
|
|
51
|
+
<meta property="og:title" content="KAPLAY-UI" />
|
|
52
|
+
<meta
|
|
53
|
+
property="og:description"
|
|
54
|
+
content="A lightweight UI plugin for the KAPLAY game framework."
|
|
55
|
+
/>
|
|
56
|
+
<meta property="og:type" content="website" />
|
|
57
|
+
<meta property="og:url" content="https://jbakchr.github.io/kaplay-ui/" />
|
|
58
|
+
<meta
|
|
59
|
+
property="og:image"
|
|
60
|
+
content="{{ '/assets/social-preview.png' | relative_url }}"
|
|
61
|
+
/>
|
|
62
|
+
</head>
|
|
63
|
+
|
|
64
|
+
<body>
|
|
65
|
+
{% include nav.html %}
|
|
66
|
+
<!-- KAPLAY-style header -->
|
|
67
|
+
<header class="kaplay-header">
|
|
68
|
+
<img src="{{ '/assets/logo.png' | relative_url }}" class="kaplay-logo" />
|
|
69
|
+
</header>
|
|
70
|
+
|
|
71
|
+
<!-- Main content -->
|
|
72
|
+
<main class="page-content">{{ content }}</main>
|
|
73
|
+
</body>
|
|
74
|
+
</html>
|
package/docs/about.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: About
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 🧩 About KAPLAY-UI
|
|
7
|
+
|
|
8
|
+
<p><span style="color:#6bc96c;font-style:italic;font-weight:bold;">ROAARRR!!</span> .. <span style="font-style:italic">and oh</span> .. Hi! I’m <b>Jonas</b> 👋 — Software Developer 👨💻 and the Captain and Board Chairman of <a href="https://codingpirates.dk/what-is-coding-pirates">Coding Pirates Hillerød</a> 🫡🤵♂️🏴☠️, where we help kids (7–17) explore coding, creativity, and technological daring in the most playful way possible.</p>
|
|
9
|
+
|
|
10
|
+
## Why? Cuz .. 🦖 + 🧒 + 🧑💻 === 💚
|
|
11
|
+
|
|
12
|
+
One evening while preparing activities, I stumbled across **KAPLAY** …
|
|
13
|
+
and instantly thought:
|
|
14
|
+
|
|
15
|
+
<div class="block">
|
|
16
|
+
“Wow — this is perfect for kids!
|
|
17
|
+
Fast, fun, visual, creative…
|
|
18
|
+
…BUT the UI bits could be even easier.”
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
So I started building **KAPLAY UI** — a tiny helper library that gives any coders simple, friendly tools like buttons, labels, menus, and HUD elements without the usual boilerplate.
|
|
22
|
+
|
|
23
|
+
## 🎯 The goal?
|
|
24
|
+
|
|
25
|
+
- Help kids and others build games
|
|
26
|
+
- Keep the creative flow alive
|
|
27
|
+
- Reduce friction
|
|
28
|
+
- Make KAPLAY _**even more**_ magical
|
|
29
|
+
|
|
30
|
+
<div class="block">
|
|
31
|
+
If KAPLAY makes game creation fun, <b>KAPLAY UI aims to make it feel <i>accessible</i></b> — even for kids and others discovering coding for the first time.
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
## 🙏 Thanks
|
|
35
|
+
|
|
36
|
+
Thanks for being here — and happy creating! 🦖✨
|
|
37
|
+
|
|
38
|
+
_— [Jonas Bak Phillipson](https://github.com/jbakchr) (2026)_ 💚 🇩🇰 🏴☠️
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
_(And oh .. "ps": I'm actually **not** a 'gamer' myself - but I'd **love** it if KAPLAY and my KAPLAY-UI plugin could help kids and others code their own games!)_
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<a href="./index.html" class="btn">⬅️ Back to Home</a>
|
|
47
|
+
</p>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/* --------------------------------------------------
|
|
2
|
+
KAPLAY Color Variables
|
|
3
|
+
-------------------------------------------------- */
|
|
4
|
+
:root {
|
|
5
|
+
--kaplay-salmon: #f2ae99;
|
|
6
|
+
--kaplay-yellow: #ffde86;
|
|
7
|
+
--kaplay-cyan: #7ffcff;
|
|
8
|
+
--kaplay-purple: #b291ff;
|
|
9
|
+
|
|
10
|
+
--bg-dark: #1b1b1b;
|
|
11
|
+
--bg-box: #262626;
|
|
12
|
+
|
|
13
|
+
--text-light: #eaeaea;
|
|
14
|
+
--text-purple: #b291ff;
|
|
15
|
+
--text-dark-green: #6bc96c;
|
|
16
|
+
--text-box-black: #262626;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* --------------------------------------------------
|
|
20
|
+
Base Page Styling
|
|
21
|
+
-------------------------------------------------- */
|
|
22
|
+
body {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-family: "Inter", sans-serif;
|
|
25
|
+
background: var(--bg-dark);
|
|
26
|
+
color: var(--text-light);
|
|
27
|
+
padding-bottom: 4rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.page-content {
|
|
31
|
+
max-width: 860px;
|
|
32
|
+
margin: 0 auto;
|
|
33
|
+
padding: 1rem 2rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* --------------------------------------------------
|
|
37
|
+
KAPLAY-Style Header
|
|
38
|
+
-------------------------------------------------- */
|
|
39
|
+
.kaplay-header {
|
|
40
|
+
width: 100%;
|
|
41
|
+
text-align: center;
|
|
42
|
+
padding: 2rem 0 2rem 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.kaplay-logo {
|
|
46
|
+
width: 400px; /* Your chosen logo width */
|
|
47
|
+
max-width: 60vw; /* Responsive scaling on mobile */
|
|
48
|
+
height: auto;
|
|
49
|
+
opacity: 0.95;
|
|
50
|
+
transition:
|
|
51
|
+
transform 0.25s ease,
|
|
52
|
+
opacity 0.25s ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.kaplay-logo:hover {
|
|
56
|
+
transform: scale(1.06);
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* --------------------------------------------------
|
|
61
|
+
Headings (KAPLAY look)
|
|
62
|
+
-------------------------------------------------- */
|
|
63
|
+
h1,
|
|
64
|
+
h2,
|
|
65
|
+
h3 {
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
letter-spacing: -0.5px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
h1 {
|
|
71
|
+
color: var(--kaplay-salmon);
|
|
72
|
+
font-size: 2.8rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
h2 {
|
|
76
|
+
color: var(--kaplay-yellow);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h3 {
|
|
80
|
+
color: var(--kaplay-purple);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* --------------------------------------------------
|
|
84
|
+
Beautiful KAPLAY-style code blocks (fixed + pretty)
|
|
85
|
+
-------------------------------------------------- */
|
|
86
|
+
pre {
|
|
87
|
+
background: var(--bg-box); /* Match the .block color */
|
|
88
|
+
padding: 1.25rem 1.5rem; /* Similar to .block but slightly tighter */
|
|
89
|
+
margin: 2rem 0; /* More breathing room */
|
|
90
|
+
border-radius: 12px; /* Match block radius */
|
|
91
|
+
overflow-x: auto;
|
|
92
|
+
white-space: pre; /* Prevent weird wrapping */
|
|
93
|
+
box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Inner <code> should NOT have padding or background */
|
|
97
|
+
pre code {
|
|
98
|
+
background: none;
|
|
99
|
+
padding: 0;
|
|
100
|
+
margin: 0;
|
|
101
|
+
line-height: 1.55;
|
|
102
|
+
font-size: 0.95rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Inline code */
|
|
106
|
+
code {
|
|
107
|
+
background: #2b2b2b;
|
|
108
|
+
padding: 0.15rem 0.35rem;
|
|
109
|
+
border-radius: 4px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* --------------------------------------------------
|
|
113
|
+
Links
|
|
114
|
+
-------------------------------------------------- */
|
|
115
|
+
a {
|
|
116
|
+
color: var(--kaplay-purple);
|
|
117
|
+
text-decoration: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
a:hover {
|
|
121
|
+
color: var(--kaplay-salmon);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* --------------------------------------------------
|
|
125
|
+
KAPLAY-like Blocks
|
|
126
|
+
-------------------------------------------------- */
|
|
127
|
+
.block {
|
|
128
|
+
background: var(--bg-box);
|
|
129
|
+
padding: 1.5rem 2rem;
|
|
130
|
+
border-radius: 14px;
|
|
131
|
+
margin: 2rem 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* --------------------------------------------------
|
|
135
|
+
Improved Mobile Layout - NEW
|
|
136
|
+
For devices narrower than ~650px
|
|
137
|
+
-------------------------------------------------- */
|
|
138
|
+
@media (max-width: 650px) {
|
|
139
|
+
/* Reduce global padding so content fits comfortably */
|
|
140
|
+
.page-content {
|
|
141
|
+
padding: 0.75rem 1rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Make H1 + H2 more compact and mobile-friendly */
|
|
145
|
+
h1 {
|
|
146
|
+
font-size: 2rem;
|
|
147
|
+
margin-top: 1rem;
|
|
148
|
+
margin-bottom: 1rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
h2 {
|
|
152
|
+
font-size: 1.4rem;
|
|
153
|
+
margin-top: 1.2rem;
|
|
154
|
+
margin-bottom: 0.8rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Reduce paragraph and list spacing */
|
|
158
|
+
p,
|
|
159
|
+
li {
|
|
160
|
+
line-height: 1.55;
|
|
161
|
+
font-size: 1rem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* KAPLAY header styling */
|
|
165
|
+
.kaplay-header {
|
|
166
|
+
padding: 1.5rem 0 1.25rem 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Better phone-sized logo */
|
|
170
|
+
.kaplay-logo {
|
|
171
|
+
width: 200px; /* smaller default */
|
|
172
|
+
max-width: 70vw; /* allow it to shrink on narrow screens */
|
|
173
|
+
margin-bottom: 0.5rem;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Code blocks: tighter and more readable */
|
|
177
|
+
pre {
|
|
178
|
+
padding: 0.75rem;
|
|
179
|
+
font-size: 0.9rem;
|
|
180
|
+
line-height: 1.35;
|
|
181
|
+
margin: 1.25rem 0;
|
|
182
|
+
border-radius: 8px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
code {
|
|
186
|
+
font-size: 0.9rem;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Improve .block container spacing */
|
|
190
|
+
.block {
|
|
191
|
+
padding: 1.25rem 1.25rem;
|
|
192
|
+
margin: 1.5rem 0;
|
|
193
|
+
border-radius: 12px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Make links easier to tap */
|
|
197
|
+
a {
|
|
198
|
+
padding: 0.2rem 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.btn {
|
|
203
|
+
display: inline-block;
|
|
204
|
+
background: var(--kaplay-purple);
|
|
205
|
+
color: var(--text-light);
|
|
206
|
+
padding: 0.6rem 1.2rem;
|
|
207
|
+
border-radius: 8px;
|
|
208
|
+
text-decoration: none;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
transition:
|
|
211
|
+
background 0.2s ease,
|
|
212
|
+
transform 0.2s ease;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.btn:hover {
|
|
216
|
+
background: var(--kaplay-salmon);
|
|
217
|
+
color: var(--text-box-black);
|
|
218
|
+
transform: translateY(-2px);
|
|
219
|
+
}
|
package/docs/faq.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ❓ KAPLAY-UI — FAQ
|
|
2
|
+
|
|
3
|
+
_**Frequently asked questions** about the KAPLAY UI plugin._
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📚 Table of Contents
|
|
8
|
+
|
|
9
|
+
- [General](#-general)
|
|
10
|
+
- [Installation](#-installation)
|
|
11
|
+
- [Usage](#-usage)
|
|
12
|
+
- [Licensing](#-licensing)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🧠 General
|
|
17
|
+
|
|
18
|
+
### **Q:** _**What is this plugin for?**_
|
|
19
|
+
|
|
20
|
+
**A:** KAPLAY UI provides lightweight, composable UI helpers — such as text‑based buttons and labels — built using familiar **KAPLAY primitives**.
|
|
21
|
+
|
|
22
|
+
<div class="block">
|
|
23
|
+
It reduces boilerplate, keeps UI consistent, and helps you build menus, HUDs, overlays, and interactive UI faster.
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 📦 Installation
|
|
29
|
+
|
|
30
|
+
### **Q:** _**How do I install KAPLAY UI?**_
|
|
31
|
+
|
|
32
|
+
**A:** Install from your project root using your preferred package manager:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install kaplay-ui@next
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🚀 Usage
|
|
41
|
+
|
|
42
|
+
### **Q:** _**How do I use the `kaplay-ui` plugin?**_
|
|
43
|
+
|
|
44
|
+
**A:** Import and enable the plugin when creating your KAPLAY instance:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import kaplay from "kaplay";
|
|
48
|
+
import kaplayUI from "kaplay-ui";
|
|
49
|
+
|
|
50
|
+
const k = kaplay({
|
|
51
|
+
plugins: [kaplayUI],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Now you can create UI components such as:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
k.addTextButton("Play");
|
|
59
|
+
k.addLabel("Score: 0");
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 📄 Licensing
|
|
65
|
+
|
|
66
|
+
### **Q:** _**How may I use `kaplay-ui` ?**_
|
|
67
|
+
|
|
68
|
+
**A:** The **MIT License** allows full personal and commercial use with virtually no restrictions.
|
|
69
|
+
|
|
70
|
+
<div class="block">
|
|
71
|
+
🔓 **In short:** You can use, modify, distribute, and even sell projects using KAPLAY UI.
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
<p align="center">
|
|
77
|
+
<a href="./index.html" class="btn">⬅️ Back to Home</a>
|
|
78
|
+
</p>
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# 🦖 KAPLAY-UI 🧩
|
|
2
|
+
|
|
3
|
+
_A lightweight and flexible **UI plugin for KAPLAY**, built to feel like a natural extension of the engine._
|
|
4
|
+
|
|
5
|
+
Create UI elements quickly using familiar KAPLAY primitives — buttons, labels, HUD elements, menus, and more.
|
|
6
|
+
|
|
7
|
+
<div class="block">
|
|
8
|
+
|
|
9
|
+
✨ KAPLAY UI helps you build game-ready user interfaces with almost no setup.
|
|
10
|
+
|
|
11
|
+
Perfect for menus, HUDs, mobile UI, prototypes, and small-to-medium games.
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Why KAPLAY UI?
|
|
18
|
+
|
|
19
|
+
- 🧩 Works exactly like native KAPLAY
|
|
20
|
+
- 🎛️ Easy, declarative API
|
|
21
|
+
- ✨ Sensible styling defaults
|
|
22
|
+
- 🎨 Fully customizable
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 📦 Installation _(v1.0.0-alpha\*)_
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm install kaplay-ui@next
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🧰 Getting Started
|
|
35
|
+
|
|
36
|
+
Add the plugin when creating your KAPLAY instance:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import kaplay from "kaplay";
|
|
40
|
+
import kaplayUI from "kaplay-ui";
|
|
41
|
+
|
|
42
|
+
const k = kaplay({
|
|
43
|
+
plugins: [kaplayUI],
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Now create a UI element:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const tb = k.addTextButton("Play");
|
|
51
|
+
const sl = k.addLabel("Score: 0");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
_**That’s it** — you’re ready to build UI!_
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🧱 Core Components
|
|
59
|
+
|
|
60
|
+
### 🔤 Text Button
|
|
61
|
+
|
|
62
|
+
Create an interactive button with centered text and built‑in outline & area detection.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const tb = k.addTextButton("Play");
|
|
66
|
+
|
|
67
|
+
tb.onClick(() => {
|
|
68
|
+
console.log("Let's play!");
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 🏷️ Label
|
|
73
|
+
|
|
74
|
+
A small, flexible text element — perfect for HUDs.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
const lbl = k.addLabel("Score: 0");
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
_More components are being added soon as the plugin grows._ 🎉
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📚 Documentation
|
|
85
|
+
|
|
86
|
+
_Soon_ .. you can find more details here:
|
|
87
|
+
|
|
88
|
+
- [x] 📄 **[faq.md](https://jbakchr.github.io/kaplay-ui/faq)** — _Questions and answers_
|
|
89
|
+
- [ ] 🧠 **design-decisions** — _The Whys?_
|
|
90
|
+
- [ ] 🔘 **API Pages** — _The What & How?_
|
|
91
|
+
- [ ] 🧪 **Examples** — _Learn by doing!_
|
|
92
|
+
- [ ] 🪧 **Demos** — _See it in action .._
|
|
93
|
+
|
|
94
|
+
_(And even an [about page](https://jbakchr.github.io/kaplay-ui/about.html) — if anybody would **ever** want to read about why I even started creating `kaply-ui` .. 🤷)_
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🗺️ Roadmap (WIP)
|
|
99
|
+
|
|
100
|
+
- **⏳ More component types**
|
|
101
|
+
_(sliders, toggles, panels)_
|
|
102
|
+
|
|
103
|
+
- **🎨 Theme presets**
|
|
104
|
+
_(built-in light/dark UI packs)_
|
|
105
|
+
|
|
106
|
+
- **🎛️ Complex layout helpers**
|
|
107
|
+
_(stacks, grids)_
|
|
108
|
+
|
|
109
|
+
- **📘 Full documentation site**
|
|
110
|
+
_(getting started, faq and .. more)_
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 🤝 Contributing
|
|
115
|
+
|
|
116
|
+
Contributions and feature ideas are warmly welcome!
|
|
117
|
+
|
|
118
|
+
Feel free to submit issues or PRs on GitHub — or share ideas in the discussions tab.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 📜 License
|
|
123
|
+
|
|
124
|
+
MIT © 2026 [Jonas Bak Phillipson](https://github.com/jbakchr)
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
<div class="block" style="text-align:center;font-weight:bold;">
|
|
129
|
+
<p>Made with 💚 + 🦖 by:<p>
|
|
130
|
+
<p style="font-style:italic;"><span style="color:#ffde86;">The</span> <span style="color:#f2ae99;">KAPLAY </span><span style="color:#CF9FFF;">Community</span></p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kaplay-ui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.9",
|
|
4
4
|
"description": "UI components for KAPLAY",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/jbakchr/kaplay-ui/issues"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://github.
|
|
20
|
+
"homepage": "https://jbakchr.github.io/kaplay-ui/",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"kaplay": "^3001.0.10"
|
|
23
23
|
},
|