@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.
Files changed (76) hide show
  1. package/AGENTS.md +1 -1
  2. package/LICENSES/THINKING-ORBS-MIT.txt +21 -0
  3. package/NOTICE +7 -10
  4. package/dist/components/agent-orb-appearance.d.ts +54 -0
  5. package/dist/components/agent-orb-appearance.d.ts.map +1 -0
  6. package/dist/components/agent-orb-appearance.js +87 -0
  7. package/dist/components/agent-orb.d.ts +5 -3
  8. package/dist/components/agent-orb.d.ts.map +1 -1
  9. package/dist/eslint/index.js +4 -0
  10. package/dist/eslint/rules/expect-chain.js +60 -0
  11. package/dist/eslint/rules/no-existence-only-assertion.js +89 -0
  12. package/dist/eslint/rules/no-subject-derived-expectation.js +129 -0
  13. package/dist/index.d.ts +0 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +0 -2
  16. package/dist/internal/agent-orb-motion.d.ts +3 -3
  17. package/dist/internal/agent-orb-motion.d.ts.map +1 -1
  18. package/dist/internal/agent-orb-motion.js +1 -0
  19. package/dist/internal/agent-orb.d.ts +11 -1
  20. package/dist/internal/agent-orb.d.ts.map +1 -1
  21. package/dist/internal/agent-orb.js +80 -5
  22. package/docs/agent-orb.md +47 -14
  23. package/docs/contract.md +8 -29
  24. package/docs/migration/9.0.0.md +35 -0
  25. package/package.json +2 -3
  26. package/LICENSES/PAPER-SHADERS-APACHE-2.0.txt +0 -186
  27. package/dist/components/agent-visual.d.ts +0 -17
  28. package/dist/components/agent-visual.d.ts.map +0 -1
  29. package/dist/components/agent-visual.js +0 -63
  30. package/dist/components/forma-appearance.d.ts +0 -13
  31. package/dist/components/forma-appearance.d.ts.map +0 -1
  32. package/dist/components/forma-appearance.js +0 -11
  33. package/dist/components/forma-avatar.d.ts +0 -23
  34. package/dist/components/forma-avatar.d.ts.map +0 -1
  35. package/dist/components/forma-avatar.js +0 -95
  36. package/dist/internal/agent-visual/color.d.ts +0 -4
  37. package/dist/internal/agent-visual/color.d.ts.map +0 -1
  38. package/dist/internal/agent-visual/color.js +0 -78
  39. package/dist/internal/agent-visual/poster.d.ts +0 -6
  40. package/dist/internal/agent-visual/poster.d.ts.map +0 -1
  41. package/dist/internal/agent-visual/poster.js +0 -35
  42. package/dist/internal/agent-visual/recipes.d.ts +0 -15
  43. package/dist/internal/agent-visual/recipes.d.ts.map +0 -1
  44. package/dist/internal/agent-visual/recipes.js +0 -72
  45. package/dist/internal/agent-visual/renderer.d.ts +0 -10
  46. package/dist/internal/agent-visual/renderer.d.ts.map +0 -1
  47. package/dist/internal/agent-visual/renderer.js +0 -112
  48. package/dist/internal/agent-visual/shader.d.ts +0 -2
  49. package/dist/internal/agent-visual/shader.d.ts.map +0 -1
  50. package/dist/internal/agent-visual/shader.js +0 -158
  51. package/dist/internal/forma/frame.d.ts +0 -10
  52. package/dist/internal/forma/frame.d.ts.map +0 -1
  53. package/dist/internal/forma/frame.js +0 -211
  54. package/dist/internal/forma/geometry.d.ts +0 -41
  55. package/dist/internal/forma/geometry.d.ts.map +0 -1
  56. package/dist/internal/forma/geometry.js +0 -235
  57. package/dist/internal/forma/hallmark.d.ts +0 -5
  58. package/dist/internal/forma/hallmark.d.ts.map +0 -1
  59. package/dist/internal/forma/hallmark.js +0 -4
  60. package/dist/internal/forma/model.d.ts +0 -53
  61. package/dist/internal/forma/model.d.ts.map +0 -1
  62. package/dist/internal/forma/model.js +0 -70
  63. package/dist/internal/forma/motion.d.ts +0 -42
  64. package/dist/internal/forma/motion.d.ts.map +0 -1
  65. package/dist/internal/forma/motion.js +0 -194
  66. package/dist/internal/forma/rig.d.ts +0 -10
  67. package/dist/internal/forma/rig.d.ts.map +0 -1
  68. package/dist/internal/forma/rig.js +0 -211
  69. package/dist/internal/forma/still.d.ts +0 -4
  70. package/dist/internal/forma/still.d.ts.map +0 -1
  71. package/dist/internal/forma/still.js +0 -8
  72. package/dist/internal/forma/stored-appearance.d.ts +0 -29
  73. package/dist/internal/forma/stored-appearance.d.ts.map +0 -1
  74. package/dist/internal/forma/stored-appearance.js +0 -53
  75. package/docs/agent-visual.md +0 -114
  76. package/docs/forma-avatar.md +0 -110
@@ -1,23 +0,0 @@
1
- import { type CSSProperties } from "react";
2
- import { type FormaChoice, type FormaColor, type FormaForm, type FormaOptions, type FormaState, type FormaView } from "../internal/forma/model.js";
3
- type AccessibleAvatar = {
4
- decorative?: true;
5
- label?: never;
6
- } | {
7
- decorative: false;
8
- label: string;
9
- };
10
- type FormaAvatarProps = FormaOptions & AccessibleAvatar & {
11
- className?: string;
12
- style?: CSSProperties;
13
- };
14
- /**
15
- * The Forma avatar: Nadia's approved shell and face, or one of the seven
16
- * forms in the shell colour the customer chose, with the approved lifecycle
17
- * gestures. One SVG per avatar; the server renders the state's resting frame
18
- * and the client rig animates it in place.
19
- */
20
- declare function FormaAvatar({ form, color, state, size, paused, view, motionKey, decorative, label, className, style, }: FormaAvatarProps): import("react").JSX.Element;
21
- export { FormaAvatar, type FormaAvatarProps, type FormaChoice, type FormaColor, type FormaForm, type FormaState, type FormaView, };
22
- export { defaultForm, formDetails, formaChoices, formaColorVariable, formaColors, formaForms, formaStates, } from "../internal/forma/model.js";
23
- //# sourceMappingURL=forma-avatar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"forma-avatar.d.ts","sourceRoot":"","sources":["../../src/components/forma-avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAsC,MAAM,OAAO,CAAC;AAW/E,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EAMf,MAAM,wBAAwB,CAAC;AAIhC,KAAK,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpG,KAAK,gBAAgB,GAAG,YAAY,GAClC,gBAAgB,GAAG;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAiBJ;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,EACnB,IAAI,EACJ,KAAK,EACL,KAAc,EACd,IAAS,EACT,MAAc,EACd,IAAc,EACd,SAAS,EACT,UAAiB,EACjB,KAAK,EACL,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,+BA4blB;AAED,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,GACf,CAAC;AACF,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,wBAAwB,CAAC"}
@@ -1,95 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useEffect, useId, useRef, useState } from "react";
4
- import { ORBIT_DOTS, ORBIT_TILTS, RIBBON_BEADS, RIBBON_TILTS, SHELL_LAYERS, } from "../internal/forma/frame.js";
5
- import { bodies, eyeProfiles } from "../internal/forma/geometry.js";
6
- import { ITALY_PATH } from "../internal/forma/hallmark.js";
7
- import { celebrationColors, formDetails, formaColorVariable, resolveFormaOptions, shellColor, } from "../internal/forma/model.js";
8
- import { stillFrame } from "../internal/forma/still.js";
9
- const WHITE = "var(--nc-identity-white)";
10
- const INK = "var(--nc-identity-ink)";
11
- function part(frame, name) {
12
- const { display, ...attributes } = frame[name] ?? {};
13
- return {
14
- "data-part": name,
15
- ...attributes,
16
- ...(display === undefined ? {} : { style: { display } }),
17
- };
18
- }
19
- const orbitDotRadius = (i) => (i % 10 === 0 ? 0.036 : 0.022 * (1 - (i % 10) / 13)).toFixed(4);
20
- /**
21
- * The Forma avatar: Nadia's approved shell and face, or one of the seven
22
- * forms in the shell colour the customer chose, with the approved lifecycle
23
- * gestures. One SVG per avatar; the server renders the state's resting frame
24
- * and the client rig animates it in place.
25
- */
26
- function FormaAvatar({ form, color, state = "idle", size = 32, paused = false, view = "front", motionKey, decorative = true, label, className, style, }) {
27
- const options = resolveFormaOptions({ form, color, state, size, paused, view, motionKey });
28
- const id = useId().replace(/:/g, "");
29
- const host = useRef(null);
30
- const handle = useRef(null);
31
- const latest = useRef(options);
32
- const [mode, setMode] = useState("still");
33
- useEffect(() => {
34
- latest.current = options;
35
- handle.current?.update(options);
36
- }, [options]);
37
- useEffect(() => {
38
- const element = host.current;
39
- if (!element)
40
- return;
41
- let generation = 0;
42
- const preference = typeof matchMedia === "function" ? matchMedia("(prefers-reduced-motion: reduce)") : null;
43
- const reconcile = () => {
44
- const token = ++generation;
45
- handle.current?.dispose();
46
- handle.current = null;
47
- setMode("still");
48
- if (paused || preference?.matches)
49
- return;
50
- import("../internal/forma/rig.js").then(({ mountForma }) => {
51
- if (generation !== token)
52
- return;
53
- handle.current = mountForma(element, latest.current, { onModeChange: setMode });
54
- });
55
- };
56
- reconcile();
57
- preference?.addEventListener("change", reconcile);
58
- return () => {
59
- generation++;
60
- preference?.removeEventListener("change", reconcile);
61
- handle.current?.dispose();
62
- handle.current = null;
63
- };
64
- }, [paused]);
65
- const detail = formDetails[options.form];
66
- const nadia = options.form === "nadia";
67
- const shade = shellColor(options);
68
- const pigment = `var(${formaColorVariable[shade]})`;
69
- const visorFill = detail.visor === "ivory" ? "var(--nc-forma-avorio)" : "var(--nc-forma-visor)";
70
- const bezelStroke = detail.visor === "ivory" ? "var(--nc-seam)" : "var(--nc-forma-bezel)";
71
- const eye = nadia ? "var(--nc-forma-eye)" : detail.eyes === "ink" ? INK : WHITE;
72
- const frame = stillFrame(options);
73
- const signature = eyeProfiles[options.form].signature === true;
74
- const { width: w, height: h } = bodies[options.form];
75
- const shadow = nadia ? INK : pigment;
76
- const shading = { mixBlendMode: "multiply" };
77
- const body = `scale(${w} ${h})`;
78
- const url = (name) => `url(#${name}-${id})`;
79
- const renderEye = (name) => (_jsxs("g", { ...part(frame, `eye${name}`), children: [_jsx("ellipse", { cx: "0", cy: "0", fill: url("halo"), ...part(frame, `halo${name}`) }), _jsx("path", { fill: eye, ...part(frame, `light${name}`) }), _jsx("path", { fill: url("glint"), ...part(frame, `glint${name}`) }), signature ? (_jsx("path", { d: "M0.045 0.103 Q0.092 0.102 0.112 0.147", fill: "none", stroke: eye, strokeLinecap: "round", strokeWidth: "0.021", ...part(frame, `flick${name}`) })) : null, _jsx("path", { d: "M-0.084 -0.012 Q0 0.082 0.084 -0.012", fill: "none", stroke: eye, strokeLinecap: "round", strokeWidth: "0.036", ...part(frame, `happy${name}`) }), _jsx("ellipse", { cx: "0", cy: "0", fill: url("pauseHalo"), rx: "0.17", ry: "0.32", ...part(frame, `pauseHalo${name}`) }), _jsx("rect", { fill: "var(--nc-identity-giallo)", height: "0.388", rx: "0.044", width: "0.088", x: "-0.044", y: "-0.194", ...part(frame, `pause${name}`) })] }));
80
- const renderOrbitDots = (layer) => ORBIT_TILTS.map((_, index) => Array.from({ length: ORBIT_DOTS }, (__, i) => (_jsx("circle", { fill: pigment, r: orbitDotRadius(i), ...part(frame, `orbit${index}${layer}${i}`) }, `${index}-${i}`))));
81
- return (_jsx("span", { "aria-hidden": decorative || undefined, "aria-label": decorative ? undefined : label, className: className, "data-color": options.color ?? "default", "data-forma-avatar": options.form, "data-state": options.state, role: decorative ? undefined : "img", style: {
82
- display: "inline-block",
83
- position: "relative",
84
- flexShrink: 0,
85
- verticalAlign: "middle",
86
- ...style,
87
- width: options.size,
88
- height: options.size,
89
- }, children: _jsxs("svg", { "aria-hidden": "true", "data-render-mode": mode, height: options.size, overflow: "visible", ref: host, style: { display: "block", overflow: "visible" }, viewBox: "-1.55 -1.55 3.1 3.1", width: options.size, children: [_jsxs("defs", { children: [_jsxs("radialGradient", { cx: "-0.18", cy: "0.3", gradientTransform: body, gradientUnits: "userSpaceOnUse", id: `tone-${id}`, r: "1.34", children: [_jsx("stop", { offset: "0", stopColor: shadow, stopOpacity: nadia ? "0.04" : "0.4" }), _jsx("stop", { offset: "1", stopColor: shadow, stopOpacity: nadia ? "0.14" : "0.95" })] }), _jsxs("radialGradient", { cx: "-0.18", cy: "0.3", gradientTransform: body, gradientUnits: "userSpaceOnUse", id: `form-${id}`, r: "1.34", children: [_jsx("stop", { offset: "0", stopColor: INK, stopOpacity: "0.02" }), _jsx("stop", { offset: "0.5", stopColor: INK, stopOpacity: "0.1" }), _jsx("stop", { offset: "0.8", stopColor: INK, stopOpacity: "0.26" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.52" })] }), _jsxs("linearGradient", { gradientTransform: body, gradientUnits: "userSpaceOnUse", id: `floor-${id}`, x1: "0", x2: "0", y1: "1", y2: "-1", children: [_jsx("stop", { offset: "0.45", stopColor: INK, stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.42" })] }), _jsxs("radialGradient", { cx: "0.05", cy: "3.6", gradientTransform: `scale(${w} ${h * 0.3})`, gradientUnits: "userSpaceOnUse", id: `key-${id}`, r: "1.05", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.62" }), _jsx("stop", { offset: "0.4", stopColor: WHITE, stopOpacity: "0.22" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "0.5", cy: "0.5", id: `spec-${id}`, r: "0.5", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.85" }), _jsx("stop", { offset: "0.5", stopColor: WHITE, stopOpacity: "0.25" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "-0.16", cy: "-0.12", gradientTransform: body, gradientUnits: "userSpaceOnUse", id: `rim-${id}`, r: "1.2", children: [_jsx("stop", { offset: "0.7", stopColor: WHITE, stopOpacity: "0" }), _jsx("stop", { offset: "0.9", stopColor: WHITE, stopOpacity: "0.26" }), _jsx("stop", { offset: "0.975", stopColor: WHITE, stopOpacity: "0.5" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0.1" })] }), _jsxs("radialGradient", { cx: "0", cy: "0", gradientUnits: "userSpaceOnUse", id: `tube-${id}`, r: "1", children: [_jsx("stop", { offset: "0.64", stopColor: INK, stopOpacity: "0.45" }), _jsx("stop", { offset: "0.7", stopColor: INK, stopOpacity: "0.1" }), _jsx("stop", { offset: "0.76", stopColor: WHITE, stopOpacity: "0" }), _jsx("stop", { offset: "0.82", stopColor: WHITE, stopOpacity: "0.36" }), _jsx("stop", { offset: "0.89", stopColor: WHITE, stopOpacity: "0" }), _jsx("stop", { offset: "0.95", stopColor: INK, stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.45" })] }), _jsxs("radialGradient", { cx: "0.3", cy: "1", gradientTransform: "translate(0.3 1) scale(1 0.6) translate(-0.3 -1)", id: `glass-${id}`, r: "0.7", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.36" }), _jsx("stop", { offset: "0.5", stopColor: WHITE, stopOpacity: "0.14" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "0.2", cy: "0.84", gradientTransform: "translate(0.2 0.84) scale(1 0.5) translate(-0.2 -0.84)", id: `streak-${id}`, r: "0.24", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.9" }), _jsx("stop", { offset: "0.62", stopColor: WHITE, stopOpacity: "0.72" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "0.98", cy: "0.58", gradientTransform: "translate(0.98 0.58) scale(0.3 1) translate(-0.98 -0.58)", id: `sole-${id}`, r: "0.42", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.28" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("linearGradient", { id: `visorShade-${id}`, x1: "0", x2: "0", y1: "1", y2: "0", children: [_jsx("stop", { offset: "0.45", stopColor: INK, stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.22" })] }), _jsxs("linearGradient", { id: `bezelLight-${id}`, x1: "0", x2: "1", y1: "1", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.5" }), _jsx("stop", { offset: "0.35", stopColor: WHITE, stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.25" })] }), _jsxs("radialGradient", { cx: "0.5", cy: "0.5", id: `halo-${id}`, r: "0.5", children: [_jsx("stop", { offset: "0", stopColor: eye, stopOpacity: "0.55" }), _jsx("stop", { offset: "0.45", stopColor: eye, stopOpacity: "0.18" }), _jsx("stop", { offset: "1", stopColor: eye, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "0.5", cy: "0.62", id: `glint-${id}`, r: "0.55", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.6" }), _jsx("stop", { offset: "1", stopColor: WHITE, stopOpacity: "0" })] }), _jsxs("radialGradient", { cx: "0.5", cy: "0.5", id: `pauseHalo-${id}`, r: "0.5", children: [_jsx("stop", { offset: "0", stopColor: "var(--nc-identity-giallo)", stopOpacity: "0.5" }), _jsx("stop", { offset: "0.5", stopColor: "var(--nc-identity-giallo)", stopOpacity: "0.14" }), _jsx("stop", { offset: "1", stopColor: "var(--nc-identity-giallo)", stopOpacity: "0" })] }), _jsxs("linearGradient", { id: `bar-${id}`, x1: "0", x2: "1", y1: "0", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.55" }), _jsx("stop", { offset: "0.4", stopColor: WHITE, stopOpacity: "0.08" }), _jsx("stop", { offset: "0.7", stopColor: INK, stopOpacity: "0.06" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.4" })] }), _jsxs("radialGradient", { cx: "0.36", cy: "0.68", id: `bead-${id}`, r: "0.72", children: [_jsx("stop", { offset: "0", stopColor: WHITE, stopOpacity: "0.65" }), _jsx("stop", { offset: "0.45", stopColor: WHITE, stopOpacity: "0" }), _jsx("stop", { offset: "0.78", stopColor: INK, stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: INK, stopOpacity: "0.45" })] }), _jsx("clipPath", { id: `shell-${id}`, children: _jsx("path", { clipRule: "evenodd", ...part(frame, "shellClip") }) }), _jsx("clipPath", { id: `visor-${id}`, children: _jsx("path", { ...part(frame, "visorClip") }) })] }), _jsxs("g", { "data-part": "root", transform: "scale(1 -1)", children: [_jsx("g", { ...part(frame, "effectsBack"), children: renderOrbitDots("Back") }), _jsxs("g", { ...part(frame, "object"), children: [_jsxs("g", { clipPath: url("shell"), children: [_jsx("path", { fill: pigment, fillRule: "evenodd", ...part(frame, "shell") }), nadia ? (_jsxs(_Fragment, { children: [_jsx("path", { fill: "var(--nc-forma-avorio)", ...part(frame, "bandW") }), _jsx("path", { fill: "var(--nc-identity-rosso)", ...part(frame, "bandR") }), _jsx("path", { fill: "var(--nc-forma-sabbia)", ...part(frame, "bandSand") }), _jsx("g", { fill: "none", opacity: "0.82", stroke: "var(--nc-forma-avorio)", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: "0.72", strokeWidth: "12", ...part(frame, "hallmark"), children: _jsx("path", { d: ITALY_PATH }) })] })) : null, SHELL_LAYERS.map((layer) => (_jsx("path", { fill: url(layer), fillRule: "evenodd", style: layer === "tone" ? shading : undefined, ...part(frame, layer) }, layer))), _jsx("ellipse", { cx: -0.4 * w, cy: 0.6 * h, fill: url("spec"), rx: 0.27 * w, ry: 0.11 * h, transform: `rotate(-24 ${-0.4 * w} ${0.6 * h})`, ...part(frame, "hot") }), _jsx("path", { fill: url("tube"), fillRule: "evenodd", ...part(frame, "tube") }), _jsx("path", { fill: "var(--nc-forma-sabbia)", fillRule: "evenodd", ...part(frame, "fade") }), _jsxs("g", { ...part(frame, "face"), children: [_jsx("path", { fill: "none", stroke: bezelStroke, strokeWidth: "0.014", ...part(frame, "bezel") }), _jsx("path", { fill: "none", stroke: url("bezelLight"), strokeWidth: "0.014", ...part(frame, "bezelLight") }), _jsx("path", { fill: visorFill, ...part(frame, "visor") }), _jsxs("g", { clipPath: url("visor"), children: [_jsx("path", { fill: url("visorShade"), ...part(frame, "visorShade") }), _jsx("path", { fill: url("glass"), ...part(frame, "glass") }), _jsx("path", { fill: url("streak"), ...part(frame, "streak") }), _jsx("path", { fill: url("sole"), ...part(frame, "sole") }), _jsx("path", { fill: "none", stroke: WHITE, strokeOpacity: "0.05", strokeWidth: "0.04", ...part(frame, "visorEdge") })] }), renderEye("L"), renderEye("R"), [0, 1, 2].map((i) => (_jsx("rect", { fill: eye, height: "0.024", rx: "0.012", width: "0.047", ...part(frame, `tick${i}`) }, i)))] })] }), _jsxs("g", { ...part(frame, "blockedBar"), children: [_jsx("rect", { fill: nadia ? "var(--nc-forma-avorio)" : pigment, height: "1.664", rx: "0.112", transform: "rotate(45)", width: "0.224", x: "-0.112", y: "-0.832" }), nadia ? null : (_jsx("rect", { fill: "var(--nc-forma-sabbia)", height: "1.664", opacity: "0.28", rx: "0.112", transform: "rotate(45)", width: "0.224", x: "-0.112", y: "-0.832" })), _jsx("rect", { fill: url("bar"), height: "1.664", rx: "0.112", transform: "rotate(45)", width: "0.224", x: "-0.112", y: "-0.832" })] })] }), _jsxs("g", { ...part(frame, "effectsFront"), children: [renderOrbitDots("Front"), [0, 1, 2].map((i) => (_jsxs("g", { ...part(frame, `thought${i}`), children: [_jsx("circle", { fill: pigment, r: (0.042 + i * 0.015).toFixed(3) }), _jsx("circle", { fill: url("bead"), r: (0.042 + i * 0.015).toFixed(3) })] }, i))), RIBBON_TILTS.map((tilt, index) => {
90
- const ribbon = `var(${formaColorVariable[celebrationColors[shade][index]]})`;
91
- return (_jsx("g", { transform: `rotate(${tilt})`, ...part(frame, `ribbon${index}Plane`), children: _jsxs("g", { ...part(frame, `ribbon${index}Sweep`), children: [_jsx("path", { fill: "none", stroke: ribbon, strokeLinecap: "round", strokeWidth: "0.024", ...part(frame, `ribbon${index}Arc`) }), _jsx("circle", { fill: ribbon, r: "0.03", ...part(frame, `ribbon${index}Head`) }), Array.from({ length: RIBBON_BEADS }, (_, i) => (_jsx("circle", { fill: ribbon, ...part(frame, `ribbon${index}Bead${i}`) }, i)))] }) }, index));
92
- })] })] })] }) }));
93
- }
94
- export { FormaAvatar, };
95
- export { defaultForm, formDetails, formaChoices, formaColorVariable, formaColors, formaForms, formaStates, } from "../internal/forma/model.js";
@@ -1,4 +0,0 @@
1
- type ShaderColor = [number, number, number, number];
2
- export declare function resolveIdentityColor(element: Element, variable: string): ShaderColor | null;
3
- export {};
4
- //# sourceMappingURL=color.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/internal/agent-visual/color.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAmFpD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAG3F"}
@@ -1,78 +0,0 @@
1
- const clamp = (value) => Math.min(Math.max(value, 0), 1);
2
- // CSS compilers may serialize numeric channels as percentages. CSS Color 4
3
- // gives each channel its own 100% value (OKLCH L: 1, C: 0.4; Lab a/b: 125).
4
- function numberOrPercentage(value, percentRange) {
5
- const number = Number.parseFloat(value ?? "");
6
- return value?.endsWith("%") ? (number / 100) * percentRange : number;
7
- }
8
- function linearToSrgb(value) {
9
- const channel = clamp(value);
10
- return channel <= 0.0031308 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;
11
- }
12
- function parseOklch(value) {
13
- if (!value.startsWith("oklch"))
14
- return null;
15
- const start = value.indexOf("(");
16
- const end = value.lastIndexOf(")");
17
- if (start < 0 || end <= start)
18
- return null;
19
- const [channels, alphaValue] = value.slice(start + 1, end).split("/");
20
- const [lightnessValue, chromaValue, hueValue] = channels?.trim().split(/\s+/) ?? [];
21
- const lightness = numberOrPercentage(lightnessValue, 1);
22
- const chroma = numberOrPercentage(chromaValue, 0.4);
23
- const hue = Number.parseFloat(hueValue ?? "");
24
- const alpha = alphaValue ? numberOrPercentage(alphaValue.trim(), 1) : 1;
25
- if (![lightness, chroma, hue, alpha].every(Number.isFinite))
26
- return null;
27
- const radians = (hue * Math.PI) / 180;
28
- const a = chroma * Math.cos(radians);
29
- const b = chroma * Math.sin(radians);
30
- const lPrime = lightness + 0.3963377774 * a + 0.2158037573 * b;
31
- const mPrime = lightness - 0.1055613458 * a - 0.0638541728 * b;
32
- const sPrime = lightness - 0.0894841775 * a - 1.291485548 * b;
33
- const l = lPrime ** 3;
34
- const m = mPrime ** 3;
35
- const s = sPrime ** 3;
36
- return [
37
- linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
38
- linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
39
- linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
40
- clamp(alpha),
41
- ];
42
- }
43
- function parseLab(value) {
44
- if (!value.startsWith("lab"))
45
- return null;
46
- const start = value.indexOf("(");
47
- const end = value.lastIndexOf(")");
48
- if (start < 0 || end <= start)
49
- return null;
50
- const [channels, alphaValue] = value.slice(start + 1, end).split("/");
51
- const [lightnessValue, aValue, bValue] = channels?.trim().split(/\s+/) ?? [];
52
- const lightness = numberOrPercentage(lightnessValue, 100);
53
- const a = numberOrPercentage(aValue, 125);
54
- const b = numberOrPercentage(bValue, 125);
55
- const alpha = alphaValue ? numberOrPercentage(alphaValue.trim(), 1) : 1;
56
- if (![lightness, a, b, alpha].every(Number.isFinite))
57
- return null;
58
- const delta = 6 / 29;
59
- const inverseLab = (channel) => channel > delta ? channel ** 3 : 3 * delta ** 2 * (channel - 4 / 29);
60
- const f1 = (lightness + 16) / 116;
61
- const x50 = 0.96422 * inverseLab(f1 + a / 500);
62
- const y50 = inverseLab(f1);
63
- const z50 = 0.82521 * inverseLab(f1 - b / 200);
64
- // CSS Lab uses D50; WebGL colors use sRGB's D65 white point.
65
- const x65 = 0.9555766 * x50 - 0.0230393 * y50 + 0.0631636 * z50;
66
- const y65 = -0.0282895 * x50 + 1.0099416 * y50 + 0.0210077 * z50;
67
- const z65 = 0.0122982 * x50 - 0.020483 * y50 + 1.3299098 * z50;
68
- return [
69
- linearToSrgb(3.2404542 * x65 - 1.5371385 * y65 - 0.4985314 * z65),
70
- linearToSrgb(-0.969266 * x65 + 1.8760108 * y65 + 0.041556 * z65),
71
- linearToSrgb(0.0556434 * x65 - 0.2040259 * y65 + 1.0572252 * z65),
72
- clamp(alpha),
73
- ];
74
- }
75
- export function resolveIdentityColor(element, variable) {
76
- const value = getComputedStyle(element).getPropertyValue(variable).trim();
77
- return parseOklch(value) ?? parseLab(value);
78
- }
@@ -1,6 +0,0 @@
1
- import { type AgentVisualRecipe } from "./recipes.js";
2
- export declare function AgentVisualPoster({ className, recipe, }: {
3
- className?: string;
4
- recipe: AgentVisualRecipe;
5
- }): import("react").JSX.Element;
6
- //# sourceMappingURL=poster.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"poster.d.ts","sourceRoot":"","sources":["../../../src/internal/agent-visual/poster.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA+C,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAiHhG,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,+BA0CA"}
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from "react";
3
- import { cn } from "../../lib/utils.js";
4
- import { AGENT_VISUAL_RECIPE_SPECS, identityVariable } from "./recipes.js";
5
- function Gradient({ id, recipe }) {
6
- const colors = AGENT_VISUAL_RECIPE_SPECS[recipe].colors;
7
- return (_jsx("linearGradient", { id: id, x1: "0", x2: "1", y1: "0", y2: "1", children: colors.map((color, index) => (_jsx("stop", { offset: `${(index / Math.max(colors.length - 1, 1)) * 100}%`, stopColor: `var(${identityVariable(color)})` }, color))) }));
8
- }
9
- function Surface({ clipId, gradientId, patternId, recipe, }) {
10
- const { colors, material } = AGENT_VISUAL_RECIPE_SPECS[recipe];
11
- if (material === "solid") {
12
- return (_jsx("rect", { width: "160", height: "120", fill: `url(#${gradientId})`, clipPath: `url(#${clipId})` }));
13
- }
14
- if (material === "points") {
15
- return (_jsx("g", { clipPath: `url(#${clipId})`, children: colors.map((color, index) => (_jsx("g", { transform: `translate(${index * 3} ${index * 2})`, children: Array.from({ length: 8 }, (_, row) => Array.from({ length: 11 }, (__, column) => (_jsx("circle", { cx: column * 16, cy: row * 16, fill: `var(${identityVariable(color)})`, r: 1.45 + ((row + column + index) % 3) * 0.35 }, `${row}-${column}`)))) }, color))) }));
16
- }
17
- if (material === "wire") {
18
- return (_jsxs("g", { clipPath: `url(#${clipId})`, fill: "none", children: [Array.from({ length: 14 }, (_, index) => (_jsx("path", { d: `M ${-28 + index * 14} 0 L ${42 + index * 14} 120`, stroke: `var(${identityVariable(colors[index % colors.length])})`, strokeWidth: "1" }, `wire-a-${index}`))), Array.from({ length: 14 }, (_, index) => (_jsx("path", { d: `M ${-28 + index * 14} 120 L ${42 + index * 14} 0`, stroke: `var(${identityVariable(colors[(index + 1) % colors.length])})`, strokeWidth: "1" }, `wire-b-${index}`))), Array.from({ length: 9 }, (_, index) => (_jsx("path", { d: `M 0 ${index * 15} H 160`, stroke: `var(${identityVariable(colors[(index + 2) % colors.length])})`, strokeWidth: "0.8" }, `wire-c-${index}`)))] }));
19
- }
20
- return (_jsxs("g", { clipPath: `url(#${clipId})`, children: [_jsx("rect", { width: "160", height: "120", fill: `url(#${patternId})` }), Array.from({ length: 46 }, (_, index) => {
21
- const color = colors[index % colors.length];
22
- const x = 20 + ((index * 37) % 125);
23
- const y = 12 + ((index * 53) % 98);
24
- const radius = 0.8 + ((index * 7) % 8) * 0.28;
25
- return (_jsx("circle", { cx: x, cy: y, fill: `var(${identityVariable(color)})`, opacity: 0.48 + (index % 5) * 0.12, r: radius }, `particle-${index}`));
26
- })] }));
27
- }
28
- export function AgentVisualPoster({ className, recipe, }) {
29
- const id = useId().replaceAll(":", "");
30
- const clipId = `${id}-clip`;
31
- const gradientId = `${id}-gradient`;
32
- const patternId = `${id}-particles`;
33
- const colors = AGENT_VISUAL_RECIPE_SPECS[recipe].colors;
34
- return (_jsxs("svg", { "aria-hidden": "true", className: cn("size-full", className), "data-agent-visual-poster": "true", focusable: "false", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 160 120", children: [_jsxs("defs", { children: [_jsx("clipPath", { id: clipId, children: AGENT_VISUAL_RECIPE_SPECS[recipe].posterForm.map(([cx, cy, radius], index) => (_jsx("circle", { cx: cx, cy: cy, r: radius }, index))) }), _jsx(Gradient, { id: gradientId, recipe: recipe }), _jsxs("pattern", { id: patternId, width: "14", height: "14", patternUnits: "userSpaceOnUse", children: [_jsx("circle", { cx: "2", cy: "3", r: "1.1", fill: `var(${identityVariable(colors[0])})` }), _jsx("circle", { cx: "10", cy: "8", r: "2.1", fill: `var(${identityVariable(colors[1] ?? colors[0])})` }), _jsx("circle", { cx: "5", cy: "12", r: "0.7", fill: `var(${identityVariable(colors[2] ?? colors[0])})` })] })] }), _jsx(Surface, { clipId: clipId, gradientId: gradientId, patternId: patternId, recipe: recipe })] }));
35
- }
@@ -1,15 +0,0 @@
1
- export type AgentVisualRecipe = "general" | "reasoning" | "coordination" | "communication" | "execution";
2
- export type AgentVisualMaterial = "solid" | "points" | "wire" | "particles";
3
- type IdentityColor = "arancio" | "cobalto" | "giallo" | "ink" | "rosso" | "verde";
4
- export type AgentVisualRecipeSpec = {
5
- colors: readonly IdentityColor[];
6
- count: number;
7
- frame: number;
8
- material: AgentVisualMaterial;
9
- posterForm: readonly (readonly [number, number, number])[];
10
- size: number;
11
- };
12
- export declare const AGENT_VISUAL_RECIPE_SPECS: Record<AgentVisualRecipe, AgentVisualRecipeSpec>;
13
- export declare function identityVariable(color: IdentityColor): string;
14
- export {};
15
- //# sourceMappingURL=recipes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../../src/internal/agent-visual/recipes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,WAAW,GACX,cAAc,GACd,eAAe,GACf,WAAW,CAAC;AAEhB,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE5E,KAAK,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAElF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAoEtF,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,UAEpD"}
@@ -1,72 +0,0 @@
1
- export const AGENT_VISUAL_RECIPE_SPECS = {
2
- general: {
3
- colors: ["cobalto", "verde", "arancio", "giallo", "rosso"],
4
- count: 10,
5
- frame: 0,
6
- material: "solid",
7
- posterForm: [
8
- [45, 64, 29],
9
- [68, 42, 32],
10
- [99, 45, 34],
11
- [116, 71, 27],
12
- [79, 80, 35],
13
- ],
14
- size: 0.83,
15
- },
16
- reasoning: {
17
- colors: ["cobalto", "verde", "giallo"],
18
- count: 10,
19
- frame: 0,
20
- material: "points",
21
- posterForm: [
22
- [44, 61, 28],
23
- [69, 39, 31],
24
- [98, 44, 34],
25
- [113, 71, 29],
26
- [76, 80, 34],
27
- ],
28
- size: 0.83,
29
- },
30
- coordination: {
31
- colors: ["verde", "cobalto", "arancio"],
32
- count: 8,
33
- frame: 2_700,
34
- material: "wire",
35
- posterForm: [
36
- [48, 61, 31],
37
- [77, 40, 33],
38
- [111, 58, 29],
39
- [90, 82, 27],
40
- ],
41
- size: 0.76,
42
- },
43
- communication: {
44
- colors: ["giallo", "arancio", "rosso"],
45
- count: 12,
46
- frame: 5_400,
47
- material: "solid",
48
- posterForm: [
49
- [51, 55, 29],
50
- [79, 43, 35],
51
- [107, 63, 30],
52
- [77, 80, 28],
53
- ],
54
- size: 0.69,
55
- },
56
- execution: {
57
- colors: ["rosso", "arancio", "cobalto"],
58
- count: 6,
59
- frame: 8_100,
60
- material: "particles",
61
- posterForm: [
62
- [48, 65, 28],
63
- [78, 52, 39],
64
- [109, 64, 32],
65
- [82, 86, 24],
66
- ],
67
- size: 0.92,
68
- },
69
- };
70
- export function identityVariable(color) {
71
- return `--nc-identity-${color}`;
72
- }
@@ -1,10 +0,0 @@
1
- import { type AgentVisualRecipe } from "./recipes.js";
2
- type AgentVisualRendererProps = {
3
- host: HTMLElement;
4
- onReady: () => void;
5
- onUnavailable: () => void;
6
- recipe: AgentVisualRecipe;
7
- };
8
- export default function AgentVisualRenderer({ host, onReady, onUnavailable, recipe, }: AgentVisualRendererProps): import("react").JSX.Element;
9
- export {};
10
- //# sourceMappingURL=renderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/internal/agent-visual/renderer.tsx"],"names":[],"mappings":"AAYA,OAAO,EAA+C,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAUhG,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,GACP,EAAE,wBAAwB,+BA8G1B"}
@@ -1,112 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { defaultObjectSizing, getShaderNoiseTexture, metaballsFragmentShader, ShaderFitOptions, ShaderMount as PaperShaderMount, } from "@paper-design/shaders";
4
- import { useEffect, useRef } from "react";
5
- import { resolveIdentityColor } from "./color.js";
6
- import { AGENT_VISUAL_RECIPE_SPECS, identityVariable } from "./recipes.js";
7
- import { AGENT_VISUAL_SHADER } from "./shader.js";
8
- const MATERIAL_INDEX = {
9
- particles: 3,
10
- points: 1,
11
- solid: 0,
12
- wire: 2,
13
- };
14
- export default function AgentVisualRenderer({ host, onReady, onUnavailable, recipe, }) {
15
- const mountRef = useRef(null);
16
- useEffect(() => {
17
- const mount = mountRef.current;
18
- if (!mount)
19
- return;
20
- const spec = AGENT_VISUAL_RECIPE_SPECS[recipe];
21
- const isSolid = spec.material === "solid";
22
- const colors = spec.colors.map((color) => resolveIdentityColor(host, identityVariable(color)));
23
- const colorBack = resolveIdentityColor(host, identityVariable("ink"));
24
- const hasPalette = colors.every((color) => color !== null) && colorBack !== null;
25
- if (!hasPalette) {
26
- onUnavailable();
27
- return;
28
- }
29
- let cancelled = false;
30
- let canvas = null;
31
- let readyFrame = 0;
32
- let shaderMount = null;
33
- const clearMount = () => {
34
- mount.replaceChildren();
35
- mount.removeAttribute("data-paper-shader");
36
- };
37
- const disposeMount = () => {
38
- try {
39
- shaderMount?.dispose();
40
- }
41
- catch {
42
- // The deterministic poster remains visible even if vendor cleanup fails.
43
- }
44
- shaderMount = null;
45
- clearMount();
46
- };
47
- const handleContextLost = (event) => {
48
- event.preventDefault();
49
- cancelled = true;
50
- cancelAnimationFrame(readyFrame);
51
- readyFrame = 0;
52
- canvas?.removeEventListener("webglcontextlost", handleContextLost);
53
- canvas = null;
54
- disposeMount();
55
- onUnavailable();
56
- };
57
- const initialize = async () => {
58
- try {
59
- const noiseTexture = getShaderNoiseTexture();
60
- if (noiseTexture && !noiseTexture.complete)
61
- await noiseTexture.decode();
62
- if (cancelled)
63
- return;
64
- shaderMount = new PaperShaderMount(mount, isSolid ? metaballsFragmentShader : AGENT_VISUAL_SHADER, {
65
- u_colorBack: colorBack,
66
- u_colors: colors,
67
- u_colorsCount: colors.length,
68
- u_count: spec.count,
69
- u_fit: ShaderFitOptions[defaultObjectSizing.fit],
70
- u_noiseTexture: noiseTexture,
71
- u_offsetX: defaultObjectSizing.offsetX,
72
- u_offsetY: defaultObjectSizing.offsetY,
73
- u_originX: defaultObjectSizing.originX,
74
- u_originY: defaultObjectSizing.originY,
75
- u_rotation: defaultObjectSizing.rotation,
76
- u_scale: 1.15,
77
- u_size: spec.size,
78
- u_worldHeight: defaultObjectSizing.worldHeight,
79
- u_worldWidth: defaultObjectSizing.worldWidth,
80
- ...(isSolid
81
- ? {}
82
- : {
83
- u_detail: 0.55,
84
- u_material: MATERIAL_INDEX[spec.material],
85
- }),
86
- }, undefined, 0.24, spec.frame, undefined, 720_000);
87
- canvas = shaderMount.canvasElement;
88
- canvas.addEventListener("webglcontextlost", handleContextLost);
89
- readyFrame = requestAnimationFrame(() => {
90
- readyFrame = 0;
91
- if (!cancelled)
92
- onReady();
93
- });
94
- }
95
- catch {
96
- canvas?.removeEventListener("webglcontextlost", handleContextLost);
97
- canvas = null;
98
- disposeMount();
99
- if (!cancelled)
100
- onUnavailable();
101
- }
102
- };
103
- void initialize();
104
- return () => {
105
- cancelled = true;
106
- cancelAnimationFrame(readyFrame);
107
- canvas?.removeEventListener("webglcontextlost", handleContextLost);
108
- disposeMount();
109
- };
110
- }, [host, onReady, onUnavailable, recipe]);
111
- return _jsx("div", { className: "size-full", ref: mountRef });
112
- }
@@ -1,2 +0,0 @@
1
- export declare const AGENT_VISUAL_SHADER = "#version 300 es\nprecision mediump float;\n\nuniform float u_time;\nuniform sampler2D u_noiseTexture;\nuniform vec4 u_colorBack;\nuniform vec4 u_colors[8];\nuniform float u_colorsCount;\nuniform float u_size;\nuniform float u_count;\nuniform float u_material;\nuniform float u_detail;\nuniform vec2 u_resolution;\n\nin vec2 v_objectUV;\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n\nfloat randomR(vec2 p) {\n vec2 uv = floor(p) / 100. + .5;\n return texture(u_noiseTexture, fract(uv)).r;\n}\n\nfloat noise(float x) {\n float i = floor(x);\n float f = fract(x);\n float u = f * f * (3.0 - 2.0 * f);\n return mix(randomR(vec2(i, 0.0)), randomR(vec2(i + 1.0, 0.0)), u);\n}\n\nfloat getBallShape(vec2 uv, vec2 c, float p) {\n float s = .5 * length(uv - c);\n s = 1. - clamp(s, 0., 1.);\n return pow(s, p);\n}\n\nfloat hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\n\nfloat orderedPoints(vec2 surfaceUV, float depth) {\n float density = clamp(min(u_resolution.x, u_resolution.y) / 12.0 * u_detail, 6.0, 34.0);\n vec2 pointUV = fract(surfaceUV * density) - 0.5;\n float radius = mix(0.14, 0.23, depth);\n return 1.0 - smoothstep(radius * 0.7, radius, length(pointUV));\n}\n\nfloat triangularWire(vec2 surfaceUV, float depth) {\n float density = clamp(min(u_resolution.x, u_resolution.y) / 16.0 * u_detail, 5.0, 26.0);\n vec2 grid = surfaceUV * density;\n float horizontal = abs(fract(grid.y) - 0.5);\n float diagonalA = abs(fract(grid.x + grid.y * 0.5) - 0.5);\n float diagonalB = abs(fract(grid.x - grid.y * 0.5) - 0.5);\n float nearestLine = min(horizontal, min(diagonalA, diagonalB));\n float width = mix(0.032, 0.072, depth);\n return 1.0 - smoothstep(width * 0.55, width, nearestLine);\n}\n\nfloat particleLayer(vec2 surfaceUV, float density, float depth, float time, float layerSeed, float threshold) {\n vec2 gridUV = surfaceUV * density + layerSeed;\n vec2 cell = floor(gridUV);\n vec2 local = fract(gridUV) - 0.5;\n float seed = hash21(cell + layerSeed);\n vec2 jitter = vec2(hash21(cell + layerSeed + 3.17), hash21(cell + layerSeed + 8.41)) - 0.5;\n jitter *= 0.72;\n jitter += 0.08 * vec2(sin(time * 0.42 + seed * 18.0 + layerSeed), cos(time * 0.31 + seed * 14.0 - layerSeed));\n float radius = mix(0.055, 0.175, hash21(cell + layerSeed + 14.3)) * mix(0.78, 1.35, depth);\n float particle = 1.0 - smoothstep(radius * 0.68, radius, length(local - jitter));\n float brightness = mix(0.45, 1.0, hash21(cell + layerSeed + 24.7));\n return particle * step(threshold, seed) * brightness;\n}\n\nfloat livingParticles(vec2 surfaceUV, float depth, float time) {\n float density = clamp(min(u_resolution.x, u_resolution.y) / 6.5 * u_detail, 13.0, 68.0);\n float dust = particleLayer(surfaceUV, density, depth, time, 0.0, 0.16);\n float motes = particleLayer(surfaceUV, density * 0.46, depth, time * 0.72, 19.7, 0.62);\n return max(dust * 0.78, motes);\n}\n\nfloat surfacePattern(vec2 surfaceUV, float depth, float material, float time) {\n if (material < 0.5) return 1.0;\n if (material < 1.5) return orderedPoints(surfaceUV, depth);\n if (material < 2.5) return triangularWire(surfaceUV, depth);\n return livingParticles(surfaceUV, depth, time);\n}\n\nvoid main() {\n vec2 shape_uv = v_objectUV + .5;\n const float firstFrameOffset = 2503.4;\n float t = .2 * (u_time + firstFrameOffset);\n vec3 totalColor = vec3(0.);\n float totalShape = 0.;\n float totalOpacity = 0.;\n vec2 weightedCenter = vec2(0.);\n vec2 weightedOrientation = vec2(0.);\n float centerWeight = 0.;\n\n for (int i = 0; i < 20; i++) {\n if (i >= int(ceil(u_count))) break;\n float idxFract = float(i) / 20.0;\n float angle = TWO_PI * idxFract;\n float speed = 1. - .2 * idxFract;\n vec2 pos = vec2(.5) + 1e-4 + .9 * (vec2(noise(angle * 10. + float(i) + t * speed), noise(angle * 20. + float(i) - t * speed)) - .5);\n int safeIndex = i % int(u_colorsCount + 0.5);\n vec4 ballColor = u_colors[safeIndex];\n ballColor.rgb *= ballColor.a;\n float sizeFrac = 1.;\n if (float(i) > floor(u_count - 1.)) sizeFrac *= fract(u_count);\n float shape = getBallShape(shape_uv, pos, 45. - 30. * u_size * sizeFrac);\n shape *= pow(u_size, .2);\n shape = smoothstep(0., 1., shape);\n totalColor += ballColor.rgb * shape;\n totalShape += shape;\n totalOpacity += ballColor.a * shape;\n float centerContribution = shape * shape;\n weightedCenter += pos * centerContribution;\n weightedOrientation += vec2(cos(angle), sin(angle)) * centerContribution;\n centerWeight += centerContribution;\n }\n\n totalColor /= max(totalShape, 1e-4);\n totalOpacity /= max(totalShape, 1e-4);\n float edgeWidth = fwidth(totalShape);\n float finalShape = smoothstep(.4, .4 + edgeWidth, totalShape);\n vec2 fieldCenter = weightedCenter / max(centerWeight, 1e-4);\n vec2 fieldVector = shape_uv - fieldCenter;\n float depth = smoothstep(0.4, 1.45, totalShape);\n float fieldRotation = 0.18 * atan(weightedOrientation.y, weightedOrientation.x);\n float rotationCos = cos(fieldRotation);\n float rotationSin = sin(fieldRotation);\n vec2 surfaceUV = fieldCenter + mat2(rotationCos, rotationSin, -rotationSin, rotationCos) * fieldVector * (1.0 + 0.1 * depth);\n vec2 gradient = vec2(dFdx(totalShape), dFdy(totalShape));\n vec2 gradientDirection = gradient / max(length(gradient), 1e-4);\n surfaceUV += gradientDirection * 0.008 * sin(totalShape * 4.0);\n float feature = surfacePattern(surfaceUV, depth, u_material, t);\n vec3 normal = normalize(vec3(-gradient * 36.0, 1.0));\n vec3 lightDirection = normalize(vec3(-0.45, 0.65, 0.8));\n float surfaceLight = 0.62 + 0.38 * max(dot(normal, lightDirection), 0.0);\n float baseSurface = mix(0.012, 0.06, depth);\n float surface = u_material < 0.5 ? 1.0 : mix(baseSurface, surfaceLight, feature);\n vec3 color = totalColor * finalShape * surface;\n float opacity = totalOpacity * finalShape * surface;\n vec3 bgColor = u_colorBack.rgb * u_colorBack.a;\n color = color + bgColor * (1. - opacity);\n opacity = opacity + u_colorBack.a * (1. - opacity);\n color += 1. / 256. * (fract(sin(dot(.014 * gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453123) - .5);\n fragColor = vec4(color, opacity);\n}\n";
2
- //# sourceMappingURL=shader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/internal/agent-visual/shader.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,+oMAuJ/B,CAAC"}