@pollinations/ui 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (71) hide show
  1. package/README.md +5 -3
  2. package/dist/app-user-menu/sdk.js +50 -752
  3. package/dist/app-user-menu/sdk.js.map +1 -1
  4. package/dist/auth/index.js +91 -1131
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/auth/sdk.js +9 -211
  7. package/dist/auth/sdk.js.map +1 -1
  8. package/dist/chunk-3VM5R3OI.js +50 -0
  9. package/dist/chunk-3VM5R3OI.js.map +1 -0
  10. package/dist/chunk-7GDUPN6U.js +115 -0
  11. package/dist/chunk-7GDUPN6U.js.map +1 -0
  12. package/dist/{app-user-menu/sdk.cjs → chunk-7WXDUAJU.js} +96 -751
  13. package/dist/chunk-7WXDUAJU.js.map +1 -0
  14. package/dist/chunk-7XDOOFTL.js +105 -0
  15. package/dist/chunk-7XDOOFTL.js.map +1 -0
  16. package/dist/chunk-DD7MHUFD.js +93 -0
  17. package/dist/chunk-DD7MHUFD.js.map +1 -0
  18. package/dist/chunk-FLQFOTMR.js +107 -0
  19. package/dist/chunk-FLQFOTMR.js.map +1 -0
  20. package/dist/chunk-IS4CNKV3.js +252 -0
  21. package/dist/chunk-IS4CNKV3.js.map +1 -0
  22. package/dist/chunk-IX6BJNHM.js +58 -0
  23. package/dist/chunk-IX6BJNHM.js.map +1 -0
  24. package/dist/chunk-K2H3JFQK.js +576 -0
  25. package/dist/chunk-K2H3JFQK.js.map +1 -0
  26. package/dist/chunk-LKUZU37X.js +15 -0
  27. package/dist/chunk-LKUZU37X.js.map +1 -0
  28. package/dist/chunk-QAR2WP3L.js +364 -0
  29. package/dist/chunk-QAR2WP3L.js.map +1 -0
  30. package/dist/chunk-QFR7XRUE.js +534 -0
  31. package/dist/chunk-QFR7XRUE.js.map +1 -0
  32. package/dist/chunk-TVPFAM3B.js +88 -0
  33. package/dist/chunk-TVPFAM3B.js.map +1 -0
  34. package/dist/chunk-ZLD4VLUG.js +112 -0
  35. package/dist/chunk-ZLD4VLUG.js.map +1 -0
  36. package/dist/gen/index.js +49 -494
  37. package/dist/gen/index.js.map +1 -1
  38. package/dist/index.browser.min.js +1 -1
  39. package/dist/index.browser.min.js.map +1 -1
  40. package/dist/index.js +577 -2630
  41. package/dist/index.js.map +1 -1
  42. package/dist/markdown.js +45 -599
  43. package/dist/markdown.js.map +1 -1
  44. package/dist/styles.css +1 -1
  45. package/dist/wallet/index.js +17 -374
  46. package/dist/wallet/index.js.map +1 -1
  47. package/package.json +10 -16
  48. package/dist/Button-BGqClaBr.d.cts +0 -29
  49. package/dist/Chip-v-ADv6cz.d.cts +0 -18
  50. package/dist/Dialog-D3Nqt8cE.d.cts +0 -66
  51. package/dist/app-user-menu/sdk.cjs.map +0 -1
  52. package/dist/app-user-menu/sdk.d.cts +0 -29
  53. package/dist/auth/index.cjs +0 -1537
  54. package/dist/auth/index.cjs.map +0 -1
  55. package/dist/auth/index.d.cts +0 -114
  56. package/dist/auth/sdk.cjs +0 -250
  57. package/dist/auth/sdk.cjs.map +0 -1
  58. package/dist/auth/sdk.d.cts +0 -40
  59. package/dist/gen/index.cjs +0 -718
  60. package/dist/gen/index.cjs.map +0 -1
  61. package/dist/gen/index.d.cts +0 -91
  62. package/dist/index.cjs +0 -5365
  63. package/dist/index.cjs.map +0 -1
  64. package/dist/index.d.cts +0 -1051
  65. package/dist/markdown.cjs +0 -838
  66. package/dist/markdown.cjs.map +0 -1
  67. package/dist/markdown.d.cts +0 -16
  68. package/dist/types-CCy9JNu9.d.cts +0 -6
  69. package/dist/wallet/index.cjs +0 -433
  70. package/dist/wallet/index.cjs.map +0 -1
  71. package/dist/wallet/index.d.cts +0 -53
package/dist/markdown.js CHANGED
@@ -1,558 +1,23 @@
1
- // src/compositions/Markdown.tsx
2
- import { isValidElement } from "react";
3
- import ReactMarkdown from "react-markdown";
4
- import remarkGfm from "remark-gfm";
5
-
6
- // src/lib/cn.ts
7
- import { clsx } from "clsx";
8
- import { extendTailwindMerge } from "tailwind-merge";
9
- var twMerge = extendTailwindMerge({
10
- prefix: "polli",
11
- extend: { theme: { text: ["micro"] } }
12
- });
13
- function cn(...inputs) {
14
- return twMerge(clsx(...inputs));
15
- }
16
-
17
- // src/lib/link.ts
18
- function isExternalHref(href, origin = globalThis.location?.origin) {
19
- if (typeof href !== "string" || !/^(https?:)?\/\//i.test(href))
20
- return false;
21
- if (!origin) return true;
22
- try {
23
- return new URL(href, origin).origin !== origin;
24
- } catch {
25
- return false;
26
- }
27
- }
28
-
29
- // src/primitives/icons/index.tsx
30
- import { jsx, jsxs } from "react/jsx-runtime";
31
- var strokeProps = {
32
- fill: "none",
33
- stroke: "currentColor",
34
- strokeWidth: 2,
35
- strokeLinecap: "round",
36
- strokeLinejoin: "round"
37
- };
38
- function CheckIcon(props) {
39
- return /* @__PURE__ */ jsx(
40
- "svg",
41
- {
42
- "aria-hidden": "true",
43
- viewBox: "0 0 24 24",
44
- ...strokeProps,
45
- strokeWidth: 2.5,
46
- ...props,
47
- children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
48
- }
49
- );
50
- }
51
- function ClipboardIcon(props) {
52
- return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: [
53
- /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
54
- /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
55
- ] });
56
- }
57
- function ExternalLinkIcon(props) {
58
- return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", ...strokeProps, ...props, children: /* @__PURE__ */ jsx("path", { d: "M7 17 17 7M9 7h8v8" }) });
59
- }
60
-
61
- // src/primitives/InlineLink.tsx
62
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
63
- function InlineLink({
64
- as,
65
- external,
66
- showIcon = true,
67
- size = "inherit",
68
- tone = "accent",
69
- className,
70
- children,
71
- ...linkProps
72
- }) {
73
- const Component = as || "a";
74
- const isExternal = external ?? isExternalHref(linkProps.href);
75
- return /* @__PURE__ */ jsxs2(
76
- Component,
77
- {
78
- target: isExternal && as !== "button" ? "_blank" : void 0,
79
- rel: isExternal && as !== "button" ? "noopener noreferrer" : void 0,
80
- className: ["polli-link", className].filter(Boolean).join(" "),
81
- "data-size": size,
82
- "data-tone": tone,
83
- ...linkProps,
84
- children: [
85
- children,
86
- showIcon && isExternal && /* @__PURE__ */ jsx2(
87
- ExternalLinkIcon,
88
- {
89
- "aria-hidden": "true",
90
- className: "polli-link-external-icon"
91
- }
92
- )
93
- ]
94
- }
95
- );
96
- }
97
-
98
- // src/compositions/CopyButton.tsx
99
1
  import {
100
- useEffect as useEffect2,
101
- useRef as useRef2,
102
- useState as useState2
103
- } from "react";
104
-
105
- // src/primitives/Button.tsx
106
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
107
- var pillSizes = {
108
- icon: "polli:h-12 polli:w-12 polli:p-0",
109
- xs: "polli:h-5 polli:px-1.5 polli:py-0 polli:text-[11px] polli:leading-none",
110
- sm: "polli:min-h-7 polli:px-2 polli:pt-0.5 polli:pb-1",
111
- md: "polli:min-h-9 polli:px-4 polli:pt-1.5 polli:pb-2",
112
- lg: "polli:min-h-12 polli:px-6 polli:py-3 polli:text-base"
113
- };
114
- var raisedSizes = {
115
- icon: "polli:h-12 polli:w-12 polli:p-0",
116
- xs: "polli:px-2 polli:py-1 polli:text-xs",
117
- sm: "polli:px-4 polli:py-2 polli:text-sm",
118
- md: "polli:px-7 polli:py-3.5 polli:text-base",
119
- lg: "polli:px-8 polli:py-4 polli:text-lg"
120
- };
121
- var appearanceClasses = {
122
- pill: "polli:rounded-full",
123
- 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"
124
- };
125
- 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";
126
- 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";
127
- var intentClasses = {
128
- brand: `${outlined} polli:hover:bg-theme-bg-active/50 polli:[.dark_&]:hover:bg-theme-text-soft/10`,
129
- 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`,
130
- 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",
131
- info: "polli:bg-intent-info-bg-light polli:text-intent-info-text polli:hover:bg-intent-info-bg-hover polli:transition-colors",
132
- // A quiet white pill on the desk, like the colour toggle; hover previews
133
- // the accent as the ambient button does.
134
- 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",
135
- // Secondary actions never take the accent: one step stronger grey on hover.
136
- 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"
137
- };
138
- var buttonClasses = ({
139
- intent,
140
- appearance = "pill",
141
- size,
142
- className,
143
- disabled,
144
- busy
145
- }) => {
146
- const colorClasses = intent ? intentClasses[intent] : themeClasses;
147
- const sizeClasses = appearance === "raised" ? raisedSizes : pillSizes;
148
- return cn(
149
- "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",
150
- // A busy button is working, not unavailable: it keeps its strength.
151
- busy ? "polli:cursor-progress" : disabled ? "polli:opacity-50 polli:cursor-not-allowed" : "polli:hover:filter polli:hover:brightness-105 polli:cursor-pointer",
152
- colorClasses,
153
- appearanceClasses[appearance],
154
- sizeClasses[size || "md"],
155
- className
156
- );
157
- };
158
- function Button({
159
- as,
160
- children,
161
- icon,
162
- intent,
163
- appearance,
164
- size,
165
- className,
166
- disabled,
167
- ...buttonProps
168
- }) {
169
- const Component = as || "button";
170
- const isButton = Component === "button";
171
- const isAnchor = Component === "a";
172
- const buttonType = buttonProps.type;
173
- const onClick = buttonProps.onClick;
174
- const ariaBusy = buttonProps["aria-busy"];
175
- const busy = ariaBusy === true || ariaBusy === "true";
176
- const handleClick = disabled ? (event) => {
177
- event.preventDefault();
178
- event.stopPropagation();
179
- } : onClick;
180
- return /* @__PURE__ */ jsxs3(
181
- Component,
182
- {
183
- ...buttonProps,
184
- "data-intent": intent,
185
- ...isButton ? { type: buttonType ?? "button", disabled } : {},
186
- ...!isButton && disabled ? { "aria-disabled": true, tabIndex: -1 } : {},
187
- ...isAnchor && disabled ? { href: void 0 } : {},
188
- onClick: handleClick,
189
- className: buttonClasses({
190
- intent,
191
- appearance,
192
- size,
193
- className,
194
- disabled,
195
- busy
196
- }),
197
- children: [
198
- icon && /* @__PURE__ */ jsx3(
199
- "span",
200
- {
201
- "aria-hidden": "true",
202
- className: "polli:mr-2 polli:flex polli:size-4 polli:shrink-0 polli:[&>svg]:size-full",
203
- children: busy ? /* @__PURE__ */ jsx3("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
204
- }
205
- ),
206
- children
207
- ]
208
- }
209
- );
210
- }
211
-
212
- // src/primitives/Tooltip.tsx
2
+ CodeBlock
3
+ } from "./chunk-QAR2WP3L.js";
213
4
  import {
214
- useEffect,
215
- useId,
216
- useRef,
217
- useState
218
- } from "react";
219
- import { createPortal } from "react-dom";
220
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
221
- var TOOLTIP_MAX_WIDTH = 288;
222
- var TOOLTIP_VIEWPORT_MARGIN = 12;
223
- var Tooltip = ({
224
- children,
225
- content,
226
- align = "start",
227
- ariaLabel,
228
- clampToViewport = true,
229
- className,
230
- maxWidth = TOOLTIP_MAX_WIDTH,
231
- onClick,
232
- stopClickPropagation = true,
233
- style,
234
- tapEnabled = false,
235
- triggerAs = "button",
236
- displayContents = false
237
- }) => {
238
- const [showTooltip, setShowTooltip] = useState(false);
239
- const [tooltipPosition, setTooltipPosition] = useState({
240
- top: 0,
241
- left: 0,
242
- maxWidth
243
- });
244
- const triggerRef = useRef(null);
245
- const tapPinnedRef = useRef(false);
246
- const tooltipId = useId();
247
- const closeTooltip = () => {
248
- tapPinnedRef.current = false;
249
- setShowTooltip(false);
250
- };
251
- useEffect(() => {
252
- if (!showTooltip) return;
253
- const dismissOnOutsideTap = (event) => {
254
- if (triggerRef.current?.contains(event.target)) return;
255
- tapPinnedRef.current = false;
256
- setShowTooltip(false);
257
- };
258
- const dismissOnEscape = (event) => {
259
- if (event.key !== "Escape") return;
260
- tapPinnedRef.current = false;
261
- setShowTooltip(false);
262
- };
263
- const dismissOnViewportChange = () => {
264
- tapPinnedRef.current = false;
265
- setShowTooltip(false);
266
- };
267
- document.addEventListener("pointerdown", dismissOnOutsideTap);
268
- document.addEventListener("keydown", dismissOnEscape);
269
- window.addEventListener("scroll", dismissOnViewportChange, {
270
- capture: true,
271
- passive: true
272
- });
273
- window.addEventListener("resize", dismissOnViewportChange);
274
- return () => {
275
- document.removeEventListener("pointerdown", dismissOnOutsideTap);
276
- document.removeEventListener("keydown", dismissOnEscape);
277
- window.removeEventListener("scroll", dismissOnViewportChange, true);
278
- window.removeEventListener("resize", dismissOnViewportChange);
279
- };
280
- }, [showTooltip]);
281
- const updateTooltipPosition = () => {
282
- if (triggerRef.current) {
283
- const rect = triggerRef.current.getBoundingClientRect();
284
- const availableMaxWidth = Math.min(
285
- maxWidth,
286
- window.innerWidth - TOOLTIP_VIEWPORT_MARGIN * 2
287
- );
288
- let left = align === "center" ? rect.left + rect.width / 2 : rect.left;
289
- let transform = align === "center" ? "translateX(-50%)" : void 0;
290
- if (clampToViewport) {
291
- left = Math.min(
292
- Math.max(rect.left, TOOLTIP_VIEWPORT_MARGIN),
293
- Math.max(
294
- TOOLTIP_VIEWPORT_MARGIN,
295
- window.innerWidth - availableMaxWidth - TOOLTIP_VIEWPORT_MARGIN
296
- )
297
- );
298
- transform = void 0;
299
- }
300
- setTooltipPosition({
301
- top: rect.bottom + 4,
302
- left,
303
- maxWidth: availableMaxWidth,
304
- transform
305
- });
306
- }
307
- };
308
- const isControl = triggerAs === "button" || tapEnabled;
309
- const triggerClassName = cn(
310
- isControl && "polli-control",
311
- "polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
312
- className
313
- );
314
- const cursorClass = displayContents ? "polli:contents" : "polli:cursor-inherit";
315
- const popupClasses = "polli:fixed polli:w-max polli:px-2 polli:py-1 polli:bg-surface-menu polli:text-theme-text-base polli:font-normal polli:leading-snug polli:tracking-normal polli:normal-case polli:not-italic polli:text-xs polli:rounded-md polli:shadow-md polli:z-[130] polli:pointer-events-none polli:transition-opacity polli:whitespace-pre-line polli:break-words";
316
- const popupNode = content ? /* @__PURE__ */ jsx4(
317
- "span",
318
- {
319
- id: tooltipId,
320
- role: "tooltip",
321
- "aria-hidden": !showTooltip,
322
- style: {
323
- top: tooltipPosition.top,
324
- left: tooltipPosition.left,
325
- maxWidth: tooltipPosition.maxWidth,
326
- transform: tooltipPosition.transform
327
- },
328
- className: `${showTooltip ? "polli:visible polli:opacity-100" : "polli:invisible polli:opacity-0"} ${popupClasses}`,
329
- children: content
330
- }
331
- ) : null;
332
- const tooltipPopup = popupNode && typeof document !== "undefined" ? createPortal(
333
- popupNode,
334
- triggerRef.current?.closest('[role="dialog"]') ?? document.body
335
- ) : popupNode;
336
- const contentNode = /* @__PURE__ */ jsxs4(Fragment, { children: [
337
- /* @__PURE__ */ jsx4("span", { className: cursorClass, children }),
338
- tooltipPopup
339
- ] });
340
- const sharedProps = {
341
- "aria-label": ariaLabel,
342
- "aria-describedby": content && showTooltip ? tooltipId : void 0,
343
- className: triggerClassName,
344
- onMouseEnter: () => {
345
- updateTooltipPosition();
346
- setShowTooltip(true);
347
- },
348
- onMouseLeave: () => {
349
- if (!tapPinnedRef.current) setShowTooltip(false);
350
- },
351
- onClick: (e) => {
352
- if (stopClickPropagation) e.stopPropagation();
353
- if (onClick) {
354
- onClick();
355
- }
356
- if (!tapEnabled || !content) return;
357
- updateTooltipPosition();
358
- if (tapPinnedRef.current) {
359
- closeTooltip();
360
- return;
361
- }
362
- tapPinnedRef.current = true;
363
- setShowTooltip(true);
364
- },
365
- onFocus: () => {
366
- updateTooltipPosition();
367
- setShowTooltip(true);
368
- },
369
- onBlur: closeTooltip,
370
- style
371
- };
372
- if (triggerAs === "span") {
373
- const handleKeyDown = (event) => {
374
- if (!tapEnabled || !content) return;
375
- if (event.key !== "Enter" && event.key !== " ") return;
376
- event.preventDefault();
377
- updateTooltipPosition();
378
- if (tapPinnedRef.current) {
379
- closeTooltip();
380
- return;
381
- }
382
- tapPinnedRef.current = true;
383
- setShowTooltip(true);
384
- };
385
- const spanInteractionProps = {
386
- ...sharedProps,
387
- role: tapEnabled && content ? "button" : void 0,
388
- tabIndex: tapEnabled && content ? 0 : void 0,
389
- onKeyDown: tapEnabled && content ? handleKeyDown : void 0
390
- };
391
- return /* @__PURE__ */ jsx4(
392
- "span",
393
- {
394
- ref: (node) => {
395
- triggerRef.current = node;
396
- },
397
- ...spanInteractionProps,
398
- children: contentNode
399
- }
400
- );
401
- }
402
- return /* @__PURE__ */ jsx4(
403
- "button",
404
- {
405
- ref: (node) => {
406
- triggerRef.current = node;
407
- },
408
- type: "button",
409
- "aria-label": ariaLabel,
410
- "aria-describedby": content && showTooltip ? tooltipId : void 0,
411
- className: triggerClassName,
412
- onMouseEnter: sharedProps.onMouseEnter,
413
- onMouseLeave: sharedProps.onMouseLeave,
414
- onClick: sharedProps.onClick,
415
- onFocus: sharedProps.onFocus,
416
- onBlur: sharedProps.onBlur,
417
- style,
418
- children: contentNode
419
- }
420
- );
421
- };
422
-
423
- // src/compositions/CopyButton.tsx
424
- import { jsx as jsx5 } from "react/jsx-runtime";
425
- function CopyButton({
426
- value,
427
- children,
428
- copiedTimeoutMs = 2e3,
429
- tooltip = "\u{1F4CB} Click to copy",
430
- tooltipAlign,
431
- tooltipClampToViewport,
432
- tooltipMaxWidth,
433
- copiedTooltip = "\u2705 Copied!",
434
- tooltipClassName,
435
- className,
436
- variant = "plain",
437
- intent,
438
- onCopied,
439
- onCopyError,
440
- ...buttonProps
441
- }) {
442
- const [copied, setCopied] = useState2(false);
443
- const timeoutRef = useRef2(null);
444
- useEffect2(
445
- () => () => {
446
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
447
- },
448
- []
449
- );
450
- async function handleCopy(event) {
451
- event.stopPropagation();
452
- try {
453
- const text = typeof value === "function" ? await value() : value;
454
- await navigator.clipboard.writeText(text);
455
- setCopied(true);
456
- onCopied?.();
457
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
458
- timeoutRef.current = setTimeout(
459
- () => setCopied(false),
460
- copiedTimeoutMs
461
- );
462
- } catch (error) {
463
- onCopyError?.(error);
464
- }
465
- }
466
- const Control = variant === "button" ? Button : "button";
467
- const button = /* @__PURE__ */ jsx5(
468
- Control,
469
- {
470
- ...buttonProps,
471
- ...variant === "button" && intent ? { intent } : {},
472
- type: "button",
473
- onClick: handleCopy,
474
- className: cn(
475
- "polli-control",
476
- buttonProps.disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer",
477
- typeof className === "function" ? className(copied) : className
478
- ),
479
- children: typeof children === "function" ? children(copied) : children
480
- }
481
- );
482
- if (tooltip === null) {
483
- return button;
484
- }
485
- return /* @__PURE__ */ jsx5(
486
- Tooltip,
487
- {
488
- triggerAs: "span",
489
- content: copied ? copiedTooltip : tooltip,
490
- align: tooltipAlign,
491
- clampToViewport: tooltipClampToViewport,
492
- maxWidth: tooltipMaxWidth,
493
- displayContents: true,
494
- tapEnabled: false,
495
- className: cn(
496
- buttonProps.disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer",
497
- tooltipClassName
498
- ),
499
- children: button
500
- }
501
- );
502
- }
503
-
504
- // src/compositions/CodeBlock.tsx
505
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
506
- var CodeBlock = ({
507
- code,
508
- codeClassName,
509
- language,
510
- className,
511
- ...rest
512
- }) => {
513
- const label = language || "Code";
514
- return /* @__PURE__ */ jsxs5(
515
- "div",
516
- {
517
- ...rest,
518
- className: cn(
519
- "polli:min-w-0 polli:max-w-full polli:overflow-hidden polli:rounded-lg polli:border polli:border-theme-border polli:bg-theme-bg-pale",
520
- className
521
- ),
522
- children: [
523
- /* @__PURE__ */ jsxs5("div", { className: "polli:flex polli:min-h-9 polli:items-center polli:justify-between polli:gap-3 polli:bg-theme-bg-subtle polli:px-3 polli:py-1.5", children: [
524
- /* @__PURE__ */ jsx6("span", { className: "polli:truncate polli:font-mono polli:text-[11px] polli:font-medium polli:uppercase polli:tracking-wide polli:text-theme-text-muted", children: label }),
525
- /* @__PURE__ */ jsx6(
526
- CopyButton,
527
- {
528
- value: code,
529
- tooltip: null,
530
- "aria-label": "Copy code",
531
- className: "polli:flex polli:items-center polli:gap-1.5 polli:rounded-md polli:px-2 polli:py-1 polli:text-xs polli:font-medium polli:text-theme-text-base polli:transition-colors polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
532
- children: (copied) => /* @__PURE__ */ jsxs5(Fragment2, { children: [
533
- copied ? /* @__PURE__ */ jsx6(CheckIcon, { className: "polli:size-3.5" }) : /* @__PURE__ */ jsx6(ClipboardIcon, { className: "polli:size-3.5" }),
534
- /* @__PURE__ */ jsx6("span", { children: copied ? "Copied" : "Copy" })
535
- ] })
536
- }
537
- )
538
- ] }),
539
- /* @__PURE__ */ jsx6(
540
- "pre",
541
- {
542
- className: cn(
543
- "polli:m-0 polli:min-w-0 polli:whitespace-pre-wrap polli:break-words polli:[overflow-wrap:anywhere] polli:[tab-size:4] polli:p-3 polli:font-mono polli:text-xs polli:leading-6 polli:text-theme-text-strong",
544
- codeClassName
545
- ),
546
- children: /* @__PURE__ */ jsx6("code", { children: code })
547
- }
548
- )
549
- ]
550
- }
551
- );
552
- };
5
+ headingClassName
6
+ } from "./chunk-TVPFAM3B.js";
7
+ import "./chunk-7GDUPN6U.js";
8
+ import {
9
+ InlineLink
10
+ } from "./chunk-IX6BJNHM.js";
11
+ import "./chunk-K2H3JFQK.js";
12
+ import {
13
+ cn
14
+ } from "./chunk-LKUZU37X.js";
553
15
 
554
16
  // src/compositions/Markdown.tsx
555
- import { jsx as jsx7 } from "react/jsx-runtime";
17
+ import { isValidElement } from "react";
18
+ import ReactMarkdown from "react-markdown";
19
+ import remarkGfm from "remark-gfm";
20
+ import { jsx } from "react/jsx-runtime";
556
21
  function textContent(value) {
557
22
  if (typeof value === "string" || typeof value === "number") {
558
23
  return String(value);
@@ -588,7 +53,7 @@ function inlineMedia(src, label) {
588
53
  const audio = AUDIO_EXTENSIONS.has(extension) || label === "Generated audio";
589
54
  if (!video && !audio) return null;
590
55
  const Element = video ? "video" : "audio";
591
- return /* @__PURE__ */ jsx7(
56
+ return /* @__PURE__ */ jsx(
592
57
  Element,
593
58
  {
594
59
  src,
@@ -607,46 +72,46 @@ function MarkdownCodeBlock({ children }) {
607
72
  /\n$/,
608
73
  ""
609
74
  );
610
- return /* @__PURE__ */ jsx7(CodeBlock, { code, language, className: "polli:my-3" });
75
+ return /* @__PURE__ */ jsx(CodeBlock, { code, language, className: "polli:my-3" });
611
76
  }
612
77
  var components = {
613
- ul: ({ node, ...props }) => /* @__PURE__ */ jsx7(
78
+ ul: ({ node, ...props }) => /* @__PURE__ */ jsx(
614
79
  "ul",
615
80
  {
616
81
  className: "polli:flex polli:min-w-0 polli:list-disc polli:flex-col polli:gap-1 polli:pl-5 polli:marker:text-theme-text-muted",
617
82
  ...props
618
83
  }
619
84
  ),
620
- ol: ({ node, ...props }) => /* @__PURE__ */ jsx7(
85
+ ol: ({ node, ...props }) => /* @__PURE__ */ jsx(
621
86
  "ol",
622
87
  {
623
88
  className: "polli:flex polli:min-w-0 polli:list-decimal polli:flex-col polli:gap-1 polli:pl-5 polli:marker:text-theme-text-muted",
624
89
  ...props
625
90
  }
626
91
  ),
627
- p: ({ node, ...props }) => /* @__PURE__ */ jsx7("p", { className: "polli:mb-2 polli:last:mb-0", ...props }),
628
- strong: ({ node, ...props }) => /* @__PURE__ */ jsx7(
92
+ p: ({ node, ...props }) => /* @__PURE__ */ jsx("p", { className: "polli:mb-2 polli:last:mb-0", ...props }),
93
+ strong: ({ node, ...props }) => /* @__PURE__ */ jsx(
629
94
  "strong",
630
95
  {
631
96
  className: "polli:font-semibold polli:text-theme-text-strong",
632
97
  ...props
633
98
  }
634
99
  ),
635
- code: ({ node, ...props }) => /* @__PURE__ */ jsx7(
100
+ code: ({ node, ...props }) => /* @__PURE__ */ jsx(
636
101
  "code",
637
102
  {
638
103
  className: "polli:break-words polli:rounded polli:bg-theme-bg-subtle polli:px-1 polli:py-0.5 polli:font-mono polli:text-xs",
639
104
  ...props
640
105
  }
641
106
  ),
642
- pre: ({ children }) => /* @__PURE__ */ jsx7(MarkdownCodeBlock, { children }),
107
+ pre: ({ children }) => /* @__PURE__ */ jsx(MarkdownCodeBlock, { children }),
643
108
  img: ({ node, src, alt, ...props }) => {
644
109
  const media = inlineMedia(
645
110
  typeof src === "string" ? src : void 0,
646
111
  alt
647
112
  );
648
113
  if (media) return media;
649
- return /* @__PURE__ */ jsx7(
114
+ return /* @__PURE__ */ jsx(
650
115
  "img",
651
116
  {
652
117
  src,
@@ -660,18 +125,18 @@ var components = {
660
125
  a: ({ node, href, ...props }) => {
661
126
  const media = inlineMedia(href, textContent(props.children));
662
127
  if (media) return media;
663
- return /* @__PURE__ */ jsx7(InlineLink, { href, ...props });
128
+ return /* @__PURE__ */ jsx(InlineLink, { href, ...props });
664
129
  }
665
130
  };
666
131
  function Markdown({ children, className }) {
667
- return /* @__PURE__ */ jsx7(
132
+ return /* @__PURE__ */ jsx(
668
133
  "div",
669
134
  {
670
135
  className: cn(
671
136
  "polli:min-w-0 polli:font-body polli:leading-relaxed",
672
137
  className
673
138
  ),
674
- children: /* @__PURE__ */ jsx7(ReactMarkdown, { remarkPlugins: [remarkGfm], components, children })
139
+ children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], components, children })
675
140
  }
676
141
  );
677
142
  }
@@ -680,117 +145,98 @@ function Markdown({ children, className }) {
680
145
  import Markdown2 from "react-markdown";
681
146
  import rehypeSlug from "rehype-slug";
682
147
  import remarkGfm2 from "remark-gfm";
683
-
684
- // src/primitives/Typography.tsx
685
- import { jsx as jsx8 } from "react/jsx-runtime";
686
- var headingSizeClasses = {
687
- display: "polli:font-heading polli:text-5xl polli:leading-none",
688
- title: "polli:font-heading polli:text-4xl polli:leading-none",
689
- section: "polli:font-subheading polli:text-2xl polli:leading-tight",
690
- subsection: "polli:font-subheading polli:text-xl polli:leading-tight",
691
- card: "polli:font-subheading polli:text-lg polli:leading-tight"
692
- };
693
- function headingClassName(size, className) {
694
- return cn(
695
- "polli:break-words polli:text-theme-text-strong",
696
- headingSizeClasses[size],
697
- className
698
- );
699
- }
700
-
701
- // src/compositions/Prose.tsx
702
- import { jsx as jsx9 } from "react/jsx-runtime";
148
+ import { jsx as jsx2 } from "react/jsx-runtime";
703
149
  var components2 = {
704
- h1: ({ node, ...props }) => /* @__PURE__ */ jsx9(
150
+ h1: ({ node, ...props }) => /* @__PURE__ */ jsx2(
705
151
  "h1",
706
152
  {
707
153
  className: headingClassName("title", "polli:mt-0 polli:mb-5"),
708
154
  ...props
709
155
  }
710
156
  ),
711
- h2: ({ node, ...props }) => /* @__PURE__ */ jsx9(
157
+ h2: ({ node, ...props }) => /* @__PURE__ */ jsx2(
712
158
  "h2",
713
159
  {
714
160
  className: headingClassName("section", "polli:mt-8 polli:mb-3"),
715
161
  ...props
716
162
  }
717
163
  ),
718
- h3: ({ node, ...props }) => /* @__PURE__ */ jsx9(
164
+ h3: ({ node, ...props }) => /* @__PURE__ */ jsx2(
719
165
  "h3",
720
166
  {
721
167
  className: headingClassName("subsection", "polli:mt-6 polli:mb-2"),
722
168
  ...props
723
169
  }
724
170
  ),
725
- p: ({ node, ...props }) => /* @__PURE__ */ jsx9("p", { className: "polli:my-4 polli:leading-relaxed", ...props }),
726
- a: ({ node, ...props }) => /* @__PURE__ */ jsx9(InlineLink, { ...props }),
727
- ul: ({ node, ...props }) => /* @__PURE__ */ jsx9(
171
+ p: ({ node, ...props }) => /* @__PURE__ */ jsx2("p", { className: "polli:my-4 polli:leading-relaxed", ...props }),
172
+ a: ({ node, ...props }) => /* @__PURE__ */ jsx2(InlineLink, { ...props }),
173
+ ul: ({ node, ...props }) => /* @__PURE__ */ jsx2(
728
174
  "ul",
729
175
  {
730
176
  className: "polli:my-4 polli:list-disc polli:pl-6 polli:leading-relaxed",
731
177
  ...props
732
178
  }
733
179
  ),
734
- ol: ({ node, ...props }) => /* @__PURE__ */ jsx9(
180
+ ol: ({ node, ...props }) => /* @__PURE__ */ jsx2(
735
181
  "ol",
736
182
  {
737
183
  className: "polli:my-4 polli:list-decimal polli:pl-6 polli:leading-relaxed",
738
184
  ...props
739
185
  }
740
186
  ),
741
- blockquote: ({ node, ...props }) => /* @__PURE__ */ jsx9(
187
+ blockquote: ({ node, ...props }) => /* @__PURE__ */ jsx2(
742
188
  "blockquote",
743
189
  {
744
190
  className: "polli:my-4 polli:border-l-4 polli:border-theme-border polli:pl-4 polli:text-theme-text-soft",
745
191
  ...props
746
192
  }
747
193
  ),
748
- code: ({ node, ...props }) => /* @__PURE__ */ jsx9(
194
+ code: ({ node, ...props }) => /* @__PURE__ */ jsx2(
749
195
  "code",
750
196
  {
751
197
  className: "polli:rounded polli:bg-theme-bg-active polli:px-1 polli:py-0.5 polli:font-pixel polli:text-sm",
752
198
  ...props
753
199
  }
754
200
  ),
755
- pre: ({ node, ...props }) => /* @__PURE__ */ jsx9(
201
+ pre: ({ node, ...props }) => /* @__PURE__ */ jsx2(
756
202
  "pre",
757
203
  {
758
204
  className: "polli:my-4 polli:overflow-x-auto polli:rounded-lg polli:bg-theme-bg-active polli:p-4",
759
205
  ...props
760
206
  }
761
207
  ),
762
- table: ({ node, ...props }) => /* @__PURE__ */ jsx9(
208
+ table: ({ node, ...props }) => /* @__PURE__ */ jsx2(
763
209
  "table",
764
210
  {
765
211
  className: "polli:my-4 polli:w-full polli:border-collapse polli:text-sm",
766
212
  ...props
767
213
  }
768
214
  ),
769
- th: ({ node, ...props }) => /* @__PURE__ */ jsx9(
215
+ th: ({ node, ...props }) => /* @__PURE__ */ jsx2(
770
216
  "th",
771
217
  {
772
218
  className: "polli:border polli:border-theme-border polli:px-3 polli:py-2 polli:text-left polli:font-semibold",
773
219
  ...props
774
220
  }
775
221
  ),
776
- td: ({ node, ...props }) => /* @__PURE__ */ jsx9(
222
+ td: ({ node, ...props }) => /* @__PURE__ */ jsx2(
777
223
  "td",
778
224
  {
779
225
  className: "polli:border polli:border-theme-border polli:px-3 polli:py-2",
780
226
  ...props
781
227
  }
782
228
  ),
783
- hr: ({ node, ...props }) => /* @__PURE__ */ jsx9("hr", { className: "polli:my-6 polli:border-theme-border", ...props })
229
+ hr: ({ node, ...props }) => /* @__PURE__ */ jsx2("hr", { className: "polli:my-6 polli:border-theme-border", ...props })
784
230
  };
785
231
  function Prose({ children, className }) {
786
- return /* @__PURE__ */ jsx9(
232
+ return /* @__PURE__ */ jsx2(
787
233
  "div",
788
234
  {
789
235
  className: cn(
790
236
  "polli:font-body polli:text-theme-text-base polli:leading-relaxed",
791
237
  className
792
238
  ),
793
- children: /* @__PURE__ */ jsx9(
239
+ children: /* @__PURE__ */ jsx2(
794
240
  Markdown2,
795
241
  {
796
242
  remarkPlugins: [remarkGfm2],