@lukeashford/aurelius 2.18.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 CHANGED
@@ -18,12 +18,22 @@ interface InputProps extends React$1.InputHTMLAttributes<HTMLInputElement> {
18
18
  declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
19
19
 
20
20
  type CardVariant = 'default' | 'elevated' | 'outlined' | 'ghost' | 'featured';
21
+ type CardSlotLoading = {
22
+ header?: {
23
+ title?: boolean;
24
+ subtitle?: boolean;
25
+ action?: boolean;
26
+ };
27
+ media?: boolean;
28
+ body?: boolean;
29
+ footer?: boolean;
30
+ };
21
31
  interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
22
32
  variant?: CardVariant;
23
33
  interactive?: boolean;
24
34
  selected?: boolean;
25
35
  noPadding?: boolean;
26
- isLoading?: boolean;
36
+ loading?: CardSlotLoading;
27
37
  }
28
38
  interface CardHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'title'> {
29
39
  title?: React$1.ReactNode;
@@ -989,6 +999,7 @@ interface ScriptCardProps extends Omit<CardProps, 'title'> {
989
999
  * Maximum height before scrolling (default: 16rem / 256px)
990
1000
  */
991
1001
  maxHeight?: string;
1002
+ loading?: CardSlotLoading;
992
1003
  }
993
1004
  /**
994
1005
  * ScriptCard displays a formatted movie/video script.
@@ -1079,7 +1090,7 @@ interface ArtifactCardProps extends React$1.HTMLAttributes<HTMLDivElement> {
1079
1090
  /**
1080
1091
  * Whether the artifact is still loading
1081
1092
  */
1082
- isLoading?: boolean;
1093
+ loading?: CardSlotLoading;
1083
1094
  }
1084
1095
  /**
1085
1096
  * A dispatcher component that renders the appropriate specialist card
@@ -1496,7 +1507,7 @@ interface ArtifactsPanelProps extends React$1.HTMLAttributes<HTMLDivElement> {
1496
1507
  /**
1497
1508
  * Whether artifacts are still loading (show skeletons)
1498
1509
  */
1499
- isLoading?: boolean;
1510
+ loading?: CardSlotLoading;
1500
1511
  /**
1501
1512
  * Current width of the panel as CSS value (e.g., "50vw", "400px").
1502
1513
  */
@@ -1643,6 +1654,7 @@ interface ImageCardProps extends Omit<CardProps, 'title'> {
1643
1654
  overlay?: React$1.ReactNode;
1644
1655
  mediaClassName?: string;
1645
1656
  contentClassName?: string;
1657
+ loading?: CardSlotLoading;
1646
1658
  }
1647
1659
  declare const ImageCard: React$1.ForwardRefExoticComponent<ImageCardProps & React$1.RefAttributes<HTMLDivElement>>;
1648
1660
 
@@ -1662,6 +1674,7 @@ interface VideoCardProps extends Omit<CardProps, 'title'> {
1662
1674
  mediaClassName?: string;
1663
1675
  contentClassName?: string;
1664
1676
  playerProps?: any;
1677
+ loading?: CardSlotLoading;
1665
1678
  }
1666
1679
  declare const VideoCard: React$1.ForwardRefExoticComponent<VideoCardProps & React$1.RefAttributes<HTMLDivElement>>;
1667
1680
 
@@ -1678,6 +1691,7 @@ interface AudioCardProps extends Omit<CardProps, 'title'> {
1678
1691
  contentClassName?: string;
1679
1692
  playerProps?: any;
1680
1693
  height?: string | number;
1694
+ loading?: CardSlotLoading;
1681
1695
  }
1682
1696
  declare const AudioCard: React$1.ForwardRefExoticComponent<AudioCardProps & React$1.RefAttributes<HTMLDivElement>>;
1683
1697
 
@@ -1706,6 +1720,7 @@ interface PdfCardProps extends Omit<CardProps, 'title'> {
1706
1720
  * Optional class name for the content container
1707
1721
  */
1708
1722
  contentClassName?: string;
1723
+ loading?: CardSlotLoading;
1709
1724
  }
1710
1725
  /**
1711
1726
  * A card for displaying PDF documents with an embedded viewer.
@@ -1739,6 +1754,7 @@ interface TextCardProps extends Omit<CardProps, 'title'> {
1739
1754
  * Optional class name for the content container
1740
1755
  */
1741
1756
  contentClassName?: string;
1757
+ loading?: CardSlotLoading;
1742
1758
  }
1743
1759
  /**
1744
1760
  * A card for displaying text content, supporting Markdown and HTML formatting.
package/dist/index.d.ts CHANGED
@@ -18,12 +18,22 @@ interface InputProps extends React$1.InputHTMLAttributes<HTMLInputElement> {
18
18
  declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
19
19
 
20
20
  type CardVariant = 'default' | 'elevated' | 'outlined' | 'ghost' | 'featured';
21
+ type CardSlotLoading = {
22
+ header?: {
23
+ title?: boolean;
24
+ subtitle?: boolean;
25
+ action?: boolean;
26
+ };
27
+ media?: boolean;
28
+ body?: boolean;
29
+ footer?: boolean;
30
+ };
21
31
  interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
22
32
  variant?: CardVariant;
23
33
  interactive?: boolean;
24
34
  selected?: boolean;
25
35
  noPadding?: boolean;
26
- isLoading?: boolean;
36
+ loading?: CardSlotLoading;
27
37
  }
28
38
  interface CardHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'title'> {
29
39
  title?: React$1.ReactNode;
@@ -989,6 +999,7 @@ interface ScriptCardProps extends Omit<CardProps, 'title'> {
989
999
  * Maximum height before scrolling (default: 16rem / 256px)
990
1000
  */
991
1001
  maxHeight?: string;
1002
+ loading?: CardSlotLoading;
992
1003
  }
993
1004
  /**
994
1005
  * ScriptCard displays a formatted movie/video script.
@@ -1079,7 +1090,7 @@ interface ArtifactCardProps extends React$1.HTMLAttributes<HTMLDivElement> {
1079
1090
  /**
1080
1091
  * Whether the artifact is still loading
1081
1092
  */
1082
- isLoading?: boolean;
1093
+ loading?: CardSlotLoading;
1083
1094
  }
1084
1095
  /**
1085
1096
  * A dispatcher component that renders the appropriate specialist card
@@ -1496,7 +1507,7 @@ interface ArtifactsPanelProps extends React$1.HTMLAttributes<HTMLDivElement> {
1496
1507
  /**
1497
1508
  * Whether artifacts are still loading (show skeletons)
1498
1509
  */
1499
- isLoading?: boolean;
1510
+ loading?: CardSlotLoading;
1500
1511
  /**
1501
1512
  * Current width of the panel as CSS value (e.g., "50vw", "400px").
1502
1513
  */
@@ -1643,6 +1654,7 @@ interface ImageCardProps extends Omit<CardProps, 'title'> {
1643
1654
  overlay?: React$1.ReactNode;
1644
1655
  mediaClassName?: string;
1645
1656
  contentClassName?: string;
1657
+ loading?: CardSlotLoading;
1646
1658
  }
1647
1659
  declare const ImageCard: React$1.ForwardRefExoticComponent<ImageCardProps & React$1.RefAttributes<HTMLDivElement>>;
1648
1660
 
@@ -1662,6 +1674,7 @@ interface VideoCardProps extends Omit<CardProps, 'title'> {
1662
1674
  mediaClassName?: string;
1663
1675
  contentClassName?: string;
1664
1676
  playerProps?: any;
1677
+ loading?: CardSlotLoading;
1665
1678
  }
1666
1679
  declare const VideoCard: React$1.ForwardRefExoticComponent<VideoCardProps & React$1.RefAttributes<HTMLDivElement>>;
1667
1680
 
@@ -1678,6 +1691,7 @@ interface AudioCardProps extends Omit<CardProps, 'title'> {
1678
1691
  contentClassName?: string;
1679
1692
  playerProps?: any;
1680
1693
  height?: string | number;
1694
+ loading?: CardSlotLoading;
1681
1695
  }
1682
1696
  declare const AudioCard: React$1.ForwardRefExoticComponent<AudioCardProps & React$1.RefAttributes<HTMLDivElement>>;
1683
1697
 
@@ -1706,6 +1720,7 @@ interface PdfCardProps extends Omit<CardProps, 'title'> {
1706
1720
  * Optional class name for the content container
1707
1721
  */
1708
1722
  contentClassName?: string;
1723
+ loading?: CardSlotLoading;
1709
1724
  }
1710
1725
  /**
1711
1726
  * A card for displaying PDF documents with an embedded viewer.
@@ -1739,6 +1754,7 @@ interface TextCardProps extends Omit<CardProps, 'title'> {
1739
1754
  * Optional class name for the content container
1740
1755
  */
1741
1756
  contentClassName?: string;
1757
+ loading?: CardSlotLoading;
1742
1758
  }
1743
1759
  /**
1744
1760
  * A card for displaying text content, supporting Markdown and HTML formatting.
package/dist/index.js CHANGED
@@ -274,8 +274,18 @@ var Skeleton = import_react3.default.forwardRef(
274
274
  Skeleton.displayName = "Skeleton";
275
275
 
276
276
  // src/components/Card.tsx
277
- var CardContext = (0, import_react4.createContext)({ isLoading: false });
277
+ var CardContext = (0, import_react4.createContext)({ loading: void 0 });
278
278
  var useCardContext = () => (0, import_react4.useContext)(CardContext);
279
+ function slotLoading(loading, path) {
280
+ if (!loading) {
281
+ return false;
282
+ }
283
+ if (Array.isArray(path)) {
284
+ const [section, field] = path;
285
+ return !!loading[section]?.[field];
286
+ }
287
+ return !!loading[path];
288
+ }
279
289
  var VARIANT_STYLES = {
280
290
  default: "bg-charcoal shadow-sm border border-gold/30",
281
291
  elevated: "bg-charcoal shadow-lg border-0",
@@ -289,12 +299,12 @@ var CardBase = import_react4.default.forwardRef(
289
299
  interactive = false,
290
300
  selected = false,
291
301
  noPadding = false,
292
- isLoading = false,
302
+ loading,
293
303
  className,
294
304
  children,
295
305
  ...props
296
306
  }, ref) => {
297
- return /* @__PURE__ */ import_react4.default.createElement(CardContext.Provider, { value: { isLoading } }, /* @__PURE__ */ import_react4.default.createElement(
307
+ return /* @__PURE__ */ import_react4.default.createElement(CardContext.Provider, { value: { loading } }, /* @__PURE__ */ import_react4.default.createElement(
298
308
  "div",
299
309
  {
300
310
  ref,
@@ -322,9 +332,12 @@ var CardBase = import_react4.default.forwardRef(
322
332
  CardBase.displayName = "Card";
323
333
  var CardHeader = import_react4.default.forwardRef(
324
334
  ({ title, subtitle, action, className, children, ...props }, ref) => {
325
- const { isLoading } = useCardContext();
335
+ const { loading } = useCardContext();
336
+ const titleIsLoading = slotLoading(loading, ["header", "title"]);
337
+ const subtitleIsLoading = slotLoading(loading, ["header", "subtitle"]);
338
+ const actionIsLoading = slotLoading(loading, ["header", "action"]);
326
339
  const hasContent = title || subtitle || action || children;
327
- if (!hasContent && !isLoading) {
340
+ if (!hasContent && !titleIsLoading && !subtitleIsLoading && !actionIsLoading) {
328
341
  return null;
329
342
  }
330
343
  return /* @__PURE__ */ import_react4.default.createElement(
@@ -334,18 +347,19 @@ var CardHeader = import_react4.default.forwardRef(
334
347
  className: cx("px-6 py-4 border-b border-ash", className),
335
348
  ...props
336
349
  },
337
- isLoading && !title && !subtitle ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "flex flex-col gap-2" }, /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-5 w-3/4" }), /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-1/2" })) : title || subtitle || action ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "flex-1 min-w-0" }, title ? /* @__PURE__ */ import_react4.default.createElement("h3", { className: "text-lg font-semibold text-white m-0" }, title) : isLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-5 w-3/4 mb-1" }) : null, subtitle ? /* @__PURE__ */ import_react4.default.createElement("p", { className: "text-sm text-silver mt-1 m-0" }, subtitle) : isLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-1/2 mt-1" }) : null), action && /* @__PURE__ */ import_react4.default.createElement("div", { className: "shrink-0" }, action)) : children
350
+ title || subtitle || action || titleIsLoading || subtitleIsLoading || actionIsLoading ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "flex-1 min-w-0" }, title ? /* @__PURE__ */ import_react4.default.createElement("h3", { className: "text-lg font-semibold text-white m-0" }, title) : titleIsLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-5 w-3/4 mb-1" }) : null, subtitle ? /* @__PURE__ */ import_react4.default.createElement("p", { className: "text-sm text-silver mt-1 m-0" }, subtitle) : subtitleIsLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-1/2 mt-1" }) : null), action ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "shrink-0" }, action) : actionIsLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-8 w-8 shrink-0" }) : null) : children
338
351
  );
339
352
  }
340
353
  );
341
354
  CardHeader.displayName = "CardHeader";
342
355
  var CardBody = import_react4.default.forwardRef(
343
356
  ({ className, children, ...props }, ref) => {
344
- const { isLoading } = useCardContext();
345
- if (!children && !isLoading) {
357
+ const { loading } = useCardContext();
358
+ const isBodyLoading = slotLoading(loading, "body");
359
+ if (!children && !isBodyLoading) {
346
360
  return null;
347
361
  }
348
- return /* @__PURE__ */ import_react4.default.createElement("div", { ref, className: cx("px-6 py-4", className), ...props }, isLoading && !children ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-3/4" })) : children);
362
+ return /* @__PURE__ */ import_react4.default.createElement("div", { ref, className: cx("px-6 py-4", className), ...props }, isBodyLoading ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "h-4 w-3/4" })) : children);
349
363
  }
350
364
  );
351
365
  CardBody.displayName = "CardBody";
@@ -381,13 +395,14 @@ var CardMedia = import_react4.default.forwardRef(
381
395
  children,
382
396
  ...props
383
397
  }, ref) => {
384
- const { isLoading } = useCardContext();
398
+ const { loading } = useCardContext();
399
+ const isMediaLoading = slotLoading(loading, "media");
385
400
  const aspectClass = aspect && aspect !== "none" ? {
386
401
  video: "aspect-video",
387
402
  square: "aspect-square",
388
403
  wide: "aspect-wide"
389
404
  }[aspect] : "";
390
- if (!children && !isLoading) {
405
+ if (!children && !isMediaLoading) {
391
406
  return null;
392
407
  }
393
408
  return /* @__PURE__ */ import_react4.default.createElement(
@@ -403,7 +418,7 @@ var CardMedia = import_react4.default.forwardRef(
403
418
  ),
404
419
  ...props
405
420
  },
406
- isLoading && !children ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "w-full h-full" }) : children
421
+ isMediaLoading ? /* @__PURE__ */ import_react4.default.createElement(Skeleton, { className: "w-full h-full" }) : children
407
422
  );
408
423
  }
409
424
  );
@@ -5188,7 +5203,7 @@ var ImageCard = import_react61.default.forwardRef(
5188
5203
  contentClassName,
5189
5204
  className,
5190
5205
  children,
5191
- isLoading,
5206
+ loading,
5192
5207
  ...props
5193
5208
  }, ref) => {
5194
5209
  return /* @__PURE__ */ import_react61.default.createElement(
@@ -5196,7 +5211,7 @@ var ImageCard = import_react61.default.forwardRef(
5196
5211
  {
5197
5212
  ref,
5198
5213
  className: cx("p-0 overflow-hidden w-full", className),
5199
- isLoading,
5214
+ loading,
5200
5215
  ...props
5201
5216
  },
5202
5217
  /* @__PURE__ */ import_react61.default.createElement(
@@ -5205,7 +5220,7 @@ var ImageCard = import_react61.default.forwardRef(
5205
5220
  className: mediaClassName,
5206
5221
  style: { aspectRatio: resolveAspectRatio(aspectRatio) }
5207
5222
  },
5208
- src && /* @__PURE__ */ import_react61.default.createElement(
5223
+ /* @__PURE__ */ import_react61.default.createElement(import_react61.default.Fragment, null, src && /* @__PURE__ */ import_react61.default.createElement(
5209
5224
  "img",
5210
5225
  {
5211
5226
  src,
@@ -5215,14 +5230,13 @@ var ImageCard = import_react61.default.forwardRef(
5215
5230
  objectFit === "cover" ? "object-cover" : "object-contain"
5216
5231
  )
5217
5232
  }
5218
- ),
5219
- overlay && /* @__PURE__ */ import_react61.default.createElement(
5233
+ ), overlay && /* @__PURE__ */ import_react61.default.createElement(
5220
5234
  "div",
5221
5235
  {
5222
5236
  className: "absolute inset-0 bg-obsidian/80 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center"
5223
5237
  },
5224
5238
  overlay
5225
- )
5239
+ ))
5226
5240
  ),
5227
5241
  /* @__PURE__ */ import_react61.default.createElement(
5228
5242
  Card.Header,
@@ -5269,7 +5283,7 @@ var VideoCard = import_react62.default.forwardRef(
5269
5283
  className,
5270
5284
  children,
5271
5285
  playerProps,
5272
- isLoading,
5286
+ loading,
5273
5287
  ...props
5274
5288
  }, ref) => {
5275
5289
  return /* @__PURE__ */ import_react62.default.createElement(
@@ -5277,7 +5291,7 @@ var VideoCard = import_react62.default.forwardRef(
5277
5291
  {
5278
5292
  ref,
5279
5293
  className: cx("p-0 overflow-hidden w-full", className),
5280
- isLoading,
5294
+ loading,
5281
5295
  ...props
5282
5296
  },
5283
5297
  /* @__PURE__ */ import_react62.default.createElement(
@@ -5337,7 +5351,7 @@ var AudioCard = import_react63.default.forwardRef(
5337
5351
  children,
5338
5352
  playerProps,
5339
5353
  height = "40px",
5340
- isLoading,
5354
+ loading,
5341
5355
  ...props
5342
5356
  }, ref) => {
5343
5357
  return /* @__PURE__ */ import_react63.default.createElement(
@@ -5345,7 +5359,7 @@ var AudioCard = import_react63.default.forwardRef(
5345
5359
  {
5346
5360
  ref,
5347
5361
  className: cx("p-0 overflow-hidden w-full", className),
5348
- isLoading,
5362
+ loading,
5349
5363
  ...props
5350
5364
  },
5351
5365
  /* @__PURE__ */ import_react63.default.createElement(Card.Media, { className: cx(
@@ -5401,7 +5415,7 @@ var PdfCard = import_react64.default.forwardRef(
5401
5415
  contentClassName,
5402
5416
  className,
5403
5417
  children,
5404
- isLoading,
5418
+ loading,
5405
5419
  ...props
5406
5420
  }, ref) => {
5407
5421
  return /* @__PURE__ */ import_react64.default.createElement(
@@ -5409,7 +5423,7 @@ var PdfCard = import_react64.default.forwardRef(
5409
5423
  {
5410
5424
  ref,
5411
5425
  className: cx("p-0 overflow-hidden w-full", className),
5412
- isLoading,
5426
+ loading,
5413
5427
  ...props
5414
5428
  },
5415
5429
  /* @__PURE__ */ import_react64.default.createElement(
@@ -5477,13 +5491,13 @@ function ScriptElementRenderer({ element }) {
5477
5491
  }
5478
5492
  }
5479
5493
  var ScriptCard = import_react65.default.forwardRef(
5480
- ({ title, subtitle, elements, maxHeight = "16rem", className, style, isLoading, ...rest }, ref) => {
5494
+ ({ title, subtitle, elements, maxHeight = "16rem", className, style, loading, ...rest }, ref) => {
5481
5495
  return /* @__PURE__ */ import_react65.default.createElement(
5482
5496
  Card,
5483
5497
  {
5484
5498
  ref,
5485
5499
  className: cx("p-0 overflow-hidden w-full", className),
5486
- isLoading,
5500
+ loading,
5487
5501
  ...rest
5488
5502
  },
5489
5503
  /* @__PURE__ */ import_react65.default.createElement(
@@ -5517,7 +5531,7 @@ var TextCard = import_react66.default.forwardRef(
5517
5531
  maxHeight = "16rem",
5518
5532
  contentClassName,
5519
5533
  className,
5520
- isLoading,
5534
+ loading,
5521
5535
  ...props
5522
5536
  }, ref) => {
5523
5537
  return /* @__PURE__ */ import_react66.default.createElement(
@@ -5525,7 +5539,7 @@ var TextCard = import_react66.default.forwardRef(
5525
5539
  {
5526
5540
  ref,
5527
5541
  className: cx("p-0 overflow-hidden w-full", className),
5528
- isLoading,
5542
+ loading,
5529
5543
  ...props
5530
5544
  },
5531
5545
  /* @__PURE__ */ import_react66.default.createElement(
@@ -5555,6 +5569,21 @@ var TextCard = import_react66.default.forwardRef(
5555
5569
  );
5556
5570
  TextCard.displayName = "TextCard";
5557
5571
 
5572
+ // src/utils/artifactLoading.ts
5573
+ function deriveCardSlotLoading(a) {
5574
+ if (!a.isPending) {
5575
+ return void 0;
5576
+ }
5577
+ const header = {
5578
+ title: !a.title,
5579
+ subtitle: !a.subtitle
5580
+ };
5581
+ const mediaNeeded = (type) => ["IMAGE", "VIDEO", "AUDIO", "PDF"].includes(type);
5582
+ const media = mediaNeeded(a.type) && !a.url;
5583
+ const body = a.type === "TEXT" && !(a.inlineContent && a.inlineContent.trim().length) || a.type === "SCRIPT" && !(a.scriptElements && a.scriptElements.length > 0);
5584
+ return { header, media, body };
5585
+ }
5586
+
5558
5587
  // src/components/ArtifactCard.tsx
5559
5588
  var ARTIFACT_TYPES = {
5560
5589
  TEXT: "TEXT",
@@ -5565,11 +5594,12 @@ var ARTIFACT_TYPES = {
5565
5594
  PDF: "PDF"
5566
5595
  };
5567
5596
  var ArtifactCard = import_react67.default.forwardRef(
5568
- ({ artifact, onExpand, isLoading, className, ...props }, ref) => {
5597
+ ({ artifact, onExpand, loading, className, ...props }, ref) => {
5598
+ const derivedLoading = deriveCardSlotLoading(artifact);
5569
5599
  const commonProps = {
5570
5600
  title: artifact.title,
5571
5601
  subtitle: artifact.subtitle,
5572
- isLoading: isLoading || artifact.isPending,
5602
+ loading: loading || derivedLoading,
5573
5603
  className: "w-full"
5574
5604
  };
5575
5605
  const handleExpand = (e) => {
@@ -5753,7 +5783,7 @@ function ArtifactModal({
5753
5783
  MarkdownContent,
5754
5784
  {
5755
5785
  content: artifact.inlineContent || "",
5756
- isMarkdown: artifact.mimeType === "text/markdown",
5786
+ isMarkdown: artifact.mimeType !== "text/plain",
5757
5787
  className: cx(
5758
5788
  "prose prose-invert max-w-none",
5759
5789
  artifact.mimeType === "text/plain" && "whitespace-pre-wrap"
@@ -5772,14 +5802,14 @@ function ArtifactModal({
5772
5802
  }
5773
5803
  function ArtifactRenderer({
5774
5804
  artifact,
5775
- isLoading,
5805
+ loading,
5776
5806
  onExpand
5777
5807
  }) {
5778
5808
  return /* @__PURE__ */ import_react68.default.createElement(
5779
5809
  ArtifactCard,
5780
5810
  {
5781
5811
  artifact,
5782
- isLoading,
5812
+ loading,
5783
5813
  onExpand
5784
5814
  }
5785
5815
  );
@@ -5789,7 +5819,7 @@ var ArtifactsPanel = import_react68.default.forwardRef(
5789
5819
  artifacts,
5790
5820
  isOpen = false,
5791
5821
  onClose,
5792
- isLoading = false,
5822
+ loading,
5793
5823
  width,
5794
5824
  widthPercent,
5795
5825
  onResizeStart,
@@ -5891,12 +5921,12 @@ var ArtifactsPanel = import_react68.default.forwardRef(
5891
5921
  columns === 3 && "grid-cols-3"
5892
5922
  )
5893
5923
  },
5894
- artifacts.length === 0 && !isLoading ? /* @__PURE__ */ import_react68.default.createElement("p", { className: "text-xs text-silver/60 text-center py-8" }, "No artifacts to display") : artifacts.map((artifact) => /* @__PURE__ */ import_react68.default.createElement(
5924
+ artifacts.length === 0 && !loading ? /* @__PURE__ */ import_react68.default.createElement("p", { className: "text-xs text-silver/60 text-center py-8" }, "No artifacts to display") : artifacts.map((artifact) => /* @__PURE__ */ import_react68.default.createElement(
5895
5925
  ArtifactRenderer,
5896
5926
  {
5897
5927
  key: artifact.id,
5898
5928
  artifact,
5899
- isLoading,
5929
+ loading,
5900
5930
  onExpand: () => setExpandedArtifact(artifact)
5901
5931
  }
5902
5932
  ))
@@ -6184,6 +6214,8 @@ var ChatInterface = import_react72.default.forwardRef(
6184
6214
  }, ref) => {
6185
6215
  const [sidebarCollapsed, setSidebarCollapsed] = (0, import_react72.useState)(initialSidebarCollapsed);
6186
6216
  const [internalPanelOpen, setInternalPanelOpen] = (0, import_react72.useState)(false);
6217
+ const prevArtifactsRef = (0, import_react72.useRef)([]);
6218
+ const prevTasksRef = (0, import_react72.useRef)([]);
6187
6219
  const {
6188
6220
  width: sidebarWidth,
6189
6221
  startResizing: startResizingSidebar
@@ -6226,14 +6258,44 @@ var ChatInterface = import_react72.default.forwardRef(
6226
6258
  }
6227
6259
  return -1;
6228
6260
  }, [effectiveMessages]);
6229
- const hasPendingArtifact = (0, import_react72.useMemo)(() => {
6230
- return artifacts.some((a) => a.isPending);
6231
- }, [artifacts]);
6232
- import_react72.default.useEffect(() => {
6233
- if (!isPanelControlled && artifacts.length > 0) {
6261
+ (0, import_react72.useEffect)(() => {
6262
+ if (isPanelControlled) {
6263
+ return;
6264
+ }
6265
+ const hasNewOrSignificantArtifact = artifacts.some((a) => {
6266
+ const p = prevArtifactsRef.current.find((prev) => prev.id === a.id);
6267
+ if (!p) {
6268
+ return true;
6269
+ }
6270
+ if (p.isPending && !a.isPending) {
6271
+ return true;
6272
+ }
6273
+ if (p.title !== a.title || p.type !== a.type) {
6274
+ return true;
6275
+ }
6276
+ return false;
6277
+ });
6278
+ const hasNewOrUpdatedTask = (curr, prev) => {
6279
+ return curr.some((c) => {
6280
+ const p = prev.find((x) => x.id === c.id);
6281
+ if (!p) {
6282
+ return true;
6283
+ }
6284
+ if (c.status !== p.status || c.label !== p.label) {
6285
+ return true;
6286
+ }
6287
+ if (c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || [])) {
6288
+ return true;
6289
+ }
6290
+ return false;
6291
+ });
6292
+ };
6293
+ if (hasNewOrSignificantArtifact || hasNewOrUpdatedTask(tasks, prevTasksRef.current)) {
6234
6294
  setInternalPanelOpen(true);
6235
6295
  }
6236
- }, [artifacts.length, isPanelControlled]);
6296
+ prevArtifactsRef.current = artifacts;
6297
+ prevTasksRef.current = tasks;
6298
+ }, [artifacts, tasks, isPanelControlled]);
6237
6299
  const handleBranchSwitch = (0, import_react72.useCallback)(
6238
6300
  (nodeId, direction) => {
6239
6301
  if (!isTreeMode || !conversationTree || !onTreeChange) {
@@ -6359,7 +6421,6 @@ var ChatInterface = import_react72.default.forwardRef(
6359
6421
  artifacts,
6360
6422
  isOpen: artifactsPanelOpen,
6361
6423
  onClose: toggleArtifactsPanel,
6362
- isLoading: isStreaming && hasPendingArtifact,
6363
6424
  width: artifactsWidth,
6364
6425
  widthPercent: artifactsWidthPercent,
6365
6426
  onResizeStart: startResizingArtifacts,