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

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