@nadicodeai/ui 8.6.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 (72) 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/index.d.ts +0 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +0 -2
  12. package/dist/internal/agent-orb-motion.d.ts +3 -3
  13. package/dist/internal/agent-orb-motion.d.ts.map +1 -1
  14. package/dist/internal/agent-orb-motion.js +1 -0
  15. package/dist/internal/agent-orb.d.ts +11 -1
  16. package/dist/internal/agent-orb.d.ts.map +1 -1
  17. package/dist/internal/agent-orb.js +80 -5
  18. package/docs/agent-orb.md +47 -14
  19. package/docs/contract.md +8 -29
  20. package/docs/migration/9.0.0.md +35 -0
  21. package/package.json +2 -3
  22. package/LICENSES/PAPER-SHADERS-APACHE-2.0.txt +0 -186
  23. package/dist/components/agent-visual.d.ts +0 -17
  24. package/dist/components/agent-visual.d.ts.map +0 -1
  25. package/dist/components/agent-visual.js +0 -63
  26. package/dist/components/forma-appearance.d.ts +0 -13
  27. package/dist/components/forma-appearance.d.ts.map +0 -1
  28. package/dist/components/forma-appearance.js +0 -11
  29. package/dist/components/forma-avatar.d.ts +0 -23
  30. package/dist/components/forma-avatar.d.ts.map +0 -1
  31. package/dist/components/forma-avatar.js +0 -95
  32. package/dist/internal/agent-visual/color.d.ts +0 -4
  33. package/dist/internal/agent-visual/color.d.ts.map +0 -1
  34. package/dist/internal/agent-visual/color.js +0 -78
  35. package/dist/internal/agent-visual/poster.d.ts +0 -6
  36. package/dist/internal/agent-visual/poster.d.ts.map +0 -1
  37. package/dist/internal/agent-visual/poster.js +0 -35
  38. package/dist/internal/agent-visual/recipes.d.ts +0 -15
  39. package/dist/internal/agent-visual/recipes.d.ts.map +0 -1
  40. package/dist/internal/agent-visual/recipes.js +0 -72
  41. package/dist/internal/agent-visual/renderer.d.ts +0 -10
  42. package/dist/internal/agent-visual/renderer.d.ts.map +0 -1
  43. package/dist/internal/agent-visual/renderer.js +0 -112
  44. package/dist/internal/agent-visual/shader.d.ts +0 -2
  45. package/dist/internal/agent-visual/shader.d.ts.map +0 -1
  46. package/dist/internal/agent-visual/shader.js +0 -158
  47. package/dist/internal/forma/frame.d.ts +0 -10
  48. package/dist/internal/forma/frame.d.ts.map +0 -1
  49. package/dist/internal/forma/frame.js +0 -211
  50. package/dist/internal/forma/geometry.d.ts +0 -41
  51. package/dist/internal/forma/geometry.d.ts.map +0 -1
  52. package/dist/internal/forma/geometry.js +0 -235
  53. package/dist/internal/forma/hallmark.d.ts +0 -5
  54. package/dist/internal/forma/hallmark.d.ts.map +0 -1
  55. package/dist/internal/forma/hallmark.js +0 -4
  56. package/dist/internal/forma/model.d.ts +0 -53
  57. package/dist/internal/forma/model.d.ts.map +0 -1
  58. package/dist/internal/forma/model.js +0 -70
  59. package/dist/internal/forma/motion.d.ts +0 -42
  60. package/dist/internal/forma/motion.d.ts.map +0 -1
  61. package/dist/internal/forma/motion.js +0 -194
  62. package/dist/internal/forma/rig.d.ts +0 -10
  63. package/dist/internal/forma/rig.d.ts.map +0 -1
  64. package/dist/internal/forma/rig.js +0 -211
  65. package/dist/internal/forma/still.d.ts +0 -4
  66. package/dist/internal/forma/still.d.ts.map +0 -1
  67. package/dist/internal/forma/still.js +0 -8
  68. package/dist/internal/forma/stored-appearance.d.ts +0 -29
  69. package/dist/internal/forma/stored-appearance.d.ts.map +0 -1
  70. package/dist/internal/forma/stored-appearance.js +0 -53
  71. package/docs/agent-visual.md +0 -114
  72. package/docs/forma-avatar.md +0 -110
@@ -0,0 +1,35 @@
1
+ # Migrating to `@nadicodeai/ui` 9.0.0
2
+
3
+ Every Agent is now an `AgentOrb`, Nadia included. This release removes the
4
+ other Agent identities. `@nadicodeai/ui` 9.0.0 requires
5
+ `@nadicodeai/design-system` 9.0.0; the two packages are released in lockstep.
6
+
7
+ ## Removed components
8
+
9
+ | Removed | Use instead |
10
+ | --- | --- |
11
+ | `components/forma-avatar` (`FormaAvatar`) | `components/agent-orb` (`AgentOrb`). Nadia is `form="nadia"`. |
12
+ | `components/forma-appearance` (`resolveAppearance`, `shapeFor`, `defaultShape`, `formaColorValues`) | `components/agent-orb-appearance` (`resolveAgentOrb`, `shapeForOrb`, `defaultAgentOrbShape`, `agentOrbColorValues`, `agentOrbColorTokens`) |
13
+ | `components/agent-visual` (`AgentVisual`) | `AgentOrb` |
14
+
15
+ `resolveAgentOrb` reads every stored `forma:` spelling, the five launch role
16
+ names included, as a distinct orb, so a stored look keeps drawing until
17
+ someone changes it. Stored colours map to cobalto, verde, rosso and arancio;
18
+ giallo, avorio and unknown values draw the inherited text colour. Store new
19
+ choices as `orb:<form>` and the colour's hex, as
20
+ [`agent-orb.md`](../agent-orb.md#stored-appearance) specifies.
21
+
22
+ ## Added
23
+
24
+ `AgentOrb` takes `form="nadia"`: her ribbon, striped azzurro, verde, the orb's
25
+ pigment and rosso. `--nc-identity-azzurro` is the design-system token for her
26
+ azzurro stripe.
27
+
28
+ ## Removed tokens and assets
29
+
30
+ | Removed | Use instead |
31
+ | --- | --- |
32
+ | `--nc-forma-visor`, `--nc-forma-bezel`, `--nc-forma-eye`, `--nc-forma-avorio`, `--nc-forma-sabbia` | No replacement; only Forma painted them. |
33
+ | `@nadicodeai/design-system/assets/nadia-solid-surface` | `<AgentOrb form="nadia" />`. The portrait is retired as Nadia's look; the file stays in the brand archive. |
34
+
35
+ The package no longer depends on `@paper-design/shaders`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadicodeai/ui",
3
- "version": "8.6.0",
3
+ "version": "9.0.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,8 +70,7 @@
70
70
  "@assistant-ui/react": "0.15.20",
71
71
  "@assistant-ui/react-markdown": "0.14.15",
72
72
  "@base-ui/react": "^1.8.0",
73
- "@nadicodeai/design-system": "8.6.0",
74
- "@paper-design/shaders": "0.0.81",
73
+ "@nadicodeai/design-system": "9.0.0",
75
74
  "class-variance-authority": "^0.7.1",
76
75
  "clsx": "^2.1.1",
77
76
  "cmdk": "^1.1.1",
@@ -1,186 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction, and
10
- distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by the
13
- copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all other
16
- entities that control, are controlled by, or are under common control with
17
- that entity. For the purposes of this definition, "control" means (i) the
18
- power, direct or indirect, to cause the direction or management of such
19
- entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
- (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
- such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity exercising
24
- permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation source, and
28
- configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical transformation
31
- or translation of a Source form, including but not limited to compiled object
32
- code, generated documentation, and conversions to other media types.
33
-
34
- "Work" shall mean the work of authorship, whether in Source or Object form,
35
- made available under the License, as indicated by a copyright notice that is
36
- included in or attached to the work (an example is provided in the Appendix
37
- below).
38
-
39
- "Derivative Works" shall mean any work, whether in Source or Object form,
40
- that is based on (or derived from) the Work and for which the editorial
41
- revisions, annotations, elaborations, or other modifications represent, as a
42
- whole, an original work of authorship. For the purposes of this License,
43
- Derivative Works shall not include works that remain separable from, or merely
44
- link (or bind by name) to the interfaces of, the Work and Derivative Works
45
- thereof.
46
-
47
- "Contribution" shall mean any work of authorship, including the original
48
- version of the Work and any modifications or additions to that Work or
49
- Derivative Works thereof, that is intentionally submitted to Licensor for
50
- inclusion in the Work by the copyright owner or by an individual or Legal
51
- Entity authorized to submit on behalf of the copyright owner. For the purposes
52
- of this definition, "submitted" means any form of electronic, verbal, or
53
- written communication sent to the Licensor or its representatives, including
54
- but not limited to communication on electronic mailing lists, source code
55
- control systems, and issue tracking systems that are managed by, or on behalf
56
- of, the Licensor for the purpose of discussing and improving the Work, but
57
- excluding communication that is conspicuously marked or otherwise designated
58
- in writing by the copyright owner as "Not a Contribution."
59
-
60
- "Contributor" shall mean Licensor and any individual or Legal Entity on
61
- behalf of whom a Contribution has been received by Licensor and subsequently
62
- incorporated within the Work.
63
-
64
- 2. Grant of Copyright License. Subject to the terms and conditions of this
65
- License, each Contributor hereby grants to You a perpetual, worldwide,
66
- non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
- reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
- sublicense, and distribute the Work and such Derivative Works in Source or
69
- Object form.
70
-
71
- 3. Grant of Patent License. Subject to the terms and conditions of this
72
- License, each Contributor hereby grants to You a perpetual, worldwide,
73
- non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
74
- section) patent license to make, have made, use, offer to sell, sell, import,
75
- and otherwise transfer the Work, where such license applies only to those
76
- patent claims licensable by such Contributor that are necessarily infringed by
77
- their Contribution(s) alone or by combination of their Contribution(s) with
78
- the Work to which such Contribution(s) was submitted. If You institute patent
79
- litigation against any entity (including a cross-claim or counterclaim in a
80
- lawsuit) alleging that the Work or a Contribution incorporated within the Work
81
- constitutes direct or contributory patent infringement, then any patent
82
- licenses granted to You under this License for that Work shall terminate as of
83
- the date such litigation is filed.
84
-
85
- 4. Redistribution. You may reproduce and distribute copies of the Work or
86
- Derivative Works thereof in any medium, with or without modifications, and in
87
- Source or Object form, provided that You meet the following conditions:
88
-
89
- (a) You must give any other recipients of the Work or Derivative Works a copy
90
- of this License; and
91
-
92
- (b) You must cause any modified files to carry prominent notices stating that
93
- You changed the files; and
94
-
95
- (c) You must retain, in the Source form of any Derivative Works that You
96
- distribute, all copyright, patent, trademark, and attribution notices from the
97
- Source form of the Work, excluding those notices that do not pertain to any
98
- part of the Derivative Works; and
99
-
100
- (d) If the Work includes a "NOTICE" text file as part of its distribution,
101
- then any Derivative Works that You distribute must include a readable copy of
102
- the attribution notices contained within such NOTICE file, excluding those
103
- notices that do not pertain to any part of the Derivative Works, in at least
104
- one of the following places: within a NOTICE text file distributed as part of
105
- the Derivative Works; within the Source form or documentation, if provided
106
- along with the Derivative Works; or, within a display generated by the
107
- Derivative Works, if and wherever such third-party notices normally appear.
108
- The contents of the NOTICE file are for informational purposes only and do not
109
- modify the License. You may add Your own attribution notices within Derivative
110
- Works that You distribute, alongside or as an addendum to the NOTICE text from
111
- the Work, provided that such additional attribution notices cannot be
112
- construed as modifying the License.
113
-
114
- You may add Your own copyright statement to Your modifications and may provide
115
- additional or different license terms and conditions for use, reproduction,
116
- or distribution of Your modifications, or for any such Derivative Works as a
117
- whole, provided Your use, reproduction, and distribution of the Work otherwise
118
- complies with the conditions stated in this License.
119
-
120
- 5. Submission of Contributions. Unless You explicitly state otherwise, any
121
- Contribution intentionally submitted for inclusion in the Work by You to the
122
- Licensor shall be under the terms and conditions of this License, without any
123
- additional terms or conditions. Notwithstanding the above, nothing herein
124
- shall supersede or modify the terms of any separate license agreement you may
125
- have executed with Licensor regarding such Contributions.
126
-
127
- 6. Trademarks. This License does not grant permission to use the trade names,
128
- trademarks, service marks, or product names of the Licensor, except as required
129
- for reasonable and customary use in describing the origin of the Work and
130
- reproducing the content of the NOTICE file.
131
-
132
- 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
133
- writing, Licensor provides the Work (and each Contributor provides its
134
- Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
135
- KIND, either express or implied, including, without limitation, any warranties
136
- or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
137
- PARTICULAR PURPOSE. You are solely responsible for determining the
138
- appropriateness of using or redistributing the Work and assume any risks
139
- associated with Your exercise of permissions under this License.
140
-
141
- 8. Limitation of Liability. In no event and under no legal theory, whether in
142
- tort (including negligence), contract, or otherwise, unless required by
143
- applicable law (such as deliberate and grossly negligent acts) or agreed to in
144
- writing, shall any Contributor be liable to You for damages, including any
145
- direct, indirect, special, incidental, or consequential damages of any
146
- character arising as a result of this License or out of the use or inability to
147
- use the Work (including but not limited to damages for loss of goodwill, work
148
- stoppage, computer failure or malfunction, or any and all other commercial
149
- damages or losses), even if such Contributor has been advised of the
150
- possibility of such damages.
151
-
152
- 9. Accepting Warranty or Additional Liability. While redistributing the Work
153
- or Derivative Works thereof, You may choose to offer, and charge a fee for,
154
- acceptance of support, warranty, indemnity, or other liability obligations
155
- and/or rights consistent with this License. However, in accepting such
156
- obligations, You may act only on Your own behalf and on Your sole
157
- responsibility, not on behalf of any other Contributor, and only if You agree
158
- to indemnify, defend, and hold each Contributor harmless for any liability
159
- incurred by, or claims asserted against, such Contributor by reason of your
160
- accepting any such warranty or additional liability.
161
-
162
- END OF TERMS AND CONDITIONS
163
-
164
- APPENDIX: How to apply the Apache License to your work.
165
-
166
- To apply the Apache License to your work, attach the following boilerplate
167
- notice, with the fields enclosed by brackets "[]" replaced with your own
168
- identifying information. (Don't include the brackets!) The text should be
169
- enclosed in the appropriate comment syntax for the file format. We also
170
- recommend that a file or class name and description of purpose be included on
171
- the same "printed page" as the copyright notice for easier identification
172
- within third-party archives.
173
-
174
- Copyright [yyyy] [name of copyright owner]
175
-
176
- Licensed under the Apache License, Version 2.0 (the "License");
177
- you may not use this file except in compliance with the License.
178
- You may obtain a copy of the License at
179
-
180
- http://www.apache.org/licenses/LICENSE-2.0
181
-
182
- Unless required by applicable law or agreed to in writing, software
183
- distributed under the License is distributed on an "AS IS" BASIS,
184
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
- See the License for the specific language governing permissions and
186
- limitations under the License.
@@ -1,17 +0,0 @@
1
- import type { AgentVisualRecipe } from "../internal/agent-visual/recipes.js";
2
- type AgentVisualPresentation = "registry" | "card" | "detail";
3
- type AgentVisualAccessibility = {
4
- decorative?: true;
5
- label?: never;
6
- } | {
7
- decorative: false;
8
- label: string;
9
- };
10
- type AgentVisualProps = AgentVisualAccessibility & {
11
- className?: string;
12
- presentation?: AgentVisualPresentation;
13
- recipe: AgentVisualRecipe;
14
- };
15
- declare function AgentVisual({ className, decorative, label, presentation, recipe, }: AgentVisualProps): import("react").JSX.Element;
16
- export { AgentVisual, type AgentVisualPresentation, type AgentVisualProps, type AgentVisualRecipe };
17
- //# sourceMappingURL=agent-visual.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-visual.d.ts","sourceRoot":"","sources":["../../src/components/agent-visual.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKzE,KAAK,uBAAuB,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D,KAAK,wBAAwB,GACzB;IAAE,UAAU,CAAC,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACpC;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,KAAK,gBAAgB,GAAG,wBAAwB,GAAG;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAuBF,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,UAAiB,EACjB,KAAK,EACL,YAAqB,EACrB,MAAM,GACP,EAAE,gBAAgB,+BAoFlB;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,CAAC"}
@@ -1,63 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Component, lazy, Suspense, useCallback, useEffect, useRef, useState, } from "react";
4
- import { AgentVisualPoster } from "../internal/agent-visual/poster.js";
5
- import { cn } from "../lib/utils.js";
6
- const LazyAgentVisualRenderer = lazy(() => import("../internal/agent-visual/renderer.js"));
7
- class AgentVisualErrorBoundary extends Component {
8
- state = { failed: false };
9
- static getDerivedStateFromError() {
10
- return { failed: true };
11
- }
12
- componentDidCatch(_error, _info) {
13
- this.props.onUnavailable();
14
- }
15
- render() {
16
- return this.state.failed ? null : this.props.children;
17
- }
18
- }
19
- function AgentVisual({ className, decorative = true, label, presentation = "card", recipe, }) {
20
- const hostRef = useRef(null);
21
- const [canAnimate, setCanAnimate] = useState(false);
22
- const [isInViewport, setIsInViewport] = useState(false);
23
- const [rendererReady, setRendererReady] = useState(false);
24
- const handleReady = useCallback(() => setRendererReady(true), []);
25
- const handleUnavailable = useCallback(() => {
26
- setRendererReady(false);
27
- setCanAnimate(false);
28
- }, []);
29
- useEffect(() => {
30
- setCanAnimate(false);
31
- setRendererReady(false);
32
- if (typeof window.matchMedia !== "function")
33
- return;
34
- const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
35
- const update = () => {
36
- setRendererReady(false);
37
- setCanAnimate(!reducedMotion.matches);
38
- };
39
- update();
40
- reducedMotion.addEventListener("change", update);
41
- return () => reducedMotion.removeEventListener("change", update);
42
- }, [recipe]);
43
- useEffect(() => {
44
- const host = hostRef.current;
45
- if (!host)
46
- return;
47
- if (typeof IntersectionObserver !== "function") {
48
- setIsInViewport(true);
49
- return;
50
- }
51
- const observer = new IntersectionObserver(([entry]) => {
52
- const isIntersecting = entry?.isIntersecting ?? false;
53
- setIsInViewport(isIntersecting);
54
- if (!isIntersecting)
55
- setRendererReady(false);
56
- });
57
- observer.observe(host);
58
- return () => observer.disconnect();
59
- }, []);
60
- const hasAmbientRenderer = canAnimate && isInViewport;
61
- return (_jsxs("div", { "aria-hidden": decorative || undefined, "aria-label": decorative ? undefined : label, className: cn("relative isolate size-full overflow-hidden rounded-md bg-nc-identity-ink", presentation === "card" && "min-h-20", presentation === "detail" && "min-h-48", className), "data-agent-visual-motion": hasAmbientRenderer ? "ambient" : "static", "data-agent-visual-presentation": presentation, "data-agent-visual-recipe": recipe, ref: hostRef, role: decorative ? undefined : "img", children: [_jsx(AgentVisualPoster, { recipe: recipe }), hasAmbientRenderer && hostRef.current ? (_jsx("div", { "aria-hidden": "true", className: cn("absolute inset-0 opacity-0 transition-opacity duration-[var(--nc-duration-close)] ease-[var(--nc-ease-out-strong)]", rendererReady && "opacity-100"), "data-agent-visual-renderer": "paper-metaballs", children: _jsx(AgentVisualErrorBoundary, { onUnavailable: handleUnavailable, children: _jsx(Suspense, { fallback: null, children: _jsx(LazyAgentVisualRenderer, { host: hostRef.current, onReady: handleReady, onUnavailable: handleUnavailable, recipe: recipe }) }) }) })) : null] }));
62
- }
63
- export { AgentVisual };
@@ -1,13 +0,0 @@
1
- /**
2
- * The stored appearance, reachable from a server. `forma-avatar.tsx` is a
3
- * `"use client"` module, and under React Server Components every export of one
4
- * becomes a client reference — a re-exported pure function included, which a
5
- * server caller can only fail to invoke. A product whose server resolves an
6
- * Agent's look before it renders the avatar (the Portal builds its rows that
7
- * way) imports the resolver from here, and so does every other consumer: the
8
- * avatar comes from `@nadicodeai/ui/components/forma-avatar`, the stored
9
- * spelling from this module, and neither re-exports the other.
10
- */
11
- export { type StoredAppearance, defaultShape, formaColorValues, resolveAppearance, shapeFor, } from "../internal/forma/stored-appearance.js";
12
- export { type FormaChoice, type FormaColor, type FormaForm, type FormaState, } from "../internal/forma/model.js";
13
- //# sourceMappingURL=forma-appearance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"forma-appearance.d.ts","sourceRoot":"","sources":["../../src/components/forma-appearance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,KAAK,gBAAgB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,wBAAwB,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * The stored appearance, reachable from a server. `forma-avatar.tsx` is a
3
- * `"use client"` module, and under React Server Components every export of one
4
- * becomes a client reference — a re-exported pure function included, which a
5
- * server caller can only fail to invoke. A product whose server resolves an
6
- * Agent's look before it renders the avatar (the Portal builds its rows that
7
- * way) imports the resolver from here, and so does every other consumer: the
8
- * avatar comes from `@nadicodeai/ui/components/forma-avatar`, the stored
9
- * spelling from this module, and neither re-exports the other.
10
- */
11
- export { defaultShape, formaColorValues, resolveAppearance, shapeFor, } from "../internal/forma/stored-appearance.js";
@@ -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"}