@lukeashford/aurelius 4.4.0 → 4.6.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.mjs CHANGED
@@ -3949,9 +3949,26 @@ var Message = React55.forwardRef(
3949
3949
  hideActions,
3950
3950
  attachments,
3951
3951
  onAttachmentOpen,
3952
+ onJumpHere,
3953
+ isActive,
3952
3954
  ...rest
3953
3955
  }, ref) => {
3954
3956
  const isUser = variant === "user";
3957
+ const isJumpInteractive = !!onJumpHere && !isActive && !isStreaming;
3958
+ const handleBubbleClick = useCallback12((e) => {
3959
+ if (!isJumpInteractive) {
3960
+ return;
3961
+ }
3962
+ const target = e.target;
3963
+ if (target.closest("a, button")) {
3964
+ return;
3965
+ }
3966
+ const selection = typeof window !== "undefined" ? window.getSelection() : null;
3967
+ if (selection && !selection.isCollapsed) {
3968
+ return;
3969
+ }
3970
+ onJumpHere();
3971
+ }, [isJumpInteractive, onJumpHere]);
3955
3972
  const { copied, copy } = useCopyToClipboard();
3956
3973
  const [isEditing, setIsEditing] = useState12(false);
3957
3974
  const [editValue, setEditValue] = useState12(typeof content === "string" ? content : "");
@@ -4058,8 +4075,12 @@ var Message = React55.forwardRef(
4058
4075
  {
4059
4076
  className: cx(
4060
4077
  "px-3 py-2 w-fit max-w-11/12",
4061
- VARIANT_STYLES3[variant]
4062
- )
4078
+ VARIANT_STYLES3[variant],
4079
+ isJumpInteractive && "cursor-pointer hover:brightness-110 transition-all duration-150"
4080
+ ),
4081
+ onClick: isJumpInteractive ? handleBubbleClick : void 0,
4082
+ role: isJumpInteractive ? "button" : void 0,
4083
+ "aria-label": isJumpInteractive ? "Jump to this message" : void 0
4063
4084
  },
4064
4085
  typeof content === "string" ? /* @__PURE__ */ React55.createElement(
4065
4086
  MarkdownContent,
@@ -6804,7 +6825,7 @@ var ChatInterface = React76.forwardRef(
6804
6825
  onMessageSubmit,
6805
6826
  onEditMessage,
6806
6827
  onRetryMessage,
6807
- onJumpToCheckpoint,
6828
+ onJumpHere,
6808
6829
  onJumpToLatest,
6809
6830
  onStop,
6810
6831
  onSelectConversation,
@@ -6980,16 +7001,16 @@ var ChatInterface = React76.forwardRef(
6980
7001
  },
6981
7002
  [tree, onTreeChange]
6982
7003
  );
6983
- const handleJumpToCheckpoint = useCallback22((checkpointId) => {
7004
+ const handleJumpHere = useCallback22((nodeId) => {
6984
7005
  if (!tree) return;
6985
- if (onJumpToCheckpoint) {
6986
- onJumpToCheckpoint(checkpointId);
7006
+ if (onJumpHere) {
7007
+ onJumpHere(nodeId);
6987
7008
  return;
6988
7009
  }
6989
7010
  if (onTreeChange) {
6990
- onTreeChange(setActiveLeaf(tree, checkpointId));
7011
+ onTreeChange(setActiveLeaf(tree, nodeId));
6991
7012
  }
6992
- }, [tree, onTreeChange, onJumpToCheckpoint]);
7013
+ }, [tree, onTreeChange, onJumpHere]);
6993
7014
  const handleJumpToLatest = useCallback22(() => {
6994
7015
  if (!tree) return;
6995
7016
  if (onJumpToLatest) {
@@ -7017,7 +7038,7 @@ var ChatInterface = React76.forwardRef(
7017
7038
  isActive: node.id === activeCheckpointId && !opts.muted,
7018
7039
  muted: opts.muted,
7019
7040
  branchInfo,
7020
- onJumpHere: () => handleJumpToCheckpoint(node.id)
7041
+ onJumpHere: () => handleJumpHere(node.id)
7021
7042
  };
7022
7043
  }
7023
7044
  const actions = enableMessageActions ? {
@@ -7025,6 +7046,7 @@ var ChatInterface = React76.forwardRef(
7025
7046
  onEdit: node.role === "user" && onEditMessage ? (newContent) => onEditMessage(node.id, newContent) : void 0,
7026
7047
  onRetry: node.role === "assistant" && onRetryMessage ? () => onRetryMessage(node.id) : void 0
7027
7048
  } : void 0;
7049
+ const isActiveLeaf = tree?.activeLeafId === node.id;
7028
7050
  return {
7029
7051
  kind: "message",
7030
7052
  id: node.id,
@@ -7041,7 +7063,9 @@ var ChatInterface = React76.forwardRef(
7041
7063
  artifactId: a.artifactId,
7042
7064
  status: a.status ?? "analyzed"
7043
7065
  })) : void 0,
7044
- onAttachmentOpen: handleAttachmentOpen
7066
+ onAttachmentOpen: handleAttachmentOpen,
7067
+ isActive: isActiveLeaf,
7068
+ onJumpHere: () => handleJumpHere(node.id)
7045
7069
  };
7046
7070
  },
7047
7071
  [
@@ -7051,7 +7075,7 @@ var ChatInterface = React76.forwardRef(
7051
7075
  onEditMessage,
7052
7076
  onRetryMessage,
7053
7077
  handleBranchSwitch,
7054
- handleJumpToCheckpoint,
7078
+ handleJumpHere,
7055
7079
  handleAttachmentOpen
7056
7080
  ]
7057
7081
  );
@@ -7540,6 +7564,155 @@ var NODE_TYPES = {
7540
7564
  VARIANT_SET: "VARIANT_SET"
7541
7565
  };
7542
7566
 
7567
+ // src/components/deliverable/DeliverableRenderer.tsx
7568
+ import React88, { useState as useState25 } from "react";
7569
+
7570
+ // src/components/deliverable/CoverSection.tsx
7571
+ import React82 from "react";
7572
+ function CoverSection({ data, clientName }) {
7573
+ return /* @__PURE__ */ React82.createElement("section", { className: "deliverable-cover deliverable-page" }, /* @__PURE__ */ React82.createElement("div", { className: "deliverable-cover-inner" }, data.eyebrow && /* @__PURE__ */ React82.createElement("p", { className: "deliverable-cover-eyebrow" }, data.eyebrow), /* @__PURE__ */ React82.createElement("h1", { className: "deliverable-cover-title" }, data.title), data.subtitle && /* @__PURE__ */ React82.createElement("p", { className: "deliverable-cover-subtitle" }, data.subtitle), clientName && /* @__PURE__ */ React82.createElement("p", { className: "deliverable-cover-client" }, "Prepared for", " ", /* @__PURE__ */ React82.createElement("span", { className: "deliverable-cover-client-name" }, clientName))));
7574
+ }
7575
+
7576
+ // src/components/deliverable/ArtifactImageGridSection.tsx
7577
+ import React83 from "react";
7578
+ var COLUMN_CLASSES = {
7579
+ 1: "deliverable-image-grid-cols-1",
7580
+ 2: "deliverable-image-grid-cols-2",
7581
+ 3: "deliverable-image-grid-cols-3"
7582
+ };
7583
+ function ArtifactImageGridSection({ data }) {
7584
+ const columns = clampColumns(data.columns);
7585
+ return /* @__PURE__ */ React83.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ React83.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ React83.createElement("div", { className: cx("deliverable-image-grid", COLUMN_CLASSES[columns]) }, data.items.map((item, idx) => /* @__PURE__ */ React83.createElement("figure", { key: idx, className: "deliverable-image-item" }, item.artifact.url ? /* @__PURE__ */ React83.createElement(
7586
+ "img",
7587
+ {
7588
+ src: item.artifact.url,
7589
+ alt: item.artifact.title ?? "",
7590
+ className: "deliverable-image-img"
7591
+ }
7592
+ ) : /* @__PURE__ */ React83.createElement("div", { className: "deliverable-image-missing" }, "Missing image"), item.caption && /* @__PURE__ */ React83.createElement("figcaption", { className: "deliverable-image-caption" }, item.caption)))));
7593
+ }
7594
+ function clampColumns(n) {
7595
+ if (n <= 1) return 1;
7596
+ if (n === 2) return 2;
7597
+ return 3;
7598
+ }
7599
+
7600
+ // src/components/deliverable/ArtifactSpotlightSection.tsx
7601
+ import React84 from "react";
7602
+ function ArtifactSpotlightSection({ data }) {
7603
+ return /* @__PURE__ */ React84.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ React84.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ React84.createElement("div", { className: "deliverable-spotlight-media" }, data.artifact.url ? /* @__PURE__ */ React84.createElement(
7604
+ "img",
7605
+ {
7606
+ src: data.artifact.url,
7607
+ alt: data.artifact.title ?? "",
7608
+ className: "deliverable-spotlight-img"
7609
+ }
7610
+ ) : /* @__PURE__ */ React84.createElement("div", { className: "deliverable-spotlight-missing" }, "Missing image")), data.body && /* @__PURE__ */ React84.createElement(
7611
+ MarkdownContent,
7612
+ {
7613
+ content: data.body,
7614
+ className: "deliverable-spotlight-body"
7615
+ }
7616
+ ));
7617
+ }
7618
+
7619
+ // src/components/deliverable/TextBlockSection.tsx
7620
+ import React85 from "react";
7621
+ function TextBlockSection({ data }) {
7622
+ return /* @__PURE__ */ React85.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ React85.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ React85.createElement(
7623
+ MarkdownContent,
7624
+ {
7625
+ content: data.body,
7626
+ className: "deliverable-text-block"
7627
+ }
7628
+ ));
7629
+ }
7630
+
7631
+ // src/components/deliverable/ColorPaletteSection.tsx
7632
+ import React86 from "react";
7633
+ function ColorPaletteSection({ data }) {
7634
+ return /* @__PURE__ */ React86.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ React86.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ React86.createElement("div", { className: "deliverable-palette" }, data.swatches.map((swatch, idx) => /* @__PURE__ */ React86.createElement("div", { key: idx, className: "deliverable-palette-item" }, /* @__PURE__ */ React86.createElement(
7635
+ "div",
7636
+ {
7637
+ className: "deliverable-palette-chip",
7638
+ style: { backgroundColor: swatch.color },
7639
+ "aria-label": swatch.label
7640
+ }
7641
+ ), /* @__PURE__ */ React86.createElement("p", { className: "deliverable-palette-label" }, swatch.label), /* @__PURE__ */ React86.createElement("p", { className: "deliverable-palette-hex" }, swatch.color.toUpperCase())))));
7642
+ }
7643
+
7644
+ // src/components/deliverable/QuoteBlockSection.tsx
7645
+ import React87 from "react";
7646
+ function QuoteBlockSection({ data }) {
7647
+ return /* @__PURE__ */ React87.createElement("section", { className: "deliverable-page deliverable-quote" }, /* @__PURE__ */ React87.createElement("blockquote", { className: "deliverable-quote-body" }, /* @__PURE__ */ React87.createElement("p", { className: "deliverable-quote-text" }, "\u201C", data.quote, "\u201D"), data.attribution && /* @__PURE__ */ React87.createElement("footer", { className: "deliverable-quote-attribution" }, "\u2014 ", data.attribution)));
7648
+ }
7649
+
7650
+ // src/components/deliverable/DeliverableRenderer.tsx
7651
+ function DeliverableRenderer({
7652
+ deliverable,
7653
+ onDownloadPdf,
7654
+ hideActions = false,
7655
+ className
7656
+ }) {
7657
+ const [isDownloading, setIsDownloading] = useState25(false);
7658
+ const accent = deliverable.accentColor?.trim();
7659
+ const style = accent ? { "--deliverable-accent": accent } : void 0;
7660
+ const handleDownload = async () => {
7661
+ if (!onDownloadPdf || isDownloading) return;
7662
+ setIsDownloading(true);
7663
+ try {
7664
+ await onDownloadPdf();
7665
+ } finally {
7666
+ setIsDownloading(false);
7667
+ }
7668
+ };
7669
+ return /* @__PURE__ */ React88.createElement(
7670
+ "div",
7671
+ {
7672
+ className: cx("deliverable", className),
7673
+ style
7674
+ },
7675
+ deliverable.sections.map((section, idx) => renderSection(section, idx, deliverable)),
7676
+ !hideActions && onDownloadPdf && /* @__PURE__ */ React88.createElement("div", { className: "deliverable-actions" }, /* @__PURE__ */ React88.createElement(
7677
+ Button,
7678
+ {
7679
+ variant: "important",
7680
+ size: "md",
7681
+ onClick: handleDownload,
7682
+ loading: isDownloading,
7683
+ className: "deliverable-action-button"
7684
+ },
7685
+ "Download PDF"
7686
+ ))
7687
+ );
7688
+ }
7689
+ function renderSection(section, idx, doc) {
7690
+ const key = `${section.type}-${idx}`;
7691
+ switch (section.type) {
7692
+ case "COVER":
7693
+ return /* @__PURE__ */ React88.createElement(
7694
+ CoverSection,
7695
+ {
7696
+ key,
7697
+ data: section,
7698
+ clientName: doc.clientName
7699
+ }
7700
+ );
7701
+ case "ARTIFACT_IMAGE_GRID":
7702
+ return /* @__PURE__ */ React88.createElement(ArtifactImageGridSection, { key, data: section });
7703
+ case "ARTIFACT_SPOTLIGHT":
7704
+ return /* @__PURE__ */ React88.createElement(ArtifactSpotlightSection, { key, data: section });
7705
+ case "TEXT_BLOCK":
7706
+ return /* @__PURE__ */ React88.createElement(TextBlockSection, { key, data: section });
7707
+ case "COLOR_PALETTE":
7708
+ return /* @__PURE__ */ React88.createElement(ColorPaletteSection, { key, data: section });
7709
+ case "QUOTE_BLOCK":
7710
+ return /* @__PURE__ */ React88.createElement(QuoteBlockSection, { key, data: section });
7711
+ default:
7712
+ return null;
7713
+ }
7714
+ }
7715
+
7543
7716
  // src/index.ts
7544
7717
  var version = "2.0.0";
7545
7718
  export {
@@ -7552,6 +7725,8 @@ export {
7552
7725
  AlertDialog,
7553
7726
  ArtifactCard,
7554
7727
  ArtifactGroup,
7728
+ ArtifactImageGridSection,
7729
+ ArtifactSpotlightSection,
7555
7730
  ArtifactVariantStack,
7556
7731
  ArtifactsPanel,
7557
7732
  ArtifactsPanelToggle,
@@ -7577,10 +7752,13 @@ export {
7577
7752
  ChevronRightIcon,
7578
7753
  CloseIcon,
7579
7754
  Col,
7755
+ ColorPaletteSection,
7580
7756
  ColorSwatch,
7581
7757
  ConfirmDialog,
7582
7758
  Container,
7759
+ CoverSection,
7583
7760
  CrossSquareIcon,
7761
+ DeliverableRenderer,
7584
7762
  Divider,
7585
7763
  Drawer,
7586
7764
  EmptySquareIcon,
@@ -7628,6 +7806,7 @@ export {
7628
7806
  Popover,
7629
7807
  Progress,
7630
7808
  PromptDialog,
7809
+ QuoteBlockSection,
7631
7810
  Radio,
7632
7811
  Row,
7633
7812
  SCRIPT_ELEMENT_TYPES,
@@ -7655,6 +7834,7 @@ export {
7655
7834
  TableHeader,
7656
7835
  TableRow,
7657
7836
  Tabs,
7837
+ TextBlockSection,
7658
7838
  TextCard,
7659
7839
  Textarea,
7660
7840
  ThinkingIndicator,