@benev/tact 0.1.1 → 0.2.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 +30 -16
- package/package.json +13 -12
- package/s/deck/deck.ts +1 -14
- package/s/deck/index.ts +1 -2
- package/s/deck/parts/db.ts +2 -3
- package/s/deck/views/bindings/view.ts +95 -0
- package/s/deck/views/overlay/view.ts +46 -0
- package/s/demo/game/parts/renderer.ts +4 -5
- package/s/demo/game/parts/state.ts +1 -2
- package/s/demo/main.bundle.ts +1 -4
- package/s/demo/ui/theater/styles.css.ts +1 -2
- package/s/demo/ui/theater/view.ts +47 -52
- package/s/demo/ui/theater/virtual/view.ts +10 -12
- package/s/index.html.ts +53 -44
- package/s/nubs/index.ts +3 -4
- package/s/nubs/lookpad/{component.ts → view.ts} +10 -16
- package/s/nubs/stick/{component.ts → view.ts} +27 -34
- package/s/nubs/vpad/{component.ts → view.ts} +25 -33
- package/s/utils/circular-clamp.ts +1 -2
- package/s/utils/gamepads.ts +2 -2
- package/x/core/devices/standard/stick.d.ts +2 -2
- package/x/deck/deck.d.ts +0 -7
- package/x/deck/deck.js +1 -9
- package/x/deck/deck.js.map +1 -1
- package/x/deck/index.d.ts +1 -2
- package/x/deck/index.js +1 -2
- package/x/deck/index.js.map +1 -1
- package/x/deck/parts/db.d.ts +3 -3
- package/x/deck/parts/db.js.map +1 -1
- package/x/deck/parts/overlay-visibility.d.ts +3 -3
- package/x/deck/views/bindings/style.css.js.map +1 -0
- package/x/deck/views/bindings/view.d.ts +2 -0
- package/x/deck/views/bindings/view.js +80 -0
- package/x/deck/views/bindings/view.js.map +1 -0
- package/x/deck/views/overlay/style.css.js.map +1 -0
- package/x/deck/views/overlay/view.d.ts +2 -0
- package/x/deck/views/overlay/view.js +40 -0
- package/x/deck/views/overlay/view.js.map +1 -0
- package/x/demo/game/parts/renderer.js +4 -4
- package/x/demo/game/parts/renderer.js.map +1 -1
- package/x/demo/game/parts/state.js +1 -1
- package/x/demo/game/parts/state.js.map +1 -1
- package/x/demo/main.bundle.js +1 -5
- package/x/demo/main.bundle.js.map +1 -1
- package/x/demo/main.bundle.min.js +242 -233
- package/x/demo/main.bundle.min.js.map +4 -4
- package/x/demo/ui/theater/styles.css.js +1 -1
- package/x/demo/ui/theater/view.d.ts +1 -367
- package/x/demo/ui/theater/view.js +27 -32
- package/x/demo/ui/theater/view.js.map +1 -1
- package/x/demo/ui/theater/virtual/view.d.ts +1 -1
- package/x/demo/ui/theater/virtual/view.js +6 -6
- package/x/demo/ui/theater/virtual/view.js.map +1 -1
- package/x/index.html +41 -125
- package/x/index.html.js +50 -39
- package/x/index.html.js.map +1 -1
- package/x/nubs/index.d.ts +3 -4
- package/x/nubs/index.js +3 -4
- package/x/nubs/index.js.map +1 -1
- package/x/nubs/lookpad/view.d.ts +1 -0
- package/x/nubs/lookpad/{component.js → view.js} +11 -14
- package/x/nubs/lookpad/view.js.map +1 -0
- package/x/nubs/stick/view.d.ts +2 -0
- package/x/nubs/stick/{component.js → view.js} +28 -34
- package/x/nubs/stick/view.js.map +1 -0
- package/x/nubs/vpad/view.d.ts +2 -0
- package/x/nubs/vpad/{component.js → view.js} +26 -32
- package/x/nubs/vpad/view.js.map +1 -0
- package/x/utils/circular-clamp.js +1 -1
- package/x/utils/circular-clamp.js.map +1 -1
- package/x/utils/gamepads.js +2 -2
- package/s/deck/components/components.ts +0 -22
- package/s/deck/components/deck-bindings/component.ts +0 -99
- package/s/deck/components/deck-overlay/component.ts +0 -51
- package/s/deck/components/framework.ts +0 -17
- package/s/nubs/components.ts +0 -14
- package/s/utils/types.ts +0 -19
- package/x/deck/components/components.d.ts +0 -14
- package/x/deck/components/components.js +0 -9
- package/x/deck/components/components.js.map +0 -1
- package/x/deck/components/deck-bindings/component.d.ts +0 -6
- package/x/deck/components/deck-bindings/component.js +0 -83
- package/x/deck/components/deck-bindings/component.js.map +0 -1
- package/x/deck/components/deck-bindings/style.css.js.map +0 -1
- package/x/deck/components/deck-overlay/component.d.ts +0 -6
- package/x/deck/components/deck-overlay/component.js +0 -44
- package/x/deck/components/deck-overlay/component.js.map +0 -1
- package/x/deck/components/deck-overlay/style.css.js.map +0 -1
- package/x/deck/components/framework.d.ts +0 -7
- package/x/deck/components/framework.js +0 -13
- package/x/deck/components/framework.js.map +0 -1
- package/x/nubs/components.d.ts +0 -9
- package/x/nubs/components.js +0 -11
- package/x/nubs/components.js.map +0 -1
- package/x/nubs/lookpad/component.d.ts +0 -4
- package/x/nubs/lookpad/component.js.map +0 -1
- package/x/nubs/stick/component.d.ts +0 -368
- package/x/nubs/stick/component.js.map +0 -1
- package/x/nubs/vpad/component.d.ts +0 -368
- package/x/nubs/vpad/component.js.map +0 -1
- package/x/utils/types.d.ts +0 -3
- package/x/utils/types.js +0 -3
- package/x/utils/types.js.map +0 -1
- /package/s/deck/{components/deck-bindings → views/bindings}/style.css.ts +0 -0
- /package/s/deck/{components/deck-overlay → views/overlay}/style.css.ts +0 -0
- /package/x/deck/{components/deck-bindings → views/bindings}/style.css.d.ts +0 -0
- /package/x/deck/{components/deck-bindings → views/bindings}/style.css.js +0 -0
- /package/x/deck/{components/deck-overlay → views/overlay}/style.css.d.ts +0 -0
- /package/x/deck/{components/deck-overlay → views/overlay}/style.css.js +0 -0
package/x/index.html
CHANGED
|
@@ -1,136 +1,52 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
6
|
-
<meta name="darkreader-lock"/>
|
|
7
|
-
<title>@benev/tact</title>
|
|
8
|
-
<style>
|
|
9
|
-
@layer vars, core, basics, page;
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>@benev/tact</title>
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
--prime: #ccc;
|
|
16
|
-
--bg: #181818;
|
|
17
|
-
--bg2: #111111;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
6
|
+
<meta charset="utf-8"/>
|
|
7
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
8
|
+
<meta name="darkreader-lock"/>
|
|
9
|
+
<style>@layer base{html{background:#000}}</style>
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
margin: 0;
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
}
|
|
11
|
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='0.9em' font-size='90'>🎮</text></svg>"/>
|
|
12
|
+
<link rel="stylesheet" href="demo/main.css?v=f6a7eee9f8b9"/>
|
|
13
|
+
<script type="module" src="demo/main.bundle.min.js?v=19fd899ab029"></script>
|
|
27
14
|
|
|
28
|
-
::-webkit-scrollbar { width: 4px; }
|
|
29
|
-
::-webkit-scrollbar-track { background: transparent; }
|
|
30
|
-
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
|
|
31
|
-
::-webkit-scrollbar-thumb:hover { background: #444; }
|
|
32
15
|
|
|
33
|
-
a {
|
|
34
|
-
color: var(--link);
|
|
35
|
-
text-decoration: none;
|
|
36
|
-
|
|
37
|
-
&:visited {
|
|
38
|
-
color: color-mix(in srgb, var(--link), purple 30%);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:hover {
|
|
42
|
-
color: color-mix(in srgb, var(--link), white 10%);
|
|
43
|
-
text-decoration: underline;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&:active {
|
|
47
|
-
color: color-mix(in srgb, var(--link), white 50%);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@layer basics {
|
|
53
|
-
html { height: 100%; }
|
|
54
|
-
body { min-height: 100%; }
|
|
55
|
-
|
|
56
|
-
html, body {
|
|
57
|
-
font-family: sans-serif;
|
|
58
|
-
font-size: 12px;
|
|
59
|
-
color: var(--prime);
|
|
60
|
-
background: var(--bg);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@layer page {
|
|
65
|
-
body {
|
|
66
|
-
display: flex;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
align-items: center;
|
|
69
|
-
|
|
70
|
-
gap: 1em;
|
|
71
|
-
padding: 2em;
|
|
72
|
-
|
|
73
|
-
> * {
|
|
74
|
-
width: 100%;
|
|
75
|
-
max-width: 42em;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
> header {
|
|
79
|
-
padding: 0 2em;
|
|
80
|
-
h1 small { font-size: 0.6em; font-weight: normal; }
|
|
81
|
-
* + * { margin-top: 0.5em; }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
> section {
|
|
85
|
-
padding: 0 2em;
|
|
86
|
-
ul {
|
|
87
|
-
padding-left: 1em;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
</style>
|
|
94
|
-
<script type=module src="demo/main.bundle.min.js?v=c30d3f5c736f"></script>
|
|
95
|
-
<link rel="icon" href="assets/b.png?v=32b1d0126431"/>
|
|
96
|
-
|
|
97
|
-
<meta name="theme-color" content="#f2ea8e">
|
|
98
16
|
<meta property="og:type" content="website">
|
|
99
|
-
<meta property="og:site_name" content="tact.benevolent.games">
|
|
100
17
|
<meta property="og:title" content="@benev/tact">
|
|
101
18
|
<meta property="og:description" content="keybindings and gamepad support for web games">
|
|
19
|
+
<meta property="og:site_name" content="tact.benevolent.games">
|
|
20
|
+
<meta name="theme-color" content="#f2ea8e">
|
|
102
21
|
<meta property="og:image" content="https://tact.benevolent.games/assets/b.png">
|
|
103
22
|
|
|
104
23
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</body>
|
|
136
|
-
</html>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<header>
|
|
27
|
+
<h1>
|
|
28
|
+
<strong>@benev/tact</strong>
|
|
29
|
+
<small>v0.2.0</small>
|
|
30
|
+
</h1>
|
|
31
|
+
<div class=deets>
|
|
32
|
+
<p><em>"from keypress to couch co-op"</em></p>
|
|
33
|
+
<p>
|
|
34
|
+
tact is a user input toolkit for the web. it's good at customizable keybindings, and multiple gamepad support.
|
|
35
|
+
see <a href="https://github.com/benevolent-games/tact">github</a>,
|
|
36
|
+
see <a href="https://benevolent.games/">benevolent.games</a>.
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
</header>
|
|
40
|
+
|
|
41
|
+
<div id=demo-theater></div>
|
|
42
|
+
|
|
43
|
+
<section>
|
|
44
|
+
<h3>controls</h3>
|
|
45
|
+
<ul>
|
|
46
|
+
<li><strong>keyboard</strong> wasd, left-bracket, right-bracket, backslash.</li>
|
|
47
|
+
<li><strong>gamepad</strong> thumbsticks, hold beta/gamma and press bumpers or dpad left/right.</li>
|
|
48
|
+
<li><strong>virtual</strong> use your mouse to press the little buttons.</li>
|
|
49
|
+
</ul>
|
|
50
|
+
</section>
|
|
51
|
+
</body>
|
|
52
|
+
</html>
|
package/x/index.html.js
CHANGED
|
@@ -1,47 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { template, html, dataSvgEmoji, socialCard } from "@e280/scute";
|
|
2
2
|
const title = "@benev/tact";
|
|
3
3
|
const domain = "tact.benevolent.games";
|
|
4
4
|
const favicon = "/assets/b.png";
|
|
5
5
|
const description = "keybindings and gamepad support for web games";
|
|
6
|
-
export default
|
|
6
|
+
export default template(import.meta.url, async (orb) => html `
|
|
7
|
+
<!doctype html>
|
|
8
|
+
<html>
|
|
9
|
+
<head>
|
|
10
|
+
<title>${title}</title>
|
|
11
|
+
|
|
12
|
+
<meta charset="utf-8"/>
|
|
13
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
14
|
+
<meta name="darkreader-lock"/>
|
|
15
|
+
<style>@layer base{html{background:#000}}</style>
|
|
16
|
+
|
|
17
|
+
<link rel="icon" href="${dataSvgEmoji("🎮")}"/>
|
|
18
|
+
<link rel="stylesheet" href="${orb.hashurl("demo/main.css")}"/>
|
|
19
|
+
<script type="module" src="${orb.hashurl("demo/main.bundle.min.js")}"></script>
|
|
20
|
+
|
|
21
|
+
${socialCard({
|
|
7
22
|
title,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
favicon
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
see <a href="https://github.com/benevolent-games/tact">github</a>,
|
|
30
|
-
see <a href="https://benevolent.games/">benevolent.games</a>.
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
</header>
|
|
23
|
+
description,
|
|
24
|
+
themeColor: "#f2ea8e",
|
|
25
|
+
siteName: domain,
|
|
26
|
+
image: `https://${domain}${favicon}`,
|
|
27
|
+
})}
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<header>
|
|
31
|
+
<h1>
|
|
32
|
+
<strong>@benev/tact</strong>
|
|
33
|
+
<small>v${orb.packageVersion()}</small>
|
|
34
|
+
</h1>
|
|
35
|
+
<div class=deets>
|
|
36
|
+
<p><em>"from keypress to couch co-op"</em></p>
|
|
37
|
+
<p>
|
|
38
|
+
tact is a user input toolkit for the web. it's good at customizable keybindings, and multiple gamepad support.
|
|
39
|
+
see <a href="https://github.com/benevolent-games/tact">github</a>,
|
|
40
|
+
see <a href="https://benevolent.games/">benevolent.games</a>.
|
|
41
|
+
</p>
|
|
42
|
+
</div>
|
|
43
|
+
</header>
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
<div id=demo-theater></div>
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
<section>
|
|
48
|
+
<h3>controls</h3>
|
|
49
|
+
<ul>
|
|
50
|
+
<li><strong>keyboard</strong> wasd, left-bracket, right-bracket, backslash.</li>
|
|
51
|
+
<li><strong>gamepad</strong> thumbsticks, hold beta/gamma and press bumpers or dpad left/right.</li>
|
|
52
|
+
<li><strong>virtual</strong> use your mouse to press the little buttons.</li>
|
|
53
|
+
</ul>
|
|
54
|
+
</section>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
`);
|
|
47
58
|
//# sourceMappingURL=index.html.js.map
|
package/x/index.html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.html.js","sourceRoot":"","sources":["../s/index.html.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.html.js","sourceRoot":"","sources":["../s/index.html.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAEpE,MAAM,KAAK,GAAG,aAAa,CAAA;AAC3B,MAAM,MAAM,GAAG,uBAAuB,CAAA;AACtC,MAAM,OAAO,GAAG,eAAe,CAAA;AAC/B,MAAM,WAAW,GAAG,+CAA+C,CAAA;AAEnE,eAAe,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,IAAI,CAAA;;;;YAI9C,KAAK;;;;;;;4BAOW,YAAY,CAAC,IAAI,CAAC;kCACZ,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC;gCAC9B,GAAG,CAAC,OAAO,CAAC,yBAAyB,CAAC;;KAEjE,UAAU,CAAC;IACZ,KAAK;IACL,WAAW;IACX,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,WAAW,MAAM,GAAG,OAAO,EAAE;CACpC,CAAC;;;;;;eAMU,GAAG,CAAC,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;CAwBlC,CAAC,CAAA"}
|
package/x/nubs/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./lookpad/
|
|
2
|
-
export * from "./stick/
|
|
3
|
-
export * from "./vpad/
|
|
4
|
-
export * from "./components.js";
|
|
1
|
+
export * from "./lookpad/view.js";
|
|
2
|
+
export * from "./stick/view.js";
|
|
3
|
+
export * from "./vpad/view.js";
|
package/x/nubs/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export * from "./lookpad/
|
|
2
|
-
export * from "./stick/
|
|
3
|
-
export * from "./vpad/
|
|
4
|
-
export * from "./components.js";
|
|
1
|
+
export * from "./lookpad/view.js";
|
|
2
|
+
export * from "./stick/view.js";
|
|
3
|
+
export * from "./vpad/view.js";
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
package/x/nubs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/nubs/index.ts"],"names":[],"mappings":"AACA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/nubs/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NubLookpad: import("@e280/sly").ShadowView<[]>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { dom,
|
|
1
|
+
import { dom, shadow, useHost, useMount, useName, useSignal, useStyles } from "@e280/sly";
|
|
2
2
|
import { styles } from "./styles.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
3
|
+
export const NubLookpad = shadow(() => {
|
|
4
|
+
useName("nub-lookpad");
|
|
5
|
+
useStyles(styles);
|
|
6
|
+
const host = useHost();
|
|
7
|
+
const $captured = useSignal(undefined);
|
|
8
|
+
useMount(() => dom.events(host, {
|
|
8
9
|
pointerdown: (event) => {
|
|
9
10
|
event.preventDefault();
|
|
10
11
|
if ($captured.value)
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
host.releasePointerCapture($captured.value);
|
|
13
|
+
host.setPointerCapture(event.pointerId);
|
|
13
14
|
$captured.value = event.pointerId;
|
|
14
15
|
// onPointerDrag(event)
|
|
15
16
|
},
|
|
@@ -22,15 +23,11 @@ const NubLookpadView = view(use => () => {
|
|
|
22
23
|
pointerup: (event) => {
|
|
23
24
|
event.preventDefault();
|
|
24
25
|
if (event.pointerId === $captured.value) {
|
|
25
|
-
|
|
26
|
+
host.releasePointerCapture($captured.value);
|
|
26
27
|
$captured.value = undefined;
|
|
27
28
|
// onPointerDrag(event)
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
}));
|
|
31
32
|
});
|
|
32
|
-
|
|
33
|
-
.component()
|
|
34
|
-
.props(() => [])) {
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=component.js.map
|
|
33
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../s/nubs/lookpad/view.ts"],"names":[],"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AAC,CAAA;gBAC3C,SAAS,CAAC,KAAK,GAAG,SAAS,CAAA;gBAC3B,uBAAuB;YACxB,CAAC;QACF,CAAC;KACD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { html } from "lit";
|
|
2
2
|
import { coalesce, nap } from "@e280/stz";
|
|
3
3
|
import { Scalar, Vec2 } from "@benev/math";
|
|
4
|
-
import {
|
|
4
|
+
import { cssReset, dom, shadow, useCss, useHost, useMount, useName, useOnce, useSignal } from "@e280/sly";
|
|
5
5
|
import styleCss from "./style.css.js";
|
|
6
6
|
import { circularClamp } from "../../utils/circular-clamp.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const range =
|
|
12
|
-
const $captured =
|
|
13
|
-
|
|
7
|
+
export const NubStick = shadow(({ $vector }) => {
|
|
8
|
+
useName("nub-stick");
|
|
9
|
+
useCss(cssReset, styleCss);
|
|
10
|
+
const host = useHost();
|
|
11
|
+
const range = useOnce(() => new Vec2(0.2, 0.8));
|
|
12
|
+
const $captured = useSignal(undefined);
|
|
13
|
+
useMount(() => {
|
|
14
14
|
function recalc(event) {
|
|
15
|
-
const rect =
|
|
15
|
+
const rect = host.getBoundingClientRect();
|
|
16
16
|
const vector = $vector.get();
|
|
17
17
|
vector.x = Scalar.remap(event.clientX, rect.left, rect.right, -1, 1);
|
|
18
18
|
vector.y = Scalar.remap(event.clientY, rect.top, rect.bottom, -1, 1);
|
|
@@ -29,7 +29,7 @@ const NubStickView = view(use => ({ $vector }) => {
|
|
|
29
29
|
nap(0).then(() => {
|
|
30
30
|
if ($captured.value === undefined)
|
|
31
31
|
return;
|
|
32
|
-
|
|
32
|
+
host.releasePointerCapture($captured.value);
|
|
33
33
|
$captured.value = undefined;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -42,11 +42,11 @@ const NubStickView = view(use => ({ $vector }) => {
|
|
|
42
42
|
event.preventDefault();
|
|
43
43
|
event.stopPropagation();
|
|
44
44
|
}],
|
|
45
|
-
}), dom.events(
|
|
45
|
+
}), dom.events(host, {
|
|
46
46
|
pointerdown: (event) => {
|
|
47
47
|
if ($captured.value === undefined) {
|
|
48
48
|
$captured.value = event.pointerId;
|
|
49
|
-
|
|
49
|
+
host.setPointerCapture($captured.value);
|
|
50
50
|
recalc(event);
|
|
51
51
|
}
|
|
52
52
|
},
|
|
@@ -71,31 +71,25 @@ const NubStickView = view(use => ({ $vector }) => {
|
|
|
71
71
|
`;
|
|
72
72
|
};
|
|
73
73
|
return html `
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
<div class=frame>
|
|
75
|
+
<div class=inner style="${innerstyle}"></div>
|
|
76
|
+
</div>
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
<div class=frame>
|
|
79
|
+
<div class=outer style="${outerstyle}"></div>
|
|
80
|
+
</div>
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
<div class=frame>
|
|
83
|
+
<div class=stickbase></div>
|
|
84
|
+
</div>
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
<div class=frame style="${framestyle(0.5)}">
|
|
87
|
+
<div class=stickunder></div>
|
|
88
|
+
</div>
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
<div class=frame style="${framestyle(1.0)}">
|
|
91
|
+
<div class=stick></div>
|
|
92
|
+
</div>
|
|
93
93
|
`;
|
|
94
94
|
});
|
|
95
|
-
|
|
96
|
-
.component(class extends BaseElement {
|
|
97
|
-
device = new StickDevice();
|
|
98
|
-
})
|
|
99
|
-
.props(el => [el.device])) {
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=component.js.map
|
|
95
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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, useRendered, useShadow } from "@e280/sly";
|
|
4
4
|
import stylesCss from "./styles.css.js";
|
|
5
|
-
import { NubStick } from "../stick/
|
|
5
|
+
import { NubStick } from "../stick/view.js";
|
|
6
6
|
import { touchTracking } from "./utils/touch-tracking.js";
|
|
7
|
-
import { VpadDevice } from "../../core/devices/standard/vpad.js";
|
|
8
7
|
import { preventDefaultTouchShenanigans } from "./utils/prevent-default-touch-shenanigans.js";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
export const NubVpad = shadow((device) => {
|
|
9
|
+
useName("nub-vpad");
|
|
10
|
+
useCss(stylesCss);
|
|
11
|
+
const shadowRoot = useShadow();
|
|
12
|
+
const buttons = useOnce(() => new Set());
|
|
13
|
+
const codes = useOnce(() => new GMap());
|
|
14
|
+
useRendered().then(() => {
|
|
15
|
+
const elements = Array.from(shadowRoot.querySelectorAll("button[x-code]"));
|
|
16
16
|
for (const button of elements) {
|
|
17
17
|
const code = button.getAttribute("x-code");
|
|
18
18
|
if (code) {
|
|
@@ -21,20 +21,20 @@ const NubVpadView = view(use => (device) => {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
target:
|
|
24
|
+
useMount(() => preventDefaultTouchShenanigans());
|
|
25
|
+
useMount(() => touchTracking({
|
|
26
|
+
target: shadowRoot,
|
|
27
27
|
buttons,
|
|
28
|
-
touchdown: button => {
|
|
28
|
+
touchdown: (button) => {
|
|
29
29
|
const code = codes.require(button);
|
|
30
30
|
device.setSample(code, 1);
|
|
31
31
|
},
|
|
32
|
-
touchup: button => {
|
|
32
|
+
touchup: (button) => {
|
|
33
33
|
const code = codes.require(button);
|
|
34
34
|
device.setSample(code, 0);
|
|
35
35
|
},
|
|
36
36
|
}));
|
|
37
|
-
|
|
37
|
+
useMount(() => ev(shadowRoot, {
|
|
38
38
|
contextmenu: (e) => e.preventDefault(),
|
|
39
39
|
}));
|
|
40
40
|
function button(code, label) {
|
|
@@ -103,27 +103,21 @@ const NubVpadView = view(use => (device) => {
|
|
|
103
103
|
<div class="left side">
|
|
104
104
|
${renderLeftShoulder()}
|
|
105
105
|
${renderDPad()}
|
|
106
|
-
${NubStick.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
${NubStick.with({
|
|
107
|
+
props: [device.stickLeft],
|
|
108
|
+
attrs: { class: "stick" },
|
|
109
|
+
})}
|
|
110
110
|
</div>
|
|
111
111
|
|
|
112
112
|
<div class="right side">
|
|
113
113
|
${renderRightShoulder()}
|
|
114
114
|
${renderButtonPad()}
|
|
115
|
-
${NubStick.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
${NubStick.with({
|
|
116
|
+
props: [device.stickRight],
|
|
117
|
+
attrs: { class: "stick" },
|
|
118
|
+
})}
|
|
119
119
|
</div>
|
|
120
120
|
</div>
|
|
121
121
|
`;
|
|
122
122
|
});
|
|
123
|
-
|
|
124
|
-
.component(class extends BaseElement {
|
|
125
|
-
device = new VpadDevice();
|
|
126
|
-
})
|
|
127
|
-
.props(el => [el.device])) {
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=component.js.map
|
|
123
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../s/nubs/vpad/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,EAAE,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,WAAW,CAAA;AAE5F,OAAO,SAAS,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EAAC,QAAQ,EAAC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SAAS,mBAAmB;QAC3B,OAAO,IAAI,CAAA;;MAEP,MAAM,CAAC,uBAAuB,EAAE,IAAI,CAAC;MACrC,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;MACpC,MAAM,CAAC,2BAA2B,EAAE,IAAI,CAAC;;GAE5C,CAAA;IACF,CAAC;IAED,OAAO,IAAI,CAAA;;KAEP,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC;KAChC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC;KAC9B,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC;;;;;MAK/B,kBAAkB,EAAE;MACpB,UAAU,EAAE;MACZ,QAAQ,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC;QACzB,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC;KACvB,CAAC;;;;MAIA,mBAAmB,EAAE;MACrB,eAAe,EAAE;MACjB,QAAQ,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;QAC1B,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC;KACvB,CAAC;;;EAGJ,CAAA;AACF,CAAC,CAAC,CAAA"}
|
|
@@ -3,6 +3,6 @@ export function circularClamp(vector, range) {
|
|
|
3
3
|
const v = Vec2.from(vector);
|
|
4
4
|
const distance = v.distance_(0, 0);
|
|
5
5
|
const modifiedDistance = Scalar.remap(distance, range.x, range.y, 0, 1, true);
|
|
6
|
-
return v.normalize().
|
|
6
|
+
return v.normalize().mulBy(modifiedDistance);
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=circular-clamp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circular-clamp.js","sourceRoot":"","sources":["../../s/utils/circular-clamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAK,MAAM,aAAa,CAAA;AAE5C,MAAM,UAAU,aAAa,CAAC,MAAU,EAAE,KAAW;IACpD,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,CACpC,QAAQ,EACR,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAChB,CAAC,EAAE,CAAC,EACJ,IAAI,CACJ,CAAA;IACD,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"circular-clamp.js","sourceRoot":"","sources":["../../s/utils/circular-clamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAK,MAAM,aAAa,CAAA;AAE5C,MAAM,UAAU,aAAa,CAAC,MAAU,EAAE,KAAW;IACpD,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,CACpC,QAAQ,EACR,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAChB,CAAC,EAAE,CAAC,EACJ,IAAI,CACJ,CAAA;IACD,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;AAC7C,CAAC"}
|
package/x/utils/gamepads.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ev,
|
|
1
|
+
import { ev, GMap } from "@e280/stz";
|
|
2
2
|
import { evergreen } from "./evergreen.js";
|
|
3
3
|
/** stable reference to a gamepad, has a getter to get the latest gamepad snapshot */
|
|
4
4
|
export class Pad {
|
|
@@ -12,7 +12,7 @@ export class Pad {
|
|
|
12
12
|
}
|
|
13
13
|
/** track gamepad lifecycles as they connect or disconnect */
|
|
14
14
|
export function gamepads(on) {
|
|
15
|
-
const pads = new
|
|
15
|
+
const pads = new GMap();
|
|
16
16
|
return ev(window, {
|
|
17
17
|
gamepadconnected: ({ gamepad }) => {
|
|
18
18
|
const get = () => navigator.getGamepads().at(gamepad.index);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {ob} from "@e280/stz"
|
|
3
|
-
import {Deck} from "../deck.js"
|
|
4
|
-
import {DropFirstParam} from "../../utils/types.js"
|
|
5
|
-
import {DeckOverlay} from "./deck-overlay/component.js"
|
|
6
|
-
import {DeckBindings} from "./deck-bindings/component.js"
|
|
7
|
-
|
|
8
|
-
const components = {DeckOverlay, DeckBindings}
|
|
9
|
-
|
|
10
|
-
export const deckComponents = (deck: Deck<any>) => (
|
|
11
|
-
ob(components)
|
|
12
|
-
.map(C => class extends C { deck = deck })
|
|
13
|
-
) as DeckComponents
|
|
14
|
-
|
|
15
|
-
export type DeckComponents = typeof components
|
|
16
|
-
|
|
17
|
-
export type DeckViews = {
|
|
18
|
-
[P in keyof DeckComponents]: (
|
|
19
|
-
DropFirstParam<DeckComponents[P]["view"]>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|