@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.js CHANGED
@@ -39,6 +39,8 @@ __export(index_exports, {
39
39
  AlertDialog: () => AlertDialog,
40
40
  ArtifactCard: () => ArtifactCard,
41
41
  ArtifactGroup: () => ArtifactGroup,
42
+ ArtifactImageGridSection: () => ArtifactImageGridSection,
43
+ ArtifactSpotlightSection: () => ArtifactSpotlightSection,
42
44
  ArtifactVariantStack: () => ArtifactVariantStack,
43
45
  ArtifactsPanel: () => ArtifactsPanel,
44
46
  ArtifactsPanelToggle: () => ArtifactsPanelToggle,
@@ -64,10 +66,13 @@ __export(index_exports, {
64
66
  ChevronRightIcon: () => ChevronRightIcon,
65
67
  CloseIcon: () => CloseIcon,
66
68
  Col: () => Col,
69
+ ColorPaletteSection: () => ColorPaletteSection,
67
70
  ColorSwatch: () => ColorSwatch,
68
71
  ConfirmDialog: () => ConfirmDialog,
69
72
  Container: () => Container,
73
+ CoverSection: () => CoverSection,
70
74
  CrossSquareIcon: () => CrossSquareIcon,
75
+ DeliverableRenderer: () => DeliverableRenderer,
71
76
  Divider: () => Divider,
72
77
  Drawer: () => Drawer,
73
78
  EmptySquareIcon: () => EmptySquareIcon,
@@ -115,6 +120,7 @@ __export(index_exports, {
115
120
  Popover: () => Popover,
116
121
  Progress: () => Progress,
117
122
  PromptDialog: () => PromptDialog,
123
+ QuoteBlockSection: () => QuoteBlockSection,
118
124
  Radio: () => Radio,
119
125
  Row: () => Row,
120
126
  SCRIPT_ELEMENT_TYPES: () => SCRIPT_ELEMENT_TYPES,
@@ -142,6 +148,7 @@ __export(index_exports, {
142
148
  TableHeader: () => TableHeader,
143
149
  TableRow: () => TableRow,
144
150
  Tabs: () => Tabs,
151
+ TextBlockSection: () => TextBlockSection,
145
152
  TextCard: () => TextCard,
146
153
  Textarea: () => Textarea,
147
154
  ThinkingIndicator: () => ThinkingIndicator,
@@ -4108,9 +4115,26 @@ var Message = import_react56.default.forwardRef(
4108
4115
  hideActions,
4109
4116
  attachments,
4110
4117
  onAttachmentOpen,
4118
+ onJumpHere,
4119
+ isActive,
4111
4120
  ...rest
4112
4121
  }, ref) => {
4113
4122
  const isUser = variant === "user";
4123
+ const isJumpInteractive = !!onJumpHere && !isActive && !isStreaming;
4124
+ const handleBubbleClick = (0, import_react56.useCallback)((e) => {
4125
+ if (!isJumpInteractive) {
4126
+ return;
4127
+ }
4128
+ const target = e.target;
4129
+ if (target.closest("a, button")) {
4130
+ return;
4131
+ }
4132
+ const selection = typeof window !== "undefined" ? window.getSelection() : null;
4133
+ if (selection && !selection.isCollapsed) {
4134
+ return;
4135
+ }
4136
+ onJumpHere();
4137
+ }, [isJumpInteractive, onJumpHere]);
4114
4138
  const { copied, copy } = useCopyToClipboard();
4115
4139
  const [isEditing, setIsEditing] = (0, import_react56.useState)(false);
4116
4140
  const [editValue, setEditValue] = (0, import_react56.useState)(typeof content === "string" ? content : "");
@@ -4217,8 +4241,12 @@ var Message = import_react56.default.forwardRef(
4217
4241
  {
4218
4242
  className: cx(
4219
4243
  "px-3 py-2 w-fit max-w-11/12",
4220
- VARIANT_STYLES3[variant]
4221
- )
4244
+ VARIANT_STYLES3[variant],
4245
+ isJumpInteractive && "cursor-pointer hover:brightness-110 transition-all duration-150"
4246
+ ),
4247
+ onClick: isJumpInteractive ? handleBubbleClick : void 0,
4248
+ role: isJumpInteractive ? "button" : void 0,
4249
+ "aria-label": isJumpInteractive ? "Jump to this message" : void 0
4222
4250
  },
4223
4251
  typeof content === "string" ? /* @__PURE__ */ import_react56.default.createElement(
4224
4252
  MarkdownContent,
@@ -6954,7 +6982,7 @@ var ChatInterface = import_react81.default.forwardRef(
6954
6982
  onMessageSubmit,
6955
6983
  onEditMessage,
6956
6984
  onRetryMessage,
6957
- onJumpToCheckpoint,
6985
+ onJumpHere,
6958
6986
  onJumpToLatest,
6959
6987
  onStop,
6960
6988
  onSelectConversation,
@@ -7130,16 +7158,16 @@ var ChatInterface = import_react81.default.forwardRef(
7130
7158
  },
7131
7159
  [tree, onTreeChange]
7132
7160
  );
7133
- const handleJumpToCheckpoint = (0, import_react81.useCallback)((checkpointId) => {
7161
+ const handleJumpHere = (0, import_react81.useCallback)((nodeId) => {
7134
7162
  if (!tree) return;
7135
- if (onJumpToCheckpoint) {
7136
- onJumpToCheckpoint(checkpointId);
7163
+ if (onJumpHere) {
7164
+ onJumpHere(nodeId);
7137
7165
  return;
7138
7166
  }
7139
7167
  if (onTreeChange) {
7140
- onTreeChange(setActiveLeaf(tree, checkpointId));
7168
+ onTreeChange(setActiveLeaf(tree, nodeId));
7141
7169
  }
7142
- }, [tree, onTreeChange, onJumpToCheckpoint]);
7170
+ }, [tree, onTreeChange, onJumpHere]);
7143
7171
  const handleJumpToLatest = (0, import_react81.useCallback)(() => {
7144
7172
  if (!tree) return;
7145
7173
  if (onJumpToLatest) {
@@ -7167,7 +7195,7 @@ var ChatInterface = import_react81.default.forwardRef(
7167
7195
  isActive: node.id === activeCheckpointId && !opts.muted,
7168
7196
  muted: opts.muted,
7169
7197
  branchInfo,
7170
- onJumpHere: () => handleJumpToCheckpoint(node.id)
7198
+ onJumpHere: () => handleJumpHere(node.id)
7171
7199
  };
7172
7200
  }
7173
7201
  const actions = enableMessageActions ? {
@@ -7175,6 +7203,7 @@ var ChatInterface = import_react81.default.forwardRef(
7175
7203
  onEdit: node.role === "user" && onEditMessage ? (newContent) => onEditMessage(node.id, newContent) : void 0,
7176
7204
  onRetry: node.role === "assistant" && onRetryMessage ? () => onRetryMessage(node.id) : void 0
7177
7205
  } : void 0;
7206
+ const isActiveLeaf = tree?.activeLeafId === node.id;
7178
7207
  return {
7179
7208
  kind: "message",
7180
7209
  id: node.id,
@@ -7191,7 +7220,9 @@ var ChatInterface = import_react81.default.forwardRef(
7191
7220
  artifactId: a.artifactId,
7192
7221
  status: a.status ?? "analyzed"
7193
7222
  })) : void 0,
7194
- onAttachmentOpen: handleAttachmentOpen
7223
+ onAttachmentOpen: handleAttachmentOpen,
7224
+ isActive: isActiveLeaf,
7225
+ onJumpHere: () => handleJumpHere(node.id)
7195
7226
  };
7196
7227
  },
7197
7228
  [
@@ -7201,7 +7232,7 @@ var ChatInterface = import_react81.default.forwardRef(
7201
7232
  onEditMessage,
7202
7233
  onRetryMessage,
7203
7234
  handleBranchSwitch,
7204
- handleJumpToCheckpoint,
7235
+ handleJumpHere,
7205
7236
  handleAttachmentOpen
7206
7237
  ]
7207
7238
  );
@@ -7690,6 +7721,155 @@ var NODE_TYPES = {
7690
7721
  VARIANT_SET: "VARIANT_SET"
7691
7722
  };
7692
7723
 
7724
+ // src/components/deliverable/DeliverableRenderer.tsx
7725
+ var import_react93 = __toESM(require("react"));
7726
+
7727
+ // src/components/deliverable/CoverSection.tsx
7728
+ var import_react87 = __toESM(require("react"));
7729
+ function CoverSection({ data, clientName }) {
7730
+ return /* @__PURE__ */ import_react87.default.createElement("section", { className: "deliverable-cover deliverable-page" }, /* @__PURE__ */ import_react87.default.createElement("div", { className: "deliverable-cover-inner" }, data.eyebrow && /* @__PURE__ */ import_react87.default.createElement("p", { className: "deliverable-cover-eyebrow" }, data.eyebrow), /* @__PURE__ */ import_react87.default.createElement("h1", { className: "deliverable-cover-title" }, data.title), data.subtitle && /* @__PURE__ */ import_react87.default.createElement("p", { className: "deliverable-cover-subtitle" }, data.subtitle), clientName && /* @__PURE__ */ import_react87.default.createElement("p", { className: "deliverable-cover-client" }, "Prepared for", " ", /* @__PURE__ */ import_react87.default.createElement("span", { className: "deliverable-cover-client-name" }, clientName))));
7731
+ }
7732
+
7733
+ // src/components/deliverable/ArtifactImageGridSection.tsx
7734
+ var import_react88 = __toESM(require("react"));
7735
+ var COLUMN_CLASSES = {
7736
+ 1: "deliverable-image-grid-cols-1",
7737
+ 2: "deliverable-image-grid-cols-2",
7738
+ 3: "deliverable-image-grid-cols-3"
7739
+ };
7740
+ function ArtifactImageGridSection({ data }) {
7741
+ const columns = clampColumns(data.columns);
7742
+ return /* @__PURE__ */ import_react88.default.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ import_react88.default.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ import_react88.default.createElement("div", { className: cx("deliverable-image-grid", COLUMN_CLASSES[columns]) }, data.items.map((item, idx) => /* @__PURE__ */ import_react88.default.createElement("figure", { key: idx, className: "deliverable-image-item" }, item.artifact.url ? /* @__PURE__ */ import_react88.default.createElement(
7743
+ "img",
7744
+ {
7745
+ src: item.artifact.url,
7746
+ alt: item.artifact.title ?? "",
7747
+ className: "deliverable-image-img"
7748
+ }
7749
+ ) : /* @__PURE__ */ import_react88.default.createElement("div", { className: "deliverable-image-missing" }, "Missing image"), item.caption && /* @__PURE__ */ import_react88.default.createElement("figcaption", { className: "deliverable-image-caption" }, item.caption)))));
7750
+ }
7751
+ function clampColumns(n) {
7752
+ if (n <= 1) return 1;
7753
+ if (n === 2) return 2;
7754
+ return 3;
7755
+ }
7756
+
7757
+ // src/components/deliverable/ArtifactSpotlightSection.tsx
7758
+ var import_react89 = __toESM(require("react"));
7759
+ function ArtifactSpotlightSection({ data }) {
7760
+ return /* @__PURE__ */ import_react89.default.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ import_react89.default.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ import_react89.default.createElement("div", { className: "deliverable-spotlight-media" }, data.artifact.url ? /* @__PURE__ */ import_react89.default.createElement(
7761
+ "img",
7762
+ {
7763
+ src: data.artifact.url,
7764
+ alt: data.artifact.title ?? "",
7765
+ className: "deliverable-spotlight-img"
7766
+ }
7767
+ ) : /* @__PURE__ */ import_react89.default.createElement("div", { className: "deliverable-spotlight-missing" }, "Missing image")), data.body && /* @__PURE__ */ import_react89.default.createElement(
7768
+ MarkdownContent,
7769
+ {
7770
+ content: data.body,
7771
+ className: "deliverable-spotlight-body"
7772
+ }
7773
+ ));
7774
+ }
7775
+
7776
+ // src/components/deliverable/TextBlockSection.tsx
7777
+ var import_react90 = __toESM(require("react"));
7778
+ function TextBlockSection({ data }) {
7779
+ return /* @__PURE__ */ import_react90.default.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ import_react90.default.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ import_react90.default.createElement(
7780
+ MarkdownContent,
7781
+ {
7782
+ content: data.body,
7783
+ className: "deliverable-text-block"
7784
+ }
7785
+ ));
7786
+ }
7787
+
7788
+ // src/components/deliverable/ColorPaletteSection.tsx
7789
+ var import_react91 = __toESM(require("react"));
7790
+ function ColorPaletteSection({ data }) {
7791
+ return /* @__PURE__ */ import_react91.default.createElement("section", { className: "deliverable-page" }, data.heading && /* @__PURE__ */ import_react91.default.createElement("h2", { className: "deliverable-heading" }, data.heading), /* @__PURE__ */ import_react91.default.createElement("div", { className: "deliverable-palette" }, data.swatches.map((swatch, idx) => /* @__PURE__ */ import_react91.default.createElement("div", { key: idx, className: "deliverable-palette-item" }, /* @__PURE__ */ import_react91.default.createElement(
7792
+ "div",
7793
+ {
7794
+ className: "deliverable-palette-chip",
7795
+ style: { backgroundColor: swatch.color },
7796
+ "aria-label": swatch.label
7797
+ }
7798
+ ), /* @__PURE__ */ import_react91.default.createElement("p", { className: "deliverable-palette-label" }, swatch.label), /* @__PURE__ */ import_react91.default.createElement("p", { className: "deliverable-palette-hex" }, swatch.color.toUpperCase())))));
7799
+ }
7800
+
7801
+ // src/components/deliverable/QuoteBlockSection.tsx
7802
+ var import_react92 = __toESM(require("react"));
7803
+ function QuoteBlockSection({ data }) {
7804
+ return /* @__PURE__ */ import_react92.default.createElement("section", { className: "deliverable-page deliverable-quote" }, /* @__PURE__ */ import_react92.default.createElement("blockquote", { className: "deliverable-quote-body" }, /* @__PURE__ */ import_react92.default.createElement("p", { className: "deliverable-quote-text" }, "\u201C", data.quote, "\u201D"), data.attribution && /* @__PURE__ */ import_react92.default.createElement("footer", { className: "deliverable-quote-attribution" }, "\u2014 ", data.attribution)));
7805
+ }
7806
+
7807
+ // src/components/deliverable/DeliverableRenderer.tsx
7808
+ function DeliverableRenderer({
7809
+ deliverable,
7810
+ onDownloadPdf,
7811
+ hideActions = false,
7812
+ className
7813
+ }) {
7814
+ const [isDownloading, setIsDownloading] = (0, import_react93.useState)(false);
7815
+ const accent = deliverable.accentColor?.trim();
7816
+ const style = accent ? { "--deliverable-accent": accent } : void 0;
7817
+ const handleDownload = async () => {
7818
+ if (!onDownloadPdf || isDownloading) return;
7819
+ setIsDownloading(true);
7820
+ try {
7821
+ await onDownloadPdf();
7822
+ } finally {
7823
+ setIsDownloading(false);
7824
+ }
7825
+ };
7826
+ return /* @__PURE__ */ import_react93.default.createElement(
7827
+ "div",
7828
+ {
7829
+ className: cx("deliverable", className),
7830
+ style
7831
+ },
7832
+ deliverable.sections.map((section, idx) => renderSection(section, idx, deliverable)),
7833
+ !hideActions && onDownloadPdf && /* @__PURE__ */ import_react93.default.createElement("div", { className: "deliverable-actions" }, /* @__PURE__ */ import_react93.default.createElement(
7834
+ Button,
7835
+ {
7836
+ variant: "important",
7837
+ size: "md",
7838
+ onClick: handleDownload,
7839
+ loading: isDownloading,
7840
+ className: "deliverable-action-button"
7841
+ },
7842
+ "Download PDF"
7843
+ ))
7844
+ );
7845
+ }
7846
+ function renderSection(section, idx, doc) {
7847
+ const key = `${section.type}-${idx}`;
7848
+ switch (section.type) {
7849
+ case "COVER":
7850
+ return /* @__PURE__ */ import_react93.default.createElement(
7851
+ CoverSection,
7852
+ {
7853
+ key,
7854
+ data: section,
7855
+ clientName: doc.clientName
7856
+ }
7857
+ );
7858
+ case "ARTIFACT_IMAGE_GRID":
7859
+ return /* @__PURE__ */ import_react93.default.createElement(ArtifactImageGridSection, { key, data: section });
7860
+ case "ARTIFACT_SPOTLIGHT":
7861
+ return /* @__PURE__ */ import_react93.default.createElement(ArtifactSpotlightSection, { key, data: section });
7862
+ case "TEXT_BLOCK":
7863
+ return /* @__PURE__ */ import_react93.default.createElement(TextBlockSection, { key, data: section });
7864
+ case "COLOR_PALETTE":
7865
+ return /* @__PURE__ */ import_react93.default.createElement(ColorPaletteSection, { key, data: section });
7866
+ case "QUOTE_BLOCK":
7867
+ return /* @__PURE__ */ import_react93.default.createElement(QuoteBlockSection, { key, data: section });
7868
+ default:
7869
+ return null;
7870
+ }
7871
+ }
7872
+
7693
7873
  // src/index.ts
7694
7874
  var version = "2.0.0";
7695
7875
  // Annotate the CommonJS export names for ESM import in node:
@@ -7703,6 +7883,8 @@ var version = "2.0.0";
7703
7883
  AlertDialog,
7704
7884
  ArtifactCard,
7705
7885
  ArtifactGroup,
7886
+ ArtifactImageGridSection,
7887
+ ArtifactSpotlightSection,
7706
7888
  ArtifactVariantStack,
7707
7889
  ArtifactsPanel,
7708
7890
  ArtifactsPanelToggle,
@@ -7728,10 +7910,13 @@ var version = "2.0.0";
7728
7910
  ChevronRightIcon,
7729
7911
  CloseIcon,
7730
7912
  Col,
7913
+ ColorPaletteSection,
7731
7914
  ColorSwatch,
7732
7915
  ConfirmDialog,
7733
7916
  Container,
7917
+ CoverSection,
7734
7918
  CrossSquareIcon,
7919
+ DeliverableRenderer,
7735
7920
  Divider,
7736
7921
  Drawer,
7737
7922
  EmptySquareIcon,
@@ -7779,6 +7964,7 @@ var version = "2.0.0";
7779
7964
  Popover,
7780
7965
  Progress,
7781
7966
  PromptDialog,
7967
+ QuoteBlockSection,
7782
7968
  Radio,
7783
7969
  Row,
7784
7970
  SCRIPT_ELEMENT_TYPES,
@@ -7806,6 +7992,7 @@ var version = "2.0.0";
7806
7992
  TableHeader,
7807
7993
  TableRow,
7808
7994
  Tabs,
7995
+ TextBlockSection,
7809
7996
  TextCard,
7810
7997
  Textarea,
7811
7998
  ThinkingIndicator,