aegisone 0.0.0-stage → 1.0.3
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 +98 -2
- package/bin/aegis.js +295 -0
- package/install.ps1 +151 -0
- package/install.sh +178 -0
- package/package.json +44 -4
- package/scripts/bump.mjs +184 -0
- package/scripts/bundle.js +126 -0
- package/scripts/predist.mjs +673 -0
- package/src/child.js +163 -0
- package/src/dispatch.js +265 -0
- package/src/doctor.js +636 -0
- package/src/host.js +108 -0
- package/src/permissions.js +239 -0
- package/src/probes.js +156 -0
- package/src/release.js +397 -0
- package/vendor/cli/LICENSE +661 -0
- package/vendor/cli/README.md +745 -0
- package/vendor/cli/bin/aegiscode.js +742 -0
- package/vendor/cli/package.json +42 -0
- package/vendor/cli/scripts/check.mjs +50 -0
- package/vendor/cli/scripts/demo.mjs +92 -0
- package/vendor/cli/scripts/predist.mjs +48 -0
- package/vendor/cli/scripts/runtests.mjs +54 -0
- package/vendor/cli/src/agents.js +136 -0
- package/vendor/cli/src/app.js +2164 -0
- package/vendor/cli/src/art.js +286 -0
- package/vendor/cli/src/autonomous.js +468 -0
- package/vendor/cli/src/caps.js +876 -0
- package/vendor/cli/src/chatflow.js +2389 -0
- package/vendor/cli/src/checkpoint.js +87 -0
- package/vendor/cli/src/clipboard.js +421 -0
- package/vendor/cli/src/cloudsync.js +525 -0
- package/vendor/cli/src/commands.js +3014 -0
- package/vendor/cli/src/config.js +527 -0
- package/vendor/cli/src/credentials.js +30 -0
- package/vendor/cli/src/deps.js +106 -0
- package/vendor/cli/src/devrun.js +184 -0
- package/vendor/cli/src/diff.js +330 -0
- package/vendor/cli/src/diffview.js +293 -0
- package/vendor/cli/src/engine.js +142 -0
- package/vendor/cli/src/entitlement.js +320 -0
- package/vendor/cli/src/events.js +694 -0
- package/vendor/cli/src/export.js +64 -0
- package/vendor/cli/src/fingerprint.js +559 -0
- package/vendor/cli/src/format.js +84 -0
- package/vendor/cli/src/fuzzy.js +116 -0
- package/vendor/cli/src/gate.js +45 -0
- package/vendor/cli/src/history.js +398 -0
- package/vendor/cli/src/init.js +172 -0
- package/vendor/cli/src/input.js +136 -0
- package/vendor/cli/src/keys.js +153 -0
- package/vendor/cli/src/markdown.js +303 -0
- package/vendor/cli/src/mcp.js +683 -0
- package/vendor/cli/src/models.js +409 -0
- package/vendor/cli/src/naming.js +226 -0
- package/vendor/cli/src/overlays.js +338 -0
- package/vendor/cli/src/panels.js +1402 -0
- package/vendor/cli/src/permissions.js +237 -0
- package/vendor/cli/src/ping.js +223 -0
- package/vendor/cli/src/presence.js +235 -0
- package/vendor/cli/src/render.js +469 -0
- package/vendor/cli/src/screen.js +504 -0
- package/vendor/cli/src/screens.js +776 -0
- package/vendor/cli/src/secret.js +56 -0
- package/vendor/cli/src/securefs.js +356 -0
- package/vendor/cli/src/settings.js +152 -0
- package/vendor/cli/src/shared.js +49 -0
- package/vendor/cli/src/sharedpaths.js +50 -0
- package/vendor/cli/src/signup.js +153 -0
- package/vendor/cli/src/summarize.js +92 -0
- package/vendor/cli/src/system.js +37 -0
- package/vendor/cli/src/theme.js +567 -0
- package/vendor/cli/src/title.js +217 -0
- package/vendor/cli/src/todos.js +109 -0
- package/vendor/cli/src/tokens.js +230 -0
- package/vendor/cli/src/topup.js +207 -0
- package/vendor/cli/src/update.js +87 -0
- package/vendor/cli/vendor/client/aegis.js +1738 -0
- package/vendor/cli/vendor/client/attest.js +439 -0
- package/vendor/cli/vendor/client/authorship-key.js +407 -0
- package/vendor/cli/vendor/client/auto-provision.js +52 -0
- package/vendor/cli/vendor/client/brain-catalog.js +265 -0
- package/vendor/cli/vendor/client/byok-catalog.js +192 -0
- package/vendor/cli/vendor/client/credentials.js +478 -0
- package/vendor/cli/vendor/client/device-fingerprint.js +145 -0
- package/vendor/cli/vendor/client/env-file.js +1016 -0
- package/vendor/cli/vendor/client/fingerprint.js +1061 -0
- package/vendor/cli/vendor/client/foreign-memory.js +666 -0
- package/vendor/cli/vendor/client/hooks.js +427 -0
- package/vendor/cli/vendor/client/platform.js +934 -0
- package/vendor/cli/vendor/client/prefs.js +348 -0
- package/vendor/cli/vendor/client/presence-constants.js +104 -0
- package/vendor/cli/vendor/client/presence.js +435 -0
- package/vendor/cli/vendor/client/record-vault.js +834 -0
- package/vendor/cli/vendor/client/session-store.js +545 -0
- package/vendor/cli/vendor/client/topup.js +294 -0
- package/vendor/cli/vendor/client/touch.js +455 -0
- package/vendor/cli/vendor/client/update.js +343 -0
- package/vendor/cli/vendor/covenant/README.md +21 -0
- package/vendor/cli/vendor/covenant/aegis.seal +177 -0
- package/vendor/cli/vendor/desktop/lib/local/aegis-seal.mjs +236 -0
- package/vendor/cli/vendor/desktop/lib/local/agents.js +102 -0
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +921 -0
- package/vendor/cli/vendor/desktop/lib/local/context.js +92 -0
- package/vendor/cli/vendor/desktop/lib/local/covenant.js +562 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +2155 -0
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +568 -0
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +225 -0
- package/vendor/cli/vendor/desktop/lib/local/local.js +2132 -0
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +242 -0
- package/vendor/cli/vendor/desktop/lib/local/queue.js +557 -0
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +205 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +603 -0
- package/vendor/cli/vendor/desktop/lib/local/tools.js +1197 -0
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +297 -0
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +232 -0
- package/vendor/cli/vendor/desktop/lib/settings.js +846 -0
- package/vendor/cli/vendor/desktop/renderer/usage.js +964 -0
- package/vendor/cli/vendor/hosts/install.js +638 -0
- package/vendor/cli/vendor/hosts/openai-shim.js +516 -0
- package/vendor/cli/vendor/hosts/spec.js +164 -0
- package/vendor/cli/vendor/hosts/targets.js +346 -0
- package/vendor/cli/vendor/mcp/server.js +217 -0
- package/vendor/cli/vendor/mcp/tools.js +405 -0
- package/vendor/cli/vendor/tools/agent-gate.mjs +1180 -0
- package/vendor/desktop/README.md +365 -0
- package/vendor/desktop/bin/aegis.js +30 -0
- package/vendor/desktop/lib/auto.js +423 -0
- package/vendor/desktop/lib/avatar/companion.js +695 -0
- package/vendor/desktop/lib/avatar/cosmetics.js +529 -0
- package/vendor/desktop/lib/avatar/events.js +341 -0
- package/vendor/desktop/lib/avatar/holder-turn.js +347 -0
- package/vendor/desktop/lib/avatar/holders.js +609 -0
- package/vendor/desktop/lib/avatar/identity.js +638 -0
- package/vendor/desktop/lib/avatar/level.js +365 -0
- package/vendor/desktop/lib/avatar/mirror.js +521 -0
- package/vendor/desktop/lib/avatar/packs/README.md +47 -0
- package/vendor/desktop/lib/avatar/packs/core-wardrobe.pack.json +15 -0
- package/vendor/desktop/lib/avatar/packs/local-voice-core.pack.json +16 -0
- package/vendor/desktop/lib/avatar/packs/seasonal-winter.pack.json +14 -0
- package/vendor/desktop/lib/avatar/persona.js +385 -0
- package/vendor/desktop/lib/avatar/profile.js +974 -0
- package/vendor/desktop/lib/avatar/register.js +304 -0
- package/vendor/desktop/lib/avatar/store.js +469 -0
- package/vendor/desktop/lib/avatar/tiers.js +35 -0
- package/vendor/desktop/lib/avatar/transfer.js +412 -0
- package/vendor/desktop/lib/avatar/turn.js +213 -0
- package/vendor/desktop/lib/avatar/voice.js +325 -0
- package/vendor/desktop/lib/avatar/xp.js +401 -0
- package/vendor/desktop/lib/deep-link.js +83 -0
- package/vendor/desktop/lib/fingerprint.js +327 -0
- package/vendor/desktop/lib/local/aegis-seal.mjs +236 -0
- package/vendor/desktop/lib/local/agents.js +102 -0
- package/vendor/desktop/lib/local/autonomous.js +921 -0
- package/vendor/desktop/lib/local/context.js +92 -0
- package/vendor/desktop/lib/local/covenant.js +562 -0
- package/vendor/desktop/lib/local/engine.js +2155 -0
- package/vendor/desktop/lib/local/entitlement.js +568 -0
- package/vendor/desktop/lib/local/git-scope.js +225 -0
- package/vendor/desktop/lib/local/local.js +2132 -0
- package/vendor/desktop/lib/local/prompt.js +242 -0
- package/vendor/desktop/lib/local/queue.js +557 -0
- package/vendor/desktop/lib/local/session-rounds.js +205 -0
- package/vendor/desktop/lib/local/shell.js +603 -0
- package/vendor/desktop/lib/local/telemetry.js +467 -0
- package/vendor/desktop/lib/local/tools.js +1197 -0
- package/vendor/desktop/lib/local/turn-guard.js +297 -0
- package/vendor/desktop/lib/local/worktree-lock.js +232 -0
- package/vendor/desktop/lib/provider-key-mirror.js +136 -0
- package/vendor/desktop/lib/quick-launcher.js +81 -0
- package/vendor/desktop/lib/settings.js +846 -0
- package/vendor/desktop/lib/sync/memory-queue.js +57 -0
- package/vendor/desktop/lib/sync/persist-gate.js +145 -0
- package/vendor/desktop/lib/sync/sessions.js +103 -0
- package/vendor/desktop/lib/window-state.js +63 -0
- package/vendor/desktop/main.js +3726 -0
- package/vendor/desktop/package.json +70 -0
- package/vendor/desktop/preload.js +557 -0
- package/vendor/desktop/renderer/app.js +5080 -0
- package/vendor/desktop/renderer/avatar/assemble.js +332 -0
- package/vendor/desktop/renderer/avatar/avatar.css +260 -0
- package/vendor/desktop/renderer/avatar/avatar.js +377 -0
- package/vendor/desktop/renderer/avatar/cards.js +138 -0
- package/vendor/desktop/renderer/avatar/hud.js +203 -0
- package/vendor/desktop/renderer/avatar/machine.js +210 -0
- package/vendor/desktop/renderer/avatar/pane.js +436 -0
- package/vendor/desktop/renderer/avatar/parts.js +434 -0
- package/vendor/desktop/renderer/budget.js +156 -0
- package/vendor/desktop/renderer/diff.js +356 -0
- package/vendor/desktop/renderer/diffview.js +333 -0
- package/vendor/desktop/renderer/fingerprint.css +143 -0
- package/vendor/desktop/renderer/fingerprint.js +583 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKcQ72j00.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKcg72j00.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKcw72j00.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKew72j00.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKfA72j00.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCs6KVjbNBYlgoKfw72.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej70l0k.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej73l0mwFg.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej74l0mwFg.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej75l0mwFg.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej76l0mwFg.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCu6KVjbNBYlgoKej7wl0mwFg.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3js2yNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3jsGyN.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3jtGyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3jvGyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3jvWyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCjC3jvmyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjs2yNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjsGyN.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjtGyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjvGyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjvWyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/4iCv6KVjbNBYlgoCxCvjvmyNL4U.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/8vIH7w4qzmVxm25L9Hz_.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/8vIH7w4qzmVxm2BL9A.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/8vIH7w4qzmVxm2NL9Hz_.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/NOTICE.md +57 -0
- package/vendor/desktop/renderer/fonts/aFTR7PB1QTsUX8KYvrGyEY2tbZX9.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTR7PB1QTsUX8KYvrGyEYOtbQ.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTR7PB1QTsUX8KYvumzEY2tbZX9.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTR7PB1QTsUX8KYvumzEYOtbQ.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTU7PB1QTsUX8KYthSQBLyM.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTU7PB1QTsUX8KYthqQBA.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTW7PB1QTsUX8KYth-gBqSI.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/aFTW7PB1QTsUX8KYth-gCKSIUKw.woff2 +0 -0
- package/vendor/desktop/renderer/fonts/fonts.css +368 -0
- package/vendor/desktop/renderer/index.html +864 -0
- package/vendor/desktop/renderer/markdown.js +165 -0
- package/vendor/desktop/renderer/quick.css +151 -0
- package/vendor/desktop/renderer/quick.html +42 -0
- package/vendor/desktop/renderer/quick.js +188 -0
- package/vendor/desktop/renderer/stream-policy.js +281 -0
- package/vendor/desktop/renderer/style.css +2519 -0
- package/vendor/desktop/renderer/transcript-view.js +320 -0
- package/vendor/desktop/renderer/usage.js +964 -0
- package/vendor/desktop/renderer/vendor/NOTICE.md +20 -0
- package/vendor/desktop/renderer/vendor/aegis-highlight.js +135 -0
- package/vendor/desktop/renderer/vendor/marked.umd.js +80 -0
- package/vendor/desktop/renderer/vendor/purify.min.js +3 -0
- package/vendor/desktop/vendor/aegis.js +1738 -0
- package/vendor/desktop/vendor/agent-gate.mjs +1180 -0
- package/vendor/desktop/vendor/attest.js +439 -0
- package/vendor/desktop/vendor/authorship-key.js +407 -0
- package/vendor/desktop/vendor/auto-provision.js +52 -0
- package/vendor/desktop/vendor/brain-catalog.js +265 -0
- package/vendor/desktop/vendor/byok-catalog.js +192 -0
- package/vendor/desktop/vendor/covenant/README.md +21 -0
- package/vendor/desktop/vendor/covenant/aegis.seal +177 -0
- package/vendor/desktop/vendor/credentials.js +478 -0
- package/vendor/desktop/vendor/device-fingerprint.js +145 -0
- package/vendor/desktop/vendor/env-file.js +1016 -0
- package/vendor/desktop/vendor/fingerprint.js +1061 -0
- package/vendor/desktop/vendor/foreign-memory.js +666 -0
- package/vendor/desktop/vendor/hooks.js +427 -0
- package/vendor/desktop/vendor/platform.js +934 -0
- package/vendor/desktop/vendor/prefs.js +348 -0
- package/vendor/desktop/vendor/presence-constants.js +104 -0
- package/vendor/desktop/vendor/presence.js +435 -0
- package/vendor/desktop/vendor/record-vault.js +834 -0
- package/vendor/desktop/vendor/session-store.js +545 -0
- package/vendor/desktop/vendor/topup.js +294 -0
- package/vendor/desktop/vendor/touch.js +455 -0
- package/vendor/desktop/vendor/update.js +343 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* assemble.js — persona JSON in, layered SVG out.
|
|
5
|
+
*
|
|
6
|
+
* A pure string builder. It takes a validated persona record plus one
|
|
7
|
+
* expression id and returns the markup, the layer list it walked, and — the
|
|
8
|
+
* part that matters — a `warnings`/`missing` pair. Three rules:
|
|
9
|
+
*
|
|
10
|
+
* 1. **Never blank, never throw.** An id the manifest does not know (a persona
|
|
11
|
+
* hand-edited, or written by a newer release) renders the default part and
|
|
12
|
+
* is REPORTED. `persona.js` made the same choice at the storage boundary
|
|
13
|
+
* for the same reason: the user's own file must not be able to take the
|
|
14
|
+
* companion's face away.
|
|
15
|
+
*
|
|
16
|
+
* 2. **No interpolation of user text.** Nothing the user typed is placed in
|
|
17
|
+
* the markup, so there is no escaping question and no injection surface:
|
|
18
|
+
* the only persona-supplied value that reaches the SVG is `hairColor`, and
|
|
19
|
+
* it is re-checked against `#rrggbb` here even though `persona.js` already
|
|
20
|
+
* checked it. Geometry comes from the manifest, which is code.
|
|
21
|
+
*
|
|
22
|
+
* 3. **No styles, no scripts, no references.** The output carries no `<style>`,
|
|
23
|
+
* no `on*` attribute and no `href`/`url(...)`: motion lives in avatar.css,
|
|
24
|
+
* keyed off the `data-motion` attribute this file sets. That keeps the
|
|
25
|
+
* renderer's CSP (`script-src 'self'; style-src 'self'`) satisfied by
|
|
26
|
+
* construction, and `desktop/test/avatar-render.test.mjs` asserts all four
|
|
27
|
+
* absences rather than trusting this paragraph.
|
|
28
|
+
*
|
|
29
|
+
* Pure: no DOM, no Electron. It runs identically under `node --test` and in the
|
|
30
|
+
* renderer, which is what makes the whole phase testable.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
'use strict';
|
|
34
|
+
|
|
35
|
+
const pkg = typeof window !== 'undefined' && window.AegisAvatarParts
|
|
36
|
+
? window.AegisAvatarParts
|
|
37
|
+
: typeof module !== 'undefined' && module.exports
|
|
38
|
+
? require('./parts.js')
|
|
39
|
+
: null;
|
|
40
|
+
|
|
41
|
+
if (!pkg) throw new Error('avatar/assemble.js: avatar/parts.js must be loaded first');
|
|
42
|
+
|
|
43
|
+
const HEX = /^#[0-9a-f]{6}$/i;
|
|
44
|
+
|
|
45
|
+
/** Lighten (`amount > 0`) or darken (`amount < 0`) a `#rrggbb` colour. */
|
|
46
|
+
function shade(hex, amount) {
|
|
47
|
+
const m = HEX.exec(String(hex || ''));
|
|
48
|
+
if (!m) return hex;
|
|
49
|
+
const n = parseInt(m[0].slice(1), 16);
|
|
50
|
+
const target = amount < 0 ? 0 : 255;
|
|
51
|
+
const k = Math.min(1, Math.abs(amount));
|
|
52
|
+
const mix = (c) => Math.round(c * (1 - k) + target * k);
|
|
53
|
+
const r = mix((n >> 16) & 255);
|
|
54
|
+
const g = mix((n >> 8) & 255);
|
|
55
|
+
const b = mix(n & 255);
|
|
56
|
+
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Walk a flat list of shape specs, keeping only the ones with geometry. */
|
|
60
|
+
function shapesOf(list) {
|
|
61
|
+
return Array.isArray(list) ? list.filter((s) => s && typeof s === 'object') : [];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A path string from an expression is geometry — normalise it to a shape. */
|
|
65
|
+
function asStrokes(value) {
|
|
66
|
+
if (typeof value === 'string' && value.trim()) return [{ kind: 'path', d: value, stroke: true }];
|
|
67
|
+
if (!Array.isArray(value)) return [];
|
|
68
|
+
return value
|
|
69
|
+
.map((v) => (typeof v === 'string' ? { kind: 'path', d: v, stroke: true } : v))
|
|
70
|
+
.filter((s) => s && typeof s === 'object');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function call(fn, ...args) {
|
|
74
|
+
return typeof fn === 'function' ? fn(...args) : undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Resolve a custom expression from `persona.expressions.custom`.
|
|
79
|
+
*
|
|
80
|
+
* A custom expression is DATA too: `{ mouth, brows, eyes }` where `mouth` is an
|
|
81
|
+
* SVG path, `brows` is a path or a list of paths, and `eyes` names one of the
|
|
82
|
+
* manifest's eye overrides. Anything unrecognised is dropped with a warning, so
|
|
83
|
+
* a half-written custom expression renders the core face rather than nothing.
|
|
84
|
+
*/
|
|
85
|
+
function customExpression(persona, id, warnings) {
|
|
86
|
+
const custom = persona && persona.expressions && persona.expressions.custom;
|
|
87
|
+
const record = custom && typeof custom === 'object' ? custom[id] : null;
|
|
88
|
+
if (!record || typeof record !== 'object') return null;
|
|
89
|
+
const out = { label: id, custom: true };
|
|
90
|
+
if (typeof record.mouth === 'string' && record.mouth.trim()) out.mouth = record.mouth.trim();
|
|
91
|
+
if (record.brows !== undefined) out.brows = asStrokes(record.brows).map((s) => s.d);
|
|
92
|
+
if (record.eyes !== undefined) {
|
|
93
|
+
if (typeof record.eyes === 'string' && pkg.EYE_OVERRIDES[record.eyes]) out.eyes = record.eyes;
|
|
94
|
+
else warnings.push(`custom expression ${id}: unknown eye override ${JSON.stringify(record.eyes)} — ignored`);
|
|
95
|
+
}
|
|
96
|
+
if (out.mouth === undefined && out.brows === undefined && out.eyes === undefined) {
|
|
97
|
+
warnings.push(`custom expression ${id} carries no drawable geometry — ignored`);
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Assemble the avatar.
|
|
105
|
+
*
|
|
106
|
+
* @param {object} persona a persona record (validated or raw — both survive)
|
|
107
|
+
* @param {object} [opts]
|
|
108
|
+
* @param {string} [opts.expression] an `events.js` expression id
|
|
109
|
+
* @param {boolean} [opts.reducedMotion] the OS preference; forces `minimal`
|
|
110
|
+
* @param {string} [opts.motion] explicit override, mostly for tests
|
|
111
|
+
* @returns {{ svg: string, layers: object[], warnings: string[], missing: string[],
|
|
112
|
+
* expression: string, palette: string, frame: string, motion: string }}
|
|
113
|
+
*/
|
|
114
|
+
function assemble(persona, opts = {}) {
|
|
115
|
+
const warnings = [];
|
|
116
|
+
const missing = [];
|
|
117
|
+
const p = persona && typeof persona === 'object' ? persona : pkg.defaultPersona();
|
|
118
|
+
const presentation = p.presentation && typeof p.presentation === 'object' ? p.presentation : {};
|
|
119
|
+
const appearance = p.appearance && typeof p.appearance === 'object' ? p.appearance : {};
|
|
120
|
+
|
|
121
|
+
// ---- palette / skin / hair colour --------------------------------------
|
|
122
|
+
const paletteId = pkg.PALETTES[presentation.palette] ? presentation.palette : 'amber';
|
|
123
|
+
if (presentation.palette !== undefined && paletteId !== presentation.palette) {
|
|
124
|
+
warnings.push(`unknown palette ${JSON.stringify(presentation.palette)} — using ${paletteId}`);
|
|
125
|
+
}
|
|
126
|
+
const palette = pkg.PALETTES[paletteId];
|
|
127
|
+
const skin = Number.isInteger(presentation.skin) && presentation.skin >= 0 && presentation.skin < pkg.SKIN_TONES.length
|
|
128
|
+
? presentation.skin
|
|
129
|
+
: 2;
|
|
130
|
+
const skinTone = pkg.SKIN_TONES[skin];
|
|
131
|
+
const hairColor = HEX.test(String(presentation.hairColor || '')) ? String(presentation.hairColor) : '#3b2a20';
|
|
132
|
+
|
|
133
|
+
function colorFor(role) {
|
|
134
|
+
switch (role) {
|
|
135
|
+
case 'skin': return skinTone;
|
|
136
|
+
case 'skinShade': return shade(skinTone, -0.18);
|
|
137
|
+
case 'hair': return hairColor;
|
|
138
|
+
case 'hairShade': return shade(hairColor, -0.25);
|
|
139
|
+
case 'cloth': return palette.cloth;
|
|
140
|
+
case 'clothShade': return palette.clothShade;
|
|
141
|
+
case 'accent': return palette.accent;
|
|
142
|
+
case 'metal': return palette.metal;
|
|
143
|
+
case 'bg': return palette.bg;
|
|
144
|
+
case 'ink': return palette.ink;
|
|
145
|
+
case 'sclera': return '#fdfbf7';
|
|
146
|
+
case 'highlight': return '#ffffff';
|
|
147
|
+
default: return palette.ink;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ---- parts -------------------------------------------------------------
|
|
152
|
+
function part(table, kind, id, fallback) {
|
|
153
|
+
const got = table[id];
|
|
154
|
+
if (got) return got;
|
|
155
|
+
if (id !== undefined && id !== null && id !== '') {
|
|
156
|
+
missing.push(`${kind}:${id}`);
|
|
157
|
+
warnings.push(`unknown ${kind} ${JSON.stringify(id)} — using ${fallback}`);
|
|
158
|
+
}
|
|
159
|
+
return table[fallback];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const frameId = pkg.FRAMES[presentation.frame] ? presentation.frame : 'A';
|
|
163
|
+
const frame = pkg.FRAMES[frameId];
|
|
164
|
+
const hair = part(pkg.HAIR, 'hair', presentation.hair, 'bob-2');
|
|
165
|
+
const eyes = part(pkg.EYES, 'eyes', presentation.eyes, 'soft');
|
|
166
|
+
|
|
167
|
+
const outfitIds = [];
|
|
168
|
+
for (const item of Array.isArray(presentation.outfit) ? presentation.outfit : []) {
|
|
169
|
+
if (pkg.OUTFITS[item]) outfitIds.push(item);
|
|
170
|
+
else missing.push(`outfit:${item}`);
|
|
171
|
+
}
|
|
172
|
+
if (!outfitIds.length && Array.isArray(presentation.outfit) && presentation.outfit.length) {
|
|
173
|
+
warnings.push('no known outfit layer — wearing the plain tee');
|
|
174
|
+
}
|
|
175
|
+
const outfits = outfitIds.slice(0, 3).map((id) => pkg.OUTFITS[id]);
|
|
176
|
+
|
|
177
|
+
// ---- expression --------------------------------------------------------
|
|
178
|
+
const requested = typeof opts.expression === 'string' && opts.expression ? opts.expression : 'neutral';
|
|
179
|
+
let expression = pkg.EXPRESSIONS[requested];
|
|
180
|
+
let expressionId = requested;
|
|
181
|
+
if (!expression) {
|
|
182
|
+
const custom = customExpression(p, requested, warnings);
|
|
183
|
+
if (custom) {
|
|
184
|
+
expression = custom;
|
|
185
|
+
} else {
|
|
186
|
+
if (requested !== 'neutral') {
|
|
187
|
+
missing.push(`expression:${requested}`);
|
|
188
|
+
warnings.push(`unknown expression ${JSON.stringify(requested)} — using neutral`);
|
|
189
|
+
}
|
|
190
|
+
expression = pkg.EXPRESSIONS.neutral;
|
|
191
|
+
expressionId = 'neutral';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const eyeOverride = expression.eyes && pkg.EYE_OVERRIDES[expression.eyes] ? pkg.EYE_OVERRIDES[expression.eyes] : null;
|
|
196
|
+
const browShapes = Array.isArray(expression.brows)
|
|
197
|
+
? asStrokes(expression.brows)
|
|
198
|
+
: asStrokes(expression.brows);
|
|
199
|
+
const mouthShapes = asStrokes(expression.mouth);
|
|
200
|
+
|
|
201
|
+
const sheet = {
|
|
202
|
+
shadow: [{ kind: 'ellipse', cx: 100, cy: 254, rx: 62, ry: 10, role: 'clothShade', opacity: 0.5 }],
|
|
203
|
+
hairBack: shapesOf(hair.back),
|
|
204
|
+
body: [
|
|
205
|
+
{ kind: 'path', d: pkg.BODY.neck, role: 'skinShade' },
|
|
206
|
+
{ kind: 'path', d: pkg.BODY.shirt, role: 'cloth' },
|
|
207
|
+
{ kind: 'path', d: pkg.BODY.sleeveL, role: 'cloth' },
|
|
208
|
+
{ kind: 'path', d: pkg.BODY.sleeveR, role: 'cloth' },
|
|
209
|
+
],
|
|
210
|
+
outfitUnder: [],
|
|
211
|
+
head: [
|
|
212
|
+
{ kind: 'path', d: frame.head, role: 'skin' },
|
|
213
|
+
...frame.ear.map((e) => ({ kind: 'circle', cx: e.cx, cy: e.cy, r: e.r, role: 'skin' })),
|
|
214
|
+
],
|
|
215
|
+
face: [
|
|
216
|
+
...(eyeOverride
|
|
217
|
+
? eyeOverride.map((s) => ({ ...s, stroke: true }))
|
|
218
|
+
: [...eyes.left, ...eyes.right]),
|
|
219
|
+
...browShapes,
|
|
220
|
+
...shapesOf(pkg.FACE.nose),
|
|
221
|
+
...mouthShapes,
|
|
222
|
+
],
|
|
223
|
+
hairFront: [...shapesOf(hair.front), ...shapesOf(hair.detail)],
|
|
224
|
+
outfitOver: [],
|
|
225
|
+
accessory: [],
|
|
226
|
+
effect: [],
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// Outfit layers draw in the order the persona listed them: the last one is
|
|
230
|
+
// the outermost. Items flagged `accessory` (headphones, glasses) go on top of
|
|
231
|
+
// the hair instead of into the clothes pile.
|
|
232
|
+
const under = sheet.outfitUnder;
|
|
233
|
+
for (const item of outfits) {
|
|
234
|
+
under.push(...shapesOf(item.under).map((s) => ({ ...s, defaultRole: 'cloth' })));
|
|
235
|
+
const overShapes = shapesOf(item.over).map((s) => ({ ...s, defaultRole: 'cloth' }));
|
|
236
|
+
if (item.accessory) sheet.accessory.push(...overShapes);
|
|
237
|
+
else sheet.outfitOver.push(...overShapes);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// A celebrating face gets a few sparks — motion-gated in CSS, and the only
|
|
241
|
+
// thing on the `effect` layer.
|
|
242
|
+
if (expressionId === 'happy' || expressionId === 'playful' || expressionId === 'delighted') {
|
|
243
|
+
sheet.effect.push(
|
|
244
|
+
{ kind: 'path', d: 'M28 66 l4 10 l10 4 l-10 4 l-4 10 l-4 -10 l-10 -4 l10 -4 Z', role: 'accent', opacity: 0.9 },
|
|
245
|
+
{ kind: 'path', d: 'M172 88 l3 8 l8 3 l-8 3 l-3 8 l-3 -8 l-8 -3 l8 -3 Z', role: 'accent', opacity: 0.7 }
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ---- markup ------------------------------------------------------------
|
|
250
|
+
/** Per-layer default fill role, so a manifest entry rarely repeats itself. */
|
|
251
|
+
const layerDefaultRole = {
|
|
252
|
+
shadow: 'clothShade',
|
|
253
|
+
hairBack: 'hair',
|
|
254
|
+
body: 'cloth',
|
|
255
|
+
outfitUnder: 'cloth',
|
|
256
|
+
head: 'skin',
|
|
257
|
+
face: 'ink',
|
|
258
|
+
hairFront: 'hair',
|
|
259
|
+
outfitOver: 'cloth',
|
|
260
|
+
accessory: 'metal',
|
|
261
|
+
effect: 'accent',
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
function renderShape(shape, layer) {
|
|
265
|
+
const role = shape.role || shape.defaultRole || layerDefaultRole[layer] || 'ink';
|
|
266
|
+
const fill = colorFor(role);
|
|
267
|
+
const common = [];
|
|
268
|
+
if (shape.stroke) {
|
|
269
|
+
common.push('fill="none"', `stroke="${fill}"`, 'stroke-width="3.5"', 'stroke-linecap="round"', 'stroke-linejoin="round"');
|
|
270
|
+
} else {
|
|
271
|
+
common.push(`fill="${fill}"`);
|
|
272
|
+
}
|
|
273
|
+
if (typeof shape.opacity === 'number') common.push(`opacity="${shape.opacity}"`);
|
|
274
|
+
|
|
275
|
+
switch (shape.kind) {
|
|
276
|
+
case 'circle':
|
|
277
|
+
return `<circle cx="${shape.cx}" cy="${shape.cy}" r="${shape.r}" ${common.join(' ')}/>`;
|
|
278
|
+
case 'ellipse':
|
|
279
|
+
return `<ellipse cx="${shape.cx}" cy="${shape.cy}" rx="${shape.rx}" ry="${shape.ry}" ${common.join(' ')}/>`;
|
|
280
|
+
case 'rect': {
|
|
281
|
+
const rx = shape.rx === undefined ? 0 : shape.rx;
|
|
282
|
+
return `<rect x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}" rx="${rx}" ${common.join(' ')}/>`;
|
|
283
|
+
}
|
|
284
|
+
case 'path':
|
|
285
|
+
default:
|
|
286
|
+
return `<path d="${shape.d}" ${common.join(' ')}/>`;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const motion = opts.motion
|
|
291
|
+
? String(opts.motion)
|
|
292
|
+
: pkg.motionFor(p, Boolean(opts.reducedMotion));
|
|
293
|
+
const size = ['small', 'medium', 'large'].includes(appearance.size) ? appearance.size : 'medium';
|
|
294
|
+
|
|
295
|
+
const layers = [];
|
|
296
|
+
const groups = [];
|
|
297
|
+
for (const name of pkg.LAYERS) {
|
|
298
|
+
const shapes = sheet[name] || [];
|
|
299
|
+
layers.push({ name, shapes: shapes.length });
|
|
300
|
+
if (!shapes.length) continue;
|
|
301
|
+
const body = shapes.map((s) => renderShape(s, name)).join('');
|
|
302
|
+
groups.push(`<g class="avatar-layer avatar-${name}" data-layer="${name}">${body}</g>`);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const svg =
|
|
306
|
+
`<svg class="avatar-svg" viewBox="0 0 200 268" xmlns="http://www.w3.org/2000/svg" ` +
|
|
307
|
+
`aria-hidden="true" focusable="false" role="presentation" ` +
|
|
308
|
+
`data-motion="${motion}" data-size="${size}" data-frame="${frameId}" ` +
|
|
309
|
+
`data-palette="${paletteId}" data-expression="${expressionId}">` +
|
|
310
|
+
`<rect class="avatar-bg" x="0" y="0" width="200" height="268" rx="24" fill="${colorFor('bg')}"/>` +
|
|
311
|
+
groups.join('') +
|
|
312
|
+
'</svg>';
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
svg,
|
|
316
|
+
layers,
|
|
317
|
+
warnings,
|
|
318
|
+
missing,
|
|
319
|
+
expression: expressionId,
|
|
320
|
+
expressionLabel: expression.label || expressionId,
|
|
321
|
+
palette: paletteId,
|
|
322
|
+
frame: frameId,
|
|
323
|
+
hair: hair === pkg.HAIR[presentation.hair] ? presentation.hair : 'bob-2',
|
|
324
|
+
motion,
|
|
325
|
+
size,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const API = Object.freeze({ assemble, shade });
|
|
330
|
+
|
|
331
|
+
if (typeof module !== 'undefined' && module.exports) module.exports = API;
|
|
332
|
+
else if (typeof globalThis !== 'undefined') globalThis.AegisAvatarAssemble = API;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/* avatar.css — the avatar's presentation layer.
|
|
2
|
+
*
|
|
3
|
+
* Motion is CSS only, and it is the ONE thing in this phase that can be turned
|
|
4
|
+
* off wholesale. Two switches do that, deliberately overlapping:
|
|
5
|
+
*
|
|
6
|
+
* 1. `data-motion` on the <svg>, set by renderer/avatar/assemble.js from
|
|
7
|
+
* `persona.appliesMotion(persona, prefersReducedMotion)` — so the persona
|
|
8
|
+
* cannot opt out of the accessibility preference, because the preference
|
|
9
|
+
* is an input to that function rather than a competing opinion;
|
|
10
|
+
* 2. a `prefers-reduced-motion` media query at the bottom, which kills the
|
|
11
|
+
* animations even if a stale page or a future edit leaves `data-motion`
|
|
12
|
+
* at "full". Belt and braces: the belt is the persona policy, the braces
|
|
13
|
+
* are the browser's own preference.
|
|
14
|
+
*
|
|
15
|
+
* Nothing here is load-bearing for layout, and nothing here is interactive: the
|
|
16
|
+
* SVG is `pointer-events: none` so it can never sit between a click and the
|
|
17
|
+
* control underneath it, and there are no animations on any element the user
|
|
18
|
+
* types into.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
.avatar-card {
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.avatar-stage {
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
padding: 4px 0 8px;
|
|
29
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.12));
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.avatar-stage .avatar-svg {
|
|
34
|
+
display: block;
|
|
35
|
+
width: 132px;
|
|
36
|
+
height: auto;
|
|
37
|
+
/* The face is decoration: it must never intercept a pointer, a scroll or a
|
|
38
|
+
drag — the two protected behaviours start as input events. */
|
|
39
|
+
pointer-events: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.avatar-svg[data-size='small'] { width: 96px; }
|
|
44
|
+
.avatar-svg[data-size='medium'] { width: 132px; }
|
|
45
|
+
.avatar-svg[data-size='large'] { width: 176px; }
|
|
46
|
+
|
|
47
|
+
.avatar-card[data-docked='false'] .avatar-stage { display: none; }
|
|
48
|
+
|
|
49
|
+
.avatar-readout {
|
|
50
|
+
margin: 6px 0 10px;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
line-height: 1.5;
|
|
53
|
+
color: var(--text-dim, #9aa4b2);
|
|
54
|
+
overflow-wrap: anywhere;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.avatar-row {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 8px;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
margin: 4px 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.avatar-level {
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
letter-spacing: 0.02em;
|
|
68
|
+
color: var(--text, #e7edf5);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.avatar-tier {
|
|
72
|
+
opacity: 0.75;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.avatar-bar {
|
|
76
|
+
flex: 1;
|
|
77
|
+
height: 8px;
|
|
78
|
+
border-radius: 999px;
|
|
79
|
+
background: rgba(255, 255, 255, 0.08);
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.avatar-xp-fill {
|
|
84
|
+
display: block;
|
|
85
|
+
height: 100%;
|
|
86
|
+
width: 0;
|
|
87
|
+
border-radius: 999px;
|
|
88
|
+
background: var(--accent, #f0a83c);
|
|
89
|
+
transition: width 0.4s ease-out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* §1.4: a held level is not a normal bar. Marked, and the readout says why. */
|
|
93
|
+
.avatar-xp-fill[data-held='true'] {
|
|
94
|
+
background: repeating-linear-gradient(45deg, var(--accent, #f0a83c) 0 6px, rgba(255, 255, 255, 0.25) 6px 12px);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.avatar-held {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
padding: 1px 6px;
|
|
100
|
+
border-radius: 999px;
|
|
101
|
+
font-size: 11px;
|
|
102
|
+
background: rgba(240, 168, 60, 0.18);
|
|
103
|
+
color: var(--accent, #f0a83c);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.avatar-next,
|
|
107
|
+
.avatar-unlock-note,
|
|
108
|
+
.avatar-source-note {
|
|
109
|
+
margin: 4px 0 0;
|
|
110
|
+
font-size: 11px;
|
|
111
|
+
line-height: 1.45;
|
|
112
|
+
color: var(--text-dim, #9aa4b2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.avatar-expression {
|
|
116
|
+
font-size: 11px;
|
|
117
|
+
opacity: 0.8;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.avatar-pane {
|
|
121
|
+
max-height: 0;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
transition: max-height 0.25s ease-out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.avatar-card[data-pane='open'] .avatar-pane {
|
|
127
|
+
max-height: 1400px;
|
|
128
|
+
overflow: visible;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.avatar-group {
|
|
132
|
+
border-top: 1px solid rgba(255, 255, 255, 0.07);
|
|
133
|
+
padding: 8px 0 4px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.avatar-group-title {
|
|
137
|
+
font-size: 11px;
|
|
138
|
+
text-transform: uppercase;
|
|
139
|
+
letter-spacing: 0.08em;
|
|
140
|
+
opacity: 0.6;
|
|
141
|
+
margin-bottom: 6px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.avatar-field {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 6px;
|
|
148
|
+
margin: 3px 0;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.avatar-label {
|
|
153
|
+
flex: 0 0 42%;
|
|
154
|
+
opacity: 0.85;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.avatar-field select,
|
|
158
|
+
.avatar-field input[type='text'],
|
|
159
|
+
.avatar-field input[type='number'] {
|
|
160
|
+
flex: 1;
|
|
161
|
+
min-width: 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.avatar-field input[type='color'] {
|
|
165
|
+
flex: 0 0 36px;
|
|
166
|
+
height: 22px;
|
|
167
|
+
padding: 0;
|
|
168
|
+
border: none;
|
|
169
|
+
background: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.avatar-value,
|
|
173
|
+
.avatar-field-note {
|
|
174
|
+
font-size: 11px;
|
|
175
|
+
opacity: 0.7;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.avatar-field-note:not(:empty) {
|
|
179
|
+
color: var(--warn, #f0a83c);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.avatar-check {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 6px;
|
|
186
|
+
font-size: 12px;
|
|
187
|
+
margin: 2px 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.avatar-pane-status {
|
|
191
|
+
margin: 6px 0 0;
|
|
192
|
+
font-size: 11px;
|
|
193
|
+
opacity: 0.75;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* ── motion ───────────────────────────────────────────────────────────────
|
|
197
|
+
Three tiers, keyed off the attribute the assembler writes:
|
|
198
|
+
full — breathing, blink, sway, sparks
|
|
199
|
+
reduced — opacity shimmer only (no movement of anything)
|
|
200
|
+
minimal — nothing at all
|
|
201
|
+
`prefers-reduced-motion` at the end forces `minimal` behaviour regardless. */
|
|
202
|
+
|
|
203
|
+
@keyframes avatar-breathe {
|
|
204
|
+
0%, 100% { transform: translateY(0); }
|
|
205
|
+
50% { transform: translateY(-2px); }
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes avatar-sway {
|
|
209
|
+
0%, 100% { transform: rotate(-1.1deg); }
|
|
210
|
+
50% { transform: rotate(1.1deg); }
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@keyframes avatar-blink {
|
|
214
|
+
0%, 92%, 100% { opacity: 1; }
|
|
215
|
+
95% { opacity: 0.15; }
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@keyframes avatar-spark {
|
|
219
|
+
0% { opacity: 0; transform: translateY(4px); }
|
|
220
|
+
50% { opacity: 0.9; }
|
|
221
|
+
100% { opacity: 0; transform: translateY(-6px); }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.avatar-svg[data-motion='full'] .avatar-body,
|
|
225
|
+
.avatar-svg[data-motion='full'] .avatar-head {
|
|
226
|
+
animation: avatar-breathe 5.5s ease-in-out infinite;
|
|
227
|
+
transform-origin: 100px 200px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.avatar-svg[data-motion='full'] .avatar-hairBack,
|
|
231
|
+
.avatar-svg[data-motion='full'] .avatar-hairFront {
|
|
232
|
+
animation: avatar-sway 7s ease-in-out infinite;
|
|
233
|
+
transform-origin: 100px 60px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.avatar-svg[data-motion='full'] .avatar-face {
|
|
237
|
+
animation: avatar-blink 6.5s steps(1, end) infinite;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.avatar-svg[data-motion='full'] .avatar-effect {
|
|
241
|
+
animation: avatar-spark 1.6s ease-out infinite;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.avatar-svg[data-motion='reduced'] .avatar-effect {
|
|
245
|
+
animation: avatar-blink 2.4s ease-in-out infinite;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.avatar-svg[data-motion='minimal'] .avatar-layer,
|
|
249
|
+
.avatar-svg[data-motion='minimal'] .avatar-svg {
|
|
250
|
+
animation: none !important;
|
|
251
|
+
transition: none !important;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@media (prefers-reduced-motion: reduce) {
|
|
255
|
+
.avatar-svg .avatar-layer,
|
|
256
|
+
.avatar-xp-fill {
|
|
257
|
+
animation: none !important;
|
|
258
|
+
transition: none !important;
|
|
259
|
+
}
|
|
260
|
+
}
|