anentrypoint-design 0.0.171 → 0.0.172

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.171",
3
+ "version": "0.0.172",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -19,6 +19,8 @@
19
19
  "./kits/spoint/loading-screen.css": "./src/kits/spoint/loading-screen.css",
20
20
  "./kits/spoint/game-hud.js": "./src/kits/spoint/game-hud.js",
21
21
  "./kits/spoint/game-hud.css": "./src/kits/spoint/game-hud.css",
22
+ "./kits/spoint/host-join-lobby.js": "./src/kits/spoint/host-join-lobby.js",
23
+ "./kits/spoint/host-join-lobby.css": "./src/kits/spoint/host-join-lobby.css",
22
24
  "./kits/os": {
23
25
  "import": "./src/kits/os/index.js",
24
26
  "default": "./src/kits/os/index.js"
package/src/index.js CHANGED
@@ -77,6 +77,7 @@ export const applyDiff = webjsx.applyDiff;
77
77
  // spoint kit paint surfaces (loading screen, HUD, editor chrome).
78
78
  export { renderLoadingScreen } from './kits/spoint/loading-screen.js';
79
79
  export { renderGameHud } from './kits/spoint/game-hud.js';
80
+ export { renderHostJoinLobby } from './kits/spoint/host-join-lobby.js';
80
81
 
81
82
  // Re-export freddie helpers so consumers can `import { FREDDIE_PAGES } from
82
83
  // 'anentrypoint-design'` directly.
@@ -0,0 +1,89 @@
1
+ /* Host/join lobby kit styles. Scoped under .ds-247420 at build time.
2
+ Token-only colors (no raw literals) per the token-lint gate. */
3
+ .sp-lobby {
4
+ position: fixed;
5
+ inset: 0;
6
+ z-index: 9500;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ background: color-mix(in srgb, var(--bg) 70%, transparent);
11
+ font-family: var(--ff-mono);
12
+ }
13
+ .sp-lobby-card {
14
+ position: relative;
15
+ width: min(360px, 88vw);
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 12px;
19
+ padding: 24px;
20
+ background: var(--bg-2);
21
+ border: 1px solid var(--bw-rule, var(--rule));
22
+ border-radius: var(--r-2, 10px);
23
+ color: var(--fg);
24
+ }
25
+ .sp-lobby-title {
26
+ margin: 0;
27
+ font-family: var(--ff-display);
28
+ font-size: var(--fs-h3);
29
+ }
30
+ .sp-lobby-sub {
31
+ margin: 0;
32
+ color: var(--fg-3);
33
+ font-size: var(--fs-small, 12px);
34
+ }
35
+ .sp-lobby-btn {
36
+ appearance: none;
37
+ border: 1px solid var(--bw-rule, var(--rule));
38
+ background: var(--bg-3);
39
+ color: var(--fg);
40
+ font-family: var(--ff-mono);
41
+ font-size: var(--fs-body);
42
+ padding: 10px 14px;
43
+ border-radius: var(--r-1, 6px);
44
+ cursor: pointer;
45
+ }
46
+ .sp-lobby-btn:hover { background: var(--bg-2); }
47
+ .sp-lobby-btn:disabled { opacity: 0.6; cursor: default; }
48
+ .sp-lobby-btn-primary {
49
+ background: var(--accent);
50
+ color: var(--accent-fg);
51
+ border-color: var(--accent);
52
+ }
53
+ .sp-lobby-join { display: flex; gap: 8px; }
54
+ .sp-lobby-input {
55
+ flex: 1;
56
+ min-width: 0;
57
+ background: var(--bg);
58
+ color: var(--fg);
59
+ border: 1px solid var(--bw-rule, var(--rule));
60
+ border-radius: var(--r-1, 6px);
61
+ padding: 8px 10px;
62
+ font: var(--fs-body) var(--ff-mono);
63
+ outline: none;
64
+ }
65
+ .sp-lobby-input:focus { border-color: var(--accent); }
66
+ .sp-lobby-link { font-size: var(--fs-small, 11px); }
67
+ .sp-lobby-code {
68
+ font-family: var(--ff-display);
69
+ font-size: var(--fs-h2);
70
+ letter-spacing: 0.12em;
71
+ text-align: center;
72
+ color: var(--accent);
73
+ padding: 8px;
74
+ background: var(--bg);
75
+ border-radius: var(--r-1, 6px);
76
+ }
77
+ .sp-lobby-err { min-height: 16px; color: var(--danger); font-size: var(--fs-small, 11px); }
78
+ .sp-lobby-close {
79
+ position: absolute;
80
+ top: 10px;
81
+ right: 12px;
82
+ appearance: none;
83
+ background: none;
84
+ border: none;
85
+ color: var(--fg-3);
86
+ font-size: 16px;
87
+ cursor: pointer;
88
+ line-height: 1;
89
+ }
@@ -0,0 +1,81 @@
1
+ // Host/join lobby paint surface for the spoint multiplayer setup.
2
+ // renderHostJoinLobby({ onHost, onJoin, onClose }) -> { node, showHosting,
3
+ // showError, dispose }. The consumer owns transport/navigation; this module
4
+ // owns layout + classes. Two actions: Host (start a room, then showHosting
5
+ // surfaces the code + copyable join link) and Join (enter a code or paste a
6
+ // join link). onHost() -> Promise|void; onJoin(rawCodeOrLink) -> void.
7
+
8
+ export function renderHostJoinLobby(opts = {}) {
9
+ const { onHost, onJoin, onClose } = opts
10
+
11
+ const node = document.createElement('div')
12
+ node.className = 'sp-lobby ds-247420'
13
+ node.dataset.component = 'host-join-lobby'
14
+
15
+ const card = document.createElement('div')
16
+ card.className = 'sp-lobby-card'
17
+ node.appendChild(card)
18
+
19
+ const mk = (tag, cls, text) => { const el = document.createElement(tag); if (cls) el.className = cls; if (text != null) el.textContent = text; return el }
20
+
21
+ function _idle() {
22
+ card.replaceChildren()
23
+ card.append(
24
+ mk('h2', 'sp-lobby-title', 'Multiplayer'),
25
+ mk('p', 'sp-lobby-sub', 'Host a match others can join, or join with a code.')
26
+ )
27
+ const hostBtn = mk('button', 'sp-lobby-btn sp-lobby-btn-primary', 'Host a Game')
28
+ hostBtn.addEventListener('click', () => { hostBtn.disabled = true; hostBtn.textContent = 'Starting...'; onHost?.() })
29
+ card.appendChild(hostBtn)
30
+
31
+ const joinRow = mk('div', 'sp-lobby-join')
32
+ const input = mk('input', 'sp-lobby-input')
33
+ input.type = 'text'
34
+ input.placeholder = 'Enter room code or link'
35
+ input.autocapitalize = 'characters'
36
+ const joinBtn = mk('button', 'sp-lobby-btn', 'Join')
37
+ const submit = () => { const v = (input.value || '').trim(); if (!v) { showError('Enter a code'); return } onJoin?.(v) }
38
+ joinBtn.addEventListener('click', submit)
39
+ input.addEventListener('keydown', e => { if (e.key === 'Enter') submit() })
40
+ joinRow.append(input, joinBtn)
41
+ card.appendChild(joinRow)
42
+
43
+ const err = mk('div', 'sp-lobby-err'); err.id = 'sp-lobby-err'
44
+ card.appendChild(err)
45
+
46
+ if (onClose) {
47
+ const close = mk('button', 'sp-lobby-close', 'x')
48
+ close.addEventListener('click', () => onClose())
49
+ card.appendChild(close)
50
+ }
51
+ }
52
+
53
+ function showHosting(code, link) {
54
+ card.replaceChildren()
55
+ card.append(
56
+ mk('h2', 'sp-lobby-title', 'Hosting'),
57
+ mk('p', 'sp-lobby-sub', 'Share this so others can join:'),
58
+ mk('div', 'sp-lobby-code', code)
59
+ )
60
+ const linkField = mk('input', 'sp-lobby-input sp-lobby-link')
61
+ linkField.type = 'text'; linkField.readOnly = true; linkField.value = link
62
+ card.appendChild(linkField)
63
+ const copyBtn = mk('button', 'sp-lobby-btn sp-lobby-btn-primary', 'Copy Join Link')
64
+ copyBtn.addEventListener('click', async () => {
65
+ try { await navigator.clipboard.writeText(link) } catch (_) { linkField.select(); document.execCommand && document.execCommand('copy') }
66
+ copyBtn.textContent = 'Copied'
67
+ setTimeout(() => { copyBtn.textContent = 'Copy Join Link' }, 1600)
68
+ })
69
+ card.appendChild(copyBtn)
70
+ card.appendChild(mk('p', 'sp-lobby-sub', 'Waiting for players...'))
71
+ }
72
+
73
+ function showError(msg) {
74
+ const err = card.querySelector('#sp-lobby-err')
75
+ if (err) err.textContent = msg
76
+ }
77
+
78
+ _idle()
79
+
80
+ return { node, showHosting, showError, dispose: () => node.remove() }
81
+ }
@@ -5,6 +5,8 @@
5
5
 
6
6
  export { renderLoadingScreen } from './loading-screen.js';
7
7
  export { renderGameHud } from './game-hud.js';
8
+ export { renderHostJoinLobby } from './host-join-lobby.js';
8
9
 
9
10
  export const themeUrl = new URL('./loading-screen.css', import.meta.url).href;
10
11
  export const gameHudCssUrl = new URL('./game-hud.css', import.meta.url).href;
12
+ export const lobbyCssUrl = new URL('./host-join-lobby.css', import.meta.url).href;