@pollinations/ui 0.1.0-alpha.0 → 0.1.0-alpha.10

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