@fadenstack/ui-web 0.0.0-stage → 0.3.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +187 -0
- package/NOTICE +19 -0
- package/README.md +24 -2
- package/dist/avatar.d.ts +30 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +85 -0
- package/dist/avatar.js.map +1 -0
- package/dist/dom.d.ts +43 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +113 -0
- package/dist/dom.js.map +1 -0
- package/dist/icons.d.ts +38 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +37 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/presentation.d.ts +25 -0
- package/dist/presentation.d.ts.map +1 -0
- package/dist/presentation.js +46 -0
- package/dist/presentation.js.map +1 -0
- package/package.json +44 -4
- package/src/avatar.ts +119 -0
- package/src/dom.ts +118 -0
- package/src/icons.ts +38 -0
- package/src/index.ts +26 -0
- package/src/presentation.ts +60 -0
- package/styles.css +1440 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
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,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising 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
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Fadenstack TypeScript SDK
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Emagin8 UG (haftungsbeschränkt) and contributors.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
@fadenstack/ui-web includes icons adapted from Material Icons by Google
|
|
18
|
+
(https://github.com/google/material-design-icons), licensed under the
|
|
19
|
+
Apache License, Version 2.0.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @fadenstack/ui-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The web look of the [Fadenstack](https://fadenstack.com) chat, for any framework: the stylesheet, the icons, the
|
|
4
|
+
agent's avatar and the panel's browser behaviours. [`@fadenstack/ui-react`](https://www.npmjs.com/package/@fadenstack/ui-react)
|
|
5
|
+
and [`@fadenstack/ui-vue`](https://www.npmjs.com/package/@fadenstack/ui-vue) draw the same markup with it; a skin for
|
|
6
|
+
another framework uses it the same way.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @fadenstack/ui-web
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import "@fadenstack/ui-web/styles.css";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `styles.css`: the panel's classes (`.fdn-*`), themed with CSS variables (`--fdn-accent`, ...). It follows the
|
|
17
|
+
page's light or dark scheme, and its directions are logical, so it mirrors for a right-to-left language.
|
|
18
|
+
- `iconPaths`: the icons as SVG path data on a 24 x 24 grid.
|
|
19
|
+
- `agentAvatar()`: the agent's avatar as SVG data, which a skin turns into its own elements.
|
|
20
|
+
- `stickToBottom`, `dismissOnOutside`, `fitToContent`, `focusAtEnd`, `composerKey`: the panel's behaviours.
|
|
21
|
+
- `toolBadges`, `toolStatusIcon`, `noticeIcon`, ...: how parts look, decided once for every skin.
|
|
22
|
+
|
|
23
|
+
- Documentation: <https://developers.fadenstack.com/sdk/typescript/chat-panel/>
|
|
24
|
+
- Source and issues: <https://github.com/fadenstack/fadenstack-sdk-typescript>
|
|
25
|
+
- Licence: Apache-2.0 (LICENSE and NOTICE are in the package)
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent's face: the Fadenstack "stack" -- three plates, the rose middle one is the thread, and two eyes peek
|
|
3
|
+
* out from under the top plate. Drawn from the brand geometry (brand/avatar/make_agent_avatar.py) as data, so
|
|
4
|
+
* every skin draws the same SVG; it scales and follows the panel's theme tokens (`--fdn-agent-*`).
|
|
5
|
+
*/
|
|
6
|
+
/** An SVG element as data, which a skin turns into its own elements (React's `createElement`, Vue's `h`). */
|
|
7
|
+
export interface SvgNode {
|
|
8
|
+
tag: string;
|
|
9
|
+
/** Attributes as SVG spells them ("stroke-width", "viewBox", "class"), in the order they are written. */
|
|
10
|
+
attrs: Readonly<Record<string, string | number>>;
|
|
11
|
+
/** Inline style: camelCase properties and custom properties ("--fdn-agent-thread"). */
|
|
12
|
+
style?: Readonly<Record<string, string | number>>;
|
|
13
|
+
children?: readonly SvgNode[];
|
|
14
|
+
}
|
|
15
|
+
export interface AgentAvatarOptions {
|
|
16
|
+
/** Pixels. Up to 32 px the small cut is drawn: bigger eyes, the top plate raised, no loose thread end. */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** `mono` draws one colour (`currentColor`): eyes are rings with a pupil, overlaps are transparent gaps. */
|
|
19
|
+
variant?: "color" | "mono";
|
|
20
|
+
/** A custom agent's own thread colour for the middle plate. Fadenstack's own agents keep the rose. */
|
|
21
|
+
color?: string;
|
|
22
|
+
/** Read out by screen readers; without it the avatar is decorative. */
|
|
23
|
+
label?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Unique on the page (React's `useId`, Vue's `useId`): the mono variant's masks are named after it. */
|
|
26
|
+
idPrefix: string;
|
|
27
|
+
}
|
|
28
|
+
/** The avatar's `<svg>`. */
|
|
29
|
+
export declare function agentAvatar({ size, variant, color, label, className, idPrefix }: AgentAvatarOptions): SvgNode;
|
|
30
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../src/avatar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6GAA6G;AAC7G,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,yGAAyG;IACzG,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IACjD,uFAAuF;IACvF,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,0GAA0G;IAC1G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4GAA4G;IAC5G,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,QAAQ,EAAE,MAAM,CAAC;CAClB;AA0BD,4BAA4B;AAC5B,wBAAgB,WAAW,CAAC,EAAE,IAAS,EAAE,OAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAAG,OAAO,CA+D5H"}
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent's face: the Fadenstack "stack" -- three plates, the rose middle one is the thread, and two eyes peek
|
|
3
|
+
* out from under the top plate. Drawn from the brand geometry (brand/avatar/make_agent_avatar.py) as data, so
|
|
4
|
+
* every skin draws the same SVG; it scales and follows the panel's theme tokens (`--fdn-agent-*`).
|
|
5
|
+
*/
|
|
6
|
+
const W = 58, H = 29, T = 9, MID = 122, BOT = 146;
|
|
7
|
+
const TAIL = "M152 128 C168 132 176 148 168 160";
|
|
8
|
+
const EYE_Y = 104;
|
|
9
|
+
const CUTS = {
|
|
10
|
+
full: { view: "21 30 158 158", lid: 62, eyes: [88, 112], rx: 8, ry: 9.5, outline: 2, pupil: 4.2, glint: 1.4, ring: 3.6, mpupil: 4.6, gap: 4 },
|
|
11
|
+
small: { view: "19.5 25 161 161", lid: 56, eyes: [84, 116], rx: 11, ry: 12.5, outline: 3, pupil: 5.8, glint: 1.9, ring: 6, mpupil: 6.4, gap: 6 },
|
|
12
|
+
};
|
|
13
|
+
const poly = (points) => `M${points.map(([x, y]) => `${x} ${y}`).join(" L")} Z`;
|
|
14
|
+
function plate(cy) {
|
|
15
|
+
return {
|
|
16
|
+
top: poly([[100, cy - H], [100 + W, cy], [100, cy + H], [100 - W, cy]]),
|
|
17
|
+
left: poly([[100 - W, cy], [100, cy + H], [100, cy + H + T], [100 - W, cy + T]]),
|
|
18
|
+
right: poly([[100, cy + H], [100 + W, cy], [100 + W, cy + T], [100, cy + H + T]]),
|
|
19
|
+
outline: poly([[100 - W, cy], [100, cy - H], [100 + W, cy], [100 + W, cy + T], [100, cy + H + T], [100 - W, cy + T]]),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const node = (tag, attrs, children, style) => ({ tag, attrs, ...(style ? { style } : {}), ...(children ? { children } : {}) });
|
|
23
|
+
const solid = (d, fill) => node("path", { d }, undefined, { fill, stroke: fill, strokeWidth: 3, strokeLinejoin: "round" });
|
|
24
|
+
/** The avatar's `<svg>`. */
|
|
25
|
+
export function agentAvatar({ size = 56, variant = "color", color, label, className, idPrefix }) {
|
|
26
|
+
const id = idPrefix.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
27
|
+
const small = size <= 32;
|
|
28
|
+
const k = small ? CUTS.small : CUTS.full;
|
|
29
|
+
const bottom = plate(BOT), middle = plate(MID), lid = plate(k.lid);
|
|
30
|
+
const a11y = label ? { role: "img", "aria-label": label } : { "aria-hidden": "true" };
|
|
31
|
+
const svg = {
|
|
32
|
+
class: `fdn-agent-avatar${className ? ` ${className}` : ""}`,
|
|
33
|
+
width: size,
|
|
34
|
+
height: size,
|
|
35
|
+
viewBox: k.view,
|
|
36
|
+
focusable: "false",
|
|
37
|
+
};
|
|
38
|
+
if (variant === "mono") {
|
|
39
|
+
const full = node("rect", { x: "0", y: "0", width: "200", height: "200", fill: "#fff" });
|
|
40
|
+
const grow = { fill: "#000", stroke: "#000", "stroke-width": k.gap * 2, "stroke-linejoin": "round" };
|
|
41
|
+
const erx = k.rx + k.ring / 2 + k.gap, ery = k.ry + k.ring / 2 + k.gap;
|
|
42
|
+
const mask = (suffix, children) => node("mask", { id: `${id}${suffix}`, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "200", height: "200" }, [full, ...children]);
|
|
43
|
+
return node("svg", { ...svg, ...a11y }, [
|
|
44
|
+
node("defs", {}, [
|
|
45
|
+
mask("b", [node("path", { d: middle.outline, ...grow }),
|
|
46
|
+
...(small ? [] : [node("path", { d: TAIL, fill: "none", stroke: "#000", "stroke-width": 6 + k.gap * 2, "stroke-linecap": "round" })])]),
|
|
47
|
+
mask("m", [node("path", { d: lid.outline, ...grow }),
|
|
48
|
+
...k.eyes.map((x) => node("ellipse", { cx: x, cy: EYE_Y, rx: erx, ry: ery, fill: "#000" }))]),
|
|
49
|
+
mask("e", [node("path", { d: lid.outline, ...grow })]),
|
|
50
|
+
]),
|
|
51
|
+
node("g", { fill: "currentColor", stroke: "currentColor", "stroke-linejoin": "round" }, [
|
|
52
|
+
node("path", { d: bottom.outline, "stroke-width": 3, mask: `url(#${id}b)` }),
|
|
53
|
+
...(small ? [] : [node("path", { d: TAIL, fill: "none", "stroke-width": 6, "stroke-linecap": "round" })]),
|
|
54
|
+
node("path", { d: middle.outline, "stroke-width": 3, mask: `url(#${id}m)` }),
|
|
55
|
+
node("g", { mask: `url(#${id}e)` }, k.eyes.map((x) => node("g", {}, [
|
|
56
|
+
node("ellipse", { cx: x, cy: EYE_Y, rx: k.rx, ry: k.ry, fill: "none", "stroke-width": k.ring }),
|
|
57
|
+
node("circle", { cx: x + 1, cy: EYE_Y - 1.5, r: k.mpupil, stroke: "none" }),
|
|
58
|
+
]))),
|
|
59
|
+
node("path", { d: lid.outline, "stroke-width": 3 }),
|
|
60
|
+
]),
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
const style = color ? { "--fdn-agent-thread": color, "--fdn-agent-thread-side": `color-mix(in srgb, ${color} 72%, #000)` } : undefined;
|
|
64
|
+
const plateSide = "var(--fdn-agent-plate-side, #0A0E1A)", plateTop = "var(--fdn-agent-plate, #1C2436)";
|
|
65
|
+
const threadSide = "var(--fdn-agent-thread-side, #A8143E)", thread = "var(--fdn-agent-thread, #E2325A)";
|
|
66
|
+
return node("svg", { ...svg, ...a11y }, [
|
|
67
|
+
solid(bottom.left, plateSide),
|
|
68
|
+
solid(bottom.right, plateSide),
|
|
69
|
+
solid(bottom.top, plateTop),
|
|
70
|
+
...(small ? [] : [node("path", { d: TAIL, fill: "none" }, undefined, { stroke: thread, strokeWidth: 6, strokeLinecap: "round" })]),
|
|
71
|
+
solid(middle.left, threadSide),
|
|
72
|
+
solid(middle.right, threadSide),
|
|
73
|
+
solid(middle.top, thread),
|
|
74
|
+
...(small ? [] : [node("ellipse", { cx: "100", cy: "110", rx: "34", ry: "11" }, undefined, { fill: "var(--fdn-agent-hollow, rgba(10, 14, 26, 0.38))" })]),
|
|
75
|
+
...k.eyes.map((x) => node("g", {}, [
|
|
76
|
+
node("ellipse", { cx: x, cy: EYE_Y, rx: k.rx, ry: k.ry }, undefined, { fill: "var(--fdn-agent-eye, #FFFFFF)", stroke: "var(--fdn-agent-pupil, #0A0E1A)", strokeWidth: k.outline }),
|
|
77
|
+
node("circle", { cx: x + 1, cy: EYE_Y - 1.5, r: k.pupil }, undefined, { fill: "var(--fdn-agent-pupil, #0A0E1A)" }),
|
|
78
|
+
node("circle", { cx: x + 2.6, cy: EYE_Y - 1.5 - k.pupil * 0.45, r: k.glint }, undefined, { fill: "var(--fdn-agent-eye, #FFFFFF)" }),
|
|
79
|
+
])),
|
|
80
|
+
solid(lid.left, plateSide),
|
|
81
|
+
solid(lid.right, plateSide),
|
|
82
|
+
solid(lid.top, plateTop),
|
|
83
|
+
], style);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../src/avatar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC;AAClD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE;IAC7I,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE;CACxI,CAAC;AAEX,MAAM,IAAI,GAAG,CAAC,MAA8C,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,C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AAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE;YACjC,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EACjE,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,iCAAiC,EAAE,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YAC/G,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,iCAAiC,EAAE,CAAC;YAClH,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE,CAAC;SACpI,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;QAC1B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC;KACzB,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The panel's browser behaviours, for any framework: a skin calls them from its own lifecycle. */
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a scroll box at the bottom while its content (its first child) grows -- unless the user scrolled up to
|
|
4
|
+
* read; then it stays where they are until they scroll back down. Call `stop` when the box goes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stickToBottom(box: HTMLElement, threshold?: number): {
|
|
7
|
+
readonly stuck: boolean;
|
|
8
|
+
stop(): void;
|
|
9
|
+
};
|
|
10
|
+
/** Calls `close` on a press outside `anchor` (a menu and its button) or on Escape. Returns the stop. */
|
|
11
|
+
export declare function dismissOnOutside(anchor: HTMLElement, close: () => void): () => void;
|
|
12
|
+
/** Grows a text box with its text, up to a third of the window (at least 120 px). */
|
|
13
|
+
export declare function fitToContent(box: HTMLTextAreaElement): void;
|
|
14
|
+
/** Focuses a text box with the caret after its text (after "Edit", or the host attached something). */
|
|
15
|
+
export declare function focusAtEnd(box: HTMLTextAreaElement): void;
|
|
16
|
+
/** What a key in the composer does (`composerKey`). */
|
|
17
|
+
export type ComposerAction = "send" | "stop" | "pick" | "next" | "previous" | "close";
|
|
18
|
+
/**
|
|
19
|
+
* What a key in the composer does: Enter sends (Shift+Enter is a new line, and an input method that is still
|
|
20
|
+
* composing keeps its Enter), Escape stops the running answer. While the skill picker is open (`pickerOpen`), the
|
|
21
|
+
* arrows move in it, Enter and Tab pick, and Escape closes it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function composerKey(e: Pick<KeyboardEvent, "key" | "shiftKey" | "isComposing">, busy: boolean, pickerOpen?: boolean): ComposerAction | undefined;
|
|
24
|
+
/** The pictures among pasted or dropped files. */
|
|
25
|
+
export declare function picturesIn(transfer: DataTransfer | null | undefined): File[];
|
|
26
|
+
/** A picture made ready for a message: a `data:` URL, and its size in pixels. */
|
|
27
|
+
export interface ReadPicture {
|
|
28
|
+
dataUrl: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A picture as a message takes it: at most `maxSide` pixels on its longer side (models scale larger ones down
|
|
34
|
+
* anyway, and the transcript keeps it), as JPEG on white (transparent parts of a screenshot stay readable).
|
|
35
|
+
* Throws when the browser cannot read it as a picture.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readPicture(picture: Blob, options?: {
|
|
38
|
+
maxSide?: number;
|
|
39
|
+
quality?: number;
|
|
40
|
+
}): Promise<ReadPicture>;
|
|
41
|
+
/** How long a copy button shows its tick. */
|
|
42
|
+
export declare const COPIED_MS = 1500;
|
|
43
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,SAAK,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,IAAI,IAAI,CAAA;CAAE,CAoBzG;AAED,wGAAwG;AACxG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAanF;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAI3D;AAED,uGAAuG;AACvG,wBAAgB,UAAU,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAIzD;AAED,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;AAEtF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,UAAU,GAAG,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,cAAc,GAAG,SAAS,CAUrJ;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,EAAE,CAE5E;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAmB3H;AAED,6CAA6C;AAC7C,eAAO,MAAM,SAAS,OAAO,CAAC"}
|
package/dist/dom.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/** The panel's browser behaviours, for any framework: a skin calls them from its own lifecycle. */
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a scroll box at the bottom while its content (its first child) grows -- unless the user scrolled up to
|
|
4
|
+
* read; then it stays where they are until they scroll back down. Call `stop` when the box goes.
|
|
5
|
+
*/
|
|
6
|
+
export function stickToBottom(box, threshold = 48) {
|
|
7
|
+
let stuck = true;
|
|
8
|
+
const onScroll = () => {
|
|
9
|
+
stuck = box.scrollHeight - box.scrollTop - box.clientHeight < threshold;
|
|
10
|
+
};
|
|
11
|
+
box.addEventListener("scroll", onScroll, { passive: true });
|
|
12
|
+
const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(() => {
|
|
13
|
+
if (stuck)
|
|
14
|
+
box.scrollTop = box.scrollHeight;
|
|
15
|
+
});
|
|
16
|
+
const content = box.firstElementChild;
|
|
17
|
+
if (observer && content)
|
|
18
|
+
observer.observe(content);
|
|
19
|
+
return {
|
|
20
|
+
get stuck() {
|
|
21
|
+
return stuck;
|
|
22
|
+
},
|
|
23
|
+
stop() {
|
|
24
|
+
box.removeEventListener("scroll", onScroll);
|
|
25
|
+
observer?.disconnect();
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Calls `close` on a press outside `anchor` (a menu and its button) or on Escape. Returns the stop. */
|
|
30
|
+
export function dismissOnOutside(anchor, close) {
|
|
31
|
+
const onPointer = (e) => {
|
|
32
|
+
if (!anchor.contains(e.target))
|
|
33
|
+
close();
|
|
34
|
+
};
|
|
35
|
+
const onKey = (e) => {
|
|
36
|
+
if (e.key === "Escape")
|
|
37
|
+
close();
|
|
38
|
+
};
|
|
39
|
+
anchor.ownerDocument.addEventListener("pointerdown", onPointer);
|
|
40
|
+
anchor.ownerDocument.addEventListener("keydown", onKey);
|
|
41
|
+
return () => {
|
|
42
|
+
anchor.ownerDocument.removeEventListener("pointerdown", onPointer);
|
|
43
|
+
anchor.ownerDocument.removeEventListener("keydown", onKey);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Grows a text box with its text, up to a third of the window (at least 120 px). */
|
|
47
|
+
export function fitToContent(box) {
|
|
48
|
+
const view = box.ownerDocument.defaultView;
|
|
49
|
+
box.style.height = "auto";
|
|
50
|
+
box.style.height = `${Math.min(box.scrollHeight, Math.max(120, (view?.innerHeight ?? 360) / 3))}px`;
|
|
51
|
+
}
|
|
52
|
+
/** Focuses a text box with the caret after its text (after "Edit", or the host attached something). */
|
|
53
|
+
export function focusAtEnd(box) {
|
|
54
|
+
box.focus();
|
|
55
|
+
const end = box.value.length;
|
|
56
|
+
box.setSelectionRange(end, end);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* What a key in the composer does: Enter sends (Shift+Enter is a new line, and an input method that is still
|
|
60
|
+
* composing keeps its Enter), Escape stops the running answer. While the skill picker is open (`pickerOpen`), the
|
|
61
|
+
* arrows move in it, Enter and Tab pick, and Escape closes it.
|
|
62
|
+
*/
|
|
63
|
+
export function composerKey(e, busy, pickerOpen = false) {
|
|
64
|
+
if (pickerOpen && !e.isComposing) {
|
|
65
|
+
if (e.key === "ArrowDown")
|
|
66
|
+
return "next";
|
|
67
|
+
if (e.key === "ArrowUp")
|
|
68
|
+
return "previous";
|
|
69
|
+
if ((e.key === "Enter" && !e.shiftKey) || e.key === "Tab")
|
|
70
|
+
return "pick";
|
|
71
|
+
if (e.key === "Escape")
|
|
72
|
+
return "close";
|
|
73
|
+
}
|
|
74
|
+
if (e.key === "Enter" && !e.shiftKey && !e.isComposing)
|
|
75
|
+
return "send";
|
|
76
|
+
if (e.key === "Escape" && busy)
|
|
77
|
+
return "stop";
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/** The pictures among pasted or dropped files. */
|
|
81
|
+
export function picturesIn(transfer) {
|
|
82
|
+
return Array.from(transfer?.files ?? []).filter((f) => f.type.startsWith("image/"));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A picture as a message takes it: at most `maxSide` pixels on its longer side (models scale larger ones down
|
|
86
|
+
* anyway, and the transcript keeps it), as JPEG on white (transparent parts of a screenshot stay readable).
|
|
87
|
+
* Throws when the browser cannot read it as a picture.
|
|
88
|
+
*/
|
|
89
|
+
export async function readPicture(picture, options = {}) {
|
|
90
|
+
const maxSide = options.maxSide ?? 1600;
|
|
91
|
+
const bitmap = await createImageBitmap(picture);
|
|
92
|
+
try {
|
|
93
|
+
const scale = Math.min(1, maxSide / Math.max(bitmap.width, bitmap.height, 1));
|
|
94
|
+
const width = Math.max(1, Math.round(bitmap.width * scale));
|
|
95
|
+
const height = Math.max(1, Math.round(bitmap.height * scale));
|
|
96
|
+
const canvas = document.createElement("canvas");
|
|
97
|
+
canvas.width = width;
|
|
98
|
+
canvas.height = height;
|
|
99
|
+
const context = canvas.getContext("2d");
|
|
100
|
+
if (!context)
|
|
101
|
+
throw new Error("No canvas to draw the picture on.");
|
|
102
|
+
context.fillStyle = "#fff";
|
|
103
|
+
context.fillRect(0, 0, width, height);
|
|
104
|
+
context.drawImage(bitmap, 0, 0, width, height);
|
|
105
|
+
return { dataUrl: canvas.toDataURL("image/jpeg", options.quality ?? 0.85), width, height };
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
bitmap.close();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** How long a copy button shows its tick. */
|
|
112
|
+
export const COPIED_MS = 1500;
|
|
113
|
+
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgB,EAAE,SAAS,GAAG,EAAE;IAC5D,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,KAAK,GAAG,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC;IAC1E,CAAC,CAAC;IACF,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,GAAG,EAAE;QAC3F,IAAI,KAAK;YAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC;IACtC,IAAI,QAAQ,IAAI,OAAO;QAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO;QACL,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI;YACF,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC5C,QAAQ,EAAE,UAAU,EAAE,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,gBAAgB,CAAC,MAAmB,EAAE,KAAiB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AG,IAAI,CAAC"}
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chat's icons as SVG path data on a 24 x 24 grid, drawn in `currentColor`: every skin draws the same ones.
|
|
3
|
+
*
|
|
4
|
+
* Most paths are Google's Material Icons (https://github.com/google/material-design-icons), some of them changed,
|
|
5
|
+
* under the Apache License 2.0. The package's NOTICE says so.
|
|
6
|
+
*/
|
|
7
|
+
export declare const iconPaths: {
|
|
8
|
+
readonly send: "M3.4 20.4 21 12 3.4 3.6l-.01 6.53L15 12 3.39 13.87z";
|
|
9
|
+
readonly image: "M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z";
|
|
10
|
+
readonly camera: "M12 15.2a3.2 3.2 0 1 0 0-6.4 3.2 3.2 0 0 0 0 6.4zM9 2 7.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-3.17L15 2z";
|
|
11
|
+
readonly translate: "m12.87 15.07-2.54-2.51.03-.03A17.52 17.52 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7 1.62-4.33L19.12 17z";
|
|
12
|
+
readonly stop: "M7 7h10v10H7z";
|
|
13
|
+
readonly plus: "M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z";
|
|
14
|
+
readonly history: "M13 3a9 9 0 0 0-9 9H1l3.9 3.9.1.1L9 12H6a7 7 0 1 1 2.05 4.95l-1.42 1.42A9 9 0 1 0 13 3zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z";
|
|
15
|
+
readonly chevron: "M7.4 8.6 12 13.2l4.6-4.6L18 10l-6 6-6-6z";
|
|
16
|
+
readonly copy: "M16 1H4a2 2 0 0 0-2 2v14h2V3h12zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11z";
|
|
17
|
+
readonly check: "M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z";
|
|
18
|
+
readonly close: "M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z";
|
|
19
|
+
readonly tool: "M22.7 19 13.6 9.9c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z";
|
|
20
|
+
readonly warning: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z";
|
|
21
|
+
readonly shield: "M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z";
|
|
22
|
+
readonly info: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z";
|
|
23
|
+
/** After a link that opens in a new tab. */
|
|
24
|
+
readonly external: "M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z";
|
|
25
|
+
readonly edit: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z";
|
|
26
|
+
readonly retry: "M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 7.73 10h-2.08A6 6 0 1 1 12 6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z";
|
|
27
|
+
readonly trash: "M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z";
|
|
28
|
+
readonly sparkle: "M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z";
|
|
29
|
+
readonly page: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm4 18H6V4h7v5h5z";
|
|
30
|
+
readonly brain: "M12 3a4 4 0 0 0-4 4v.1A3.5 3.5 0 0 0 5 10.5c0 .9.3 1.7.9 2.4A3.5 3.5 0 0 0 8 19h.2A4 4 0 0 0 16 19h.2a3.5 3.5 0 0 0 2-6.1c.5-.7.8-1.5.8-2.4A3.5 3.5 0 0 0 16 7.1V7a4 4 0 0 0-4-4zm-1 3v12H9a1.5 1.5 0 0 1 0-3V9A1.5 1.5 0 0 1 11 6zm2 0a1.5 1.5 0 0 1 2 3v6a1.5 1.5 0 0 1 0 3h-2z";
|
|
31
|
+
readonly quote: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z";
|
|
32
|
+
readonly book: "M18 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zM6 4h5v8l-2.5-1.5L6 12z";
|
|
33
|
+
readonly attach: "M16.5 6v11.5a4 4 0 0 1-8 0V5a2.5 2.5 0 0 1 5 0v10.5a1 1 0 0 1-2 0V6H10v9.5a2.5 2.5 0 0 0 5 0V5a4 4 0 0 0-8 0v12.5a5.5 5.5 0 0 0 11 0V6z";
|
|
34
|
+
readonly tabs: "M21 3H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 16H3V5h10v4h8z";
|
|
35
|
+
readonly settings: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.48.48 0 0 0-.59.22L2.74 8.87a.47.47 0 0 0 .12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32a.47.47 0 0 0-.12-.61zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z";
|
|
36
|
+
};
|
|
37
|
+
export type IconName = keyof typeof iconPaths;
|
|
38
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;IAgBpB,4CAA4C;;;;;;;;;;;;;CAapC,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chat's icons as SVG path data on a 24 x 24 grid, drawn in `currentColor`: every skin draws the same ones.
|
|
3
|
+
*
|
|
4
|
+
* Most paths are Google's Material Icons (https://github.com/google/material-design-icons), some of them changed,
|
|
5
|
+
* under the Apache License 2.0. The package's NOTICE says so.
|
|
6
|
+
*/
|
|
7
|
+
export const iconPaths = {
|
|
8
|
+
send: "M3.4 20.4 21 12 3.4 3.6l-.01 6.53L15 12 3.39 13.87z",
|
|
9
|
+
image: "M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z",
|
|
10
|
+
camera: "M12 15.2a3.2 3.2 0 1 0 0-6.4 3.2 3.2 0 0 0 0 6.4zM9 2 7.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-3.17L15 2z",
|
|
11
|
+
translate: "m12.87 15.07-2.54-2.51.03-.03A17.52 17.52 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7 1.62-4.33L19.12 17z",
|
|
12
|
+
stop: "M7 7h10v10H7z",
|
|
13
|
+
plus: "M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z",
|
|
14
|
+
history: "M13 3a9 9 0 0 0-9 9H1l3.9 3.9.1.1L9 12H6a7 7 0 1 1 2.05 4.95l-1.42 1.42A9 9 0 1 0 13 3zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z",
|
|
15
|
+
chevron: "M7.4 8.6 12 13.2l4.6-4.6L18 10l-6 6-6-6z",
|
|
16
|
+
copy: "M16 1H4a2 2 0 0 0-2 2v14h2V3h12zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11z",
|
|
17
|
+
check: "M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z",
|
|
18
|
+
close: "M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z",
|
|
19
|
+
tool: "M22.7 19 13.6 9.9c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z",
|
|
20
|
+
warning: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z",
|
|
21
|
+
shield: "M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z",
|
|
22
|
+
info: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",
|
|
23
|
+
/** After a link that opens in a new tab. */
|
|
24
|
+
external: "M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z",
|
|
25
|
+
edit: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z",
|
|
26
|
+
retry: "M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 7.73 10h-2.08A6 6 0 1 1 12 6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z",
|
|
27
|
+
trash: "M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z",
|
|
28
|
+
sparkle: "M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z",
|
|
29
|
+
page: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm4 18H6V4h7v5h5z",
|
|
30
|
+
brain: "M12 3a4 4 0 0 0-4 4v.1A3.5 3.5 0 0 0 5 10.5c0 .9.3 1.7.9 2.4A3.5 3.5 0 0 0 8 19h.2A4 4 0 0 0 16 19h.2a3.5 3.5 0 0 0 2-6.1c.5-.7.8-1.5.8-2.4A3.5 3.5 0 0 0 16 7.1V7a4 4 0 0 0-4-4zm-1 3v12H9a1.5 1.5 0 0 1 0-3V9A1.5 1.5 0 0 1 11 6zm2 0a1.5 1.5 0 0 1 2 3v6a1.5 1.5 0 0 1 0 3h-2z",
|
|
31
|
+
quote: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z",
|
|
32
|
+
book: "M18 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zM6 4h5v8l-2.5-1.5L6 12z",
|
|
33
|
+
attach: "M16.5 6v11.5a4 4 0 0 1-8 0V5a2.5 2.5 0 0 1 5 0v10.5a1 1 0 0 1-2 0V6H10v9.5a2.5 2.5 0 0 0 5 0V5a4 4 0 0 0-8 0v12.5a5.5 5.5 0 0 0 11 0V6z",
|
|
34
|
+
tabs: "M21 3H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 16H3V5h10v4h8z",
|
|
35
|
+
settings: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.48.48 0 0 0-.59.22L2.74 8.87a.47.47 0 0 0 .12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32a.47.47 0 0 0-.12-.61zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z",
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=icons.js.map
|