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