@pollinations/ui 0.1.0-alpha.0 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -87
- package/dist/Button-CO3Dpbkj.d.cts +29 -0
- package/dist/Button-CO3Dpbkj.d.ts +29 -0
- package/dist/Chip-v-ADv6cz.d.cts +18 -0
- package/dist/Chip-v-ADv6cz.d.ts +18 -0
- package/dist/Dialog-yXzIFrDg.d.cts +63 -0
- package/dist/Dialog-yXzIFrDg.d.ts +63 -0
- package/dist/app-user-menu/sdk.cjs +893 -0
- package/dist/app-user-menu/sdk.cjs.map +1 -0
- package/dist/{compositions/app-user.d.cts → app-user-menu/sdk.d.cts} +6 -7
- package/dist/{compositions/app-user.d.ts → app-user-menu/sdk.d.ts} +6 -7
- package/dist/app-user-menu/sdk.js +872 -0
- package/dist/app-user-menu/sdk.js.map +1 -0
- package/dist/app.css +7 -32
- package/dist/auth/index.cjs +1346 -76
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +88 -6
- package/dist/auth/index.d.ts +88 -6
- package/dist/auth/index.js +1343 -75
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sdk.cjs +78 -60
- package/dist/auth/sdk.cjs.map +1 -1
- package/dist/auth/sdk.d.cts +2 -15
- package/dist/auth/sdk.d.ts +2 -15
- package/dist/auth/sdk.js +77 -57
- package/dist/auth/sdk.js.map +1 -1
- package/dist/brand/lockup-horizontal-black.png +0 -0
- package/dist/brand/lockup-horizontal-black.svg +4 -0
- package/dist/brand/lockup-horizontal-white.png +0 -0
- package/dist/brand/lockup-horizontal-white.svg +4 -0
- package/dist/brand/lockup-horizontal.svg +1 -0
- package/dist/brand/lockup-stacked-black.png +0 -0
- package/dist/brand/lockup-stacked-black.svg +4 -0
- package/dist/brand/lockup-stacked-white.png +0 -0
- package/dist/brand/lockup-stacked-white.svg +4 -0
- package/dist/brand/lockup-stacked.svg +4 -0
- package/dist/brand/mark-black.png +0 -0
- package/dist/brand/mark-black.svg +3 -0
- package/dist/brand/mark-white.png +0 -0
- package/dist/brand/mark-white.svg +3 -0
- package/dist/brand/mark.svg +1 -0
- package/dist/brand/polli/polli-lockup-horizontal-black.png +0 -0
- package/dist/brand/polli/polli-lockup-horizontal-white.png +0 -0
- package/dist/brand/polli/polli-lockup-stacked-black.png +0 -0
- package/dist/brand/polli/polli-lockup-stacked-white.png +0 -0
- package/dist/brand/polli/polli.png +0 -0
- package/dist/brand/wordmark-black.png +0 -0
- package/dist/brand/wordmark-black.svg +1 -0
- package/dist/brand/wordmark-white.png +0 -0
- package/dist/brand/wordmark-white.svg +1 -0
- package/dist/brand/wordmark.svg +1 -0
- package/dist/fonts/geist-pixel-square.woff2 +0 -0
- package/dist/gen/index.cjs +658 -0
- package/dist/gen/index.cjs.map +1 -0
- package/dist/gen/index.d.cts +80 -0
- package/dist/gen/index.d.ts +80 -0
- package/dist/gen/index.js +630 -0
- package/dist/gen/index.js.map +1 -0
- package/dist/index.browser.min.js +2 -0
- package/dist/index.browser.min.js.map +1 -0
- package/dist/index.cjs +3847 -1490
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +632 -218
- package/dist/index.d.ts +632 -218
- package/dist/index.js +3744 -1450
- package/dist/index.js.map +1 -1
- package/dist/licenses/Geist-OFL.txt +93 -0
- package/dist/markdown.cjs +821 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +16 -0
- package/dist/markdown.d.ts +16 -0
- package/dist/markdown.js +792 -0
- package/dist/markdown.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +92 -0
- package/dist/wallet/index.cjs +258 -45
- package/dist/wallet/index.cjs.map +1 -1
- package/dist/wallet/index.d.cts +29 -7
- package/dist/wallet/index.d.ts +29 -7
- package/dist/wallet/index.js +257 -45
- package/dist/wallet/index.js.map +1 -1
- package/package.json +104 -102
- package/dist/Button-BvLF_Km2.d.cts +0 -26
- package/dist/Button-DQAZzvyQ.d.ts +0 -26
- package/dist/Chip-C5impfYd.d.ts +0 -20
- package/dist/Chip-SM52sUbZ.d.cts +0 -20
- package/dist/assets/logo-wordmark.svg +0 -1
- package/dist/assets/logo.svg +0 -4
- package/dist/compositions/app-user.cjs +0 -497
- package/dist/compositions/app-user.cjs.map +0 -1
- package/dist/compositions/app-user.js +0 -469
- package/dist/compositions/app-user.js.map +0 -1
- package/dist/modality/index.cjs +0 -86
- package/dist/modality/index.cjs.map +0 -1
- package/dist/modality/index.d.cts +0 -26
- package/dist/modality/index.d.ts +0 -26
- package/dist/modality/index.js +0 -59
- package/dist/modality/index.js.map +0 -1
- package/dist/models/index.cjs +0 -508
- package/dist/models/index.cjs.map +0 -1
- package/dist/models/index.d.cts +0 -22
- package/dist/models/index.d.ts +0 -22
- package/dist/models/index.js +0 -486
- package/dist/models/index.js.map +0 -1
- package/dist/theme-VMRlhqST.d.cts +0 -9
- package/dist/theme-VMRlhqST.d.ts +0 -9
- package/dist/wallet/sdk.cjs +0 -206
- package/dist/wallet/sdk.cjs.map +0 -1
- package/dist/wallet/sdk.d.cts +0 -33
- package/dist/wallet/sdk.d.ts +0 -33
- package/dist/wallet/sdk.js +0 -175
- package/dist/wallet/sdk.js.map +0 -1
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
// src/lib/cn.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
+
var twMerge = extendTailwindMerge({ prefix: "polli" });
|
|
5
|
+
function cn(...inputs) {
|
|
6
|
+
return twMerge(clsx(...inputs));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/primitives/Chip.tsx
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var chipSizes = {
|
|
12
|
+
icon: "polli:h-5 polli:w-5 polli:p-0 polli:text-xs",
|
|
13
|
+
sm: "polli:h-5 polli:px-2 polli:text-xs",
|
|
14
|
+
md: "polli:h-6 polli:px-2.5 polli:text-sm",
|
|
15
|
+
lg: "polli:h-7 polli:px-3 polli:text-sm"
|
|
16
|
+
};
|
|
17
|
+
var intentClasses = {
|
|
18
|
+
news: "polli:bg-intent-news-bg-light polli:text-intent-news-text",
|
|
19
|
+
new: "polli:bg-intent-new-bg-light polli:text-intent-new-text",
|
|
20
|
+
free: "polli:bg-intent-free-bg-light polli:text-intent-free-text",
|
|
21
|
+
alpha: "polli:bg-intent-alpha-bg-light polli:text-intent-alpha-text",
|
|
22
|
+
neutral: "polli:bg-ink-100/80 polli:text-ink-900",
|
|
23
|
+
success: "polli:bg-intent-success-bg-bright/15 polli:text-intent-success-text",
|
|
24
|
+
warning: "polli:bg-intent-warning-bg-light polli:text-intent-warning-text",
|
|
25
|
+
info: "polli:bg-intent-info-bg-light polli:text-intent-info-text",
|
|
26
|
+
danger: "polli:bg-intent-danger-bg-light polli:text-intent-danger-text"
|
|
27
|
+
};
|
|
28
|
+
var Chip = ({
|
|
29
|
+
intent,
|
|
30
|
+
size = "md",
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
...rest
|
|
34
|
+
}) => {
|
|
35
|
+
const intentClass = intent ? intentClasses[intent] : "polli:bg-theme-bg-active polli:text-theme-text-strong";
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
...rest,
|
|
40
|
+
className: cn(
|
|
41
|
+
"polli:inline-flex polli:shrink-0 polli:items-center polli:justify-center polli:gap-1 polli:rounded-lg polli:font-medium polli:leading-none",
|
|
42
|
+
chipSizes[size],
|
|
43
|
+
intentClass,
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
children
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/modules/gen/themes.ts
|
|
52
|
+
var MODALITIES = [
|
|
53
|
+
"text",
|
|
54
|
+
"image",
|
|
55
|
+
"video",
|
|
56
|
+
"audio",
|
|
57
|
+
"realtime",
|
|
58
|
+
"embedding"
|
|
59
|
+
];
|
|
60
|
+
function getModalityKey(category) {
|
|
61
|
+
const lower = category.toLowerCase();
|
|
62
|
+
if (lower === "images") return "image";
|
|
63
|
+
if (lower === "embeddings") return "embedding";
|
|
64
|
+
return MODALITIES.includes(lower) ? lower : null;
|
|
65
|
+
}
|
|
66
|
+
var modalityColorVar = (key) => `var(--polli-color-modality-${key})`;
|
|
67
|
+
var modalityBgVar = (key) => `var(--polli-color-modality-${key}-bg)`;
|
|
68
|
+
|
|
69
|
+
// src/modules/gen/ModalityChip.tsx
|
|
70
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
71
|
+
function ModalityChip({
|
|
72
|
+
modality,
|
|
73
|
+
size = "sm",
|
|
74
|
+
className,
|
|
75
|
+
children
|
|
76
|
+
}) {
|
|
77
|
+
const key = getModalityKey(modality);
|
|
78
|
+
if (!key) {
|
|
79
|
+
return /* @__PURE__ */ jsx2(Chip, { intent: "neutral", size, className, children });
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsx2(
|
|
82
|
+
Chip,
|
|
83
|
+
{
|
|
84
|
+
size,
|
|
85
|
+
className,
|
|
86
|
+
style: {
|
|
87
|
+
backgroundColor: modalityBgVar(key),
|
|
88
|
+
color: `color-mix(in oklab, ${modalityColorVar(key)} 72%, var(--polli-color-text-strong))`
|
|
89
|
+
},
|
|
90
|
+
children
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/modules/gen/ModalityDot.tsx
|
|
96
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
97
|
+
function ModalityDot({
|
|
98
|
+
modality,
|
|
99
|
+
className
|
|
100
|
+
}) {
|
|
101
|
+
const key = getModalityKey(modality);
|
|
102
|
+
if (!key) return null;
|
|
103
|
+
return /* @__PURE__ */ jsx3(
|
|
104
|
+
"span",
|
|
105
|
+
{
|
|
106
|
+
"aria-hidden": "true",
|
|
107
|
+
className: cn(
|
|
108
|
+
"polli:inline-block polli:size-2 polli:shrink-0 polli:rounded-full",
|
|
109
|
+
className
|
|
110
|
+
),
|
|
111
|
+
style: { backgroundColor: modalityColorVar(key) }
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/primitives/TabButton.tsx
|
|
117
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
118
|
+
var tabButtonBaseClass = "polli-control polli:inline-flex polli:items-center polli:justify-center polli:rounded-full polli:font-medium polli:leading-normal polli:transition-colors polli:duration-200";
|
|
119
|
+
var tabButtonSizeClass = {
|
|
120
|
+
xs: "polli:px-2.5 polli:py-1 polli:text-xs",
|
|
121
|
+
lg: "polli:px-5 polli:py-2 polli:text-lg",
|
|
122
|
+
md: "polli:px-4 polli:py-1.5 polli:text-base",
|
|
123
|
+
sm: "polli:px-3 polli:py-1.5 polli:text-sm"
|
|
124
|
+
};
|
|
125
|
+
var variantClasses = {
|
|
126
|
+
// The default tab look: borderless and monochrome. Selected uses `bg-active`
|
|
127
|
+
// — the same light resting fill as the site's normal buttons. Both states
|
|
128
|
+
// deepen to `bg-hover` and use the theme's hover label color. Non-selected
|
|
129
|
+
// uses the quiet `bg-subtle` token until then.
|
|
130
|
+
soft: {
|
|
131
|
+
base: "",
|
|
132
|
+
active: "polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
|
|
133
|
+
inactive: "polli:bg-theme-bg-subtle polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover"
|
|
134
|
+
},
|
|
135
|
+
// Transparent until hovered or selected — for multi-select toggles and
|
|
136
|
+
// inline rows where a filled idle pill would read as a hard selection.
|
|
137
|
+
ghost: {
|
|
138
|
+
base: "polli:border polli:border-transparent",
|
|
139
|
+
active: "polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
|
|
140
|
+
inactive: "polli:bg-transparent polli:text-theme-text-base polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover"
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function TabButton({
|
|
144
|
+
as,
|
|
145
|
+
active,
|
|
146
|
+
onClick,
|
|
147
|
+
children,
|
|
148
|
+
size = "md",
|
|
149
|
+
variant = "soft",
|
|
150
|
+
intent,
|
|
151
|
+
ariaLabel,
|
|
152
|
+
disabled = false,
|
|
153
|
+
className,
|
|
154
|
+
...rest
|
|
155
|
+
}) {
|
|
156
|
+
const Component = as || "button";
|
|
157
|
+
const isButton = Component === "button";
|
|
158
|
+
const colors = variantClasses[intent === "neutral" ? "soft" : variant];
|
|
159
|
+
const handleClick = disabled ? (event) => {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
} : onClick;
|
|
163
|
+
return /* @__PURE__ */ jsx4(
|
|
164
|
+
Component,
|
|
165
|
+
{
|
|
166
|
+
...rest,
|
|
167
|
+
...isButton ? { type: "button", disabled } : {},
|
|
168
|
+
...!isButton && disabled ? { "aria-disabled": true, tabIndex: -1 } : {},
|
|
169
|
+
...Component === "a" && disabled ? { href: void 0 } : {},
|
|
170
|
+
onClick: handleClick,
|
|
171
|
+
...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
|
|
172
|
+
...isButton ? { "aria-pressed": active } : { "aria-current": active ? "page" : void 0 },
|
|
173
|
+
className: cn(
|
|
174
|
+
tabButtonBaseClass,
|
|
175
|
+
variantClasses[variant].base,
|
|
176
|
+
active ? colors.active : colors.inactive,
|
|
177
|
+
disabled && "polli:pointer-events-none polli:cursor-not-allowed polli:opacity-50",
|
|
178
|
+
tabButtonSizeClass[size],
|
|
179
|
+
className
|
|
180
|
+
),
|
|
181
|
+
children
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/modules/gen/ModalityTab.tsx
|
|
187
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
188
|
+
function ModalityTab({
|
|
189
|
+
active,
|
|
190
|
+
onClick,
|
|
191
|
+
children,
|
|
192
|
+
size = "md",
|
|
193
|
+
disabled = false,
|
|
194
|
+
className,
|
|
195
|
+
...rest
|
|
196
|
+
}) {
|
|
197
|
+
return /* @__PURE__ */ jsx5(
|
|
198
|
+
TabButton,
|
|
199
|
+
{
|
|
200
|
+
...rest,
|
|
201
|
+
active,
|
|
202
|
+
onClick,
|
|
203
|
+
size,
|
|
204
|
+
disabled,
|
|
205
|
+
className,
|
|
206
|
+
children
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/primitives/icons/index.tsx
|
|
212
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
213
|
+
var strokeProps = {
|
|
214
|
+
fill: "none",
|
|
215
|
+
stroke: "currentColor",
|
|
216
|
+
strokeWidth: 2,
|
|
217
|
+
strokeLinecap: "round",
|
|
218
|
+
strokeLinejoin: "round"
|
|
219
|
+
};
|
|
220
|
+
function CardIcon(props) {
|
|
221
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
|
|
222
|
+
/* @__PURE__ */ jsx6("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
223
|
+
/* @__PURE__ */ jsx6("path", { d: "M2 10h20" })
|
|
224
|
+
] });
|
|
225
|
+
}
|
|
226
|
+
function SproutIcon(props) {
|
|
227
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
|
|
228
|
+
/* @__PURE__ */ jsx6("path", { d: "M7 20h10" }),
|
|
229
|
+
/* @__PURE__ */ jsx6("path", { d: "M10 20c5.5-2.5.8-6.4 3-10" }),
|
|
230
|
+
/* @__PURE__ */ jsx6("path", { d: "M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z" }),
|
|
231
|
+
/* @__PURE__ */ jsx6("path", { d: "M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z" })
|
|
232
|
+
] });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/modules/gen/ModelAccessIcon.tsx
|
|
236
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
237
|
+
function ModelAccessIcon({
|
|
238
|
+
paidOnly = false,
|
|
239
|
+
className = "polli:h-3.5 polli:w-3.5"
|
|
240
|
+
}) {
|
|
241
|
+
const label = paidOnly ? "Paid Pollen required" : "Works with any Pollen";
|
|
242
|
+
const Icon = paidOnly ? CardIcon : SproutIcon;
|
|
243
|
+
return /* @__PURE__ */ jsx7(
|
|
244
|
+
"span",
|
|
245
|
+
{
|
|
246
|
+
role: "img",
|
|
247
|
+
"aria-label": label,
|
|
248
|
+
title: label,
|
|
249
|
+
className: "polli:inline-flex polli:shrink-0",
|
|
250
|
+
children: /* @__PURE__ */ jsx7(Icon, { className })
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/primitives/Button.tsx
|
|
256
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
257
|
+
var pillSizes = {
|
|
258
|
+
icon: "polli:h-12 polli:w-12 polli:p-0",
|
|
259
|
+
xs: "polli:h-5 polli:px-1.5 polli:py-0 polli:text-[11px] polli:leading-none",
|
|
260
|
+
sm: "polli:min-h-7 polli:px-2 polli:pt-0.5 polli:pb-1",
|
|
261
|
+
md: "polli:min-h-9 polli:px-4 polli:pt-1.5 polli:pb-2",
|
|
262
|
+
lg: "polli:min-h-12 polli:px-6 polli:py-3"
|
|
263
|
+
};
|
|
264
|
+
var raisedSizes = {
|
|
265
|
+
icon: "polli:h-12 polli:w-12 polli:p-0",
|
|
266
|
+
xs: "polli:px-2 polli:py-1 polli:text-xs",
|
|
267
|
+
sm: "polli:px-4 polli:py-2 polli:text-sm",
|
|
268
|
+
md: "polli:px-7 polli:py-3.5 polli:text-base",
|
|
269
|
+
lg: "polli:px-8 polli:py-4 polli:text-lg"
|
|
270
|
+
};
|
|
271
|
+
var appearanceClasses = {
|
|
272
|
+
pill: "polli:rounded-full",
|
|
273
|
+
raised: "polli:rounded-xl polli:border-r-[3px] polli:border-b-[3px] polli:border-solid polli:border-theme-text-strong/20 polli:hover:border-theme-text-strong/45"
|
|
274
|
+
};
|
|
275
|
+
var themeClasses = "polli:bg-theme-bg-active polli:text-theme-text-strong polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover polli:transition-colors";
|
|
276
|
+
var outlined = "polli:border polli:border-theme-text-soft polli:bg-surface-white polli:text-theme-text-strong polli:transition-colors polli:[.dark_&]:bg-transparent";
|
|
277
|
+
var intentClasses2 = {
|
|
278
|
+
brand: `${outlined} polli:hover:bg-theme-text-soft/10`,
|
|
279
|
+
commit: `${outlined} polli:hover:border-theme-bg-active polli:hover:bg-theme-bg-active polli:focus-visible:border-theme-bg-active polli:focus-visible:bg-theme-bg-active polli:[.dark_&]:hover:bg-theme-bg-active polli:[.dark_&]:focus-visible:bg-theme-bg-active`,
|
|
280
|
+
danger: "polli:border polli:border-intent-danger-text polli:bg-transparent polli:text-intent-danger-text polli:hover:bg-intent-danger-bg-hover polli:focus-visible:bg-intent-danger-bg-hover polli:transition-colors",
|
|
281
|
+
info: "polli:bg-intent-info-bg-light polli:text-intent-info-text polli:hover:bg-intent-info-bg-hover polli:transition-colors",
|
|
282
|
+
// Secondary actions never take the accent: one step stronger grey on hover.
|
|
283
|
+
neutral: "polli:bg-theme-bg-subtle polli:text-theme-text-base polli:hover:bg-theme-text-muted/25 polli:hover:text-theme-text-strong polli:transition-colors"
|
|
284
|
+
};
|
|
285
|
+
var buttonClasses = ({
|
|
286
|
+
intent,
|
|
287
|
+
appearance = "pill",
|
|
288
|
+
size,
|
|
289
|
+
className,
|
|
290
|
+
disabled
|
|
291
|
+
}) => {
|
|
292
|
+
const colorClasses = intent ? intentClasses2[intent] : themeClasses;
|
|
293
|
+
const sizeClasses = appearance === "raised" ? raisedSizes : pillSizes;
|
|
294
|
+
return cn(
|
|
295
|
+
"polli-control polli:inline-flex polli:items-center polli:justify-center polli:self-center polli:font-body polli:text-sm polli:font-medium polli:leading-normal polli:box-border polli:border polli:border-transparent",
|
|
296
|
+
disabled ? "polli:opacity-50 polli:cursor-not-allowed" : "polli:hover:filter polli:hover:brightness-105 polli:cursor-pointer",
|
|
297
|
+
colorClasses,
|
|
298
|
+
appearanceClasses[appearance],
|
|
299
|
+
sizeClasses[size || "md"],
|
|
300
|
+
className
|
|
301
|
+
);
|
|
302
|
+
};
|
|
303
|
+
function Button({
|
|
304
|
+
as,
|
|
305
|
+
children,
|
|
306
|
+
icon,
|
|
307
|
+
intent,
|
|
308
|
+
appearance,
|
|
309
|
+
size,
|
|
310
|
+
className,
|
|
311
|
+
disabled,
|
|
312
|
+
...buttonProps
|
|
313
|
+
}) {
|
|
314
|
+
const Component = as || "button";
|
|
315
|
+
const isButton = Component === "button";
|
|
316
|
+
const isAnchor = Component === "a";
|
|
317
|
+
const buttonType = buttonProps.type;
|
|
318
|
+
const onClick = buttonProps.onClick;
|
|
319
|
+
const handleClick = disabled ? (event) => {
|
|
320
|
+
event.preventDefault();
|
|
321
|
+
event.stopPropagation();
|
|
322
|
+
} : onClick;
|
|
323
|
+
return /* @__PURE__ */ jsxs2(
|
|
324
|
+
Component,
|
|
325
|
+
{
|
|
326
|
+
...buttonProps,
|
|
327
|
+
"data-intent": intent,
|
|
328
|
+
...isButton ? { type: buttonType ?? "button", disabled } : {},
|
|
329
|
+
...!isButton && disabled ? { "aria-disabled": true, tabIndex: -1 } : {},
|
|
330
|
+
...isAnchor && disabled ? { href: void 0 } : {},
|
|
331
|
+
onClick: handleClick,
|
|
332
|
+
className: buttonClasses({
|
|
333
|
+
intent,
|
|
334
|
+
appearance,
|
|
335
|
+
size,
|
|
336
|
+
className,
|
|
337
|
+
disabled
|
|
338
|
+
}),
|
|
339
|
+
children: [
|
|
340
|
+
icon && /* @__PURE__ */ jsx8(
|
|
341
|
+
"span",
|
|
342
|
+
{
|
|
343
|
+
"aria-hidden": "true",
|
|
344
|
+
className: "polli:mr-2 polli:flex polli:size-4 polli:shrink-0 polli:[&>svg]:size-full",
|
|
345
|
+
children: icon
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
children
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// src/primitives/ChevronIcon.tsx
|
|
355
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
356
|
+
var ChevronIcon = ({ expanded, className }) => /* @__PURE__ */ jsx9(
|
|
357
|
+
"svg",
|
|
358
|
+
{
|
|
359
|
+
"aria-hidden": "true",
|
|
360
|
+
width: "12",
|
|
361
|
+
height: "12",
|
|
362
|
+
viewBox: "0 0 12 12",
|
|
363
|
+
className: cn(
|
|
364
|
+
"polli:shrink-0 polli:transition-transform polli:duration-200 polli:ease-out",
|
|
365
|
+
expanded && "polli:rotate-180",
|
|
366
|
+
className
|
|
367
|
+
),
|
|
368
|
+
children: /* @__PURE__ */ jsx9(
|
|
369
|
+
"path",
|
|
370
|
+
{
|
|
371
|
+
d: "M3 4.5 6 7.5l3-3",
|
|
372
|
+
fill: "none",
|
|
373
|
+
stroke: "currentColor",
|
|
374
|
+
strokeLinecap: "round",
|
|
375
|
+
strokeLinejoin: "round",
|
|
376
|
+
strokeWidth: "1.5"
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
// src/primitives/Dropdown.tsx
|
|
383
|
+
import { Popover } from "@ark-ui/react/popover";
|
|
384
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
385
|
+
import { useId, useState } from "react";
|
|
386
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
387
|
+
var DEFAULT_PANEL = "polli:rounded-lg polli:bg-surface-menu polli:shadow-lg";
|
|
388
|
+
var Dropdown = ({
|
|
389
|
+
trigger,
|
|
390
|
+
children,
|
|
391
|
+
align = "start",
|
|
392
|
+
side = "bottom",
|
|
393
|
+
open: openProp,
|
|
394
|
+
portalled = true,
|
|
395
|
+
onOpenChange,
|
|
396
|
+
className,
|
|
397
|
+
panelStyle
|
|
398
|
+
}) => {
|
|
399
|
+
const triggerId = useId();
|
|
400
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
401
|
+
const isControlled = openProp !== void 0;
|
|
402
|
+
const open = isControlled ? openProp : internalOpen;
|
|
403
|
+
const setOpen = (next) => {
|
|
404
|
+
if (!isControlled) setInternalOpen(next);
|
|
405
|
+
onOpenChange?.(next);
|
|
406
|
+
};
|
|
407
|
+
return /* @__PURE__ */ jsxs3(
|
|
408
|
+
Popover.Root,
|
|
409
|
+
{
|
|
410
|
+
ids: { trigger: triggerId },
|
|
411
|
+
open,
|
|
412
|
+
portalled,
|
|
413
|
+
onOpenChange: (details) => setOpen(details.open),
|
|
414
|
+
positioning: {
|
|
415
|
+
placement: `${side}-${align}`,
|
|
416
|
+
strategy: portalled ? "absolute" : "fixed"
|
|
417
|
+
},
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ jsx10(Popover.Trigger, { asChild: true, children: trigger(open) }),
|
|
420
|
+
/* @__PURE__ */ jsx10(Portal, { disabled: !portalled, children: /* @__PURE__ */ jsx10(Popover.Positioner, { children: /* @__PURE__ */ jsx10(
|
|
421
|
+
Popover.Content,
|
|
422
|
+
{
|
|
423
|
+
"aria-labelledby": triggerId,
|
|
424
|
+
style: panelStyle,
|
|
425
|
+
className: cn(
|
|
426
|
+
"polli:z-[120] polli:overflow-hidden polli:focus:outline-none",
|
|
427
|
+
DEFAULT_PANEL,
|
|
428
|
+
className
|
|
429
|
+
),
|
|
430
|
+
children: typeof children === "function" ? children(() => setOpen(false)) : children
|
|
431
|
+
}
|
|
432
|
+
) }) })
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// src/primitives/ScrollArea.tsx
|
|
439
|
+
import {
|
|
440
|
+
forwardRef,
|
|
441
|
+
useCallback,
|
|
442
|
+
useEffect,
|
|
443
|
+
useRef
|
|
444
|
+
} from "react";
|
|
445
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
446
|
+
var axisClasses = {
|
|
447
|
+
y: "polli:overflow-y-auto polli:overflow-x-hidden",
|
|
448
|
+
x: "polli:overflow-x-auto polli:overflow-y-hidden",
|
|
449
|
+
both: "polli:overflow-auto"
|
|
450
|
+
};
|
|
451
|
+
function assignRef(ref, value) {
|
|
452
|
+
if (typeof ref === "function") ref(value);
|
|
453
|
+
else if (ref) ref.current = value;
|
|
454
|
+
}
|
|
455
|
+
var ScrollArea = forwardRef(
|
|
456
|
+
({ axis = "y", scrollbar = "subtle", className, children, ...rest }, externalRef) => {
|
|
457
|
+
const innerRef = useRef(null);
|
|
458
|
+
const setRef = useCallback(
|
|
459
|
+
(node) => {
|
|
460
|
+
innerRef.current = node;
|
|
461
|
+
assignRef(externalRef, node);
|
|
462
|
+
},
|
|
463
|
+
[externalRef]
|
|
464
|
+
);
|
|
465
|
+
useEffect(() => {
|
|
466
|
+
if (scrollbar === "native") return;
|
|
467
|
+
const element = innerRef.current;
|
|
468
|
+
if (!element) return;
|
|
469
|
+
let hideTimer = null;
|
|
470
|
+
const clearHideTimer = () => {
|
|
471
|
+
if (hideTimer !== null) {
|
|
472
|
+
window.clearTimeout(hideTimer);
|
|
473
|
+
hideTimer = null;
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
const show = () => {
|
|
477
|
+
element.dataset.scrollbarActive = "true";
|
|
478
|
+
clearHideTimer();
|
|
479
|
+
};
|
|
480
|
+
const hide = () => {
|
|
481
|
+
element.dataset.scrollbarActive = "false";
|
|
482
|
+
clearHideTimer();
|
|
483
|
+
};
|
|
484
|
+
const scheduleHide = () => {
|
|
485
|
+
clearHideTimer();
|
|
486
|
+
hideTimer = window.setTimeout(hide, 2e3);
|
|
487
|
+
};
|
|
488
|
+
const handleInteraction = () => {
|
|
489
|
+
show();
|
|
490
|
+
scheduleHide();
|
|
491
|
+
};
|
|
492
|
+
hide();
|
|
493
|
+
element.addEventListener("scroll", handleInteraction, {
|
|
494
|
+
passive: true
|
|
495
|
+
});
|
|
496
|
+
element.addEventListener("wheel", handleInteraction, {
|
|
497
|
+
passive: true
|
|
498
|
+
});
|
|
499
|
+
element.addEventListener("touchstart", handleInteraction, {
|
|
500
|
+
passive: true
|
|
501
|
+
});
|
|
502
|
+
element.addEventListener("pointerdown", handleInteraction);
|
|
503
|
+
element.addEventListener("keydown", handleInteraction);
|
|
504
|
+
element.addEventListener("focusin", handleInteraction);
|
|
505
|
+
element.addEventListener("focusout", scheduleHide);
|
|
506
|
+
return () => {
|
|
507
|
+
clearHideTimer();
|
|
508
|
+
element.removeEventListener("scroll", handleInteraction);
|
|
509
|
+
element.removeEventListener("wheel", handleInteraction);
|
|
510
|
+
element.removeEventListener("touchstart", handleInteraction);
|
|
511
|
+
element.removeEventListener("pointerdown", handleInteraction);
|
|
512
|
+
element.removeEventListener("keydown", handleInteraction);
|
|
513
|
+
element.removeEventListener("focusin", handleInteraction);
|
|
514
|
+
element.removeEventListener("focusout", scheduleHide);
|
|
515
|
+
};
|
|
516
|
+
}, [scrollbar]);
|
|
517
|
+
return /* @__PURE__ */ jsx11(
|
|
518
|
+
"div",
|
|
519
|
+
{
|
|
520
|
+
...rest,
|
|
521
|
+
ref: setRef,
|
|
522
|
+
className: cn(
|
|
523
|
+
scrollbar === "subtle" && "polli-scrollbar-subtle",
|
|
524
|
+
"polli:min-w-0 polli:max-w-full",
|
|
525
|
+
axisClasses[axis],
|
|
526
|
+
className
|
|
527
|
+
),
|
|
528
|
+
children
|
|
529
|
+
}
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
ScrollArea.displayName = "ScrollArea";
|
|
534
|
+
|
|
535
|
+
// src/modules/gen/ModelSelector.tsx
|
|
536
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
537
|
+
var CATEGORY_LABELS = {
|
|
538
|
+
image: "Image",
|
|
539
|
+
video: "Video",
|
|
540
|
+
text: "Text",
|
|
541
|
+
audio: "Audio",
|
|
542
|
+
"3d": "3D",
|
|
543
|
+
embedding: "Embeddings",
|
|
544
|
+
realtime: "Realtime"
|
|
545
|
+
};
|
|
546
|
+
function categoryLabel(category) {
|
|
547
|
+
return CATEGORY_LABELS[category];
|
|
548
|
+
}
|
|
549
|
+
function modelId(model) {
|
|
550
|
+
return model.id ?? model.name;
|
|
551
|
+
}
|
|
552
|
+
function ModelSelector({
|
|
553
|
+
models,
|
|
554
|
+
category,
|
|
555
|
+
value,
|
|
556
|
+
isLoading = false,
|
|
557
|
+
onChange
|
|
558
|
+
}) {
|
|
559
|
+
const filteredModels = models.filter((model) => model.category === category).sort((a, b) => modelId(a).localeCompare(modelId(b)));
|
|
560
|
+
const currentModel = models.find((model) => modelId(model) === value);
|
|
561
|
+
const modelLabel = currentModel ? currentModel.title ?? currentModel.name : "Select";
|
|
562
|
+
const accessibleLabel = currentModel ? `${CATEGORY_LABELS[category]} model: ${modelLabel}` : `Select ${CATEGORY_LABELS[category].toLowerCase()} model`;
|
|
563
|
+
return /* @__PURE__ */ jsx12(
|
|
564
|
+
Dropdown,
|
|
565
|
+
{
|
|
566
|
+
align: "start",
|
|
567
|
+
className: "polli:w-[min(24rem,calc(100vw-2rem))] polli:p-2",
|
|
568
|
+
trigger: (open) => /* @__PURE__ */ jsxs4(
|
|
569
|
+
Button,
|
|
570
|
+
{
|
|
571
|
+
type: "button",
|
|
572
|
+
"aria-label": accessibleLabel,
|
|
573
|
+
className: "polli:min-w-64 polli:max-w-full polli:self-start polli:justify-between polli:gap-2",
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ jsxs4("span", { className: "polli:flex polli:min-w-0 polli:items-center polli:gap-2", children: [
|
|
576
|
+
/* @__PURE__ */ jsx12("span", { className: "polli:truncate", children: modelLabel }),
|
|
577
|
+
currentModel && /* @__PURE__ */ jsx12(
|
|
578
|
+
ModelAccessIcon,
|
|
579
|
+
{
|
|
580
|
+
paidOnly: currentModel.paid_only
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsx12(ChevronIcon, { expanded: open })
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
children: (close) => isLoading ? /* @__PURE__ */ jsx12("p", { className: "polli:m-0 polli:px-2 polli:py-2 polli:text-sm polli:text-theme-text-soft", children: "Loading models..." }) : /* @__PURE__ */ jsx12(ScrollArea, { className: "polli:max-h-80 polli:pr-2", children: /* @__PURE__ */ jsx12("div", { className: "polli:flex polli:flex-col polli:gap-1", children: filteredModels.map((model) => {
|
|
589
|
+
const id = modelId(model);
|
|
590
|
+
const isActive = value === id;
|
|
591
|
+
return /* @__PURE__ */ jsx12(
|
|
592
|
+
TabButton,
|
|
593
|
+
{
|
|
594
|
+
active: isActive,
|
|
595
|
+
size: "sm",
|
|
596
|
+
variant: "ghost",
|
|
597
|
+
className: "polli:w-full polli:justify-start polli:text-left",
|
|
598
|
+
onClick: () => {
|
|
599
|
+
onChange(id);
|
|
600
|
+
close();
|
|
601
|
+
},
|
|
602
|
+
children: /* @__PURE__ */ jsxs4("span", { className: "polli:flex polli:min-w-0 polli:flex-col polli:gap-0.5", children: [
|
|
603
|
+
/* @__PURE__ */ jsxs4("span", { className: "polli:flex polli:min-w-0 polli:items-center polli:gap-2", children: [
|
|
604
|
+
/* @__PURE__ */ jsx12("span", { className: "polli:truncate", children: model.title ?? model.name }),
|
|
605
|
+
/* @__PURE__ */ jsx12(
|
|
606
|
+
ModelAccessIcon,
|
|
607
|
+
{
|
|
608
|
+
paidOnly: model.paid_only
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] }),
|
|
612
|
+
model.description && /* @__PURE__ */ jsx12("span", { className: "polli:truncate polli:text-xs polli:font-normal polli:text-theme-text-muted", children: model.description })
|
|
613
|
+
] })
|
|
614
|
+
},
|
|
615
|
+
id
|
|
616
|
+
);
|
|
617
|
+
}) }) })
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
export {
|
|
622
|
+
ModalityChip,
|
|
623
|
+
ModalityDot,
|
|
624
|
+
ModalityTab,
|
|
625
|
+
ModelAccessIcon,
|
|
626
|
+
ModelSelector,
|
|
627
|
+
categoryLabel,
|
|
628
|
+
getModalityKey
|
|
629
|
+
};
|
|
630
|
+
//# sourceMappingURL=index.js.map
|