@nadicodeai/ui 8.5.0 → 9.0.0
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/AGENTS.md +1 -1
- package/LICENSES/THINKING-ORBS-MIT.txt +21 -0
- package/NOTICE +7 -10
- package/dist/components/agent-orb-appearance.d.ts +54 -0
- package/dist/components/agent-orb-appearance.d.ts.map +1 -0
- package/dist/components/agent-orb-appearance.js +87 -0
- package/dist/components/agent-orb.d.ts +5 -3
- package/dist/components/agent-orb.d.ts.map +1 -1
- package/dist/eslint/index.js +4 -0
- package/dist/eslint/rules/expect-chain.js +60 -0
- package/dist/eslint/rules/no-existence-only-assertion.js +89 -0
- package/dist/eslint/rules/no-subject-derived-expectation.js +129 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/internal/agent-orb-motion.d.ts +3 -3
- package/dist/internal/agent-orb-motion.d.ts.map +1 -1
- package/dist/internal/agent-orb-motion.js +1 -0
- package/dist/internal/agent-orb.d.ts +11 -1
- package/dist/internal/agent-orb.d.ts.map +1 -1
- package/dist/internal/agent-orb.js +80 -5
- package/docs/agent-orb.md +47 -14
- package/docs/contract.md +8 -29
- package/docs/migration/9.0.0.md +35 -0
- package/package.json +2 -3
- package/LICENSES/PAPER-SHADERS-APACHE-2.0.txt +0 -186
- package/dist/components/agent-visual.d.ts +0 -17
- package/dist/components/agent-visual.d.ts.map +0 -1
- package/dist/components/agent-visual.js +0 -63
- package/dist/components/forma-appearance.d.ts +0 -13
- package/dist/components/forma-appearance.d.ts.map +0 -1
- package/dist/components/forma-appearance.js +0 -11
- package/dist/components/forma-avatar.d.ts +0 -23
- package/dist/components/forma-avatar.d.ts.map +0 -1
- package/dist/components/forma-avatar.js +0 -95
- package/dist/internal/agent-visual/color.d.ts +0 -4
- package/dist/internal/agent-visual/color.d.ts.map +0 -1
- package/dist/internal/agent-visual/color.js +0 -78
- package/dist/internal/agent-visual/poster.d.ts +0 -6
- package/dist/internal/agent-visual/poster.d.ts.map +0 -1
- package/dist/internal/agent-visual/poster.js +0 -35
- package/dist/internal/agent-visual/recipes.d.ts +0 -15
- package/dist/internal/agent-visual/recipes.d.ts.map +0 -1
- package/dist/internal/agent-visual/recipes.js +0 -72
- package/dist/internal/agent-visual/renderer.d.ts +0 -10
- package/dist/internal/agent-visual/renderer.d.ts.map +0 -1
- package/dist/internal/agent-visual/renderer.js +0 -112
- package/dist/internal/agent-visual/shader.d.ts +0 -2
- package/dist/internal/agent-visual/shader.d.ts.map +0 -1
- package/dist/internal/agent-visual/shader.js +0 -158
- package/dist/internal/forma/frame.d.ts +0 -10
- package/dist/internal/forma/frame.d.ts.map +0 -1
- package/dist/internal/forma/frame.js +0 -211
- package/dist/internal/forma/geometry.d.ts +0 -41
- package/dist/internal/forma/geometry.d.ts.map +0 -1
- package/dist/internal/forma/geometry.js +0 -235
- package/dist/internal/forma/hallmark.d.ts +0 -5
- package/dist/internal/forma/hallmark.d.ts.map +0 -1
- package/dist/internal/forma/hallmark.js +0 -4
- package/dist/internal/forma/model.d.ts +0 -53
- package/dist/internal/forma/model.d.ts.map +0 -1
- package/dist/internal/forma/model.js +0 -70
- package/dist/internal/forma/motion.d.ts +0 -42
- package/dist/internal/forma/motion.d.ts.map +0 -1
- package/dist/internal/forma/motion.js +0 -194
- package/dist/internal/forma/rig.d.ts +0 -10
- package/dist/internal/forma/rig.d.ts.map +0 -1
- package/dist/internal/forma/rig.js +0 -211
- package/dist/internal/forma/still.d.ts +0 -4
- package/dist/internal/forma/still.d.ts.map +0 -1
- package/dist/internal/forma/still.js +0 -8
- package/dist/internal/forma/stored-appearance.d.ts +0 -29
- package/dist/internal/forma/stored-appearance.d.ts.map +0 -1
- package/dist/internal/forma/stored-appearance.js +0 -53
- package/docs/agent-visual.md +0 -114
- package/docs/forma-avatar.md +0 -110
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export const ITALY_PATH = "M188.4,46.1L207.3,52.6L210.9,43.9L241.6,36L248.6,51.8L293.1,63.5L289.7,85.7L297.1,104.7L272.4,98.2L247.1,114L248.8,135.9L245,148.4L255.2,170.5L284.4,192.2L300,227.5L334.6,261.4L359,261.1L366.6,270.4L357.8,278.7L385.7,293.6L408.5,306.1L435.2,327.5L438.4,335.1L432.6,349.6L415.4,330.7L388.3,324L375.2,350.3L397.7,365.2L394,386.2L381,388.5L364.4,422.6L351.5,425.6L351.6,413.5L357.9,392.2L364.7,383.7L352.5,360.4L343,340L330.1,334.9L321,317.3L301,309.9L287.5,293.3L264.5,290.6L240.2,271.9L211.7,244.6L190.6,220.2L180.9,177.9L165.4,172.9L140.1,158.6L125.8,164.4L107.8,184.5L94.9,187.7L98.4,168.9L81.6,163.4L73.6,129.6L84.3,116.1L75.2,99.5L76.5,86.9L89.9,96.4L104.9,94.3L122.3,79.1L127.7,86.2L142.5,84.8L149.2,66.7L172.3,72.3L186,64.7ZM322.8,416.3L346.4,412.9L335.2,443.9L339.8,456L333.3,476L309.5,461.4L293.7,457.2L250.3,437.3L254.6,417L291,420.6ZM134.5,305.2L150.1,292.4L168.7,321.6L164.4,375.2L150.2,372.6L137.5,386L125.8,375.4L124.5,326.6L117.4,303.1Z";
|
|
2
|
-
export const ITALY_BOX = 512;
|
|
3
|
-
export const HALLMARK_SIZE = 0.39;
|
|
4
|
-
export const HALLMARK_LONGITUDE = 1.24;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export declare const formaForms: readonly ["nadia", "goccia", "nuvola", "triangolo", "esagono", "quadrato", "pillola", "uovo"];
|
|
2
|
-
export type FormaForm = (typeof formaForms)[number];
|
|
3
|
-
/** The forms a customer may choose; Nadia's is reserved for the root Agent. */
|
|
4
|
-
export declare const formaChoices: ("goccia" | "nuvola" | "triangolo" | "esagono" | "quadrato" | "pillola" | "uovo")[];
|
|
5
|
-
export type FormaChoice = (typeof formaChoices)[number];
|
|
6
|
-
export declare const formaStates: readonly ["idle", "working", "thinking", "waiting", "blocked", "done"];
|
|
7
|
-
export type FormaState = (typeof formaStates)[number];
|
|
8
|
-
export type FormaView = "front" | "side";
|
|
9
|
-
export declare const formaColors: readonly ["verde", "cobalto", "rosso", "arancio", "giallo", "avorio"];
|
|
10
|
-
export type FormaColor = (typeof formaColors)[number];
|
|
11
|
-
/** The CSS custom property that carries each shell colour. */
|
|
12
|
-
export declare const formaColorVariable: Record<FormaColor, string>;
|
|
13
|
-
/** The three pigments that sweep a completion, the shell's own leading. */
|
|
14
|
-
export declare const celebrationColors: Record<FormaColor, readonly [FormaColor, FormaColor, FormaColor]>;
|
|
15
|
-
export type FormaVisor = "black" | "ivory";
|
|
16
|
-
export type FormaEyeTone = "light" | "ink";
|
|
17
|
-
export interface FormDetail {
|
|
18
|
-
name: string;
|
|
19
|
-
/** The shell colour a form wears until the customer picks one. */
|
|
20
|
-
pigment: FormaColor;
|
|
21
|
-
/** The visor fill, and the tone the eyes take against it. */
|
|
22
|
-
visor: FormaVisor;
|
|
23
|
-
eyes: FormaEyeTone;
|
|
24
|
-
}
|
|
25
|
-
export declare const formDetails: Record<FormaForm, FormDetail>;
|
|
26
|
-
/** The form an Agent wears until a customer chooses one. */
|
|
27
|
-
export declare const defaultForm: FormaChoice;
|
|
28
|
-
export interface FormaOptions {
|
|
29
|
-
form: FormaForm;
|
|
30
|
-
/** Shell colour. Nadia always keeps her tricolour. */
|
|
31
|
-
color?: FormaColor;
|
|
32
|
-
state?: FormaState;
|
|
33
|
-
/** CSS pixels, 12 through 512. Default 32. */
|
|
34
|
-
size?: number;
|
|
35
|
-
/** Hold a deterministic still. Default false. */
|
|
36
|
-
paused?: boolean;
|
|
37
|
-
/** Turn to show the flank. Waiting and blocked always face forward. */
|
|
38
|
-
view?: FormaView;
|
|
39
|
-
/** Changing this key replays a gesture even if the state is unchanged. */
|
|
40
|
-
motionKey?: string | number;
|
|
41
|
-
}
|
|
42
|
-
export interface ResolvedFormaOptions {
|
|
43
|
-
form: FormaForm;
|
|
44
|
-
color?: FormaColor;
|
|
45
|
-
state: FormaState;
|
|
46
|
-
size: number;
|
|
47
|
-
paused: boolean;
|
|
48
|
-
view: FormaView;
|
|
49
|
-
motionKey?: string | number;
|
|
50
|
-
}
|
|
51
|
-
export declare function resolveFormaOptions(options: FormaOptions): ResolvedFormaOptions;
|
|
52
|
-
export declare function shellColor(options: Pick<ResolvedFormaOptions, "form" | "color">): FormaColor;
|
|
53
|
-
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/internal/forma/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,+FASb,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,+EAA+E;AAC/E,eAAO,MAAM,YAAY,qFAExB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW,wEAAyE,CAAC;AAClG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC,eAAO,MAAM,WAAW,uEAAwE,CAAC;AACjG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAOzD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAQ7F,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAC3C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAE3C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,EAAE,UAAU,CAAC;IACpB,6DAA6D;IAC7D,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,CASrD,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,WAAW,EAAE,WAAoB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,sDAAsD;IACtD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,oBAAoB,CAoB/E;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,UAAU,CAE5F"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export const formaForms = [
|
|
2
|
-
"nadia",
|
|
3
|
-
"goccia",
|
|
4
|
-
"nuvola",
|
|
5
|
-
"triangolo",
|
|
6
|
-
"esagono",
|
|
7
|
-
"quadrato",
|
|
8
|
-
"pillola",
|
|
9
|
-
"uovo",
|
|
10
|
-
];
|
|
11
|
-
/** The forms a customer may choose; Nadia's is reserved for the root Agent. */
|
|
12
|
-
export const formaChoices = formaForms.filter((form) => form !== "nadia");
|
|
13
|
-
export const formaStates = ["idle", "working", "thinking", "waiting", "blocked", "done"];
|
|
14
|
-
export const formaColors = ["verde", "cobalto", "rosso", "arancio", "giallo", "avorio"];
|
|
15
|
-
/** The CSS custom property that carries each shell colour. */
|
|
16
|
-
export const formaColorVariable = {
|
|
17
|
-
verde: "--nc-identity-verde",
|
|
18
|
-
cobalto: "--nc-identity-cobalto",
|
|
19
|
-
rosso: "--nc-identity-rosso",
|
|
20
|
-
arancio: "--nc-identity-arancio",
|
|
21
|
-
giallo: "--nc-identity-giallo",
|
|
22
|
-
avorio: "--nc-forma-avorio",
|
|
23
|
-
};
|
|
24
|
-
/** The three pigments that sweep a completion, the shell's own leading. */
|
|
25
|
-
export const celebrationColors = {
|
|
26
|
-
verde: ["verde", "cobalto", "giallo"],
|
|
27
|
-
cobalto: ["cobalto", "verde", "giallo"],
|
|
28
|
-
rosso: ["rosso", "arancio", "giallo"],
|
|
29
|
-
arancio: ["arancio", "rosso", "giallo"],
|
|
30
|
-
giallo: ["giallo", "verde", "cobalto"],
|
|
31
|
-
avorio: ["avorio", "cobalto", "verde"],
|
|
32
|
-
};
|
|
33
|
-
export const formDetails = {
|
|
34
|
-
nadia: { name: "Nadia", pigment: "verde", visor: "black", eyes: "light" },
|
|
35
|
-
goccia: { name: "Goccia", pigment: "rosso", visor: "black", eyes: "light" },
|
|
36
|
-
nuvola: { name: "Nuvola", pigment: "cobalto", visor: "ivory", eyes: "ink" },
|
|
37
|
-
triangolo: { name: "Triangolo", pigment: "verde", visor: "ivory", eyes: "ink" },
|
|
38
|
-
esagono: { name: "Esagono", pigment: "giallo", visor: "black", eyes: "light" },
|
|
39
|
-
quadrato: { name: "Quadrato", pigment: "arancio", visor: "ivory", eyes: "ink" },
|
|
40
|
-
pillola: { name: "Pillola", pigment: "verde", visor: "black", eyes: "light" },
|
|
41
|
-
uovo: { name: "Uovo", pigment: "cobalto", visor: "black", eyes: "light" },
|
|
42
|
-
};
|
|
43
|
-
/** The form an Agent wears until a customer chooses one. */
|
|
44
|
-
export const defaultForm = "uovo";
|
|
45
|
-
export function resolveFormaOptions(options) {
|
|
46
|
-
if (!formaForms.includes(options.form))
|
|
47
|
-
throw new TypeError("Unknown Forma avatar form");
|
|
48
|
-
if (options.color !== undefined && !formaColors.includes(options.color))
|
|
49
|
-
throw new TypeError("Unknown Forma avatar colour");
|
|
50
|
-
const state = options.state ?? "idle";
|
|
51
|
-
if (!formaStates.includes(state))
|
|
52
|
-
throw new TypeError("Unknown Forma avatar state");
|
|
53
|
-
const size = options.size ?? 32;
|
|
54
|
-
if (!Number.isFinite(size) || size < 12 || size > 512)
|
|
55
|
-
throw new RangeError("Forma avatar size must be 12–512 CSS pixels");
|
|
56
|
-
if (options.view !== undefined && options.view !== "front" && options.view !== "side")
|
|
57
|
-
throw new TypeError("Unknown Forma avatar view");
|
|
58
|
-
return {
|
|
59
|
-
form: options.form,
|
|
60
|
-
color: options.form === "nadia" ? undefined : options.color,
|
|
61
|
-
state,
|
|
62
|
-
size,
|
|
63
|
-
paused: options.paused ?? false,
|
|
64
|
-
view: state === "waiting" || state === "blocked" ? "front" : (options.view ?? "front"),
|
|
65
|
-
motionKey: options.motionKey,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export function shellColor(options) {
|
|
69
|
-
return options.form === "nadia" ? "verde" : (options.color ?? formDetails[options.form].pigment);
|
|
70
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ResolvedFormaOptions } from "./model.js";
|
|
2
|
-
export declare const easeOut: (x: number) => number;
|
|
3
|
-
export declare const easeInOut: (x: number) => number;
|
|
4
|
-
declare function makePose(): {
|
|
5
|
-
yaw: number;
|
|
6
|
-
pitch: number;
|
|
7
|
-
roll: number;
|
|
8
|
-
lift: number;
|
|
9
|
-
stretch: number;
|
|
10
|
-
open: number;
|
|
11
|
-
gazeX: number;
|
|
12
|
-
gazeY: number;
|
|
13
|
-
morph: number;
|
|
14
|
-
working: number;
|
|
15
|
-
waiting: number;
|
|
16
|
-
thinking: number;
|
|
17
|
-
done: number;
|
|
18
|
-
};
|
|
19
|
-
export type Pose = ReturnType<typeof makePose>;
|
|
20
|
-
type SpringChannel = "pitch" | "roll" | "lift" | "stretch";
|
|
21
|
-
export interface FormaMotion extends ResolvedFormaOptions {
|
|
22
|
-
pose: Pose;
|
|
23
|
-
velocity: Record<SpringChannel, number>;
|
|
24
|
-
pointer: {
|
|
25
|
-
x: number;
|
|
26
|
-
y: number;
|
|
27
|
-
};
|
|
28
|
-
started: number;
|
|
29
|
-
entered: number;
|
|
30
|
-
lastTime: number;
|
|
31
|
-
celebratedAt: number;
|
|
32
|
-
skipEntry: boolean;
|
|
33
|
-
snap: boolean;
|
|
34
|
-
still: boolean;
|
|
35
|
-
}
|
|
36
|
-
export declare function createMotion(options: ResolvedFormaOptions, now: number): FormaMotion;
|
|
37
|
-
export declare function updateMotion(motion: FormaMotion, options: ResolvedFormaOptions, now: number): void;
|
|
38
|
-
export declare function needsMotion(motion: FormaMotion, now: number): boolean;
|
|
39
|
-
export declare function settled(motion: FormaMotion, now: number): boolean;
|
|
40
|
-
export declare function stepPose(motion: FormaMotion, now: number, dt: number): Pose;
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../../src/internal/forma/motion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAqBpD,eAAO,MAAM,OAAO,MAhBP,MAAM,KAAG,MAgByB,CAAC;AAChD,eAAO,MAAM,SAAS,MAjBT,MAAM,KAAG,MAiB4B,CAAC;AAEnD,iBAAS,QAAQ;;;;;;;;;;;;;;EAgBhB;AACD,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC/C,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACvD,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAcpF;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,EAAE,MAAM,GACV,IAAI,CAYN;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAOrE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQjE;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAsG3E"}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { TAU, clamp, mix } from "./geometry.js";
|
|
2
|
-
function bezier(x1, y1, x2, y2) {
|
|
3
|
-
const coordinate = (t, a, b) => 3 * (1 - t) * (1 - t) * t * a + 3 * (1 - t) * t * t * b + t * t * t;
|
|
4
|
-
return (x) => {
|
|
5
|
-
const target = clamp(x, 0, 1);
|
|
6
|
-
let low = 0;
|
|
7
|
-
let high = 1;
|
|
8
|
-
let t = target;
|
|
9
|
-
for (let i = 0; i < 12; i++) {
|
|
10
|
-
if (coordinate(t, x1, x2) < target)
|
|
11
|
-
low = t;
|
|
12
|
-
else
|
|
13
|
-
high = t;
|
|
14
|
-
t = (low + high) / 2;
|
|
15
|
-
}
|
|
16
|
-
return coordinate(t, y1, y2);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const SPRING_STIFFNESS = 100;
|
|
20
|
-
const SPRING_DAMPING = 10;
|
|
21
|
-
export const easeOut = bezier(0.23, 1, 0.32, 1);
|
|
22
|
-
export const easeInOut = bezier(0.77, 0, 0.175, 1);
|
|
23
|
-
function makePose() {
|
|
24
|
-
return {
|
|
25
|
-
yaw: -0.16,
|
|
26
|
-
pitch: 0.02,
|
|
27
|
-
roll: 0,
|
|
28
|
-
lift: 0,
|
|
29
|
-
stretch: 1,
|
|
30
|
-
open: 1,
|
|
31
|
-
gazeX: 0,
|
|
32
|
-
gazeY: 0,
|
|
33
|
-
morph: 0,
|
|
34
|
-
working: 0,
|
|
35
|
-
waiting: 0,
|
|
36
|
-
thinking: 0,
|
|
37
|
-
done: 0,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export function createMotion(options, now) {
|
|
41
|
-
return {
|
|
42
|
-
...options,
|
|
43
|
-
pose: makePose(),
|
|
44
|
-
velocity: { pitch: 0, roll: 0, lift: 0, stretch: 0 },
|
|
45
|
-
pointer: { x: 0, y: 0 },
|
|
46
|
-
started: now,
|
|
47
|
-
entered: now,
|
|
48
|
-
lastTime: now,
|
|
49
|
-
celebratedAt: -Infinity,
|
|
50
|
-
skipEntry: true,
|
|
51
|
-
snap: true,
|
|
52
|
-
still: options.paused,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export function updateMotion(motion, options, now) {
|
|
56
|
-
const formChanged = options.form !== motion.form;
|
|
57
|
-
const event = options.state !== motion.state || options.motionKey !== motion.motionKey;
|
|
58
|
-
if (formChanged)
|
|
59
|
-
Object.assign(motion, createMotion(options, now));
|
|
60
|
-
else if (event) {
|
|
61
|
-
motion.entered = now;
|
|
62
|
-
motion.skipEntry = options.paused;
|
|
63
|
-
motion.celebratedAt = options.state === "done" && !options.paused ? now : -Infinity;
|
|
64
|
-
}
|
|
65
|
-
if (options.paused !== motion.paused || options.view !== motion.view)
|
|
66
|
-
motion.snap = options.paused;
|
|
67
|
-
Object.assign(motion, options);
|
|
68
|
-
}
|
|
69
|
-
export function needsMotion(motion, now) {
|
|
70
|
-
if (motion.still)
|
|
71
|
-
return false;
|
|
72
|
-
const age = now - motion.entered;
|
|
73
|
-
if (motion.state === "waiting")
|
|
74
|
-
return age < 900;
|
|
75
|
-
if (motion.state === "blocked")
|
|
76
|
-
return age < 1000;
|
|
77
|
-
if (motion.state === "done")
|
|
78
|
-
return !motion.skipEntry && age < 2500;
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
export function settled(motion, now) {
|
|
82
|
-
const t = (now - motion.entered) / 1000;
|
|
83
|
-
return (motion.still ||
|
|
84
|
-
(motion.state === "done" && (motion.skipEntry || t >= 2.45)) ||
|
|
85
|
-
(motion.state === "waiting" && t >= 0.85) ||
|
|
86
|
-
(motion.state === "blocked" && t >= 1));
|
|
87
|
-
}
|
|
88
|
-
export function stepPose(motion, now, dt) {
|
|
89
|
-
const { pose, velocity, state: current, still } = motion;
|
|
90
|
-
const t = (now - motion.entered) / 1000;
|
|
91
|
-
const clock = (now - motion.started) / 1000;
|
|
92
|
-
const point = motion.pointer;
|
|
93
|
-
const instant = still ||
|
|
94
|
-
motion.snap ||
|
|
95
|
-
(current === "waiting" && t > 0.85) ||
|
|
96
|
-
(current === "blocked" && t >= 1) ||
|
|
97
|
-
(current === "done" && t >= 2.45);
|
|
98
|
-
const blend = instant ? 1 : 1 - Math.exp(-12 * dt);
|
|
99
|
-
motion.snap = false;
|
|
100
|
-
const target = makePose();
|
|
101
|
-
if (current === "working")
|
|
102
|
-
Object.assign(target, { yaw: 0, pitch: 0.16, open: 0.76, gazeY: -0.04, working: 1 });
|
|
103
|
-
if (current === "waiting")
|
|
104
|
-
Object.assign(target, { yaw: 0, pitch: -0.025, open: 1.1, gazeY: 0, waiting: 1 });
|
|
105
|
-
if (current === "thinking")
|
|
106
|
-
Object.assign(target, {
|
|
107
|
-
yaw: 0.15,
|
|
108
|
-
pitch: -0.17,
|
|
109
|
-
roll: -0.09,
|
|
110
|
-
lift: 0.025,
|
|
111
|
-
open: 0.96,
|
|
112
|
-
gazeX: 0.065,
|
|
113
|
-
gazeY: 0.075,
|
|
114
|
-
thinking: 1,
|
|
115
|
-
});
|
|
116
|
-
if (current === "done")
|
|
117
|
-
Object.assign(target, { yaw: 0, pitch: -0.015, open: 0.24, gazeY: 0.018, done: 1 });
|
|
118
|
-
if (current === "blocked")
|
|
119
|
-
Object.assign(target, { yaw: 0, pitch: 0, morph: 1, open: 0.4 });
|
|
120
|
-
if (!still) {
|
|
121
|
-
if (current === "idle") {
|
|
122
|
-
target.yaw += Math.sin(t * 0.7) * 0.018 + point.x * 0.9;
|
|
123
|
-
target.pitch += point.y * 0.5;
|
|
124
|
-
target.gazeX = point.x * 0.11;
|
|
125
|
-
target.gazeY = -point.y * 0.07;
|
|
126
|
-
target.lift = Math.sin(t * 1.1) * 0.009;
|
|
127
|
-
}
|
|
128
|
-
if (current === "working") {
|
|
129
|
-
const scan = Math.sin((clock * TAU) / 3.2);
|
|
130
|
-
const beat = Math.sin((clock * TAU) / 1.05);
|
|
131
|
-
target.gazeX = scan * 0.085;
|
|
132
|
-
target.yaw = scan * 0.15;
|
|
133
|
-
target.roll = -scan * 0.036;
|
|
134
|
-
target.pitch += beat * 0.033;
|
|
135
|
-
target.lift = 0.015 * beat;
|
|
136
|
-
target.open += beat * 0.08;
|
|
137
|
-
if (!motion.skipEntry && t < 0.5) {
|
|
138
|
-
const acknowledge = Math.sin((t / 0.5) * Math.PI);
|
|
139
|
-
target.pitch += 0.17 * acknowledge;
|
|
140
|
-
target.lift -= 0.065 * acknowledge;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (current === "thinking") {
|
|
144
|
-
const consider = Math.sin((clock * TAU) / 4.6);
|
|
145
|
-
target.yaw += consider * 0.07;
|
|
146
|
-
target.roll += consider * 0.035;
|
|
147
|
-
target.gazeX += consider * 0.019;
|
|
148
|
-
target.lift += consider * 0.015;
|
|
149
|
-
}
|
|
150
|
-
if (current === "done" && !motion.skipEntry && t < 1.65) {
|
|
151
|
-
const windup = 1 - easeOut((t - 0.2) / 0.16);
|
|
152
|
-
target.yaw = -0.16 * windup + TAU * easeInOut((t - 0.2) / 0.78);
|
|
153
|
-
target.pitch = 0.13 * windup - 0.07 * Math.sin(clamp((t - 0.2) / 0.78, 0, 1) * Math.PI);
|
|
154
|
-
target.roll = -0.11 * windup + 0.12 * Math.sin(clamp((t - 0.2) / 0.88, 0, 1) * TAU);
|
|
155
|
-
if (t < 0.2)
|
|
156
|
-
target.lift = -0.07 * easeOut(t / 0.2);
|
|
157
|
-
else if (t < 0.53)
|
|
158
|
-
target.lift = mix(-0.07, 0.24, easeOut((t - 0.2) / 0.33));
|
|
159
|
-
else if (t < 0.98)
|
|
160
|
-
target.lift = 0.24 * (1 - easeInOut((t - 0.53) / 0.45));
|
|
161
|
-
else
|
|
162
|
-
target.lift = 0.042 * Math.sin(clamp((t - 0.98) / 0.4, 0, 1) * Math.PI);
|
|
163
|
-
target.stretch =
|
|
164
|
-
1 - 0.032 * windup + 0.024 * Math.sin(clamp((t - 0.2) / 0.78, 0, 1) * Math.PI);
|
|
165
|
-
}
|
|
166
|
-
if (current === "working" || current === "thinking") {
|
|
167
|
-
target.yaw += point.x * 0.45;
|
|
168
|
-
target.pitch += point.y * 0.2;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (motion.view === "side")
|
|
172
|
-
Object.assign(target, { yaw: -1.2, pitch: 0.02, roll: 0, gazeX: 0, gazeY: 0 });
|
|
173
|
-
target.yaw =
|
|
174
|
-
pose.yaw + Math.atan2(Math.sin(target.yaw - pose.yaw), Math.cos(target.yaw - pose.yaw));
|
|
175
|
-
for (const key of Object.keys(pose)) {
|
|
176
|
-
if (key in velocity && !instant) {
|
|
177
|
-
const channel = key;
|
|
178
|
-
const steps = Math.max(1, Math.ceil(dt * 120));
|
|
179
|
-
const step = dt / steps;
|
|
180
|
-
for (let i = 0; i < steps; i++) {
|
|
181
|
-
velocity[channel] +=
|
|
182
|
-
(SPRING_STIFFNESS * (target[key] - pose[key]) - SPRING_DAMPING * velocity[channel]) *
|
|
183
|
-
step;
|
|
184
|
-
pose[key] += velocity[channel] * step;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
pose[key] = mix(pose[key], target[key], blend);
|
|
189
|
-
if (key in velocity)
|
|
190
|
-
velocity[key] = 0;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return pose;
|
|
194
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ResolvedFormaOptions } from "./model.js";
|
|
2
|
-
export interface FormaHandle {
|
|
3
|
-
update(options: ResolvedFormaOptions): void;
|
|
4
|
-
dispose(): void;
|
|
5
|
-
}
|
|
6
|
-
export interface FormaMountCallbacks {
|
|
7
|
-
onModeChange?: (mode: "live" | "still") => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function mountForma(svg: SVGSVGElement, options: ResolvedFormaOptions, callbacks?: FormaMountCallbacks): FormaHandle;
|
|
10
|
-
//# sourceMappingURL=rig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rig.d.ts","sourceRoot":"","sources":["../../../src/internal/forma/rig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAUpD,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC5C,OAAO,IAAI,IAAI,CAAC;CACjB;AACD,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CACjD;AAyLD,wBAAgB,UAAU,CACxB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,GAAE,mBAAwB,GAClC,WAAW,CAwCb"}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { computeFrame } from "./frame.js";
|
|
2
|
-
import { createMotion, needsMotion, settled, stepPose, updateMotion, } from "./motion.js";
|
|
3
|
-
const attributeName = (prop) => prop.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
4
|
-
function write(element, attributes) {
|
|
5
|
-
for (const prop in attributes) {
|
|
6
|
-
const value = attributes[prop] ?? "";
|
|
7
|
-
if (prop === "display") {
|
|
8
|
-
element.style.display = value;
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
const name = attributeName(prop);
|
|
12
|
-
if (element.getAttribute(name) !== value)
|
|
13
|
-
element.setAttribute(name, value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const pools = new WeakMap();
|
|
17
|
-
class Pool {
|
|
18
|
-
document;
|
|
19
|
-
entries = new Map();
|
|
20
|
-
observer;
|
|
21
|
-
reduced = typeof matchMedia === "function"
|
|
22
|
-
? matchMedia("(prefers-reduced-motion: reduce)")
|
|
23
|
-
: { matches: false, addEventListener() { }, removeEventListener() { } };
|
|
24
|
-
pointer = { x: NaN, y: NaN };
|
|
25
|
-
frame;
|
|
26
|
-
lastFrame = -Infinity;
|
|
27
|
-
constructor(document) {
|
|
28
|
-
this.document = document;
|
|
29
|
-
this.observer =
|
|
30
|
-
typeof IntersectionObserver === "undefined"
|
|
31
|
-
? undefined
|
|
32
|
-
: new IntersectionObserver((records) => {
|
|
33
|
-
for (const record of records) {
|
|
34
|
-
const entry = this.entries.get(record.target);
|
|
35
|
-
if (!entry)
|
|
36
|
-
continue;
|
|
37
|
-
if (record.isIntersecting && !entry.visible)
|
|
38
|
-
entry.motion.snap = true;
|
|
39
|
-
entry.visible = record.isIntersecting;
|
|
40
|
-
entry.dirty = true;
|
|
41
|
-
}
|
|
42
|
-
this.request();
|
|
43
|
-
}, { rootMargin: "80px" });
|
|
44
|
-
document.addEventListener("visibilitychange", this.onWake);
|
|
45
|
-
document.addEventListener("pointermove", this.onPointer, { passive: true });
|
|
46
|
-
document.addEventListener("pointerleave", this.onPointerLeave);
|
|
47
|
-
this.reduced.addEventListener("change", this.onWake);
|
|
48
|
-
window.addEventListener("resize", this.onWake);
|
|
49
|
-
}
|
|
50
|
-
onWake = () => {
|
|
51
|
-
for (const entry of this.entries.values()) {
|
|
52
|
-
entry.dirty = true;
|
|
53
|
-
entry.motion.snap = true;
|
|
54
|
-
entry.rect = null;
|
|
55
|
-
}
|
|
56
|
-
if (this.document.hidden && this.frame !== undefined) {
|
|
57
|
-
cancelAnimationFrame(this.frame);
|
|
58
|
-
this.frame = undefined;
|
|
59
|
-
}
|
|
60
|
-
this.request();
|
|
61
|
-
};
|
|
62
|
-
onPointer = (event) => {
|
|
63
|
-
if (event.pointerType === "touch")
|
|
64
|
-
return;
|
|
65
|
-
this.pointer.x = event.clientX;
|
|
66
|
-
this.pointer.y = event.clientY;
|
|
67
|
-
this.request();
|
|
68
|
-
};
|
|
69
|
-
onPointerLeave = () => {
|
|
70
|
-
this.pointer.x = NaN;
|
|
71
|
-
this.pointer.y = NaN;
|
|
72
|
-
this.request();
|
|
73
|
-
};
|
|
74
|
-
request() {
|
|
75
|
-
if (this.frame === undefined &&
|
|
76
|
-
!this.document.hidden &&
|
|
77
|
-
this.entries.size > 0 &&
|
|
78
|
-
typeof requestAnimationFrame === "function")
|
|
79
|
-
this.frame = requestAnimationFrame(this.tick);
|
|
80
|
-
}
|
|
81
|
-
aim(entry, now) {
|
|
82
|
-
const { motion } = entry;
|
|
83
|
-
if (motion.still || motion.view !== "front" || Number.isNaN(this.pointer.x)) {
|
|
84
|
-
motion.pointer.x = 0;
|
|
85
|
-
motion.pointer.y = 0;
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (!entry.rect || now - entry.rectAt > 500) {
|
|
89
|
-
entry.rect = entry.svg.getBoundingClientRect();
|
|
90
|
-
entry.rectAt = now;
|
|
91
|
-
}
|
|
92
|
-
const rect = entry.rect;
|
|
93
|
-
if (!rect.width)
|
|
94
|
-
return;
|
|
95
|
-
const cx = rect.left + rect.width / 2;
|
|
96
|
-
const cy = rect.top + rect.height / 2;
|
|
97
|
-
const reach = Math.max(rect.width, 32) * 2.5;
|
|
98
|
-
const dx = this.pointer.x - cx;
|
|
99
|
-
const dy = this.pointer.y - cy;
|
|
100
|
-
const distance = Math.hypot(dx, dy);
|
|
101
|
-
const k = Math.min(1, distance / reach) / (distance || 1);
|
|
102
|
-
motion.pointer.x = Math.max(-1, Math.min(1, dx * k));
|
|
103
|
-
motion.pointer.y = Math.max(-1, Math.min(1, dy * k));
|
|
104
|
-
}
|
|
105
|
-
tick = (now) => {
|
|
106
|
-
this.frame = undefined;
|
|
107
|
-
if (this.document.hidden)
|
|
108
|
-
return;
|
|
109
|
-
if (now - this.lastFrame < 1000 / 30) {
|
|
110
|
-
this.request();
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const dt = Math.min(0.05, Math.max(0, (now - this.lastFrame) / 1000));
|
|
114
|
-
this.lastFrame = now;
|
|
115
|
-
let again = false;
|
|
116
|
-
for (const entry of this.entries.values()) {
|
|
117
|
-
if (!entry.visible)
|
|
118
|
-
continue;
|
|
119
|
-
const { motion } = entry;
|
|
120
|
-
motion.still = motion.paused || this.reduced.matches;
|
|
121
|
-
this.aim(entry, now);
|
|
122
|
-
const moving = needsMotion(motion, now);
|
|
123
|
-
if (entry.dirty || moving || entry.terminalFrameDue) {
|
|
124
|
-
const pose = stepPose(motion, now, entry.dirty ? 0 : dt);
|
|
125
|
-
this.paint(entry, pose, now);
|
|
126
|
-
this.setMode(entry, motion.still ? "still" : "live");
|
|
127
|
-
entry.dirty = false;
|
|
128
|
-
entry.terminalFrameDue = moving;
|
|
129
|
-
}
|
|
130
|
-
again ||= needsMotion(motion, now) && !settled(motion, now);
|
|
131
|
-
if (Number.isFinite(this.pointer.x) && motion.state === "idle" && !motion.still)
|
|
132
|
-
again = true;
|
|
133
|
-
}
|
|
134
|
-
if (again)
|
|
135
|
-
this.request();
|
|
136
|
-
};
|
|
137
|
-
paint(entry, pose, now) {
|
|
138
|
-
const frame = computeFrame(entry.motion, pose, now);
|
|
139
|
-
for (const part in frame) {
|
|
140
|
-
const element = entry.parts.get(part);
|
|
141
|
-
if (element)
|
|
142
|
-
write(element, frame[part]);
|
|
143
|
-
}
|
|
144
|
-
entry.svg.dataset.state = entry.motion.state;
|
|
145
|
-
}
|
|
146
|
-
setMode(entry, mode) {
|
|
147
|
-
if (entry.svg.dataset.renderMode === mode)
|
|
148
|
-
return;
|
|
149
|
-
entry.svg.dataset.renderMode = mode;
|
|
150
|
-
entry.callbacks.onModeChange?.(mode);
|
|
151
|
-
}
|
|
152
|
-
release(svg) {
|
|
153
|
-
this.observer?.unobserve(svg);
|
|
154
|
-
this.entries.delete(svg);
|
|
155
|
-
if (this.entries.size !== 0)
|
|
156
|
-
return;
|
|
157
|
-
if (this.frame !== undefined)
|
|
158
|
-
cancelAnimationFrame(this.frame);
|
|
159
|
-
this.observer?.disconnect();
|
|
160
|
-
this.document.removeEventListener("visibilitychange", this.onWake);
|
|
161
|
-
this.document.removeEventListener("pointermove", this.onPointer);
|
|
162
|
-
this.document.removeEventListener("pointerleave", this.onPointerLeave);
|
|
163
|
-
this.reduced.removeEventListener("change", this.onWake);
|
|
164
|
-
window.removeEventListener("resize", this.onWake);
|
|
165
|
-
pools.delete(this.document);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
export function mountForma(svg, options, callbacks = {}) {
|
|
169
|
-
const doc = svg.ownerDocument;
|
|
170
|
-
let pool = pools.get(doc);
|
|
171
|
-
if (!pool) {
|
|
172
|
-
pool = new Pool(doc);
|
|
173
|
-
pools.set(doc, pool);
|
|
174
|
-
}
|
|
175
|
-
if (pool.entries.has(svg))
|
|
176
|
-
throw new Error("This element already has a Forma avatar");
|
|
177
|
-
const parts = new Map();
|
|
178
|
-
for (const element of svg.querySelectorAll("[data-part]"))
|
|
179
|
-
parts.set(element.getAttribute("data-part"), element);
|
|
180
|
-
const entry = {
|
|
181
|
-
svg,
|
|
182
|
-
parts,
|
|
183
|
-
motion: createMotion(options, performance.now()),
|
|
184
|
-
visible: !pool.observer,
|
|
185
|
-
dirty: true,
|
|
186
|
-
terminalFrameDue: false,
|
|
187
|
-
callbacks,
|
|
188
|
-
rect: null,
|
|
189
|
-
rectAt: -Infinity,
|
|
190
|
-
};
|
|
191
|
-
const activePool = pool;
|
|
192
|
-
pool.entries.set(svg, entry);
|
|
193
|
-
pool.observer?.observe(svg);
|
|
194
|
-
pool.request();
|
|
195
|
-
let disposed = false;
|
|
196
|
-
return {
|
|
197
|
-
update(next) {
|
|
198
|
-
if (disposed)
|
|
199
|
-
return;
|
|
200
|
-
updateMotion(entry.motion, next, performance.now());
|
|
201
|
-
entry.dirty = true;
|
|
202
|
-
activePool.request();
|
|
203
|
-
},
|
|
204
|
-
dispose() {
|
|
205
|
-
if (disposed)
|
|
206
|
-
return;
|
|
207
|
-
disposed = true;
|
|
208
|
-
activePool.release(svg);
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"still.d.ts","sourceRoot":"","sources":["../../../src/internal/forma/still.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,wBAAgB,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,KAAK,CAK/D"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { computeFrame } from "./frame.js";
|
|
2
|
-
import { createMotion, stepPose } from "./motion.js";
|
|
3
|
-
export function stillFrame(options) {
|
|
4
|
-
const motion = createMotion({ ...options, paused: true }, 0);
|
|
5
|
-
motion.still = true;
|
|
6
|
-
const pose = stepPose(motion, 0, 0);
|
|
7
|
-
return computeFrame(motion, pose, 0);
|
|
8
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type FormaChoice, type FormaColor } from "./model.js";
|
|
2
|
-
/** What Hermes stores for an Agent's look. Both may be absent or unknown. */
|
|
3
|
-
export interface StoredAppearance {
|
|
4
|
-
shape?: string | null;
|
|
5
|
-
color?: string | null;
|
|
6
|
-
}
|
|
7
|
-
/** The `shape` value a chosen form is stored as. */
|
|
8
|
-
export declare const shapeFor: (form: FormaChoice) => string;
|
|
9
|
-
/** The stored shape of the form an Agent wears until a customer chooses one. */
|
|
10
|
-
export declare const defaultShape: string;
|
|
11
|
-
/**
|
|
12
|
-
* The hex each palette colour is stored as. Hermes keeps an Agent's colour as
|
|
13
|
-
* a CSS colour for its own surfaces, so the stored spelling is a value rather
|
|
14
|
-
* than a token reference; `stored-appearance.test.ts` holds this table to the
|
|
15
|
-
* shipped design-system tokens, and the ESLint colour-literal exemption in the
|
|
16
|
-
* root config names this file.
|
|
17
|
-
*/
|
|
18
|
-
export declare const formaColorValues: Record<FormaColor, string>;
|
|
19
|
-
/**
|
|
20
|
-
* Resolve the stored strings to what `FormaAvatar` draws. An unknown shape is
|
|
21
|
-
* the default form and an unknown colour is undefined, which leaves the form
|
|
22
|
-
* its own pigment. The root Agent is the caller's business: a caller that owns
|
|
23
|
-
* one passes `form="nadia"` instead of asking here.
|
|
24
|
-
*/
|
|
25
|
-
export declare function resolveAppearance(stored: StoredAppearance): {
|
|
26
|
-
form: FormaChoice;
|
|
27
|
-
color: FormaColor | undefined;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=stored-appearance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stored-appearance.d.ts","sourceRoot":"","sources":["../../../src/internal/forma/stored-appearance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAA0C,MAAM,SAAS,CAAC;AAEpG,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,oDAAoD;AACpD,eAAO,MAAM,QAAQ,GAAI,MAAM,WAAW,KAAG,MAAyB,CAAC;AAEvE,gFAAgF;AAChF,eAAO,MAAM,YAAY,EAAE,MAA8B,CAAC;AAc1D;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAOvD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG;IAC3D,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;CAC/B,CAEA"}
|