synabun 2.2.0 → 2.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/CHANGELOG.md +45 -0
- package/README.md +1 -1
- package/hooks/claude-code/pre-websearch.mjs +4 -1
- package/hooks/claude-code/prompt-submit.mjs +7 -0
- package/lib/release-scan.mjs +23 -10
- package/lib/virustotal.mjs +143 -39
- package/mcp-server/dist/http.d.ts +19 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +55 -13
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +14 -9
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +118 -0
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-route-flow.js +339 -0
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +2 -2
- package/mcp-server/dist/services/desktop-client.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +66 -3
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +61 -4
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +112 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +555 -61
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/tools/bluesky.d.ts +20 -7
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
- package/mcp-server/dist/tools/bluesky.js +147 -45
- package/mcp-server/dist/tools/bluesky.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +11 -2
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +131 -18
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +4 -2
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +58 -12
- package/mcp-server/src/index.ts +15 -9
- package/mcp-server/src/services/browser-route-flow.ts +402 -0
- package/mcp-server/src/services/desktop-client.ts +2 -2
- package/mcp-server/src/services/identity.ts +80 -4
- package/mcp-server/src/services/neural-interface.ts +572 -70
- package/mcp-server/src/tools/bluesky.ts +164 -51
- package/mcp-server/src/tools/browser-advanced.ts +121 -17
- package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
- package/mcp-server/src/tools/morelogin.ts +4 -2
- package/mcp-server/src/tools/youtube/helpers.ts +2 -2
- package/neural-interface/i18n/en.json +27 -0
- package/neural-interface/i18n/pt-BR.json +27 -0
- package/neural-interface/lib/assistant-api.js +64 -23
- package/neural-interface/lib/assistant-brains/codex.js +6 -1
- package/neural-interface/lib/assistant-catalog.js +20 -2
- package/neural-interface/lib/assistant-dispatch.js +31 -2
- package/neural-interface/lib/assistant-persona.js +1 -0
- package/neural-interface/lib/assistant-runtime.js +15 -1
- package/neural-interface/lib/assistant-tools.js +10 -1
- package/neural-interface/lib/browser-automation-routes.js +84 -0
- package/neural-interface/lib/browser-execution.js +16 -3
- package/neural-interface/lib/browser-owner.js +48 -0
- package/neural-interface/lib/browser-session-close.js +84 -0
- package/neural-interface/lib/browser-start-handoff.js +202 -0
- package/neural-interface/lib/browser-tool-policy.js +21 -4
- package/neural-interface/lib/browser-wedge-retire.js +64 -0
- package/neural-interface/lib/claude-agent-bridge.js +36 -1
- package/neural-interface/lib/claude-background-hold.js +239 -0
- package/neural-interface/lib/exec-loop-command.js +8 -0
- package/neural-interface/lib/http-guards.js +11 -6
- package/neural-interface/lib/loop-logger.js +6 -1
- package/neural-interface/lib/mcp-external-servers.js +64 -13
- package/neural-interface/lib/native-loop-providers.js +122 -10
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/opencode-native-boundary.js +155 -21
- package/neural-interface/lib/owner-authority.js +113 -37
- package/neural-interface/lib/page-session.js +81 -23
- package/neural-interface/lib/peer-identity.js +311 -47
- package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
- package/neural-interface/lib/pty-host/core.js +36 -0
- package/neural-interface/lib/pty-host/protocol.js +2 -0
- package/neural-interface/lib/skills/api-v2.js +13 -2
- package/neural-interface/lib/skills/creation-api.js +3 -1
- package/neural-interface/lib/skills/evals-api.js +5 -1
- package/neural-interface/lib/social-write-pacing.js +151 -0
- package/neural-interface/lib/terminal-token-redaction.js +293 -0
- package/neural-interface/lib/terminal-tokens.js +359 -0
- package/neural-interface/lib/worker-mcp-channel.js +45 -10
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/shared/agy/agy-render.js +41 -1
- package/neural-interface/public/shared/agy/agy-styles.js +5 -0
- package/neural-interface/public/shared/api.js +1 -0
- package/neural-interface/public/shared/assistant/asst-api.js +14 -2
- package/neural-interface/public/shared/assistant/asst-computer.js +73 -4
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +3 -1
- package/neural-interface/public/shared/assistant/asst-motion-gate.js +80 -0
- package/neural-interface/public/shared/assistant/asst-panel.js +8 -4
- package/neural-interface/public/shared/assistant/asst-render.js +72 -11
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +55 -23
- package/neural-interface/public/shared/assistant/asst-scenes.js +225 -79
- package/neural-interface/public/shared/assistant/asst-sidepanel-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-style-cache.js +44 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +26 -5
- package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
- package/neural-interface/public/shared/cp/cp-agents.js +8 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +18 -2
- package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
- package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
- package/neural-interface/public/shared/judgments-log-origins.js +29 -0
- package/neural-interface/public/shared/loading-teardown.js +34 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +6 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +5 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +16 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +6 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +88 -72
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
- package/neural-interface/public/shared/owner-access.js +134 -0
- package/neural-interface/public/shared/owner-authority-view.js +92 -0
- package/neural-interface/public/shared/page-session.js +143 -14
- package/neural-interface/public/shared/poll-backoff.js +59 -0
- package/neural-interface/public/shared/settings/settings-data.js +6 -1
- package/neural-interface/public/shared/settings/settings-kit.js +11 -3
- package/neural-interface/public/shared/settings/settings-shell.js +7 -0
- package/neural-interface/public/shared/shown-children.js +72 -0
- package/neural-interface/public/shared/static-bg-state.js +22 -0
- package/neural-interface/public/shared/storage-retry.js +47 -0
- package/neural-interface/public/shared/storage.js +25 -4
- package/neural-interface/public/shared/styles.css +109 -8
- package/neural-interface/public/shared/synabun-mascot.js +27 -8
- package/neural-interface/public/shared/synabun-ticker.js +147 -12
- package/neural-interface/public/shared/synabun-tools.js +173 -0
- package/neural-interface/public/shared/tool-heartbeat.js +43 -0
- package/neural-interface/public/shared/tool-list-picker.js +3 -1
- package/neural-interface/public/shared/tool-list-view.js +23 -4
- package/neural-interface/public/shared/ui-automation-studio.js +8 -1
- package/neural-interface/public/shared/ui-claude-panel.js +238 -90
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-loading.js +5 -4
- package/neural-interface/public/shared/ui-navbar.js +6 -0
- package/neural-interface/public/shared/ui-owner-access.js +191 -0
- package/neural-interface/public/shared/ui-owner-authority.js +162 -0
- package/neural-interface/public/shared/ui-sessions.js +45 -16
- package/neural-interface/public/shared/ui-settings.js +86 -15
- package/neural-interface/public/shared/ui-terminal.js +15 -7
- package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
- package/neural-interface/public/shared/ui-update.js +3 -0
- package/neural-interface/public/shared/ui-whiteboard.js +4 -0
- package/neural-interface/public/shared/window-keys.js +38 -0
- package/neural-interface/server.js +1240 -238
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hostedSidepanelId, sidepanelHost } from './ui-sidepanel-runtime.js';
|
|
2
|
+
import { createRetryState } from './storage-retry.js';
|
|
2
3
|
// ═══════════════════════════════════════════
|
|
3
4
|
// STORAGE — Server-synced persistent state
|
|
4
5
|
// ═══════════════════════════════════════════
|
|
@@ -19,6 +20,8 @@ let _dirty = {};
|
|
|
19
20
|
let _flushTimer = null;
|
|
20
21
|
let _hydrated = false;
|
|
21
22
|
const DEBOUNCE_MS = 500;
|
|
23
|
+
// A refused flush is tried again with backoff (storage-retry.js); a 401 / 403 waits for a write or a reconnect.
|
|
24
|
+
const _retry = createRetryState();
|
|
22
25
|
// Keys that migrated to the per-entry blob store (see blob-store.js and the
|
|
23
26
|
// server's FAT_KEY_ROUTES). Excluded from hydration so they can never re-enter
|
|
24
27
|
// the whole-map PATCH cycle.
|
|
@@ -129,10 +132,20 @@ export const storage = (hostedSidepanelId && sidepanelHost()?.storageFor(hostedS
|
|
|
129
132
|
|
|
130
133
|
// ── Debounced flush to server ────────────────────────
|
|
131
134
|
|
|
132
|
-
|
|
135
|
+
/** `fromWrite`: a new write or a reconnect, which lifts a 401 / 403 block (the backoff still applies). */
|
|
136
|
+
function _scheduleDebouncedFlush(fromWrite = true) {
|
|
133
137
|
if (SHOWCASE_MODE) { _dirty = {}; return; }
|
|
138
|
+
const owed = fromWrite ? _retry.poke() : _retry.wait();
|
|
139
|
+
if (!Number.isFinite(owed)) return; // blocked: values stay in _dirty until something changes
|
|
134
140
|
if (_flushTimer) clearTimeout(_flushTimer);
|
|
135
|
-
_flushTimer = setTimeout(_flushToServer, DEBOUNCE_MS);
|
|
141
|
+
_flushTimer = setTimeout(_flushToServer, Math.max(DEBOUNCE_MS, owed));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!SHOWCASE_MODE) {
|
|
145
|
+
const _reconnected = () => { if (Object.keys(_dirty).length) _scheduleDebouncedFlush(true); };
|
|
146
|
+
window.addEventListener('online', _reconnected);
|
|
147
|
+
window.addEventListener('focus', _reconnected);
|
|
148
|
+
window.addEventListener('synabun:auth-changed', _reconnected);
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
async function _flushToServer() {
|
|
@@ -150,20 +163,28 @@ async function _flushToServer() {
|
|
|
150
163
|
_dirty = {};
|
|
151
164
|
_flushTimer = null;
|
|
152
165
|
if (Object.keys(payload).length === 0) return;
|
|
166
|
+
let status = null;
|
|
153
167
|
try {
|
|
154
168
|
const res = await fetch('/api/ui-state', {
|
|
155
169
|
method: 'PATCH',
|
|
156
170
|
headers: { 'Content-Type': 'application/json' },
|
|
157
171
|
body: JSON.stringify(payload),
|
|
158
172
|
});
|
|
173
|
+
status = res.status;
|
|
159
174
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
175
|
+
_retry.ok();
|
|
160
176
|
} catch (err) {
|
|
161
|
-
console.warn('[storage] Flush failed:', err.message, '— will retry');
|
|
162
177
|
// Re-queue failed keys (don't overwrite newer dirty values)
|
|
163
178
|
for (const [k, v] of Object.entries(payload)) {
|
|
164
179
|
if (!(k in _dirty)) _dirty[k] = v;
|
|
165
180
|
}
|
|
166
|
-
|
|
181
|
+
const { blocked, delay } = _retry.fail(status);
|
|
182
|
+
if (blocked) {
|
|
183
|
+
if (_retry.attempt === 1 || _retry.attempt % 20 === 0) console.warn('[storage] Flush refused:', err.message, '— kept; will try again on the next change or reconnect');
|
|
184
|
+
} else {
|
|
185
|
+
if (_retry.attempt <= 3 || _retry.attempt % 20 === 0) console.warn('[storage] Flush failed:', err.message, `— will retry in ${Math.round(delay / 1000)} s`);
|
|
186
|
+
_scheduleDebouncedFlush(false);
|
|
187
|
+
}
|
|
167
188
|
}
|
|
168
189
|
}
|
|
169
190
|
|
|
@@ -6358,7 +6358,7 @@
|
|
|
6358
6358
|
transition: background 0.2s, border-color 0.2s;
|
|
6359
6359
|
}
|
|
6360
6360
|
#toolbar-show-btn[hidden],
|
|
6361
|
-
|
|
6361
|
+
:root:not(.static-bg-visible) #toolbar-show-btn,
|
|
6362
6362
|
body.fe-editor-open #toolbar-show-btn {
|
|
6363
6363
|
display: none;
|
|
6364
6364
|
}
|
|
@@ -6411,7 +6411,10 @@
|
|
|
6411
6411
|
--topright-row: calc(298px + var(--topright-buttons));
|
|
6412
6412
|
--topright-compact: clamp(0, tan(atan2(calc(var(--topright-row) + 45px - var(--topright-band)), 0.01px)), 1);
|
|
6413
6413
|
}
|
|
6414
|
-
|
|
6414
|
+
/* No update button in the row. The state is a class on <html> (ui-update.js applyTopRightButton), not
|
|
6415
|
+
`:root:has(#topright-update-btn[style*="none"])`: a `[style]` test anchored on the root made every inline style
|
|
6416
|
+
change anywhere re-style the whole page (tests/css-has-performance.test.mjs). */
|
|
6417
|
+
:root:not(.topright-update-shown) {
|
|
6415
6418
|
--topright-row: calc(266px + var(--topright-buttons));
|
|
6416
6419
|
}
|
|
6417
6420
|
@container style(--topright-compact: 1) {
|
|
@@ -6431,7 +6434,8 @@
|
|
|
6431
6434
|
:root {
|
|
6432
6435
|
--topright-tray-inset: 0px;
|
|
6433
6436
|
}
|
|
6434
|
-
:
|
|
6437
|
+
/* Focus Mode's board is showing: html.static-bg-visible, set with #static-bg.visible (static-bg-state.js). */
|
|
6438
|
+
:root.static-bg-visible {
|
|
6435
6439
|
--topright-tray-inset: 50px;
|
|
6436
6440
|
}
|
|
6437
6441
|
#topright-controls > #term-minimized-tray {
|
|
@@ -6628,7 +6632,7 @@
|
|
|
6628
6632
|
box-shadow: 0 0 0 2px rgba(18, 18, 22, 0.9);
|
|
6629
6633
|
pointer-events: none;
|
|
6630
6634
|
}
|
|
6631
|
-
#topright-controls.tools-hidden
|
|
6635
|
+
:root.topright-update-shown #topright-controls.tools-hidden .topright-tools-dot {
|
|
6632
6636
|
display: block;
|
|
6633
6637
|
}
|
|
6634
6638
|
|
|
@@ -13830,6 +13834,8 @@
|
|
|
13830
13834
|
.settings-panel .settings-nav-item[data-status="disconnected"]::after { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5); }
|
|
13831
13835
|
.settings-panel .settings-nav-item.active[data-status="connected"]::after { background: #fff; }
|
|
13832
13836
|
.settings-panel .settings-nav-item.active[data-status="disconnected"]::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85); }
|
|
13837
|
+
/* No owner access (ui-owner-access.js): the inline alert's warning tint, a ring like "Off" so it is not a state */
|
|
13838
|
+
.settings-panel .settings-nav-item[data-status="refused"]::after { background: transparent; box-shadow: inset 0 0 0 1.5px #ffb74d; }
|
|
13833
13839
|
|
|
13834
13840
|
.stg-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
13835
13841
|
.stg-main > .settings-content { flex: 1; min-height: 0; padding: 22px 24px 28px; }
|
|
@@ -13993,7 +13999,9 @@
|
|
|
13993
13999
|
display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center;
|
|
13994
14000
|
}
|
|
13995
14001
|
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > label { grid-column: 1; margin: 0; }
|
|
13996
|
-
|
|
14002
|
+
/* The control itself, named: a subject that matches nearly every element (`> :not(label):not(.stg-help)`) behind a
|
|
14003
|
+
:has() made each whole-page re-style cost tens of ms (tests/css-has-performance.test.mjs). */
|
|
14004
|
+
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle) { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
|
|
13997
14005
|
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > .stg-help { grid-column: 1; grid-row: 2; }
|
|
13998
14006
|
.settings-panel .stg-toggle-field {
|
|
13999
14007
|
display: flex; align-items: center; gap: 16px;
|
|
@@ -15112,7 +15120,7 @@
|
|
|
15112
15120
|
.settings-panel .stg-card-body > :is(.stg-help, .settings-hint, .cc-hint, .setup-hint, p):first-child { margin-top: 10px !important; }
|
|
15113
15121
|
/* a closed row-card keeps no trace of its body (no stray hairline or gap under the row) */
|
|
15114
15122
|
.settings-panel .stg-card-body .stg-card[data-collapsible].collapsed > .stg-card-body,
|
|
15115
|
-
.settings-panel .stg-card-body .stg-card[data-collapsible] > .stg-card-body
|
|
15123
|
+
.settings-panel .stg-card-body .stg-card[data-collapsible] > .stg-card-body[data-empty] { margin-top: 0; border-top: 0; }
|
|
15116
15124
|
|
|
15117
15125
|
/* ── Chevrons and disclosure triangles: 10px, quiet ── */
|
|
15118
15126
|
.settings-panel :is(.cc-section-chevron, .cc-panel-chevron, .stg-model-expand-icon) { width: 10px !important; height: 10px !important; stroke: rgba(255,255,255,0.45) !important; }
|
|
@@ -16744,7 +16752,9 @@
|
|
|
16744
16752
|
border: 1px solid var(--fe-menu-border);
|
|
16745
16753
|
border-radius: var(--r-card);
|
|
16746
16754
|
box-shadow: var(--fe-menu-shadow);
|
|
16747
|
-
|
|
16755
|
+
/* Same tier as .fe-ctx-flyout: a float anchored to the panel, appended to body to escape it, must still
|
|
16756
|
+
outrank what is drawn beside it (#topright-controls at 400) and above it (a floating terminal at 10000). */
|
|
16757
|
+
z-index: 100010;
|
|
16748
16758
|
padding: 10px;
|
|
16749
16759
|
opacity: 0;
|
|
16750
16760
|
transform: translateX(-8px) scale(0.96);
|
|
@@ -18574,6 +18584,11 @@
|
|
|
18574
18584
|
opacity: 0;
|
|
18575
18585
|
pointer-events: none;
|
|
18576
18586
|
}
|
|
18587
|
+
/* Faded out: nothing inside keeps animating (loading-teardown.js adds `gone` once the fade ends). */
|
|
18588
|
+
#loading-overlay.hidden #loading-text,
|
|
18589
|
+
#loading-overlay.hidden #loading-mascot,
|
|
18590
|
+
#loading-overlay.hidden #loading-mascot * { animation: none !important; }
|
|
18591
|
+
#loading-overlay.gone { display: none !important; }
|
|
18577
18592
|
|
|
18578
18593
|
.loading-logo {
|
|
18579
18594
|
height: 28px;
|
|
@@ -29085,8 +29100,94 @@
|
|
|
29085
29100
|
outline: 2px solid var(--stg-focus, #93c5fd);
|
|
29086
29101
|
outline-offset: 2px;
|
|
29087
29102
|
}
|
|
29088
|
-
|
|
29103
|
+
/* Another update toast on the page (both are children of <body>): its sibling, before or after it. Not
|
|
29104
|
+
`body:has(…)`, which re-checks the whole page on every change (tests/css-has-performance.test.mjs). */
|
|
29105
|
+
.update-check-toast:not(.crash-notice) ~ .crash-notice,
|
|
29106
|
+
.crash-notice:has(~ .update-check-toast:not(.crash-notice)) { bottom: auto; top: 64px; }
|
|
29089
29107
|
@media (prefers-reduced-motion: reduce) { .crash-notice { transition: none; } }
|
|
29108
|
+
/* The banner of a degraded owner authority (ui-owner-authority.js): the update toast's glass and type (DESIGN.md
|
|
29109
|
+
`toast`), at the top centre of the page so it never meets the bottom-right toasts, which replace each other (it is
|
|
29110
|
+
not an .update-check-toast for that reason), non-modal (nothing behind it is blocked), with the warning tint of the
|
|
29111
|
+
inline alert (DESIGN.md `alert`: rgba(255,183,77,.22) border, #ffb74d). */
|
|
29112
|
+
.owner-authority-notice {
|
|
29113
|
+
position: fixed;
|
|
29114
|
+
top: 64px;
|
|
29115
|
+
left: 0;
|
|
29116
|
+
right: 0;
|
|
29117
|
+
margin-inline: auto;
|
|
29118
|
+
z-index: 300050;
|
|
29119
|
+
display: flex;
|
|
29120
|
+
gap: 12px;
|
|
29121
|
+
align-items: flex-start;
|
|
29122
|
+
width: max-content;
|
|
29123
|
+
min-width: 240px;
|
|
29124
|
+
max-width: min(520px, calc(100vw - 40px));
|
|
29125
|
+
padding: 12px 14px;
|
|
29126
|
+
border-radius: 14px;
|
|
29127
|
+
background: rgba(20, 20, 24, 0.85);
|
|
29128
|
+
backdrop-filter: blur(20px) saturate(160%);
|
|
29129
|
+
-webkit-backdrop-filter: blur(20px) saturate(160%);
|
|
29130
|
+
border: 1px solid rgba(255, 183, 77, 0.22);
|
|
29131
|
+
color: var(--t-text);
|
|
29132
|
+
font-size: 12px;
|
|
29133
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
29134
|
+
opacity: 0;
|
|
29135
|
+
transform: translateY(-8px);
|
|
29136
|
+
transition: opacity 0.25s ease, transform 0.25s ease;
|
|
29137
|
+
pointer-events: auto;
|
|
29138
|
+
}
|
|
29139
|
+
.owner-authority-notice.show { opacity: 1; transform: translateY(0); }
|
|
29140
|
+
.owner-authority-icon {
|
|
29141
|
+
width: 24px; height: 24px;
|
|
29142
|
+
border-radius: 50%;
|
|
29143
|
+
display: flex; align-items: center; justify-content: center;
|
|
29144
|
+
font-weight: 700; font-size: 14px;
|
|
29145
|
+
flex-shrink: 0;
|
|
29146
|
+
background: rgba(255, 183, 77, 0.18);
|
|
29147
|
+
color: #ffb74d;
|
|
29148
|
+
}
|
|
29149
|
+
.owner-authority-body { flex: 1; min-width: 0; }
|
|
29150
|
+
.owner-authority-title { font-weight: 600; margin-bottom: 4px; }
|
|
29151
|
+
.owner-authority-sub { color: var(--t-muted); overflow-wrap: anywhere; margin-top: 2px; }
|
|
29152
|
+
.owner-authority-reason { font-family: var(--ff-mono, ui-monospace, Menlo, monospace); font-size: 11px; }
|
|
29153
|
+
.owner-authority-hint { color: var(--t-muted); opacity: 0.7; margin-top: 6px; font-size: 11px; overflow-wrap: anywhere; }
|
|
29154
|
+
.owner-authority-notice .action-btn:focus-visible {
|
|
29155
|
+
outline: 2px solid var(--stg-focus, #93c5fd);
|
|
29156
|
+
outline-offset: 2px;
|
|
29157
|
+
}
|
|
29158
|
+
@media (prefers-reduced-motion: reduce) { .owner-authority-notice { transition: none; } }
|
|
29159
|
+
/* The banner of a page without the owner's access (ui-owner-access.js): the same banner, below the one above when
|
|
29160
|
+
both show. A panel whose data was refused shows the "No access" block (the inline alert's warning tint, DESIGN.md
|
|
29161
|
+
`alert`; the card radius and the md spacing) in place of an empty list or default values. */
|
|
29162
|
+
.owner-authority-notice ~ .owner-access-notice { top: 168px; }
|
|
29163
|
+
.owner-no-access {
|
|
29164
|
+
display: flex;
|
|
29165
|
+
gap: 12px;
|
|
29166
|
+
align-items: flex-start;
|
|
29167
|
+
margin: 0 0 12px;
|
|
29168
|
+
padding: 12px 14px;
|
|
29169
|
+
border-radius: 9px;
|
|
29170
|
+
border: 1px solid rgba(255, 183, 77, 0.22);
|
|
29171
|
+
background: rgba(255, 183, 77, 0.06);
|
|
29172
|
+
color: var(--t-text);
|
|
29173
|
+
font-size: 12px;
|
|
29174
|
+
line-height: 1.45;
|
|
29175
|
+
text-align: left;
|
|
29176
|
+
}
|
|
29177
|
+
.owner-no-access--compact { margin: 12px; }
|
|
29178
|
+
.owner-no-access-icon {
|
|
29179
|
+
width: 20px; height: 20px;
|
|
29180
|
+
border-radius: 50%;
|
|
29181
|
+
display: flex; align-items: center; justify-content: center;
|
|
29182
|
+
font-weight: 700; font-size: 12px;
|
|
29183
|
+
flex-shrink: 0;
|
|
29184
|
+
background: rgba(255, 183, 77, 0.18);
|
|
29185
|
+
color: #ffb74d;
|
|
29186
|
+
}
|
|
29187
|
+
.owner-no-access-body { flex: 1; min-width: 0; }
|
|
29188
|
+
.owner-no-access-title { font-weight: 600; margin-bottom: 2px; }
|
|
29189
|
+
.owner-no-access-desc { color: var(--t-muted); overflow-wrap: anywhere; }
|
|
29190
|
+
.owner-access-disabled { cursor: not-allowed; opacity: 0.5; }
|
|
29090
29191
|
|
|
29091
29192
|
.update-channel-pill {
|
|
29092
29193
|
display: inline-block;
|
|
@@ -90,9 +90,10 @@
|
|
|
90
90
|
* - `paintMascot(svg, frame)` — draw a frame on any `mascotSvg()`. A still
|
|
91
91
|
* frame (`stillFrame`, or a rig that is not looping) draws its prop at
|
|
92
92
|
* ≥ .7 opacity with strokes of ≥ 1.5 CSS px, so it reads at 28×14.
|
|
93
|
-
* - `mascotCameoSvg()` — two 3×7 px pill eyes (`syna-cameo`
|
|
94
|
-
* `syna-cameo-eye`) for running pills,
|
|
95
|
-
* (never a pause glyph); the host's CSS
|
|
93
|
+
* - `mascotCameoSvg()` — two 3×7 px pill eyes (`syna-cameo` >
|
|
94
|
+
* `syna-cameo-eyes` > svg > `syna-cameo-eye` ×2) for running pills,
|
|
95
|
+
* leaning −12° like the two-pill mark (never a pause glyph); the host's CSS
|
|
96
|
+
* moves the `syna-cameo-eyes` box (an HTML element, so the compositor runs it).
|
|
96
97
|
* - `mascotPropSvg(kind, { width, height })` + `paintMascotProp(svg, kind)`
|
|
97
98
|
* — a kind's prop alone, framed to its own box: the ledger's row glyphs.
|
|
98
99
|
* - `mascotBounds(pose)` — the face-unit box a pose can draw in (the eyes over
|
|
@@ -167,14 +168,18 @@ export function blinkAmount(elapsed) {
|
|
|
167
168
|
/**
|
|
168
169
|
* Two 3×7 px pill eyes for a running pill; the host's CSS moves them. The
|
|
169
170
|
* pair leans −12° like the two-pill mark (the right eye sits higher), so it
|
|
170
|
-
* never reads as a pause glyph.
|
|
171
|
+
* never reads as a pause glyph. What moves is the HTML box around the eyes
|
|
172
|
+
* (`syna-cameo-eyes`), never a part of the SVG: a box's transform runs on
|
|
173
|
+
* the compositor and, when the page draws a frame anyway, restyles one
|
|
174
|
+
* element without laying the SVG out again.
|
|
171
175
|
*/
|
|
172
176
|
export function mascotCameoSvg({ className = '' } = {}) {
|
|
173
|
-
return `<
|
|
177
|
+
return `<span class="syna-cameo${className ? ` ${className}` : ''}" aria-hidden="true"><span class="syna-cameo-eyes">`
|
|
178
|
+
+ '<svg viewBox="0 0 10 7" width="10" height="7" style="display:block;overflow:visible" focusable="false">'
|
|
174
179
|
+ '<g class="syna-cameo-pair" transform="rotate(-12 5 3.5)">'
|
|
175
180
|
+ '<rect class="syna-cameo-eye" x="0" y="0" width="3" height="7" rx="1.5" fill="currentColor"/>'
|
|
176
181
|
+ '<rect class="syna-cameo-eye" x="7" y="0" width="3" height="7" rx="1.5" fill="currentColor"/>'
|
|
177
|
-
+ '</g></svg>';
|
|
182
|
+
+ '</g></svg></span></span>';
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
/** Each prop's own box in face units, to draw it alone (a ledger row's glyph, a suggestion's). */
|
|
@@ -1842,6 +1847,14 @@ function createPainter(svg, uid) {
|
|
|
1842
1847
|
if (value == null) el.removeAttribute(attr);
|
|
1843
1848
|
else el.setAttribute(attr, value);
|
|
1844
1849
|
};
|
|
1850
|
+
/** A prop's writes for this frame: the last value per attribute wins, put() writes it once (paint). */
|
|
1851
|
+
const staged = new Map();
|
|
1852
|
+
const stage = (el, attr, value) => {
|
|
1853
|
+
if (!el) return;
|
|
1854
|
+
let attrs = staged.get(el);
|
|
1855
|
+
if (!attrs) { attrs = new Map(); staged.set(el, attrs); }
|
|
1856
|
+
attrs.set(attr, value);
|
|
1857
|
+
};
|
|
1845
1858
|
/** CSS px per face unit: the SVG's box over its viewBox (xMidYMid meet: the tighter axis). */
|
|
1846
1859
|
const unitPx = () => {
|
|
1847
1860
|
const w = Number(svg.getAttribute?.('width'));
|
|
@@ -1898,8 +1911,14 @@ function createPainter(svg, uid) {
|
|
|
1898
1911
|
put(entry.g, 'display', null);
|
|
1899
1912
|
put(entry.g, 'opacity', op < 0.999 ? n(op) : null);
|
|
1900
1913
|
put(entry.g, 'transform', p.dx || p.dy ? `translate(${n(p.dx || 0)},${n(p.dy || 0)})` : null);
|
|
1901
|
-
|
|
1902
|
-
|
|
1914
|
+
// Live: the drawn values, then the frame's own over them. Both are staged and each attribute is
|
|
1915
|
+
// written once with its final value, so a frame that changes nothing writes nothing (an attribute
|
|
1916
|
+
// written twice a frame, back to its base and on again, restyles and re-lays the SVG out every frame).
|
|
1917
|
+
staged.clear();
|
|
1918
|
+
if (!f.still) for (const b of entry.base) stage(b.el, b.attr, b.value);
|
|
1919
|
+
PROPS[name].update(entry.r, p, stage);
|
|
1920
|
+
for (const [el, attrs] of staged) for (const [attr, value] of attrs) put(el, attr, value);
|
|
1921
|
+
staged.clear();
|
|
1903
1922
|
if (f.still) legible(entry);
|
|
1904
1923
|
}
|
|
1905
1924
|
}
|
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
// requestFrames(ms) lifts the animation subscribers (≥ 24 fps) to 60 fps for a
|
|
10
10
|
// moment: a pose blend, a hop.
|
|
11
11
|
//
|
|
12
|
+
// A frame is only requested for the vsync a subscriber is due on: a 30 fps
|
|
13
|
+
// rig costs 30 frames a second, not one per vsync. Every frame the page draws
|
|
14
|
+
// makes the browser restyle each running CSS animation on the main thread
|
|
15
|
+
// (composited or not), so a frame nobody needs is never free. Between due
|
|
16
|
+
// frames the loop sleeps on a timer that wakes half a frame before the vsync
|
|
17
|
+
// it wants; the frame interval is learnt from back-to-back frames (60 Hz,
|
|
18
|
+
// 120 Hz displays).
|
|
19
|
+
//
|
|
20
|
+
// A subscriber may name a `target` element: it runs only while that element
|
|
21
|
+
// is on screen (one shared IntersectionObserver), and a loop whose every
|
|
22
|
+
// subscriber is off screen requests nothing at all until one comes back.
|
|
23
|
+
//
|
|
12
24
|
// The loop stops while the tab is hidden (document.hidden, body.app-hidden)
|
|
13
25
|
// and freezes while the UI is dragged (body.ui-interacting): subscribers are
|
|
14
26
|
// skipped, and the first frame after either hands each one a dt of at most
|
|
@@ -20,7 +32,7 @@
|
|
|
20
32
|
// pointermove listener and one keydown listener (both capture phase, so a
|
|
21
33
|
// handler that stops propagation cannot hide input from them).
|
|
22
34
|
//
|
|
23
|
-
// subscribe(fn(now, dt), { fps }) → unsubscribe() (unsubscribe.setFps(n) re-caps)
|
|
35
|
+
// subscribe(fn(now, dt), { fps, target }) → unsubscribe() (unsubscribe.setFps(n) re-caps)
|
|
24
36
|
// requestFrames(ms) 60 fps for the next ms
|
|
25
37
|
// isReducedMotion() live prefers-reduced-motion
|
|
26
38
|
// onReducedMotionChange(fn(on)) → unsubscribe()
|
|
@@ -41,8 +53,10 @@
|
|
|
41
53
|
const FRAME_60 = 1000 / 60;
|
|
42
54
|
const SLOP = 4; // ms of rAF jitter a capped subscriber tolerates before it skips a frame
|
|
43
55
|
const RESUME_DT = 50; // the first dt after a stop or a freeze is at most this
|
|
44
|
-
const SLEEP_OVER = 48; // a wait longer than this sleeps on a timer instead of frames
|
|
45
56
|
const POLL_MS = 250; // how often a stopped loop re-checks when no MutationObserver exists
|
|
57
|
+
const PHASE_MS = 1500; // a frame newer than this still tells where the vsyncs fall
|
|
58
|
+
const MIN_FRAME = 4; // ms: the shortest frame interval believed (240 Hz)
|
|
59
|
+
const MAX_FRAME = 34; // ms: the longest (30 Hz)
|
|
46
60
|
const MAX_BOOST = 5000;
|
|
47
61
|
const LISTEN = { passive: true, capture: true };
|
|
48
62
|
|
|
@@ -84,10 +98,73 @@ let pollId = 0;
|
|
|
84
98
|
let boostUntil = -Infinity;
|
|
85
99
|
let watching = false;
|
|
86
100
|
let observer = null;
|
|
101
|
+
let frameMs = FRAME_60; // the display's frame interval, as back-to-back frames show it
|
|
102
|
+
let lastTs = -Infinity; // the last frame's timestamp: where the vsyncs fall
|
|
103
|
+
let inFrame = false; // frame() is running
|
|
104
|
+
let chained = false; // the frame in flight was requested by the previous one, with no wait between
|
|
105
|
+
const counts = { frames: 0, requests: 0, sleeps: 0 }; // for tests and the idle-CPU suite
|
|
87
106
|
|
|
88
107
|
const capFps = fps => Math.max(1, Math.min(60, Number(fps) > 0 ? Number(fps) : 30));
|
|
89
108
|
const boosted = (sub, t) => t < boostUntil && sub.fps >= 24;
|
|
90
109
|
const intervalOf = (sub, t) => (boosted(sub, t) ? FRAME_60 : 1000 / sub.fps);
|
|
110
|
+
/** A subscriber with a target off screen is parked: it is neither called nor waited for. */
|
|
111
|
+
const parked = sub => sub.target && !sub.seen;
|
|
112
|
+
|
|
113
|
+
// ── Targets: one IntersectionObserver for every subscriber that names an element ──
|
|
114
|
+
|
|
115
|
+
let targetIo = null; // undefined while unavailable
|
|
116
|
+
const targetSubs = new Map(); // element → Set of subs
|
|
117
|
+
const targetSeen = new Map(); // element → on screen as last reported (absent until the first report)
|
|
118
|
+
|
|
119
|
+
function targetObserver() {
|
|
120
|
+
if (targetIo !== null) return targetIo;
|
|
121
|
+
const IO = env ? env.IntersectionObserver : globalThis.IntersectionObserver;
|
|
122
|
+
if (typeof IO !== 'function') { targetIo = undefined; return targetIo; }
|
|
123
|
+
try {
|
|
124
|
+
targetIo = new IO((entries) => {
|
|
125
|
+
let woke = false;
|
|
126
|
+
for (const entry of entries) {
|
|
127
|
+
const set = targetSubs.get(entry.target);
|
|
128
|
+
if (!set) continue;
|
|
129
|
+
const on = !!entry.isIntersecting;
|
|
130
|
+
targetSeen.set(entry.target, on);
|
|
131
|
+
for (const sub of set) {
|
|
132
|
+
if (sub.seen === on) continue;
|
|
133
|
+
sub.seen = on;
|
|
134
|
+
if (on) { sub.resume = true; woke = true; }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (woke && subs.size) wakeNow();
|
|
138
|
+
});
|
|
139
|
+
} catch { targetIo = undefined; }
|
|
140
|
+
return targetIo;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function watchTarget(sub) {
|
|
144
|
+
const el = sub.target;
|
|
145
|
+
const io = targetObserver();
|
|
146
|
+
if (!io) { sub.target = null; return; } // no observer: the target counts as on screen
|
|
147
|
+
let set = targetSubs.get(el);
|
|
148
|
+
if (!set) {
|
|
149
|
+
set = new Set();
|
|
150
|
+
targetSubs.set(el, set);
|
|
151
|
+
try { io.observe(el); } catch { targetSubs.delete(el); sub.target = null; return; }
|
|
152
|
+
}
|
|
153
|
+
set.add(sub);
|
|
154
|
+
// Until the observer's first report the target counts as on screen (it draws at once, as before).
|
|
155
|
+
sub.seen = targetSeen.has(el) ? targetSeen.get(el) : true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function unwatchTarget(sub) {
|
|
159
|
+
const el = sub.target;
|
|
160
|
+
const set = el ? targetSubs.get(el) : null;
|
|
161
|
+
if (!set) return;
|
|
162
|
+
set.delete(sub);
|
|
163
|
+
if (set.size) return;
|
|
164
|
+
targetSubs.delete(el);
|
|
165
|
+
targetSeen.delete(el);
|
|
166
|
+
try { targetIo?.unobserve(el); } catch { /* already gone */ }
|
|
167
|
+
}
|
|
91
168
|
|
|
92
169
|
/** Why the loop is not running: '' (it runs), 'hidden' or 'interacting'. */
|
|
93
170
|
export function tickerPaused() {
|
|
@@ -102,17 +179,20 @@ export function tickerPaused() {
|
|
|
102
179
|
|
|
103
180
|
/**
|
|
104
181
|
* Call `fn(now, dt)` from the shared loop, at most `fps` times a second
|
|
105
|
-
* (1-60, default 30).
|
|
106
|
-
*
|
|
182
|
+
* (1-60, default 30). With `target` (an element) it is called only while that
|
|
183
|
+
* element is on screen. Returns unsubscribe(); unsubscribe.setFps(n) changes
|
|
184
|
+
* the cap in place.
|
|
107
185
|
*/
|
|
108
|
-
export function subscribe(fn, { fps = 30 } = {}) {
|
|
186
|
+
export function subscribe(fn, { fps = 30, target = null } = {}) {
|
|
109
187
|
if (typeof fn !== 'function') return Object.assign(() => {}, { setFps() {} });
|
|
110
|
-
const sub = { fn, fps: capFps(fps), last: -1, born: now(), resume: false };
|
|
188
|
+
const sub = { fn, fps: capFps(fps), last: -1, born: now(), resume: false, target: target && typeof target === 'object' ? target : null, seen: true };
|
|
111
189
|
subs.add(sub);
|
|
190
|
+
if (sub.target) watchTarget(sub);
|
|
112
191
|
watch();
|
|
113
192
|
wakeNow();
|
|
114
193
|
const unsubscribe = () => {
|
|
115
194
|
if (!subs.delete(sub)) return;
|
|
195
|
+
unwatchTarget(sub);
|
|
116
196
|
if (!subs.size) halt();
|
|
117
197
|
};
|
|
118
198
|
unsubscribe.setFps = (next) => {
|
|
@@ -138,31 +218,71 @@ function wakeNow() {
|
|
|
138
218
|
schedule();
|
|
139
219
|
}
|
|
140
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Request the next frame a subscriber is due on, and no other: when the next
|
|
223
|
+
* vsync serves it, at once; otherwise a timer wakes half a frame before the
|
|
224
|
+
* vsync it wants. Nothing at all while every subscriber is parked.
|
|
225
|
+
*/
|
|
141
226
|
function schedule() {
|
|
142
227
|
if (rafId || timerId || !subs.size) return;
|
|
143
228
|
const raf = rafFn();
|
|
144
229
|
if (!raf) return;
|
|
145
230
|
if (tickerPaused()) { stopped(); return; }
|
|
146
231
|
const t = now();
|
|
147
|
-
let
|
|
232
|
+
let due = Infinity;
|
|
148
233
|
for (const sub of subs) {
|
|
149
|
-
|
|
150
|
-
|
|
234
|
+
if (parked(sub)) continue;
|
|
235
|
+
const at = sub.last < 0 ? t : sub.last + intervalOf(sub, t) - SLOP;
|
|
236
|
+
if (at < due) due = at;
|
|
151
237
|
}
|
|
152
|
-
if (
|
|
153
|
-
|
|
238
|
+
if (!Number.isFinite(due)) return; // every subscriber is off screen: the observer wakes the loop
|
|
239
|
+
const phase = lastTs > -Infinity && t - lastTs < PHASE_MS ? lastTs : null;
|
|
240
|
+
let lead;
|
|
241
|
+
if (due <= t) lead = 0;
|
|
242
|
+
else if (phase === null) lead = due - t - frameMs; // no recent vsync to count from: the frame before `due`
|
|
243
|
+
else {
|
|
244
|
+
const k = Math.max(1, Math.ceil((due - phase) / frameMs - 1e-6));
|
|
245
|
+
lead = k === 1 ? 0 : phase + (k - 0.5) * frameMs - t; // half a frame before the vsync that serves `due`
|
|
246
|
+
}
|
|
247
|
+
if (lead > 1) {
|
|
248
|
+
counts.sleeps += 1;
|
|
249
|
+
timerId = later(() => { timerId = 0; schedule(); }, lead);
|
|
154
250
|
return;
|
|
155
251
|
}
|
|
252
|
+
counts.requests += 1;
|
|
253
|
+
chained = inFrame;
|
|
156
254
|
rafId = raf(frame);
|
|
157
255
|
}
|
|
158
256
|
|
|
257
|
+
/** Learn the display's frame interval from two frames requested back to back. */
|
|
258
|
+
function learnInterval(ts) {
|
|
259
|
+
if (!chained || !(lastTs > -Infinity)) return;
|
|
260
|
+
const d = ts - lastTs;
|
|
261
|
+
if (!(d >= MIN_FRAME && d <= MAX_FRAME)) return;
|
|
262
|
+
// Snap down to the shortest seen; drift back up slowly (a dropped frame is two, not a slower display).
|
|
263
|
+
frameMs = Math.min(d, Math.min(MAX_FRAME, frameMs + 0.05));
|
|
264
|
+
}
|
|
265
|
+
|
|
159
266
|
function frame(ts) {
|
|
160
267
|
rafId = 0;
|
|
161
268
|
if (!subs.size) return;
|
|
162
269
|
if (tickerPaused()) { stopped(); return; }
|
|
163
270
|
const t = typeof ts === 'number' && Number.isFinite(ts) ? ts : now();
|
|
271
|
+
counts.frames += 1;
|
|
272
|
+
learnInterval(t);
|
|
273
|
+
lastTs = t;
|
|
274
|
+
chained = false;
|
|
275
|
+
inFrame = true;
|
|
276
|
+
try {
|
|
277
|
+
runSubscribers(t);
|
|
278
|
+
schedule(); // inside the frame: a frame requested from here is the next vsync's (it teaches the interval)
|
|
279
|
+
} finally { inFrame = false; }
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function runSubscribers(t) {
|
|
164
283
|
for (const sub of Array.from(subs)) {
|
|
165
284
|
if (!subs.has(sub)) continue; // unsubscribed by an earlier subscriber this frame
|
|
285
|
+
if (parked(sub)) continue;
|
|
166
286
|
const interval = intervalOf(sub, t);
|
|
167
287
|
if (sub.last >= 0 && t - sub.last < interval - SLOP) continue;
|
|
168
288
|
let dt = t - (sub.last >= 0 ? sub.last : sub.born);
|
|
@@ -172,7 +292,6 @@ function frame(ts) {
|
|
|
172
292
|
sub.last = t;
|
|
173
293
|
try { sub.fn(t, dt); } catch (err) { report(err); }
|
|
174
294
|
}
|
|
175
|
-
schedule();
|
|
176
295
|
}
|
|
177
296
|
|
|
178
297
|
/** The loop stopped (hidden) or froze (drag): mark the jump, wait for the watchers. */
|
|
@@ -334,6 +453,17 @@ function reset() {
|
|
|
334
453
|
halt();
|
|
335
454
|
subs.clear();
|
|
336
455
|
boostUntil = -Infinity;
|
|
456
|
+
try { targetIo?.disconnect(); } catch { /* gone */ }
|
|
457
|
+
targetIo = null;
|
|
458
|
+
targetSubs.clear();
|
|
459
|
+
targetSeen.clear();
|
|
460
|
+
frameMs = FRAME_60;
|
|
461
|
+
lastTs = -Infinity;
|
|
462
|
+
inFrame = false;
|
|
463
|
+
chained = false;
|
|
464
|
+
counts.frames = 0;
|
|
465
|
+
counts.requests = 0;
|
|
466
|
+
counts.sleeps = 0;
|
|
337
467
|
const q = motionQuery;
|
|
338
468
|
if (q && motionFns.size) {
|
|
339
469
|
if (q.removeEventListener) q.removeEventListener('change', onMotionQuery);
|
|
@@ -372,5 +502,10 @@ export const __ticker = {
|
|
|
372
502
|
keyListeners: keyFns.size,
|
|
373
503
|
keyAttached: keyOn,
|
|
374
504
|
motionListeners: motionFns.size,
|
|
505
|
+
parked: Array.from(subs).filter(parked).length,
|
|
506
|
+
targets: targetSubs.size,
|
|
507
|
+
frameMs,
|
|
375
508
|
}),
|
|
509
|
+
/** Frames run, frames requested and timer sleeps since the last reset (the idle-CPU suite reads them). */
|
|
510
|
+
counts: () => ({ ...counts }),
|
|
376
511
|
};
|