@floless/app 0.141.0 → 0.141.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.
@@ -0,0 +1,168 @@
1
+ /* ──────────────────────────────────────────────────────────────────────────
2
+ Account menu — the avatar at the far right of the header.
3
+
4
+ The same menu floless.io shows under its avatar: the signed-in name and email, then Profile and
5
+ Settings (opened on floless.io in a new browser tab, like the sign-in screen's "Manage
6
+ subscription" link), then Sign Out. Who is signed in comes from GET /api/license/me — display
7
+ only, and only while the licence is valid; when nobody is, the avatar stays hidden.
8
+
9
+ Sign Out asks the leave guard first (web/leave-guard.js), because reloading onto the sign-in
10
+ screen would lose unsaved work exactly like stopping the app would.
11
+ ────────────────────────────────────────────────────────────────────────── */
12
+ (function () {
13
+ 'use strict';
14
+
15
+ var $btn = document.getElementById('account-btn');
16
+ var $menu = document.getElementById('account-menu');
17
+ if (!$btn || !$menu) return;
18
+ var $initials = document.getElementById('account-initials');
19
+ var $name = document.getElementById('account-name');
20
+ var $email = document.getElementById('account-email');
21
+ var $profile = document.getElementById('account-profile');
22
+ var $settings = document.getElementById('account-settings');
23
+ var $signOut = document.getElementById('account-sign-out');
24
+
25
+ /** floless.io's getUserInitials: first + last initial of the full name, else the email's first letter. */
26
+ function initialsFor(fullName, email) {
27
+ var names = String(fullName || '').trim().split(/\s+/).filter(Boolean);
28
+ if (names.length >= 2) return (names[0][0] + names[names.length - 1][0]).toUpperCase();
29
+ if (names.length === 1) return names[0][0].toUpperCase();
30
+ var e = String(email || '').trim();
31
+ return e ? e[0].toUpperCase() : '?';
32
+ }
33
+
34
+ function showInitials() {
35
+ var img = $btn.querySelector('img');
36
+ if (img) img.remove();
37
+ $initials.hidden = false;
38
+ }
39
+
40
+ function render(me) {
41
+ if (!me || !me.signedIn) { $btn.hidden = true; close(false); return; }
42
+ var who = me.fullName || me.email || '';
43
+ $initials.textContent = initialsFor(me.fullName, me.email);
44
+ $name.textContent = me.fullName || '';
45
+ $name.hidden = !me.fullName;
46
+ $email.textContent = me.email || '';
47
+ $email.hidden = !me.email;
48
+ $email.dataset.tip = me.email || '';
49
+ $btn.setAttribute('aria-label', who ? 'Account menu — signed in as ' + who : 'Account menu');
50
+ $btn.dataset.tip = who ? 'Signed in as ' + who : 'Your account';
51
+ if (me.profileUrl) $profile.href = me.profileUrl;
52
+ if (me.settingsUrl) $settings.href = me.settingsUrl;
53
+ var old = $btn.querySelector('img');
54
+ if (old) old.remove();
55
+ $initials.hidden = false;
56
+ if (me.avatarUrl && /^https:\/\//.test(me.avatarUrl)) {
57
+ var img = document.createElement('img');
58
+ img.alt = '';
59
+ img.referrerPolicy = 'no-referrer';
60
+ img.decoding = 'async';
61
+ // Initials stay until the photo has actually loaded; a broken photo falls back to them.
62
+ img.addEventListener('load', function () { $initials.hidden = true; img.hidden = false; });
63
+ img.addEventListener('error', showInitials);
64
+ img.hidden = true;
65
+ img.src = me.avatarUrl;
66
+ $btn.appendChild(img);
67
+ }
68
+ $btn.hidden = false;
69
+ }
70
+
71
+ async function load() {
72
+ try {
73
+ var r = await fetch('/api/license/me', { cache: 'no-store' });
74
+ render(r.ok ? await r.json() : null);
75
+ } catch (_) { /* offline: keep whatever was shown; the next load tries again */ }
76
+ }
77
+
78
+ /* ── open / close / keyboard ───────────────────────────────────────────── */
79
+
80
+ function items() { return Array.from($menu.querySelectorAll('.menu-item')).filter(function (i) { return !i.hidden; }); }
81
+
82
+ function open() {
83
+ if (typeof window.toggleMenu === 'function') window.toggleMenu(false); // one menu at a time
84
+ $menu.classList.add('show');
85
+ $btn.classList.add('open');
86
+ $btn.setAttribute('aria-expanded', 'true');
87
+ }
88
+ function close(returnFocus) {
89
+ if (!$menu.classList.contains('show')) return;
90
+ $menu.classList.remove('show');
91
+ $btn.classList.remove('open');
92
+ $btn.setAttribute('aria-expanded', 'false');
93
+ if (returnFocus) $btn.focus();
94
+ }
95
+
96
+ $btn.addEventListener('click', function (e) {
97
+ e.stopPropagation();
98
+ if ($menu.classList.contains('show')) close(false); else open();
99
+ });
100
+ // Opening from the keyboard lands on the first item, as a menu button should.
101
+ $btn.addEventListener('keydown', function (e) {
102
+ if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {
103
+ e.preventDefault();
104
+ open();
105
+ var list = items();
106
+ if (list[0]) list[0].focus();
107
+ }
108
+ });
109
+ $menu.addEventListener('keydown', function (e) {
110
+ var list = items();
111
+ var at = list.indexOf(document.activeElement);
112
+ if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(true); }
113
+ else if (e.key === 'ArrowDown') { e.preventDefault(); (list[(at + 1) % list.length] || list[0]).focus(); }
114
+ else if (e.key === 'ArrowUp') { e.preventDefault(); (list[(at - 1 + list.length) % list.length] || list[list.length - 1]).focus(); }
115
+ else if (e.key === 'Home') { e.preventDefault(); list[0].focus(); }
116
+ else if (e.key === 'End') { e.preventDefault(); list[list.length - 1].focus(); }
117
+ else if (e.key === 'Tab') close(false);
118
+ });
119
+ // Esc closes it wherever focus is (a mouse-opened menu leaves focus on the avatar, not inside).
120
+ document.addEventListener('keydown', function (e) {
121
+ if (e.key !== 'Escape' || !$menu.classList.contains('show') || $menu.contains(document.activeElement)) return;
122
+ e.preventDefault();
123
+ e.stopPropagation();
124
+ close(true);
125
+ }, true);
126
+ document.addEventListener('click', function (e) {
127
+ if ($menu.classList.contains('show') && !$menu.contains(e.target) && e.target !== $btn && !$btn.contains(e.target)) close(false);
128
+ });
129
+ // The ≡ menu and this one never stand open together.
130
+ var $hamburger = document.getElementById('menu-btn');
131
+ if ($hamburger) $hamburger.addEventListener('click', function () { close(false); });
132
+
133
+ $profile.addEventListener('click', function () { close(false); });
134
+ $settings.addEventListener('click', function () { close(false); });
135
+
136
+ var signingOut = false;
137
+ $signOut.addEventListener('click', async function () {
138
+ close(false);
139
+ if (signingOut) return;
140
+ var guard = window.flolessLeaveGuard;
141
+ signingOut = true;
142
+ // The sign-out request runs INSIDE the question (commit), which stays open and busy until the
143
+ // server answers — nothing can be edited in between, and a refusal is explained right there.
144
+ var go = guard ? await guard.confirm({ action: 'signout', returnFocus: $btn, commit: requestLogout }) : (await requestLogout()).ok;
145
+ if (!go) { signingOut = false; return; }
146
+ location.reload(); // lands on the sign-in screen
147
+ });
148
+ async function requestLogout() {
149
+ try {
150
+ var r = await fetch('/api/license/logout', { method: 'POST' });
151
+ if (r.ok) return { ok: true };
152
+ } catch (_) { /* unreachable server: ask below, which fails the same way */ }
153
+ // A refused sign-out can still have signed you out (the server clears the session even when a
154
+ // later clean-up step fails), so ask who is signed in rather than claiming you still are.
155
+ var who = null;
156
+ try {
157
+ var me = await fetch('/api/license/me', { cache: 'no-store' });
158
+ if (me.ok) who = await me.json();
159
+ } catch (_) { /* could not tell — say so below */ }
160
+ if (who && who.signedIn === false) return { ok: true };
161
+ if (who && who.signedIn === true) return { ok: false }; // the dialog's own "you are still signed in"
162
+ // Neither answer arrived: do not claim either way.
163
+ return { ok: false, message: 'FloLess could not tell whether you were signed out. Reload this tab to check; if you are still signed in, try Sign Out again.' };
164
+ }
165
+
166
+ window.flolessAccountMenu = { load: load, initialsFor: initialsFor };
167
+ load();
168
+ })();
package/dist/web/app.css CHANGED
@@ -1827,24 +1827,31 @@
1827
1827
  #project-setup-folder-choose:focus-visible { border-color:var(--accent); outline:none;
1828
1828
  box-shadow:0 0 0 2px var(--accent-soft); }
1829
1829
  .project-setup-note { color:var(--text-dim); font-size:11px; line-height:1.45; }
1830
- .project-setup-standard-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
1831
- .project-setup-standard-options button { display:grid; gap:3px; min-width:0; padding:9px 10px;
1830
+ /* The AI Chat choice (#1605) is the same held one-of-two choice as the Standard, so it wears the
1831
+ same toggle; its sign-in line sits under the pair, as it does in the AI Chat empty state. */
1832
+ .project-setup-standard-options, .project-setup-provider-options, .project-setup-provider-accounts {
1833
+ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
1834
+ .project-setup-standard-options button, .project-setup-provider-options button { display:grid; gap:3px; min-width:0; padding:9px 10px;
1832
1835
  text-align:left; border:1px solid var(--border-strong); background:var(--surface-2); color:var(--text-muted); }
1833
- .project-setup-standard-options button:hover { color:var(--text); border-color:var(--accent-dim); }
1834
- .project-setup-standard-options button[aria-pressed="true"] { color:var(--text); border-color:var(--accent);
1835
- background:var(--accent-soft); box-shadow:inset 2px 0 0 var(--accent); }
1836
+ .project-setup-standard-options button:hover, .project-setup-provider-options button:not([aria-disabled="true"]):hover {
1837
+ color:var(--text); border-color:var(--accent-dim); }
1838
+ .project-setup-standard-options button[aria-pressed="true"], .project-setup-provider-options button[aria-pressed="true"] {
1839
+ color:var(--text); border-color:var(--accent); background:var(--accent-soft); box-shadow:inset 2px 0 0 var(--accent); }
1840
+ .project-setup-provider-options button { font-weight:650; }
1841
+ /* aria-disabled, not disabled: a provider that is not installed stays focusable so its data-tip
1842
+ can say why it cannot be chosen. */
1843
+ .project-setup-provider-options button[aria-disabled="true"] { cursor:default; opacity:.45; }
1844
+ .project-setup-provider-accounts { margin-top:-2px; color:var(--text-dim); font:9.5px/1.4 var(--mono); }
1845
+ .project-setup-provider-accounts > span { min-width:0; overflow-wrap:anywhere; }
1836
1846
  .project-setup-standard-options button > span:last-child { color:var(--text-dim); font-size:10px; }
1837
1847
  .project-setup-standard-label { font-weight:650; }
1838
1848
  .project-setup-storage-note { margin-top:14px; padding:10px 11px; border-left:2px solid var(--accent-dim);
1839
1849
  background:color-mix(in srgb, var(--accent) 5%, transparent); color:var(--text-muted);
1840
1850
  font-size:11px; line-height:1.5; }
1841
- .project-setup-chat-meta { margin:10px 0 -4px; color:var(--text-dim); font:10px/1.4 var(--mono);
1842
- text-align:right; }
1843
- .project-setup-chat-meta[hidden] { display:none; }
1844
1851
  .project-setup-error { margin-top:12px; padding:8px 10px; border:1px solid color-mix(in srgb, var(--err) 45%, var(--border));
1845
1852
  border-radius:5px; background:color-mix(in srgb, var(--err) 8%, transparent); color:var(--err);
1846
1853
  font-size:11px; line-height:1.45; }
1847
- .project-setup-error[hidden], .project-setup-standard[hidden] { display:none; }
1854
+ .project-setup-error[hidden], .project-setup-standard[hidden], .project-setup-provider[hidden] { display:none; }
1848
1855
  #project-setup-modal[aria-busy="true"] .project-setup-dialog { cursor:wait; }
1849
1856
  @media (max-width:560px) {
1850
1857
  .project-setup-standard-options { grid-template-columns:1fr; }
@@ -2369,6 +2376,10 @@
2369
2376
  scrollport there. */
2370
2377
  scroll-margin-block: 8px;
2371
2378
  }
2379
+ /* A row holds focus when the control that had it is gone after a repaint (#1594) or a Stop.
2380
+ The shared ring sits 2px OUTSIDE its element, where the list's scrollport clips it to one edge;
2381
+ inside the row it reads whole. */
2382
+ .req-item:focus-visible { outline-offset: -2px; }
2372
2383
  .req-info { flex: 1; min-width: 0; }
2373
2384
  .req-head { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
2374
2385
  .req-head code { font-family: var(--mono); color: var(--text-muted); }
@@ -2661,6 +2672,9 @@
2661
2672
  .req-run-output > summary::before { content: '▸ '; font-size: 9px; }
2662
2673
  .req-run-output[open] > summary::before { content: '▾ '; }
2663
2674
  .req-run-output > summary:hover { color: var(--text-muted); }
2675
+ /* The shared ring, as .req-technical's summary has it: without one Chrome draws its own white ring,
2676
+ and keyboard focus now stays on this summary while a running request repaints the list (#1594). */
2677
+ .req-run-output > summary:focus-visible { color: var(--text); outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
2664
2678
  .req-run-output pre {
2665
2679
  margin: 6px 0 0; padding: 7px 9px; max-height: 120px; overflow: auto;
2666
2680
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
@@ -2750,6 +2764,10 @@
2750
2764
  .int-rt-badge { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
2751
2765
  padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); }
2752
2766
  .int-rt.is-missing .int-rt-badge { color: var(--text-dim); }
2767
+ /* A setup that failed claims no readiness, so it may say so; every other state stays neutral. */
2768
+ .int-rt-badge.is-warn, .int-rt.is-missing .int-rt-badge.is-warn { color: var(--warn); }
2769
+ /* FloLess's own copy (#1622): a sentence, not a path — prose type that wraps instead of truncating. */
2770
+ .int-rt-copy { font-size: 10px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; overflow-wrap: anywhere; }
2753
2771
  .int-rt-side { display: flex; align-items: center; gap: 7px; }
2754
2772
  .int-folder { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
2755
2773
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
@@ -3364,6 +3382,75 @@
3364
3382
  background: var(--border);
3365
3383
  margin: 5px 4px;
3366
3384
  }
3385
+ /* "Stop FloLess" — the one ≡ row that ends something, so it reads as such at rest (--err is the
3386
+ palette's only red; no new colour). It always asks first, so this is a signal, not a trap. */
3387
+ .menu-item-danger, .menu-item-danger .menu-icon { color: var(--err); }
3388
+ .menu-item-danger:hover { background: color-mix(in srgb, var(--err) 10%, transparent); }
3389
+ /* Profile / Settings are links (they open floless.io), styled exactly as the button rows. */
3390
+ a.menu-item { text-decoration: none; }
3391
+ .menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
3392
+
3393
+ /* ── Account menu (web/account-menu.js) — floless.io's avatar dropdown, in this skin ── */
3394
+ /* The header is space-between with two children; the avatar makes three, so the controls take the
3395
+ free space themselves and the avatar sits at the far right, as on floless.io. */
3396
+ header > .controls { margin-left: auto; }
3397
+ .account-btn {
3398
+ flex-shrink: 0;
3399
+ width: 28px; height: 28px; margin-left: 14px; padding: 0;
3400
+ border-radius: 50%;
3401
+ border: 1px solid var(--border-strong);
3402
+ background: var(--accent-soft);
3403
+ color: var(--accent-bright);
3404
+ display: inline-flex; align-items: center; justify-content: center;
3405
+ overflow: hidden; cursor: pointer;
3406
+ font: 600 11px/1 var(--ui); letter-spacing: 0.02em;
3407
+ }
3408
+ .account-btn:hover, .account-btn.open { border-color: var(--accent-dim); }
3409
+ .account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
3410
+ .account-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
3411
+ .account-menu { left: auto; right: 12px; width: 224px; }
3412
+ .account-id { padding: 6px 9px 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
3413
+ .account-name { font: 500 13px/1.35 var(--ui); color: var(--text); overflow-wrap: anywhere; }
3414
+ .account-email { font: 400 11px/1.35 var(--ui); color: var(--text-muted);
3415
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
3416
+
3417
+ /* ── Leave guard (web/leave-guard.js) — the #confirm-modal look, plus the unsaved list ── */
3418
+ .modal.leave-guard { width: min(480px, calc(100vw - 32px)); }
3419
+ .leave-guard-unsaved {
3420
+ margin-top: 12px; max-height: 240px; overflow: auto; padding: 8px 12px;
3421
+ border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-2);
3422
+ scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
3423
+ }
3424
+ .leave-guard-unsaved::-webkit-scrollbar { width: 9px; height: 9px; }
3425
+ .leave-guard-unsaved::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
3426
+ .leave-guard-unsaved::-webkit-scrollbar-track { background: transparent; }
3427
+ .leave-guard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
3428
+ .leave-guard-list li { font: 12.5px/1.45 var(--ui); color: var(--text-muted); padding-left: 12px; position: relative; }
3429
+ .leave-guard-list li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 5px; height: 5px;
3430
+ border-radius: 50%; background: var(--warn); }
3431
+ .leave-guard-list li strong { color: var(--text); font-weight: 600; }
3432
+ .leave-guard-list li.lg-failed::before { background: var(--err); }
3433
+ .leave-guard-list .lg-why { display: block; color: var(--err); font-size: 12px; margin-top: 2px; }
3434
+ .leave-guard-note { margin: 10px 0 0; font: 12.5px/1.45 var(--ui); color: var(--text); }
3435
+ .leave-guard-running { margin: 12px 0 0; padding: 6px 10px; border-left: 2px solid var(--warn);
3436
+ background: color-mix(in srgb, var(--warn) 8%, transparent); font: 12.5px/1.45 var(--ui); color: var(--text); }
3437
+
3438
+ /* ── "FloLess has stopped" — the terminal screen after Stop FloLess (the sign-in gate's recipe) ── */
3439
+ #app-stopped { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
3440
+ background: var(--bg); color: var(--text); font-family: var(--ui); padding: 16px; }
3441
+ #app-stopped .as-card { max-width: 420px; text-align: center; padding: 40px 36px; border-radius: 14px;
3442
+ background: var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
3443
+ #app-stopped .as-card:focus { outline: none; }
3444
+ #app-stopped .as-mark { color: var(--text-dim); width: 54px; height: 51px; margin: 0 auto 18px; }
3445
+ #app-stopped .as-mark svg { width: 100%; height: 100%; display: block; }
3446
+ #app-stopped .as-mark .mark-node { fill: var(--surface); }
3447
+ #app-stopped h1 { font-size: 20px; margin: 0 0 8px; font-weight: 600; }
3448
+ #app-stopped p { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin: 0 0 22px; }
3449
+ #app-stopped .as-start { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent-bright);
3450
+ text-decoration: none; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: 8px; }
3451
+ #app-stopped .as-start:hover { border-color: var(--accent); }
3452
+ #app-stopped .as-start:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
3453
+ #app-stopped .as-status { min-height: 18px; margin: 14px 0 0; font-size: 12.5px; }
3367
3454
  /* Checkmarked menu items use the app's existing accent-active dialect
3368
3455
  (.code-wrap-btn.active, .tf-chip.active). The icon recolors to accent-bright and a trailing check
3369
3456
  confirms it — mirroring the trailing .menu-kbd slot the action items already reserve on the
package/dist/web/app.js CHANGED
@@ -1388,6 +1388,8 @@ function handleMenuAction(action) {
1388
1388
  case 'routines': openRoutines(); break;
1389
1389
  case 'report-issue': openReportIssue(); break;
1390
1390
  case 'fullscreen': toggleFullscreen(); break;
1391
+ // Asks first (unsaved work, a running workflow) — see web/leave-guard.js.
1392
+ case 'stop-app': if (window.flolessLeaveGuard) window.flolessLeaveGuard.stopApp(); break;
1391
1393
  }
1392
1394
  }
1393
1395