@parley-im/parley 0.2.1 → 0.2.2
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 +1 -1
- package/web/app.css +31 -8
- package/web/chat.html +13 -6
- package/web/chat.js +9 -2
- package/web/site.js +11 -0
package/package.json
CHANGED
package/web/app.css
CHANGED
|
@@ -109,13 +109,16 @@ button, input, textarea, select { font: inherit; color: inherit; }
|
|
|
109
109
|
.chip.low { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
|
|
110
110
|
.info-btn { width: 34px; height: 34px; margin-right: -6px; }
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
/* The menu: drops from the button at the top right, over the conversation. */
|
|
113
|
+
.sheet-back { position: absolute; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.12); }
|
|
113
114
|
.sheet {
|
|
114
|
-
position:
|
|
115
|
-
width: min(
|
|
115
|
+
position: absolute; z-index: 41; right: 8px; top: calc(54px + env(safe-area-inset-top));
|
|
116
|
+
width: min(380px, calc(100% - 16px)); max-height: calc(100% - 70px - env(safe-area-inset-top)); overflow-y: auto;
|
|
116
117
|
background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
|
|
118
|
+
transform-origin: top right; animation: drop 0.14s ease-out;
|
|
117
119
|
}
|
|
118
|
-
.sheet header { display: flex; align-items: center; justify-content: space-between; padding:
|
|
120
|
+
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 2px 16px; }
|
|
121
|
+
.sheet header .icon-btn { width: 34px; height: 34px; }
|
|
119
122
|
.sheet h2 { font-size: 16px; margin: 0; }
|
|
120
123
|
.sheet-body { padding: 4px 16px 16px; font-size: 14px; }
|
|
121
124
|
.sheet-body p { margin: 0 0 10px; color: var(--muted); }
|
|
@@ -125,9 +128,6 @@ button, input, textarea, select { font: inherit; color: inherit; }
|
|
|
125
128
|
.sheet-body .fine { font-size: 12px; color: var(--faint); }
|
|
126
129
|
.sheet-body details.how { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
|
|
127
130
|
.sheet-body details.how summary { cursor: pointer; color: var(--text); font-weight: 500; margin-bottom: 8px; }
|
|
128
|
-
@media (max-width: 560px) {
|
|
129
|
-
.sheet { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
|
|
130
|
-
}
|
|
131
131
|
|
|
132
132
|
.notice {
|
|
133
133
|
margin: 10px 16px 0; padding: 9px 12px; border-radius: 8px; font-size: 14px;
|
|
@@ -138,7 +138,7 @@ button, input, textarea, select { font: inherit; color: inherit; }
|
|
|
138
138
|
|
|
139
139
|
/* ---------- chat ---------- */
|
|
140
140
|
|
|
141
|
-
.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
|
|
141
|
+
.app { position: relative; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
|
|
142
142
|
/* The chat never scrolls the page itself, only its conversation. */
|
|
143
143
|
body:has(> .app) { overflow: hidden; overscroll-behavior: none; }
|
|
144
144
|
.layout { flex: 1; min-height: 0; display: flex; }
|
|
@@ -393,6 +393,29 @@ body.panel { overflow: auto; }
|
|
|
393
393
|
.site code { font-family: var(--mono); font-size: 0.88em; background: var(--subtle); border: 1px solid var(--line); padding: 0.05em 0.35em; border-radius: 5px; }
|
|
394
394
|
.site h3 { margin: 32px 0 8px; }
|
|
395
395
|
.stack { display: grid; gap: 10px; max-width: 360px; margin-top: 16px; }
|
|
396
|
+
/* Your account, top right of parley.im's pages. */
|
|
397
|
+
.account-menu { position: relative; }
|
|
398
|
+
.account-menu summary { list-style: none; display: flex; align-items: center; gap: 4px; padding: 3px 6px 3px 3px; border-radius: 99px; cursor: pointer; }
|
|
399
|
+
.account-menu summary::-webkit-details-marker { display: none; }
|
|
400
|
+
.account-menu summary:hover, .account-menu[open] summary { background: var(--subtle); }
|
|
401
|
+
.account-menu summary svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
402
|
+
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
|
|
403
|
+
.menu-panel {
|
|
404
|
+
position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; max-width: calc(100vw - 24px);
|
|
405
|
+
background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
|
|
406
|
+
animation: drop 0.14s ease-out;
|
|
407
|
+
}
|
|
408
|
+
.menu-panel a, .menu-panel button {
|
|
409
|
+
display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
|
|
410
|
+
background: none; color: var(--text); text-decoration: none; font-size: 14px; text-align: left; cursor: pointer;
|
|
411
|
+
}
|
|
412
|
+
.menu-panel a:hover, .menu-panel button:hover { background: var(--subtle); }
|
|
413
|
+
.menu-panel form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
|
|
414
|
+
.menu-who { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
|
|
415
|
+
.menu-who strong { font-size: 14px; }
|
|
416
|
+
.menu-who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
417
|
+
@keyframes drop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
|
|
418
|
+
|
|
396
419
|
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
|
|
397
420
|
.docs { padding-bottom: 40px; }
|
|
398
421
|
.docs h2 { font-size: 17px; letter-spacing: -0.01em; margin: 36px 0 10px; }
|
package/web/chat.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<span class="status" id="status" hidden><span class="dot" id="status-dot"></span><span id="status-text"></span></span>
|
|
25
25
|
<span class="chip" id="chip" hidden></span>
|
|
26
26
|
<button class="icon-btn info-btn" id="info-btn" type="button" title="This conversation" hidden>
|
|
27
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="
|
|
27
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16"/><path d="M4 12h16"/><path d="M4 17h16"/></svg>
|
|
28
28
|
<span class="sr">This conversation: details and actions</span>
|
|
29
29
|
</button>
|
|
30
30
|
</header>
|
|
@@ -66,12 +66,19 @@
|
|
|
66
66
|
</div>
|
|
67
67
|
<aside class="side" id="side" hidden></aside>
|
|
68
68
|
</div>
|
|
69
|
+
<!-- Inside the app, so it stays under the header when a phone's keyboard
|
|
70
|
+
moves things around. -->
|
|
71
|
+
<div class="sheet-back" id="sheet-back" hidden></div>
|
|
72
|
+
<section class="sheet" id="sheet" hidden aria-label="This conversation">
|
|
73
|
+
<header>
|
|
74
|
+
<h2>This conversation</h2>
|
|
75
|
+
<button class="icon-btn" id="sheet-close" type="button" title="Close">
|
|
76
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg><span class="sr">Close</span>
|
|
77
|
+
</button>
|
|
78
|
+
</header>
|
|
79
|
+
<div class="sheet-body" id="sheet-body"></div>
|
|
80
|
+
</section>
|
|
69
81
|
</div>
|
|
70
|
-
<div class="sheet-back" id="sheet-back" hidden></div>
|
|
71
|
-
<section class="sheet" id="sheet" hidden aria-label="This conversation">
|
|
72
|
-
<header><h2>This conversation</h2><button class="btn ghost" id="sheet-close" type="button">Done</button></header>
|
|
73
|
-
<div class="sheet-body" id="sheet-body"></div>
|
|
74
|
-
</section>
|
|
75
82
|
<div class="drop" id="drop" hidden><div>Drop screenshots to add them</div></div>
|
|
76
83
|
<script>window.PARLEY = {{CONFIG}};</script>
|
|
77
84
|
<script src="/static/markdown.js"></script>
|
package/web/chat.js
CHANGED
|
@@ -360,11 +360,18 @@
|
|
|
360
360
|
el("p", {}, `When the replies run out, the chat pauses until ${whom} adds more. Replies come from ${theirs} computer, so it needs to be on, and the link stops working for good once the chat ends.`),
|
|
361
361
|
),
|
|
362
362
|
);
|
|
363
|
+
// Just under the header, whatever its height on this screen.
|
|
364
|
+
const header = document.querySelector(".topbar").getBoundingClientRect();
|
|
365
|
+
els.sheet.style.top = `${header.bottom - els.app.getBoundingClientRect().top + 6}px`;
|
|
363
366
|
els.sheet.hidden = els.sheetBack.hidden = false;
|
|
367
|
+
els.infoBtn.setAttribute("aria-expanded", "true");
|
|
364
368
|
els.sheetClose.focus();
|
|
365
369
|
}
|
|
366
|
-
const closeSheet = () =>
|
|
367
|
-
|
|
370
|
+
const closeSheet = () => {
|
|
371
|
+
els.sheet.hidden = els.sheetBack.hidden = true;
|
|
372
|
+
els.infoBtn.setAttribute("aria-expanded", "false");
|
|
373
|
+
};
|
|
374
|
+
els.infoBtn.addEventListener("click", () => (els.sheet.hidden ? openSheet() : closeSheet()));
|
|
368
375
|
els.sheetClose.addEventListener("click", closeSheet);
|
|
369
376
|
els.sheetBack.addEventListener("click", closeSheet);
|
|
370
377
|
addEventListener("keydown", (e) => e.key === "Escape" && closeSheet());
|
package/web/site.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// parley.im's account menu closes when you click outside it or press Escape.
|
|
2
|
+
(() => {
|
|
3
|
+
const menu = document.querySelector(".account-menu");
|
|
4
|
+
if (!menu) return;
|
|
5
|
+
document.addEventListener("click", (e) => {
|
|
6
|
+
if (menu.open && !menu.contains(e.target)) menu.open = false;
|
|
7
|
+
});
|
|
8
|
+
document.addEventListener("keydown", (e) => {
|
|
9
|
+
if (e.key === "Escape") menu.open = false;
|
|
10
|
+
});
|
|
11
|
+
})();
|