@pollinations/ui 0.1.0-alpha.4 → 0.1.0-alpha.40

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