@arc-lo/ui 0.2.1 → 0.3.0
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.
- package/dist/index.cjs +1069 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -88
- package/dist/index.d.ts +197 -88
- package/dist/index.js +1069 -188
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles.css +177 -16
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, forwardRef, useState, useCallback, useRef, useEffect,
|
|
1
|
+
import { createContext, forwardRef, useState, useCallback, useRef, useEffect, useId, useMemo, useContext } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -30,6 +30,8 @@ function cn(...inputs) {
|
|
|
30
30
|
// src/lib/theme.ts
|
|
31
31
|
var themeVars = {
|
|
32
32
|
accent: "var(--arclo-accent, #6C5CE7)",
|
|
33
|
+
accentFg: "var(--arclo-accent-fg, #ffffff)",
|
|
34
|
+
accentBright: "var(--arclo-accent-bright, rgb(167,139,250))",
|
|
33
35
|
surface: "var(--arclo-surface, #ffffff)",
|
|
34
36
|
surfaceSecondary: "var(--arclo-surface-secondary, #f9fafb)",
|
|
35
37
|
border: "var(--arclo-border, #e5e7eb)",
|
|
@@ -37,7 +39,9 @@ var themeVars = {
|
|
|
37
39
|
textSecondary: "var(--arclo-text-secondary, #6b7280)",
|
|
38
40
|
textMuted: "var(--arclo-text-muted, #9ca3af)",
|
|
39
41
|
error: "var(--arclo-error, #ef4444)",
|
|
40
|
-
errorSurface: "var(--arclo-error-surface, #fef2f2)"
|
|
42
|
+
errorSurface: "var(--arclo-error-surface, #fef2f2)",
|
|
43
|
+
radius: "var(--arclo-radius, 0.75rem)"
|
|
44
|
+
};
|
|
41
45
|
function chunkText(text, mode) {
|
|
42
46
|
switch (mode) {
|
|
43
47
|
case "char":
|
|
@@ -537,9 +541,13 @@ var Chip = forwardRef(
|
|
|
537
541
|
{
|
|
538
542
|
ref,
|
|
539
543
|
className: cn(
|
|
540
|
-
"arclo-prompt-chip inline-flex items-center gap-1.5 rounded-lg
|
|
544
|
+
"arclo-prompt-chip inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium",
|
|
541
545
|
className
|
|
542
546
|
),
|
|
547
|
+
style: {
|
|
548
|
+
backgroundColor: themeVars.surfaceSecondary,
|
|
549
|
+
color: themeVars.textSecondary
|
|
550
|
+
},
|
|
543
551
|
...props,
|
|
544
552
|
children: [
|
|
545
553
|
children,
|
|
@@ -593,8 +601,12 @@ var Input = forwardRef(
|
|
|
593
601
|
disabled: disabled || isSubmitting,
|
|
594
602
|
rows: minRows,
|
|
595
603
|
placeholder: "Ask anything...",
|
|
604
|
+
style: {
|
|
605
|
+
scrollbarWidth: "none",
|
|
606
|
+
color: themeVars.text
|
|
607
|
+
},
|
|
596
608
|
className: cn(
|
|
597
|
-
"arclo-prompt-input w-full resize-none bg-transparent px-4 py-3 text-[15px] leading-relaxed outline-none
|
|
609
|
+
"arclo-prompt-input w-full resize-none bg-transparent px-4 py-3 text-[15px] leading-relaxed outline-none",
|
|
598
610
|
className
|
|
599
611
|
),
|
|
600
612
|
...props
|
|
@@ -630,9 +642,9 @@ var SubmitButton = forwardRef(
|
|
|
630
642
|
ref,
|
|
631
643
|
type: "submit",
|
|
632
644
|
disabled: isEmpty || isSubmitting || disabled,
|
|
633
|
-
style: { backgroundColor: themeVars.accent },
|
|
645
|
+
style: { backgroundColor: themeVars.accent, color: themeVars.accentFg },
|
|
634
646
|
className: cn(
|
|
635
|
-
"arclo-prompt-submit ml-auto rounded-xl px-4 py-2 text-sm font-medium
|
|
647
|
+
"arclo-prompt-submit ml-auto rounded-xl px-4 py-2 text-sm font-medium transition-all hover:brightness-90 disabled:opacity-25 cursor-pointer disabled:cursor-default",
|
|
636
648
|
className
|
|
637
649
|
),
|
|
638
650
|
...props,
|
|
@@ -1328,9 +1340,13 @@ var Messages = forwardRef(
|
|
|
1328
1340
|
{
|
|
1329
1341
|
ref,
|
|
1330
1342
|
className: cn(
|
|
1331
|
-
"arclo-chat-messages flex-1 overflow-y-auto space-y-4 p-4
|
|
1343
|
+
"arclo-chat-messages flex-1 overflow-y-auto space-y-4 p-4",
|
|
1332
1344
|
className
|
|
1333
1345
|
),
|
|
1346
|
+
style: {
|
|
1347
|
+
scrollbarWidth: "thin",
|
|
1348
|
+
scrollbarColor: `var(--arclo-border, #e5e7eb) transparent`
|
|
1349
|
+
},
|
|
1334
1350
|
...props,
|
|
1335
1351
|
children
|
|
1336
1352
|
}
|
|
@@ -1411,9 +1427,9 @@ var Message = forwardRef(
|
|
|
1411
1427
|
),
|
|
1412
1428
|
style: isUser ? {
|
|
1413
1429
|
backgroundColor: themeVars.accent,
|
|
1414
|
-
color:
|
|
1430
|
+
color: themeVars.accentFg
|
|
1415
1431
|
} : {
|
|
1416
|
-
backgroundColor: themeVars.
|
|
1432
|
+
backgroundColor: themeVars.surface,
|
|
1417
1433
|
color: themeVars.text,
|
|
1418
1434
|
border: `1px solid ${themeVars.border}`
|
|
1419
1435
|
},
|
|
@@ -1448,8 +1464,14 @@ var ScrollAnchor = forwardRef(
|
|
|
1448
1464
|
useEffect(() => {
|
|
1449
1465
|
const el = innerRef.current;
|
|
1450
1466
|
if (!el) return;
|
|
1467
|
+
const scrollParent = el.closest(".arclo-chat-messages");
|
|
1451
1468
|
const observer = new MutationObserver(() => {
|
|
1452
|
-
|
|
1469
|
+
if (scrollParent) {
|
|
1470
|
+
scrollParent.scrollTo({
|
|
1471
|
+
top: scrollParent.scrollHeight,
|
|
1472
|
+
behavior: "smooth"
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1453
1475
|
});
|
|
1454
1476
|
const parent = el.parentElement;
|
|
1455
1477
|
if (parent) {
|
|
@@ -1469,172 +1491,996 @@ var ScrollAnchor = forwardRef(
|
|
|
1469
1491
|
}
|
|
1470
1492
|
);
|
|
1471
1493
|
ScrollAnchor.displayName = "ChatThread.ScrollAnchor";
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1494
|
+
|
|
1495
|
+
// src/image-gen/index.ts
|
|
1496
|
+
var image_gen_exports = {};
|
|
1497
|
+
__export(image_gen_exports, {
|
|
1498
|
+
Download: () => Download,
|
|
1499
|
+
ErrorFallback: () => ErrorFallback2,
|
|
1500
|
+
Overlay: () => Overlay,
|
|
1501
|
+
Placeholder: () => Placeholder,
|
|
1502
|
+
Preview: () => Preview,
|
|
1503
|
+
Progress: () => Progress,
|
|
1504
|
+
Retry: () => Retry,
|
|
1505
|
+
Root: () => Root7,
|
|
1506
|
+
Toolbar: () => Toolbar2
|
|
1507
|
+
});
|
|
1508
|
+
var ImageGenContext = createContext(null);
|
|
1509
|
+
function useImageGenContext() {
|
|
1510
|
+
const ctx = useContext(ImageGenContext);
|
|
1511
|
+
if (!ctx) {
|
|
1512
|
+
throw new Error(
|
|
1513
|
+
"useImageGenContext must be used within <ImageGen.Root>"
|
|
1514
|
+
);
|
|
1488
1515
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1516
|
+
return ctx;
|
|
1517
|
+
}
|
|
1518
|
+
var Root7 = forwardRef(
|
|
1519
|
+
({
|
|
1520
|
+
state,
|
|
1521
|
+
src,
|
|
1522
|
+
alt,
|
|
1523
|
+
aspectRatio = "1/1",
|
|
1524
|
+
prompt,
|
|
1525
|
+
onRetry,
|
|
1526
|
+
onDownload,
|
|
1527
|
+
blurReveal = true,
|
|
1528
|
+
children,
|
|
1529
|
+
className,
|
|
1530
|
+
...props
|
|
1531
|
+
}, ref) => {
|
|
1532
|
+
const ctx = {
|
|
1533
|
+
state,
|
|
1534
|
+
src,
|
|
1535
|
+
alt,
|
|
1536
|
+
aspectRatio,
|
|
1537
|
+
prompt,
|
|
1538
|
+
onRetry,
|
|
1539
|
+
onDownload,
|
|
1540
|
+
blurReveal
|
|
1541
|
+
};
|
|
1542
|
+
return /* @__PURE__ */ jsx(ImageGenContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1543
|
+
"div",
|
|
1544
|
+
{
|
|
1545
|
+
ref,
|
|
1546
|
+
"data-state": state,
|
|
1547
|
+
style: { position: "relative" },
|
|
1548
|
+
className: cn("arclo-image-gen", className),
|
|
1549
|
+
...props,
|
|
1550
|
+
children
|
|
1551
|
+
}
|
|
1552
|
+
) });
|
|
1553
|
+
}
|
|
1554
|
+
);
|
|
1555
|
+
Root7.displayName = "ImageGen.Root";
|
|
1556
|
+
var Placeholder = forwardRef(
|
|
1557
|
+
({ className, ...props }, ref) => {
|
|
1558
|
+
const { state, src, aspectRatio } = useImageGenContext();
|
|
1559
|
+
const visible = state === "idle" || state === "pending" || state === "generating" && !src;
|
|
1560
|
+
if (!visible) return null;
|
|
1533
1561
|
return /* @__PURE__ */ jsxs(
|
|
1534
|
-
"
|
|
1562
|
+
"div",
|
|
1535
1563
|
{
|
|
1536
1564
|
ref,
|
|
1537
1565
|
role: "status",
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1566
|
+
"aria-label": "Loading image",
|
|
1567
|
+
style: {
|
|
1568
|
+
aspectRatio,
|
|
1569
|
+
backgroundColor: themeVars.surfaceSecondary,
|
|
1570
|
+
borderRadius: themeVars.radius,
|
|
1571
|
+
overflow: "hidden",
|
|
1572
|
+
position: "relative"
|
|
1573
|
+
},
|
|
1574
|
+
className: cn("arclo-image-gen-placeholder", className),
|
|
1543
1575
|
...props,
|
|
1544
1576
|
children: [
|
|
1545
1577
|
/* @__PURE__ */ jsx(
|
|
1546
|
-
"
|
|
1578
|
+
"div",
|
|
1547
1579
|
{
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1580
|
+
dangerouslySetInnerHTML: {
|
|
1581
|
+
__html: `<style>
|
|
1582
|
+
@keyframes arclo-shimmer {
|
|
1583
|
+
0% { transform: translateX(-100%); }
|
|
1584
|
+
100% { transform: translateX(100%); }
|
|
1585
|
+
}
|
|
1586
|
+
</style>`
|
|
1587
|
+
}
|
|
1555
1588
|
}
|
|
1556
1589
|
),
|
|
1557
|
-
|
|
1590
|
+
/* @__PURE__ */ jsx(
|
|
1591
|
+
"div",
|
|
1592
|
+
{
|
|
1593
|
+
style: {
|
|
1594
|
+
position: "absolute",
|
|
1595
|
+
inset: 0,
|
|
1596
|
+
background: `linear-gradient(90deg, transparent 0%, ${themeVars.border} 50%, transparent 100%)`,
|
|
1597
|
+
animation: "arclo-shimmer 1.5s ease-in-out infinite"
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
)
|
|
1558
1601
|
]
|
|
1559
1602
|
}
|
|
1560
1603
|
);
|
|
1561
1604
|
}
|
|
1562
1605
|
);
|
|
1563
|
-
|
|
1564
|
-
var
|
|
1565
|
-
({
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
...props
|
|
1573
|
-
}, ref) => {
|
|
1574
|
-
const [showPreview, setShowPreview] = useState(false);
|
|
1575
|
-
const label = variant === "bracket" ? `[${index}]` : `${index}`;
|
|
1576
|
-
const Tag = href ? "a" : "span";
|
|
1577
|
-
const linkProps = href ? { href, target: "_blank", rel: "noopener noreferrer" } : {};
|
|
1578
|
-
return /* @__PURE__ */ jsxs(
|
|
1579
|
-
"span",
|
|
1606
|
+
Placeholder.displayName = "ImageGen.Placeholder";
|
|
1607
|
+
var Preview = forwardRef(
|
|
1608
|
+
({ className, style, ...props }, ref) => {
|
|
1609
|
+
const { state, src, alt, aspectRatio, blurReveal } = useImageGenContext();
|
|
1610
|
+
if (!src) return null;
|
|
1611
|
+
const isDone = state === "done";
|
|
1612
|
+
const blurValue = blurReveal && !isDone ? "blur(20px)" : "blur(0)";
|
|
1613
|
+
return /* @__PURE__ */ jsx(
|
|
1614
|
+
"img",
|
|
1580
1615
|
{
|
|
1581
1616
|
ref,
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1617
|
+
src,
|
|
1618
|
+
alt: alt ?? "",
|
|
1619
|
+
"data-state": state,
|
|
1620
|
+
style: {
|
|
1621
|
+
aspectRatio,
|
|
1622
|
+
width: "100%",
|
|
1623
|
+
display: "block",
|
|
1624
|
+
borderRadius: themeVars.radius,
|
|
1625
|
+
objectFit: "cover",
|
|
1626
|
+
filter: blurValue,
|
|
1627
|
+
transition: "filter 0.6s ease-out",
|
|
1628
|
+
...style
|
|
1629
|
+
},
|
|
1630
|
+
className: cn("arclo-image-gen-preview", className),
|
|
1631
|
+
...props
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
);
|
|
1636
|
+
Preview.displayName = "ImageGen.Preview";
|
|
1637
|
+
var Progress = forwardRef(
|
|
1638
|
+
({ progress, className, ...props }, ref) => {
|
|
1639
|
+
const { state } = useImageGenContext();
|
|
1640
|
+
if (state !== "pending" && state !== "generating") return null;
|
|
1641
|
+
const isIndeterminate = progress === void 0;
|
|
1642
|
+
return /* @__PURE__ */ jsx(
|
|
1643
|
+
"div",
|
|
1644
|
+
{
|
|
1645
|
+
ref,
|
|
1646
|
+
role: "progressbar",
|
|
1647
|
+
"aria-valuenow": isIndeterminate ? void 0 : progress,
|
|
1648
|
+
"aria-valuemin": 0,
|
|
1649
|
+
"aria-valuemax": 100,
|
|
1650
|
+
style: {
|
|
1651
|
+
position: "absolute",
|
|
1652
|
+
bottom: 0,
|
|
1653
|
+
left: 0,
|
|
1654
|
+
right: 0,
|
|
1655
|
+
height: "3px",
|
|
1656
|
+
backgroundColor: themeVars.surfaceSecondary,
|
|
1657
|
+
borderRadius: "0 0 3px 3px",
|
|
1658
|
+
overflow: "hidden"
|
|
1659
|
+
},
|
|
1660
|
+
className: cn("arclo-image-gen-progress", className),
|
|
1585
1661
|
...props,
|
|
1586
|
-
children: [
|
|
1662
|
+
children: isIndeterminate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1587
1663
|
/* @__PURE__ */ jsx(
|
|
1588
|
-
|
|
1664
|
+
"div",
|
|
1589
1665
|
{
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
children: label
|
|
1666
|
+
dangerouslySetInnerHTML: {
|
|
1667
|
+
__html: `<style>
|
|
1668
|
+
@keyframes arclo-progress-shimmer {
|
|
1669
|
+
0% { transform: translateX(-100%); }
|
|
1670
|
+
100% { transform: translateX(200%); }
|
|
1671
|
+
}
|
|
1672
|
+
</style>`
|
|
1673
|
+
}
|
|
1599
1674
|
}
|
|
1600
1675
|
),
|
|
1601
|
-
|
|
1676
|
+
/* @__PURE__ */ jsx(
|
|
1602
1677
|
"div",
|
|
1603
1678
|
{
|
|
1604
|
-
|
|
1605
|
-
|
|
1679
|
+
style: {
|
|
1680
|
+
width: "40%",
|
|
1681
|
+
height: "100%",
|
|
1682
|
+
backgroundColor: themeVars.accent,
|
|
1683
|
+
animation: "arclo-progress-shimmer 1.2s ease-in-out infinite"
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
)
|
|
1687
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1688
|
+
"div",
|
|
1689
|
+
{
|
|
1690
|
+
style: {
|
|
1691
|
+
width: `${Math.min(100, Math.max(0, progress))}%`,
|
|
1692
|
+
height: "100%",
|
|
1693
|
+
backgroundColor: themeVars.accent,
|
|
1694
|
+
transition: "width 0.3s ease-out"
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
)
|
|
1698
|
+
}
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
);
|
|
1702
|
+
Progress.displayName = "ImageGen.Progress";
|
|
1703
|
+
var stateLabels = {
|
|
1704
|
+
idle: "Waiting",
|
|
1705
|
+
pending: "Preparing...",
|
|
1706
|
+
generating: "Generating...",
|
|
1707
|
+
done: "Done",
|
|
1708
|
+
error: "Error"
|
|
1709
|
+
};
|
|
1710
|
+
var Overlay = forwardRef(
|
|
1711
|
+
({ label, className, ...props }, ref) => {
|
|
1712
|
+
const { state } = useImageGenContext();
|
|
1713
|
+
if (state !== "pending" && state !== "generating") return null;
|
|
1714
|
+
const displayLabel = label ?? stateLabels[state];
|
|
1715
|
+
return /* @__PURE__ */ jsxs(
|
|
1716
|
+
"div",
|
|
1717
|
+
{
|
|
1718
|
+
ref,
|
|
1719
|
+
style: {
|
|
1720
|
+
position: "absolute",
|
|
1721
|
+
inset: 0,
|
|
1722
|
+
display: "flex",
|
|
1723
|
+
flexDirection: "column",
|
|
1724
|
+
alignItems: "center",
|
|
1725
|
+
justifyContent: "center",
|
|
1726
|
+
gap: "8px",
|
|
1727
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
1728
|
+
borderRadius: themeVars.radius,
|
|
1729
|
+
color: "#ffffff"
|
|
1730
|
+
},
|
|
1731
|
+
className: cn("arclo-image-gen-overlay", className),
|
|
1732
|
+
...props,
|
|
1733
|
+
children: [
|
|
1734
|
+
/* @__PURE__ */ jsxs(
|
|
1735
|
+
"svg",
|
|
1736
|
+
{
|
|
1737
|
+
width: "24",
|
|
1738
|
+
height: "24",
|
|
1739
|
+
viewBox: "0 0 24 24",
|
|
1740
|
+
fill: "none",
|
|
1741
|
+
style: { animation: "spin 1s linear infinite" },
|
|
1606
1742
|
children: [
|
|
1607
|
-
|
|
1608
|
-
/* @__PURE__ */ jsx(
|
|
1609
|
-
|
|
1610
|
-
|
|
1743
|
+
/* @__PURE__ */ jsx("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` }),
|
|
1744
|
+
/* @__PURE__ */ jsx(
|
|
1745
|
+
"circle",
|
|
1746
|
+
{
|
|
1747
|
+
cx: "12",
|
|
1748
|
+
cy: "12",
|
|
1749
|
+
r: "10",
|
|
1750
|
+
stroke: "currentColor",
|
|
1751
|
+
strokeWidth: "3",
|
|
1752
|
+
strokeDasharray: "31.4 31.4",
|
|
1753
|
+
strokeLinecap: "round"
|
|
1754
|
+
}
|
|
1755
|
+
)
|
|
1611
1756
|
]
|
|
1612
1757
|
}
|
|
1613
|
-
)
|
|
1758
|
+
),
|
|
1759
|
+
displayLabel && /* @__PURE__ */ jsx("span", { style: { fontSize: "14px", fontWeight: 500 }, children: displayLabel })
|
|
1614
1760
|
]
|
|
1615
1761
|
}
|
|
1616
1762
|
);
|
|
1617
1763
|
}
|
|
1618
1764
|
);
|
|
1619
|
-
|
|
1620
|
-
var
|
|
1621
|
-
({
|
|
1622
|
-
|
|
1623
|
-
|
|
1765
|
+
Overlay.displayName = "ImageGen.Overlay";
|
|
1766
|
+
var ErrorFallback2 = forwardRef(
|
|
1767
|
+
({ message = "Failed to generate image.", className, ...props }, ref) => {
|
|
1768
|
+
const { state, onRetry } = useImageGenContext();
|
|
1769
|
+
if (state !== "error") return null;
|
|
1770
|
+
return /* @__PURE__ */ jsxs(
|
|
1771
|
+
"div",
|
|
1624
1772
|
{
|
|
1625
1773
|
ref,
|
|
1626
|
-
|
|
1774
|
+
role: "alert",
|
|
1775
|
+
style: {
|
|
1776
|
+
borderColor: themeVars.error,
|
|
1777
|
+
backgroundColor: themeVars.errorSurface,
|
|
1778
|
+
color: themeVars.error
|
|
1779
|
+
},
|
|
1780
|
+
className: cn(
|
|
1781
|
+
"arclo-image-gen-error rounded-lg border p-4 text-sm",
|
|
1782
|
+
className
|
|
1783
|
+
),
|
|
1627
1784
|
...props,
|
|
1628
|
-
children
|
|
1785
|
+
children: [
|
|
1786
|
+
/* @__PURE__ */ jsx("p", { children: message }),
|
|
1787
|
+
onRetry && /* @__PURE__ */ jsx(
|
|
1788
|
+
"button",
|
|
1789
|
+
{
|
|
1790
|
+
type: "button",
|
|
1791
|
+
onClick: onRetry,
|
|
1792
|
+
style: { color: themeVars.error },
|
|
1793
|
+
className: "mt-2 underline cursor-pointer",
|
|
1794
|
+
children: "Try again"
|
|
1795
|
+
}
|
|
1796
|
+
)
|
|
1797
|
+
]
|
|
1629
1798
|
}
|
|
1630
1799
|
);
|
|
1631
1800
|
}
|
|
1632
1801
|
);
|
|
1633
|
-
|
|
1634
|
-
var
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1802
|
+
ErrorFallback2.displayName = "ImageGen.ErrorFallback";
|
|
1803
|
+
var Toolbar2 = forwardRef(
|
|
1804
|
+
({ children, className, ...props }, ref) => {
|
|
1805
|
+
const { state } = useImageGenContext();
|
|
1806
|
+
if (state !== "done") return null;
|
|
1807
|
+
return /* @__PURE__ */ jsx(
|
|
1808
|
+
"div",
|
|
1809
|
+
{
|
|
1810
|
+
ref,
|
|
1811
|
+
className: cn(
|
|
1812
|
+
"arclo-image-gen-toolbar mt-2 flex items-center gap-2 animate-in fade-in duration-150",
|
|
1813
|
+
className
|
|
1814
|
+
),
|
|
1815
|
+
...props,
|
|
1816
|
+
children
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1820
|
+
);
|
|
1821
|
+
Toolbar2.displayName = "ImageGen.Toolbar";
|
|
1822
|
+
var Download = forwardRef(
|
|
1823
|
+
({ children, className, ...props }, ref) => {
|
|
1824
|
+
const { onDownload } = useImageGenContext();
|
|
1825
|
+
return /* @__PURE__ */ jsx(
|
|
1826
|
+
"button",
|
|
1827
|
+
{
|
|
1828
|
+
ref,
|
|
1829
|
+
type: "button",
|
|
1830
|
+
onClick: onDownload,
|
|
1831
|
+
style: {
|
|
1832
|
+
backgroundColor: themeVars.accent,
|
|
1833
|
+
color: themeVars.accentFg,
|
|
1834
|
+
borderRadius: themeVars.radius
|
|
1835
|
+
},
|
|
1836
|
+
className: cn(
|
|
1837
|
+
"arclo-image-gen-download px-3 py-1.5 text-sm cursor-pointer",
|
|
1838
|
+
className
|
|
1839
|
+
),
|
|
1840
|
+
...props,
|
|
1841
|
+
children: children ?? "Download"
|
|
1842
|
+
}
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
Download.displayName = "ImageGen.Download";
|
|
1847
|
+
var Retry = forwardRef(
|
|
1848
|
+
({ children, className, ...props }, ref) => {
|
|
1849
|
+
const { onRetry } = useImageGenContext();
|
|
1850
|
+
return /* @__PURE__ */ jsx(
|
|
1851
|
+
"button",
|
|
1852
|
+
{
|
|
1853
|
+
ref,
|
|
1854
|
+
type: "button",
|
|
1855
|
+
onClick: onRetry,
|
|
1856
|
+
style: {
|
|
1857
|
+
borderColor: themeVars.border,
|
|
1858
|
+
color: themeVars.text,
|
|
1859
|
+
borderRadius: themeVars.radius,
|
|
1860
|
+
borderWidth: "1px",
|
|
1861
|
+
borderStyle: "solid"
|
|
1862
|
+
},
|
|
1863
|
+
className: cn(
|
|
1864
|
+
"arclo-image-gen-retry px-3 py-1.5 text-sm cursor-pointer",
|
|
1865
|
+
className
|
|
1866
|
+
),
|
|
1867
|
+
...props,
|
|
1868
|
+
children: children ?? "Retry"
|
|
1869
|
+
}
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
);
|
|
1873
|
+
Retry.displayName = "ImageGen.Retry";
|
|
1874
|
+
|
|
1875
|
+
// src/video-gen/index.ts
|
|
1876
|
+
var video_gen_exports = {};
|
|
1877
|
+
__export(video_gen_exports, {
|
|
1878
|
+
ErrorFallback: () => ErrorFallback3,
|
|
1879
|
+
Placeholder: () => Placeholder2,
|
|
1880
|
+
PlayButton: () => PlayButton,
|
|
1881
|
+
Player: () => Player,
|
|
1882
|
+
Progress: () => Progress2,
|
|
1883
|
+
Root: () => Root8,
|
|
1884
|
+
StageLabel: () => StageLabel,
|
|
1885
|
+
Thumbnail: () => Thumbnail,
|
|
1886
|
+
Toolbar: () => Toolbar3
|
|
1887
|
+
});
|
|
1888
|
+
var VideoGenContext = createContext(null);
|
|
1889
|
+
function useVideoGenContext() {
|
|
1890
|
+
const ctx = useContext(VideoGenContext);
|
|
1891
|
+
if (!ctx) {
|
|
1892
|
+
throw new Error(
|
|
1893
|
+
"useVideoGenContext must be used within <VideoGen.Root>"
|
|
1894
|
+
);
|
|
1895
|
+
}
|
|
1896
|
+
return ctx;
|
|
1897
|
+
}
|
|
1898
|
+
var Root8 = forwardRef(
|
|
1899
|
+
({
|
|
1900
|
+
state,
|
|
1901
|
+
src = null,
|
|
1902
|
+
poster = null,
|
|
1903
|
+
progress,
|
|
1904
|
+
aspectRatio = "16/9",
|
|
1905
|
+
duration = null,
|
|
1906
|
+
prompt,
|
|
1907
|
+
onRetry,
|
|
1908
|
+
onDownload,
|
|
1909
|
+
onPlay,
|
|
1910
|
+
children,
|
|
1911
|
+
className,
|
|
1912
|
+
style,
|
|
1913
|
+
...props
|
|
1914
|
+
}, ref) => {
|
|
1915
|
+
const ctx = {
|
|
1916
|
+
state,
|
|
1917
|
+
src,
|
|
1918
|
+
poster,
|
|
1919
|
+
progress,
|
|
1920
|
+
aspectRatio,
|
|
1921
|
+
duration,
|
|
1922
|
+
prompt,
|
|
1923
|
+
onRetry,
|
|
1924
|
+
onDownload,
|
|
1925
|
+
onPlay
|
|
1926
|
+
};
|
|
1927
|
+
return /* @__PURE__ */ jsx(VideoGenContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1928
|
+
"div",
|
|
1929
|
+
{
|
|
1930
|
+
ref,
|
|
1931
|
+
"data-state": state,
|
|
1932
|
+
className: cn("arclo-video-gen relative overflow-hidden", className),
|
|
1933
|
+
style: {
|
|
1934
|
+
aspectRatio,
|
|
1935
|
+
borderRadius: themeVars.radius,
|
|
1936
|
+
...style
|
|
1937
|
+
},
|
|
1938
|
+
...props,
|
|
1939
|
+
children
|
|
1940
|
+
}
|
|
1941
|
+
) });
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
Root8.displayName = "VideoGen.Root";
|
|
1945
|
+
var Placeholder2 = forwardRef(
|
|
1946
|
+
({ className, ...props }, ref) => {
|
|
1947
|
+
const { state, poster } = useVideoGenContext();
|
|
1948
|
+
const id = useId().replace(/:/g, "");
|
|
1949
|
+
const visible = (state === "idle" || state === "queued" || state === "processing") && !poster;
|
|
1950
|
+
if (!visible) return null;
|
|
1951
|
+
return /* @__PURE__ */ jsxs(
|
|
1952
|
+
"div",
|
|
1953
|
+
{
|
|
1954
|
+
ref,
|
|
1955
|
+
role: "status",
|
|
1956
|
+
"aria-label": "Preparing video",
|
|
1957
|
+
className: cn(
|
|
1958
|
+
"arclo-video-gen-placeholder absolute inset-0 flex items-center justify-center",
|
|
1959
|
+
className
|
|
1960
|
+
),
|
|
1961
|
+
style: { backgroundColor: themeVars.surfaceSecondary },
|
|
1962
|
+
...props,
|
|
1963
|
+
children: [
|
|
1964
|
+
/* @__PURE__ */ jsx(
|
|
1965
|
+
"style",
|
|
1966
|
+
{
|
|
1967
|
+
dangerouslySetInnerHTML: {
|
|
1968
|
+
__html: `
|
|
1969
|
+
@keyframes arclo-vg-shimmer-${id} {
|
|
1970
|
+
0% { background-position: -200% 0; }
|
|
1971
|
+
100% { background-position: 200% 0; }
|
|
1972
|
+
}`
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
),
|
|
1976
|
+
/* @__PURE__ */ jsx(
|
|
1977
|
+
"div",
|
|
1978
|
+
{
|
|
1979
|
+
className: "absolute inset-0",
|
|
1980
|
+
style: {
|
|
1981
|
+
background: `linear-gradient(90deg, transparent 0%, ${themeVars.border} 50%, transparent 100%)`,
|
|
1982
|
+
backgroundSize: "200% 100%",
|
|
1983
|
+
animation: `arclo-vg-shimmer-${id} 2s ease-in-out infinite`,
|
|
1984
|
+
opacity: 0.5
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
),
|
|
1988
|
+
/* @__PURE__ */ jsxs(
|
|
1989
|
+
"svg",
|
|
1990
|
+
{
|
|
1991
|
+
width: "48",
|
|
1992
|
+
height: "48",
|
|
1993
|
+
viewBox: "0 0 24 24",
|
|
1994
|
+
fill: "none",
|
|
1995
|
+
stroke: "currentColor",
|
|
1996
|
+
strokeWidth: "1.5",
|
|
1997
|
+
strokeLinecap: "round",
|
|
1998
|
+
strokeLinejoin: "round",
|
|
1999
|
+
style: { color: themeVars.textMuted, position: "relative", zIndex: 1 },
|
|
2000
|
+
children: [
|
|
2001
|
+
/* @__PURE__ */ jsx("path", { d: "M4 11v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" }),
|
|
2002
|
+
/* @__PURE__ */ jsx("path", { d: "M4 11V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4" }),
|
|
2003
|
+
/* @__PURE__ */ jsx("path", { d: "M4 11h16" }),
|
|
2004
|
+
/* @__PURE__ */ jsx("path", { d: "M7 5l2 6" }),
|
|
2005
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5l2 6" }),
|
|
2006
|
+
/* @__PURE__ */ jsx("path", { d: "M15 5l2 6" })
|
|
2007
|
+
]
|
|
2008
|
+
}
|
|
2009
|
+
)
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
Placeholder2.displayName = "VideoGen.Placeholder";
|
|
2016
|
+
var Thumbnail = forwardRef(
|
|
2017
|
+
({ className, style: styleProp, ...props }, ref) => {
|
|
2018
|
+
const { state, poster } = useVideoGenContext();
|
|
2019
|
+
const visible = poster && (state === "processing" || state === "rendering" || state === "done");
|
|
2020
|
+
if (!visible) return null;
|
|
2021
|
+
return /* @__PURE__ */ jsx(
|
|
2022
|
+
"img",
|
|
2023
|
+
{
|
|
2024
|
+
ref,
|
|
2025
|
+
src: poster,
|
|
2026
|
+
alt: "Video thumbnail",
|
|
2027
|
+
className: cn(
|
|
2028
|
+
"arclo-video-gen-thumbnail absolute inset-0 h-full w-full object-cover",
|
|
2029
|
+
className
|
|
2030
|
+
),
|
|
2031
|
+
style: {
|
|
2032
|
+
borderRadius: themeVars.radius,
|
|
2033
|
+
...styleProp
|
|
2034
|
+
},
|
|
2035
|
+
...props
|
|
2036
|
+
}
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
);
|
|
2040
|
+
Thumbnail.displayName = "VideoGen.Thumbnail";
|
|
2041
|
+
var Player = forwardRef(
|
|
2042
|
+
({ className, style: styleProp, autoPlay, loop, muted, ...props }, ref) => {
|
|
2043
|
+
const { state, src, poster } = useVideoGenContext();
|
|
2044
|
+
if (state !== "done" || !src) return null;
|
|
2045
|
+
return /* @__PURE__ */ jsx(
|
|
2046
|
+
"video",
|
|
2047
|
+
{
|
|
2048
|
+
ref,
|
|
2049
|
+
src,
|
|
2050
|
+
poster: poster ?? void 0,
|
|
2051
|
+
controls: true,
|
|
2052
|
+
autoPlay,
|
|
2053
|
+
loop,
|
|
2054
|
+
muted,
|
|
2055
|
+
className: cn(
|
|
2056
|
+
"arclo-video-gen-player absolute inset-0 h-full w-full object-contain",
|
|
2057
|
+
className
|
|
2058
|
+
),
|
|
2059
|
+
style: {
|
|
2060
|
+
borderRadius: themeVars.radius,
|
|
2061
|
+
backgroundColor: themeVars.surface,
|
|
2062
|
+
...styleProp
|
|
2063
|
+
},
|
|
2064
|
+
...props
|
|
2065
|
+
}
|
|
2066
|
+
);
|
|
2067
|
+
}
|
|
2068
|
+
);
|
|
2069
|
+
Player.displayName = "VideoGen.Player";
|
|
2070
|
+
var Progress2 = forwardRef(
|
|
2071
|
+
({ className, ...props }, ref) => {
|
|
2072
|
+
const { state, progress } = useVideoGenContext();
|
|
2073
|
+
const id = useId().replace(/:/g, "");
|
|
2074
|
+
const visible = state === "queued" || state === "processing" || state === "rendering";
|
|
2075
|
+
if (!visible) return null;
|
|
2076
|
+
const isDeterminate = progress != null;
|
|
2077
|
+
return /* @__PURE__ */ jsxs(
|
|
2078
|
+
"div",
|
|
2079
|
+
{
|
|
2080
|
+
ref,
|
|
2081
|
+
role: "progressbar",
|
|
2082
|
+
"aria-valuenow": isDeterminate ? progress : void 0,
|
|
2083
|
+
"aria-valuemin": 0,
|
|
2084
|
+
"aria-valuemax": 100,
|
|
2085
|
+
className: cn(
|
|
2086
|
+
"arclo-video-gen-progress absolute bottom-0 left-0 right-0 h-1",
|
|
2087
|
+
className
|
|
2088
|
+
),
|
|
2089
|
+
style: { backgroundColor: `color-mix(in srgb, ${themeVars.accent} 20%, transparent)` },
|
|
2090
|
+
...props,
|
|
2091
|
+
children: [
|
|
2092
|
+
/* @__PURE__ */ jsx(
|
|
2093
|
+
"style",
|
|
2094
|
+
{
|
|
2095
|
+
dangerouslySetInnerHTML: {
|
|
2096
|
+
__html: `
|
|
2097
|
+
@keyframes arclo-vg-indeterminate-${id} {
|
|
2098
|
+
0% { transform: translateX(-100%); }
|
|
2099
|
+
100% { transform: translateX(400%); }
|
|
2100
|
+
}`
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
),
|
|
2104
|
+
/* @__PURE__ */ jsx(
|
|
2105
|
+
"div",
|
|
2106
|
+
{
|
|
2107
|
+
className: "h-full",
|
|
2108
|
+
style: isDeterminate ? {
|
|
2109
|
+
width: `${Math.min(100, Math.max(0, progress))}%`,
|
|
2110
|
+
backgroundColor: themeVars.accent,
|
|
2111
|
+
transition: "width 0.3s ease"
|
|
2112
|
+
} : {
|
|
2113
|
+
width: "25%",
|
|
2114
|
+
backgroundColor: themeVars.accent,
|
|
2115
|
+
animation: `arclo-vg-indeterminate-${id} 1.5s ease-in-out infinite`
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
)
|
|
2119
|
+
]
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
}
|
|
2123
|
+
);
|
|
2124
|
+
Progress2.displayName = "VideoGen.Progress";
|
|
2125
|
+
function getAutoLabel(state, progress) {
|
|
2126
|
+
switch (state) {
|
|
2127
|
+
case "idle":
|
|
2128
|
+
return "";
|
|
2129
|
+
case "queued":
|
|
2130
|
+
return "Queued...";
|
|
2131
|
+
case "processing":
|
|
2132
|
+
return progress != null ? `Processing ${Math.round(progress)}%` : "Processing...";
|
|
2133
|
+
case "rendering":
|
|
2134
|
+
return progress != null ? `Rendering ${Math.round(progress)}%` : "Rendering...";
|
|
2135
|
+
case "done":
|
|
2136
|
+
return "Complete";
|
|
2137
|
+
case "error":
|
|
2138
|
+
return "Failed";
|
|
2139
|
+
default:
|
|
2140
|
+
return "";
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
var StageLabel = forwardRef(
|
|
2144
|
+
({ label, className, ...props }, ref) => {
|
|
2145
|
+
const { state, progress } = useVideoGenContext();
|
|
2146
|
+
const id = useId().replace(/:/g, "");
|
|
2147
|
+
const displayLabel = label ?? getAutoLabel(state, progress);
|
|
2148
|
+
const isActive = state === "queued" || state === "processing" || state === "rendering";
|
|
2149
|
+
if (!displayLabel) return null;
|
|
2150
|
+
const accentColor = themeVars.accent;
|
|
2151
|
+
const brightColor = themeVars.accentBright;
|
|
2152
|
+
return /* @__PURE__ */ jsxs(
|
|
2153
|
+
"span",
|
|
2154
|
+
{
|
|
2155
|
+
ref,
|
|
2156
|
+
"data-state": state,
|
|
2157
|
+
className: cn(
|
|
2158
|
+
"arclo-video-gen-stage-label text-sm font-medium",
|
|
2159
|
+
className
|
|
2160
|
+
),
|
|
2161
|
+
style: { color: accentColor },
|
|
2162
|
+
...props,
|
|
2163
|
+
children: [
|
|
2164
|
+
/* @__PURE__ */ jsx(
|
|
2165
|
+
"style",
|
|
2166
|
+
{
|
|
2167
|
+
dangerouslySetInnerHTML: {
|
|
2168
|
+
__html: `
|
|
2169
|
+
@keyframes arclo-vg-sweep-${id} {
|
|
2170
|
+
0%, 100% { color: ${accentColor}; opacity: 0.5; }
|
|
2171
|
+
50% { color: ${brightColor}; opacity: 1; }
|
|
2172
|
+
}`
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
),
|
|
2176
|
+
isActive ? /* @__PURE__ */ jsx("span", { "aria-label": displayLabel, children: displayLabel.split("").map((char, i) => /* @__PURE__ */ jsx(
|
|
2177
|
+
"span",
|
|
2178
|
+
{
|
|
2179
|
+
style: {
|
|
2180
|
+
display: "inline-block",
|
|
2181
|
+
animation: `arclo-vg-sweep-${id} 1.5s ease-in-out infinite`,
|
|
2182
|
+
animationDelay: `${i * 0.08}s`
|
|
2183
|
+
},
|
|
2184
|
+
children: char === " " ? "\xA0" : char
|
|
2185
|
+
},
|
|
2186
|
+
i
|
|
2187
|
+
)) }) : /* @__PURE__ */ jsx("span", { children: displayLabel })
|
|
2188
|
+
]
|
|
2189
|
+
}
|
|
2190
|
+
);
|
|
2191
|
+
}
|
|
2192
|
+
);
|
|
2193
|
+
StageLabel.displayName = "VideoGen.StageLabel";
|
|
2194
|
+
var ErrorFallback3 = forwardRef(
|
|
2195
|
+
({ message = "Video generation failed.", className, ...props }, ref) => {
|
|
2196
|
+
const { state, onRetry } = useVideoGenContext();
|
|
2197
|
+
if (state !== "error") return null;
|
|
2198
|
+
return /* @__PURE__ */ jsxs(
|
|
2199
|
+
"div",
|
|
2200
|
+
{
|
|
2201
|
+
ref,
|
|
2202
|
+
role: "alert",
|
|
2203
|
+
className: cn(
|
|
2204
|
+
"arclo-video-gen-error absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-sm",
|
|
2205
|
+
className
|
|
2206
|
+
),
|
|
2207
|
+
style: {
|
|
2208
|
+
backgroundColor: themeVars.errorSurface,
|
|
2209
|
+
color: themeVars.error,
|
|
2210
|
+
borderRadius: themeVars.radius
|
|
2211
|
+
},
|
|
2212
|
+
...props,
|
|
2213
|
+
children: [
|
|
2214
|
+
/* @__PURE__ */ jsxs(
|
|
2215
|
+
"svg",
|
|
2216
|
+
{
|
|
2217
|
+
width: "24",
|
|
2218
|
+
height: "24",
|
|
2219
|
+
viewBox: "0 0 24 24",
|
|
2220
|
+
fill: "none",
|
|
2221
|
+
stroke: "currentColor",
|
|
2222
|
+
strokeWidth: "2",
|
|
2223
|
+
strokeLinecap: "round",
|
|
2224
|
+
strokeLinejoin: "round",
|
|
2225
|
+
children: [
|
|
2226
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2227
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
2228
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
2229
|
+
]
|
|
2230
|
+
}
|
|
2231
|
+
),
|
|
2232
|
+
/* @__PURE__ */ jsx("p", { children: message }),
|
|
2233
|
+
onRetry && /* @__PURE__ */ jsx(
|
|
2234
|
+
"button",
|
|
2235
|
+
{
|
|
2236
|
+
type: "button",
|
|
2237
|
+
onClick: onRetry,
|
|
2238
|
+
className: "mt-1 underline cursor-pointer",
|
|
2239
|
+
style: { color: themeVars.error },
|
|
2240
|
+
children: "Try again"
|
|
2241
|
+
}
|
|
2242
|
+
)
|
|
2243
|
+
]
|
|
2244
|
+
}
|
|
2245
|
+
);
|
|
2246
|
+
}
|
|
2247
|
+
);
|
|
2248
|
+
ErrorFallback3.displayName = "VideoGen.ErrorFallback";
|
|
2249
|
+
var Toolbar3 = forwardRef(
|
|
2250
|
+
({ children, className, ...props }, ref) => {
|
|
2251
|
+
const { state } = useVideoGenContext();
|
|
2252
|
+
if (state !== "done") return null;
|
|
2253
|
+
return /* @__PURE__ */ jsx(
|
|
2254
|
+
"div",
|
|
2255
|
+
{
|
|
2256
|
+
ref,
|
|
2257
|
+
className: cn(
|
|
2258
|
+
"arclo-video-gen-toolbar absolute bottom-4 right-4 flex items-center gap-2 animate-in fade-in duration-150",
|
|
2259
|
+
className
|
|
2260
|
+
),
|
|
2261
|
+
...props,
|
|
2262
|
+
children
|
|
2263
|
+
}
|
|
2264
|
+
);
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
Toolbar3.displayName = "VideoGen.Toolbar";
|
|
2268
|
+
var PlayButton = forwardRef(
|
|
2269
|
+
({ className, children, ...props }, ref) => {
|
|
2270
|
+
const { state, onPlay, src } = useVideoGenContext();
|
|
2271
|
+
useRef(null);
|
|
2272
|
+
const visible = state === "done" && src;
|
|
2273
|
+
if (!visible) return null;
|
|
2274
|
+
const handleClick = () => {
|
|
2275
|
+
if (onPlay) {
|
|
2276
|
+
onPlay();
|
|
2277
|
+
} else {
|
|
2278
|
+
const root = ref?.current?.closest(
|
|
2279
|
+
".arclo-video-gen"
|
|
2280
|
+
);
|
|
2281
|
+
const video = root?.querySelector("video");
|
|
2282
|
+
if (video) {
|
|
2283
|
+
video.play();
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
return /* @__PURE__ */ jsx(
|
|
2288
|
+
"button",
|
|
2289
|
+
{
|
|
2290
|
+
ref,
|
|
2291
|
+
type: "button",
|
|
2292
|
+
"aria-label": "Play video",
|
|
2293
|
+
onClick: handleClick,
|
|
2294
|
+
className: cn(
|
|
2295
|
+
"arclo-video-gen-play-button absolute inset-0 m-auto flex h-16 w-16 items-center justify-center rounded-full cursor-pointer transition-transform hover:scale-110",
|
|
2296
|
+
className
|
|
2297
|
+
),
|
|
2298
|
+
style: {
|
|
2299
|
+
backgroundColor: themeVars.accent,
|
|
2300
|
+
color: themeVars.accentFg
|
|
2301
|
+
},
|
|
2302
|
+
...props,
|
|
2303
|
+
children: children ?? /* @__PURE__ */ jsx(
|
|
2304
|
+
"svg",
|
|
2305
|
+
{
|
|
2306
|
+
width: "28",
|
|
2307
|
+
height: "28",
|
|
2308
|
+
viewBox: "0 0 24 24",
|
|
2309
|
+
fill: "currentColor",
|
|
2310
|
+
children: /* @__PURE__ */ jsx("path", { d: "M8 5v14l11-7z" })
|
|
2311
|
+
}
|
|
2312
|
+
)
|
|
2313
|
+
}
|
|
2314
|
+
);
|
|
2315
|
+
}
|
|
2316
|
+
);
|
|
2317
|
+
PlayButton.displayName = "VideoGen.PlayButton";
|
|
2318
|
+
var levelConfig = {
|
|
2319
|
+
high: {
|
|
2320
|
+
label: "High confidence",
|
|
2321
|
+
classes: "bg-emerald-50 text-emerald-700 border-emerald-200"
|
|
2322
|
+
},
|
|
2323
|
+
medium: {
|
|
2324
|
+
label: "Medium confidence",
|
|
2325
|
+
classes: "bg-amber-50 text-amber-700 border-amber-200"
|
|
2326
|
+
},
|
|
2327
|
+
low: {
|
|
2328
|
+
label: "Low confidence",
|
|
2329
|
+
classes: "bg-red-50 text-red-700 border-red-200"
|
|
2330
|
+
},
|
|
2331
|
+
unknown: {
|
|
2332
|
+
label: "Confidence unknown",
|
|
2333
|
+
classes: "bg-gray-50 text-gray-500 border-gray-200"
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
var ConfidenceBadge = forwardRef(
|
|
2337
|
+
({ level, label, variant = "badge", className, ...props }, ref) => {
|
|
2338
|
+
const config = levelConfig[level];
|
|
2339
|
+
const displayLabel = label ?? config.label;
|
|
2340
|
+
if (variant === "dot") {
|
|
2341
|
+
return /* @__PURE__ */ jsx(
|
|
2342
|
+
"span",
|
|
2343
|
+
{
|
|
2344
|
+
ref,
|
|
2345
|
+
role: "status",
|
|
2346
|
+
"aria-label": displayLabel,
|
|
2347
|
+
title: displayLabel,
|
|
2348
|
+
className: cn(
|
|
2349
|
+
"arclo-confidence-dot inline-block h-2.5 w-2.5 shrink-0 rounded-full",
|
|
2350
|
+
level === "high" && "bg-emerald-500",
|
|
2351
|
+
level === "medium" && "bg-amber-500",
|
|
2352
|
+
level === "low" && "bg-red-500",
|
|
2353
|
+
level === "unknown" && "bg-gray-400",
|
|
2354
|
+
className
|
|
2355
|
+
),
|
|
2356
|
+
...props
|
|
2357
|
+
}
|
|
2358
|
+
);
|
|
2359
|
+
}
|
|
2360
|
+
if (variant === "inline") {
|
|
2361
|
+
return /* @__PURE__ */ jsx(
|
|
2362
|
+
"span",
|
|
2363
|
+
{
|
|
2364
|
+
ref,
|
|
2365
|
+
role: "status",
|
|
2366
|
+
className: cn(
|
|
2367
|
+
"arclo-confidence-inline text-xs italic",
|
|
2368
|
+
level === "high" && "text-emerald-600",
|
|
2369
|
+
level === "medium" && "text-amber-600",
|
|
2370
|
+
level === "low" && "text-red-600",
|
|
2371
|
+
level === "unknown" && "text-gray-400",
|
|
2372
|
+
className
|
|
2373
|
+
),
|
|
2374
|
+
...props,
|
|
2375
|
+
children: displayLabel
|
|
2376
|
+
}
|
|
2377
|
+
);
|
|
2378
|
+
}
|
|
2379
|
+
return /* @__PURE__ */ jsxs(
|
|
2380
|
+
"span",
|
|
2381
|
+
{
|
|
2382
|
+
ref,
|
|
2383
|
+
role: "status",
|
|
2384
|
+
className: cn(
|
|
2385
|
+
"arclo-confidence-badge inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium",
|
|
2386
|
+
config.classes,
|
|
2387
|
+
className
|
|
2388
|
+
),
|
|
2389
|
+
...props,
|
|
2390
|
+
children: [
|
|
2391
|
+
/* @__PURE__ */ jsx(
|
|
2392
|
+
"span",
|
|
2393
|
+
{
|
|
2394
|
+
className: cn(
|
|
2395
|
+
"h-2 w-2 shrink-0 rounded-full",
|
|
2396
|
+
level === "high" && "bg-emerald-500",
|
|
2397
|
+
level === "medium" && "bg-amber-500",
|
|
2398
|
+
level === "low" && "bg-red-500",
|
|
2399
|
+
level === "unknown" && "bg-gray-400"
|
|
2400
|
+
)
|
|
2401
|
+
}
|
|
2402
|
+
),
|
|
2403
|
+
displayLabel
|
|
2404
|
+
]
|
|
2405
|
+
}
|
|
2406
|
+
);
|
|
2407
|
+
}
|
|
2408
|
+
);
|
|
2409
|
+
ConfidenceBadge.displayName = "ConfidenceBadge";
|
|
2410
|
+
var CitationInline = forwardRef(
|
|
2411
|
+
({
|
|
2412
|
+
index,
|
|
2413
|
+
href,
|
|
2414
|
+
sourceTitle,
|
|
2415
|
+
preview,
|
|
2416
|
+
variant = "superscript",
|
|
2417
|
+
className,
|
|
2418
|
+
...props
|
|
2419
|
+
}, ref) => {
|
|
2420
|
+
const [showPreview, setShowPreview] = useState(false);
|
|
2421
|
+
const label = variant === "bracket" ? `[${index}]` : `${index}`;
|
|
2422
|
+
const Tag = href ? "a" : "span";
|
|
2423
|
+
const linkProps = href ? { href, target: "_blank", rel: "noopener noreferrer" } : {};
|
|
2424
|
+
return /* @__PURE__ */ jsxs(
|
|
2425
|
+
"span",
|
|
2426
|
+
{
|
|
2427
|
+
ref,
|
|
2428
|
+
className: cn("arclo-citation relative inline-block", className),
|
|
2429
|
+
onMouseEnter: () => setShowPreview(true),
|
|
2430
|
+
onMouseLeave: () => setShowPreview(false),
|
|
2431
|
+
...props,
|
|
2432
|
+
children: [
|
|
2433
|
+
/* @__PURE__ */ jsx(
|
|
2434
|
+
Tag,
|
|
2435
|
+
{
|
|
2436
|
+
...linkProps,
|
|
2437
|
+
className: cn(
|
|
2438
|
+
"arclo-citation-trigger transition-colors cursor-pointer",
|
|
2439
|
+
variant === "superscript" && "align-super text-[0.65em] text-blue-600 hover:text-blue-800",
|
|
2440
|
+
variant === "bracket" && "text-sm text-blue-600 hover:text-blue-800",
|
|
2441
|
+
variant === "pill" && "inline-flex h-5 w-5 items-center justify-center rounded-full bg-blue-100 text-[0.6rem] font-medium text-blue-700 hover:bg-blue-200"
|
|
2442
|
+
),
|
|
2443
|
+
"aria-label": sourceTitle ? `Source: ${sourceTitle}` : `Citation ${index}`,
|
|
2444
|
+
children: label
|
|
2445
|
+
}
|
|
2446
|
+
),
|
|
2447
|
+
preview && showPreview && /* @__PURE__ */ jsxs(
|
|
2448
|
+
"div",
|
|
2449
|
+
{
|
|
2450
|
+
role: "tooltip",
|
|
2451
|
+
className: "arclo-citation-preview absolute bottom-full left-1/2 z-50 mb-2 w-64 -translate-x-1/2 rounded-lg border border-gray-200 bg-white p-3 text-sm shadow-lg",
|
|
2452
|
+
children: [
|
|
2453
|
+
sourceTitle && /* @__PURE__ */ jsx("p", { className: "mb-1 font-medium text-gray-900", children: sourceTitle }),
|
|
2454
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-600", children: preview }),
|
|
2455
|
+
href && /* @__PURE__ */ jsx("p", { className: "mt-2 truncate text-xs text-blue-500", children: href }),
|
|
2456
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-white" })
|
|
2457
|
+
]
|
|
2458
|
+
}
|
|
2459
|
+
)
|
|
2460
|
+
]
|
|
2461
|
+
}
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
);
|
|
2465
|
+
CitationInline.displayName = "CitationInline";
|
|
2466
|
+
var CitationGroup = forwardRef(
|
|
2467
|
+
({ children, className, ...props }, ref) => {
|
|
2468
|
+
return /* @__PURE__ */ jsx(
|
|
2469
|
+
"span",
|
|
2470
|
+
{
|
|
2471
|
+
ref,
|
|
2472
|
+
className: cn("arclo-citation-group inline-flex gap-0.5", className),
|
|
2473
|
+
...props,
|
|
2474
|
+
children
|
|
2475
|
+
}
|
|
2476
|
+
);
|
|
2477
|
+
}
|
|
2478
|
+
);
|
|
2479
|
+
CitationGroup.displayName = "CitationGroup";
|
|
2480
|
+
var typeConfig = {
|
|
2481
|
+
safety: {
|
|
2482
|
+
icon: "\u{1F6E1}",
|
|
2483
|
+
defaultReason: "I can't help with that request for safety reasons.",
|
|
1638
2484
|
accent: "border-red-200 bg-red-50"
|
|
1639
2485
|
},
|
|
1640
2486
|
capability: {
|
|
@@ -2630,59 +3476,94 @@ var CodeBlock = forwardRef(
|
|
|
2630
3476
|
"arclo-code-block overflow-hidden rounded-xl border",
|
|
2631
3477
|
className
|
|
2632
3478
|
),
|
|
2633
|
-
style: {
|
|
3479
|
+
style: {
|
|
3480
|
+
backgroundColor: themeVars.surfaceSecondary,
|
|
3481
|
+
borderColor: themeVars.border
|
|
3482
|
+
},
|
|
2634
3483
|
...props,
|
|
2635
3484
|
children: [
|
|
2636
|
-
/* @__PURE__ */ jsxs(
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
"
|
|
2640
|
-
{
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
"
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
3485
|
+
/* @__PURE__ */ jsxs(
|
|
3486
|
+
"div",
|
|
3487
|
+
{
|
|
3488
|
+
className: "flex items-center justify-between px-4 py-2",
|
|
3489
|
+
style: { borderBottom: `1px solid ${themeVars.border}` },
|
|
3490
|
+
children: [
|
|
3491
|
+
/* @__PURE__ */ jsx(
|
|
3492
|
+
"span",
|
|
3493
|
+
{
|
|
3494
|
+
className: "text-[11px] font-medium uppercase tracking-wider",
|
|
3495
|
+
style: { color: themeVars.textMuted },
|
|
3496
|
+
children: language ?? "code"
|
|
3497
|
+
}
|
|
3498
|
+
),
|
|
3499
|
+
/* @__PURE__ */ jsx(
|
|
3500
|
+
"button",
|
|
3501
|
+
{
|
|
3502
|
+
type: "button",
|
|
3503
|
+
onClick: handleCopy,
|
|
3504
|
+
className: "flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] transition-colors cursor-pointer",
|
|
3505
|
+
style: { color: themeVars.textMuted },
|
|
3506
|
+
children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3507
|
+
/* @__PURE__ */ jsx(
|
|
3508
|
+
"svg",
|
|
3509
|
+
{
|
|
3510
|
+
className: "h-3.5 w-3.5",
|
|
3511
|
+
style: { color: "#10b981" },
|
|
3512
|
+
viewBox: "0 0 24 24",
|
|
3513
|
+
fill: "none",
|
|
3514
|
+
stroke: "currentColor",
|
|
3515
|
+
strokeWidth: "2",
|
|
3516
|
+
strokeLinecap: "round",
|
|
3517
|
+
strokeLinejoin: "round",
|
|
3518
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
3519
|
+
}
|
|
3520
|
+
),
|
|
3521
|
+
"Copied"
|
|
3522
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3523
|
+
/* @__PURE__ */ jsxs(
|
|
3524
|
+
"svg",
|
|
3525
|
+
{
|
|
3526
|
+
className: "h-3.5 w-3.5",
|
|
3527
|
+
viewBox: "0 0 24 24",
|
|
3528
|
+
fill: "none",
|
|
3529
|
+
stroke: "currentColor",
|
|
3530
|
+
strokeWidth: "2",
|
|
3531
|
+
strokeLinecap: "round",
|
|
3532
|
+
strokeLinejoin: "round",
|
|
3533
|
+
children: [
|
|
3534
|
+
/* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
3535
|
+
/* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
3536
|
+
]
|
|
3537
|
+
}
|
|
3538
|
+
),
|
|
3539
|
+
"Copy"
|
|
3540
|
+
] })
|
|
3541
|
+
}
|
|
3542
|
+
)
|
|
3543
|
+
]
|
|
3544
|
+
}
|
|
3545
|
+
),
|
|
3546
|
+
/* @__PURE__ */ jsx(
|
|
3547
|
+
"div",
|
|
3548
|
+
{
|
|
3549
|
+
className: "overflow-auto [scrollbar-width:thin] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full",
|
|
3550
|
+
style: {
|
|
3551
|
+
maxHeight,
|
|
3552
|
+
scrollbarColor: `${themeVars.border} transparent`
|
|
3553
|
+
},
|
|
3554
|
+
children: /* @__PURE__ */ jsx("pre", { className: "p-4 text-[13px] leading-relaxed", children: /* @__PURE__ */ jsx("code", { className: "font-mono", style: { color: themeVars.text }, children: lines.map((line, i) => /* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
3555
|
+
showLineNumbers && /* @__PURE__ */ jsx(
|
|
3556
|
+
"span",
|
|
3557
|
+
{
|
|
3558
|
+
className: "mr-4 inline-block w-8 shrink-0 select-none text-right",
|
|
3559
|
+
style: { color: themeVars.textMuted },
|
|
3560
|
+
children: i + 1
|
|
3561
|
+
}
|
|
3562
|
+
),
|
|
3563
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: line || "\n" })
|
|
3564
|
+
] }, i)) }) })
|
|
3565
|
+
}
|
|
3566
|
+
)
|
|
2686
3567
|
]
|
|
2687
3568
|
}
|
|
2688
3569
|
);
|
|
@@ -2958,6 +3839,6 @@ var SuggestTopics = forwardRef(
|
|
|
2958
3839
|
);
|
|
2959
3840
|
SuggestTopics.displayName = "SuggestTopics";
|
|
2960
3841
|
|
|
2961
|
-
export { chat_thread_exports as ChatThread, CitationGroup, CitationInline, CodeBlock, ConfidenceBadge, ConversationBranch, feedback_bar_exports as FeedbackBar, FileAttachment, MarkdownRenderer, ModelSelector, prompt_box_exports as PromptBox, RefusalCard, SourceCard, StatusIndicator, streaming_text_exports as StreamingText, SuggestTopics, thinking_block_exports as ThinkingBlock, TokenUsage, tool_call_exports as ToolCall, TopicCard, useStreamingText };
|
|
3842
|
+
export { chat_thread_exports as ChatThread, CitationGroup, CitationInline, CodeBlock, ConfidenceBadge, ConversationBranch, feedback_bar_exports as FeedbackBar, FileAttachment, image_gen_exports as ImageGen, MarkdownRenderer, ModelSelector, prompt_box_exports as PromptBox, RefusalCard, SourceCard, StatusIndicator, streaming_text_exports as StreamingText, SuggestTopics, thinking_block_exports as ThinkingBlock, TokenUsage, tool_call_exports as ToolCall, TopicCard, video_gen_exports as VideoGen, useStreamingText };
|
|
2962
3843
|
//# sourceMappingURL=index.js.map
|
|
2963
3844
|
//# sourceMappingURL=index.js.map
|