@lukeashford/aurelius 2.19.0 → 2.20.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.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +66 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -40
- package/dist/index.mjs.map +1 -1
- package/llms.md +11 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -109,8 +109,18 @@ var Skeleton = React3.forwardRef(
|
|
|
109
109
|
Skeleton.displayName = "Skeleton";
|
|
110
110
|
|
|
111
111
|
// src/components/Card.tsx
|
|
112
|
-
var CardContext = createContext({
|
|
112
|
+
var CardContext = createContext({ loading: void 0 });
|
|
113
113
|
var useCardContext = () => useContext(CardContext);
|
|
114
|
+
function slotLoading(loading, path) {
|
|
115
|
+
if (!loading) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (Array.isArray(path)) {
|
|
119
|
+
const [section, field] = path;
|
|
120
|
+
return !!loading[section]?.[field];
|
|
121
|
+
}
|
|
122
|
+
return !!loading[path];
|
|
123
|
+
}
|
|
114
124
|
var VARIANT_STYLES = {
|
|
115
125
|
default: "bg-charcoal shadow-sm border border-gold/30",
|
|
116
126
|
elevated: "bg-charcoal shadow-lg border-0",
|
|
@@ -124,12 +134,12 @@ var CardBase = React4.forwardRef(
|
|
|
124
134
|
interactive = false,
|
|
125
135
|
selected = false,
|
|
126
136
|
noPadding = false,
|
|
127
|
-
|
|
137
|
+
loading,
|
|
128
138
|
className,
|
|
129
139
|
children,
|
|
130
140
|
...props
|
|
131
141
|
}, ref) => {
|
|
132
|
-
return /* @__PURE__ */ React4.createElement(CardContext.Provider, { value: {
|
|
142
|
+
return /* @__PURE__ */ React4.createElement(CardContext.Provider, { value: { loading } }, /* @__PURE__ */ React4.createElement(
|
|
133
143
|
"div",
|
|
134
144
|
{
|
|
135
145
|
ref,
|
|
@@ -157,9 +167,12 @@ var CardBase = React4.forwardRef(
|
|
|
157
167
|
CardBase.displayName = "Card";
|
|
158
168
|
var CardHeader = React4.forwardRef(
|
|
159
169
|
({ title, subtitle, action, className, children, ...props }, ref) => {
|
|
160
|
-
const {
|
|
170
|
+
const { loading } = useCardContext();
|
|
171
|
+
const titleIsLoading = slotLoading(loading, ["header", "title"]);
|
|
172
|
+
const subtitleIsLoading = slotLoading(loading, ["header", "subtitle"]);
|
|
173
|
+
const actionIsLoading = slotLoading(loading, ["header", "action"]);
|
|
161
174
|
const hasContent = title || subtitle || action || children;
|
|
162
|
-
if (!hasContent && !
|
|
175
|
+
if (!hasContent && !titleIsLoading && !subtitleIsLoading && !actionIsLoading) {
|
|
163
176
|
return null;
|
|
164
177
|
}
|
|
165
178
|
return /* @__PURE__ */ React4.createElement(
|
|
@@ -169,18 +182,19 @@ var CardHeader = React4.forwardRef(
|
|
|
169
182
|
className: cx("px-6 py-4 border-b border-ash", className),
|
|
170
183
|
...props
|
|
171
184
|
},
|
|
172
|
-
|
|
185
|
+
title || subtitle || action || titleIsLoading || subtitleIsLoading || actionIsLoading ? /* @__PURE__ */ React4.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ React4.createElement("div", { className: "flex-1 min-w-0" }, title ? /* @__PURE__ */ React4.createElement("h3", { className: "text-lg font-semibold text-white m-0" }, title) : titleIsLoading ? /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-5 w-3/4 mb-1" }) : null, subtitle ? /* @__PURE__ */ React4.createElement("p", { className: "text-sm text-silver mt-1 m-0" }, subtitle) : subtitleIsLoading ? /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-4 w-1/2 mt-1" }) : null), action ? /* @__PURE__ */ React4.createElement("div", { className: "shrink-0" }, action) : actionIsLoading ? /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-8 w-8 shrink-0" }) : null) : children
|
|
173
186
|
);
|
|
174
187
|
}
|
|
175
188
|
);
|
|
176
189
|
CardHeader.displayName = "CardHeader";
|
|
177
190
|
var CardBody = React4.forwardRef(
|
|
178
191
|
({ className, children, ...props }, ref) => {
|
|
179
|
-
const {
|
|
180
|
-
|
|
192
|
+
const { loading } = useCardContext();
|
|
193
|
+
const isBodyLoading = slotLoading(loading, "body");
|
|
194
|
+
if (!children && !isBodyLoading) {
|
|
181
195
|
return null;
|
|
182
196
|
}
|
|
183
|
-
return /* @__PURE__ */ React4.createElement("div", { ref, className: cx("px-6 py-4", className), ...props },
|
|
197
|
+
return /* @__PURE__ */ React4.createElement("div", { ref, className: cx("px-6 py-4", className), ...props }, isBodyLoading ? /* @__PURE__ */ React4.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ React4.createElement(Skeleton, { className: "h-4 w-3/4" })) : children);
|
|
184
198
|
}
|
|
185
199
|
);
|
|
186
200
|
CardBody.displayName = "CardBody";
|
|
@@ -216,13 +230,14 @@ var CardMedia = React4.forwardRef(
|
|
|
216
230
|
children,
|
|
217
231
|
...props
|
|
218
232
|
}, ref) => {
|
|
219
|
-
const {
|
|
233
|
+
const { loading } = useCardContext();
|
|
234
|
+
const isMediaLoading = slotLoading(loading, "media");
|
|
220
235
|
const aspectClass = aspect && aspect !== "none" ? {
|
|
221
236
|
video: "aspect-video",
|
|
222
237
|
square: "aspect-square",
|
|
223
238
|
wide: "aspect-wide"
|
|
224
239
|
}[aspect] : "";
|
|
225
|
-
if (!children && !
|
|
240
|
+
if (!children && !isMediaLoading) {
|
|
226
241
|
return null;
|
|
227
242
|
}
|
|
228
243
|
return /* @__PURE__ */ React4.createElement(
|
|
@@ -238,7 +253,7 @@ var CardMedia = React4.forwardRef(
|
|
|
238
253
|
),
|
|
239
254
|
...props
|
|
240
255
|
},
|
|
241
|
-
|
|
256
|
+
isMediaLoading ? /* @__PURE__ */ React4.createElement(Skeleton, { className: "w-full h-full" }) : children
|
|
242
257
|
);
|
|
243
258
|
}
|
|
244
259
|
);
|
|
@@ -5041,7 +5056,7 @@ var ImageCard = React59.forwardRef(
|
|
|
5041
5056
|
contentClassName,
|
|
5042
5057
|
className,
|
|
5043
5058
|
children,
|
|
5044
|
-
|
|
5059
|
+
loading,
|
|
5045
5060
|
...props
|
|
5046
5061
|
}, ref) => {
|
|
5047
5062
|
return /* @__PURE__ */ React59.createElement(
|
|
@@ -5049,7 +5064,7 @@ var ImageCard = React59.forwardRef(
|
|
|
5049
5064
|
{
|
|
5050
5065
|
ref,
|
|
5051
5066
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5052
|
-
|
|
5067
|
+
loading,
|
|
5053
5068
|
...props
|
|
5054
5069
|
},
|
|
5055
5070
|
/* @__PURE__ */ React59.createElement(
|
|
@@ -5058,7 +5073,7 @@ var ImageCard = React59.forwardRef(
|
|
|
5058
5073
|
className: mediaClassName,
|
|
5059
5074
|
style: { aspectRatio: resolveAspectRatio(aspectRatio) }
|
|
5060
5075
|
},
|
|
5061
|
-
src && /* @__PURE__ */ React59.createElement(
|
|
5076
|
+
/* @__PURE__ */ React59.createElement(React59.Fragment, null, src && /* @__PURE__ */ React59.createElement(
|
|
5062
5077
|
"img",
|
|
5063
5078
|
{
|
|
5064
5079
|
src,
|
|
@@ -5068,14 +5083,13 @@ var ImageCard = React59.forwardRef(
|
|
|
5068
5083
|
objectFit === "cover" ? "object-cover" : "object-contain"
|
|
5069
5084
|
)
|
|
5070
5085
|
}
|
|
5071
|
-
),
|
|
5072
|
-
overlay && /* @__PURE__ */ React59.createElement(
|
|
5086
|
+
), overlay && /* @__PURE__ */ React59.createElement(
|
|
5073
5087
|
"div",
|
|
5074
5088
|
{
|
|
5075
5089
|
className: "absolute inset-0 bg-obsidian/80 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center"
|
|
5076
5090
|
},
|
|
5077
5091
|
overlay
|
|
5078
|
-
)
|
|
5092
|
+
))
|
|
5079
5093
|
),
|
|
5080
5094
|
/* @__PURE__ */ React59.createElement(
|
|
5081
5095
|
Card.Header,
|
|
@@ -5122,7 +5136,7 @@ var VideoCard = React60.forwardRef(
|
|
|
5122
5136
|
className,
|
|
5123
5137
|
children,
|
|
5124
5138
|
playerProps,
|
|
5125
|
-
|
|
5139
|
+
loading,
|
|
5126
5140
|
...props
|
|
5127
5141
|
}, ref) => {
|
|
5128
5142
|
return /* @__PURE__ */ React60.createElement(
|
|
@@ -5130,7 +5144,7 @@ var VideoCard = React60.forwardRef(
|
|
|
5130
5144
|
{
|
|
5131
5145
|
ref,
|
|
5132
5146
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5133
|
-
|
|
5147
|
+
loading,
|
|
5134
5148
|
...props
|
|
5135
5149
|
},
|
|
5136
5150
|
/* @__PURE__ */ React60.createElement(
|
|
@@ -5190,7 +5204,7 @@ var AudioCard = React61.forwardRef(
|
|
|
5190
5204
|
children,
|
|
5191
5205
|
playerProps,
|
|
5192
5206
|
height = "40px",
|
|
5193
|
-
|
|
5207
|
+
loading,
|
|
5194
5208
|
...props
|
|
5195
5209
|
}, ref) => {
|
|
5196
5210
|
return /* @__PURE__ */ React61.createElement(
|
|
@@ -5198,7 +5212,7 @@ var AudioCard = React61.forwardRef(
|
|
|
5198
5212
|
{
|
|
5199
5213
|
ref,
|
|
5200
5214
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5201
|
-
|
|
5215
|
+
loading,
|
|
5202
5216
|
...props
|
|
5203
5217
|
},
|
|
5204
5218
|
/* @__PURE__ */ React61.createElement(Card.Media, { className: cx(
|
|
@@ -5254,7 +5268,7 @@ var PdfCard = React62.forwardRef(
|
|
|
5254
5268
|
contentClassName,
|
|
5255
5269
|
className,
|
|
5256
5270
|
children,
|
|
5257
|
-
|
|
5271
|
+
loading,
|
|
5258
5272
|
...props
|
|
5259
5273
|
}, ref) => {
|
|
5260
5274
|
return /* @__PURE__ */ React62.createElement(
|
|
@@ -5262,7 +5276,7 @@ var PdfCard = React62.forwardRef(
|
|
|
5262
5276
|
{
|
|
5263
5277
|
ref,
|
|
5264
5278
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5265
|
-
|
|
5279
|
+
loading,
|
|
5266
5280
|
...props
|
|
5267
5281
|
},
|
|
5268
5282
|
/* @__PURE__ */ React62.createElement(
|
|
@@ -5330,13 +5344,13 @@ function ScriptElementRenderer({ element }) {
|
|
|
5330
5344
|
}
|
|
5331
5345
|
}
|
|
5332
5346
|
var ScriptCard = React63.forwardRef(
|
|
5333
|
-
({ title, subtitle, elements, maxHeight = "16rem", className, style,
|
|
5347
|
+
({ title, subtitle, elements, maxHeight = "16rem", className, style, loading, ...rest }, ref) => {
|
|
5334
5348
|
return /* @__PURE__ */ React63.createElement(
|
|
5335
5349
|
Card,
|
|
5336
5350
|
{
|
|
5337
5351
|
ref,
|
|
5338
5352
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5339
|
-
|
|
5353
|
+
loading,
|
|
5340
5354
|
...rest
|
|
5341
5355
|
},
|
|
5342
5356
|
/* @__PURE__ */ React63.createElement(
|
|
@@ -5370,7 +5384,7 @@ var TextCard = React64.forwardRef(
|
|
|
5370
5384
|
maxHeight = "16rem",
|
|
5371
5385
|
contentClassName,
|
|
5372
5386
|
className,
|
|
5373
|
-
|
|
5387
|
+
loading,
|
|
5374
5388
|
...props
|
|
5375
5389
|
}, ref) => {
|
|
5376
5390
|
return /* @__PURE__ */ React64.createElement(
|
|
@@ -5378,7 +5392,7 @@ var TextCard = React64.forwardRef(
|
|
|
5378
5392
|
{
|
|
5379
5393
|
ref,
|
|
5380
5394
|
className: cx("p-0 overflow-hidden w-full", className),
|
|
5381
|
-
|
|
5395
|
+
loading,
|
|
5382
5396
|
...props
|
|
5383
5397
|
},
|
|
5384
5398
|
/* @__PURE__ */ React64.createElement(
|
|
@@ -5408,6 +5422,21 @@ var TextCard = React64.forwardRef(
|
|
|
5408
5422
|
);
|
|
5409
5423
|
TextCard.displayName = "TextCard";
|
|
5410
5424
|
|
|
5425
|
+
// src/utils/artifactLoading.ts
|
|
5426
|
+
function deriveCardSlotLoading(a) {
|
|
5427
|
+
if (!a.isPending) {
|
|
5428
|
+
return void 0;
|
|
5429
|
+
}
|
|
5430
|
+
const header = {
|
|
5431
|
+
title: !a.title,
|
|
5432
|
+
subtitle: !a.subtitle
|
|
5433
|
+
};
|
|
5434
|
+
const mediaNeeded = (type) => ["IMAGE", "VIDEO", "AUDIO", "PDF"].includes(type);
|
|
5435
|
+
const media = mediaNeeded(a.type) && !a.url;
|
|
5436
|
+
const body = a.type === "TEXT" && !(a.inlineContent && a.inlineContent.trim().length) || a.type === "SCRIPT" && !(a.scriptElements && a.scriptElements.length > 0);
|
|
5437
|
+
return { header, media, body };
|
|
5438
|
+
}
|
|
5439
|
+
|
|
5411
5440
|
// src/components/ArtifactCard.tsx
|
|
5412
5441
|
var ARTIFACT_TYPES = {
|
|
5413
5442
|
TEXT: "TEXT",
|
|
@@ -5418,11 +5447,12 @@ var ARTIFACT_TYPES = {
|
|
|
5418
5447
|
PDF: "PDF"
|
|
5419
5448
|
};
|
|
5420
5449
|
var ArtifactCard = React65.forwardRef(
|
|
5421
|
-
({ artifact, onExpand,
|
|
5450
|
+
({ artifact, onExpand, loading, className, ...props }, ref) => {
|
|
5451
|
+
const derivedLoading = deriveCardSlotLoading(artifact);
|
|
5422
5452
|
const commonProps = {
|
|
5423
5453
|
title: artifact.title,
|
|
5424
5454
|
subtitle: artifact.subtitle,
|
|
5425
|
-
|
|
5455
|
+
loading: loading || derivedLoading,
|
|
5426
5456
|
className: "w-full"
|
|
5427
5457
|
};
|
|
5428
5458
|
const handleExpand = (e) => {
|
|
@@ -5606,7 +5636,7 @@ function ArtifactModal({
|
|
|
5606
5636
|
MarkdownContent,
|
|
5607
5637
|
{
|
|
5608
5638
|
content: artifact.inlineContent || "",
|
|
5609
|
-
isMarkdown: artifact.mimeType
|
|
5639
|
+
isMarkdown: artifact.mimeType !== "text/plain",
|
|
5610
5640
|
className: cx(
|
|
5611
5641
|
"prose prose-invert max-w-none",
|
|
5612
5642
|
artifact.mimeType === "text/plain" && "whitespace-pre-wrap"
|
|
@@ -5625,14 +5655,14 @@ function ArtifactModal({
|
|
|
5625
5655
|
}
|
|
5626
5656
|
function ArtifactRenderer({
|
|
5627
5657
|
artifact,
|
|
5628
|
-
|
|
5658
|
+
loading,
|
|
5629
5659
|
onExpand
|
|
5630
5660
|
}) {
|
|
5631
5661
|
return /* @__PURE__ */ React66.createElement(
|
|
5632
5662
|
ArtifactCard,
|
|
5633
5663
|
{
|
|
5634
5664
|
artifact,
|
|
5635
|
-
|
|
5665
|
+
loading,
|
|
5636
5666
|
onExpand
|
|
5637
5667
|
}
|
|
5638
5668
|
);
|
|
@@ -5642,7 +5672,7 @@ var ArtifactsPanel = React66.forwardRef(
|
|
|
5642
5672
|
artifacts,
|
|
5643
5673
|
isOpen = false,
|
|
5644
5674
|
onClose,
|
|
5645
|
-
|
|
5675
|
+
loading,
|
|
5646
5676
|
width,
|
|
5647
5677
|
widthPercent,
|
|
5648
5678
|
onResizeStart,
|
|
@@ -5744,12 +5774,12 @@ var ArtifactsPanel = React66.forwardRef(
|
|
|
5744
5774
|
columns === 3 && "grid-cols-3"
|
|
5745
5775
|
)
|
|
5746
5776
|
},
|
|
5747
|
-
artifacts.length === 0 && !
|
|
5777
|
+
artifacts.length === 0 && !loading ? /* @__PURE__ */ React66.createElement("p", { className: "text-xs text-silver/60 text-center py-8" }, "No artifacts to display") : artifacts.map((artifact) => /* @__PURE__ */ React66.createElement(
|
|
5748
5778
|
ArtifactRenderer,
|
|
5749
5779
|
{
|
|
5750
5780
|
key: artifact.id,
|
|
5751
5781
|
artifact,
|
|
5752
|
-
|
|
5782
|
+
loading,
|
|
5753
5783
|
onExpand: () => setExpandedArtifact(artifact)
|
|
5754
5784
|
}
|
|
5755
5785
|
))
|
|
@@ -6081,9 +6111,6 @@ var ChatInterface = React68.forwardRef(
|
|
|
6081
6111
|
}
|
|
6082
6112
|
return -1;
|
|
6083
6113
|
}, [effectiveMessages]);
|
|
6084
|
-
const hasPendingArtifact = useMemo3(() => {
|
|
6085
|
-
return artifacts.some((a) => a.isPending);
|
|
6086
|
-
}, [artifacts]);
|
|
6087
6114
|
useEffect13(() => {
|
|
6088
6115
|
if (isPanelControlled) {
|
|
6089
6116
|
return;
|
|
@@ -6247,7 +6274,6 @@ var ChatInterface = React68.forwardRef(
|
|
|
6247
6274
|
artifacts,
|
|
6248
6275
|
isOpen: artifactsPanelOpen,
|
|
6249
6276
|
onClose: toggleArtifactsPanel,
|
|
6250
|
-
isLoading: isStreaming && hasPendingArtifact,
|
|
6251
6277
|
width: artifactsWidth,
|
|
6252
6278
|
widthPercent: artifactsWidthPercent,
|
|
6253
6279
|
onResizeStart: startResizingArtifacts,
|