a2ui-react 0.2.1 → 0.4.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
@@ -6,7 +6,7 @@ import { cva } from 'class-variance-authority';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
9
- import { X, ChevronDown, ChevronUp, Check, Copy, Trash, Edit, Minus, Plus, Menu, Search, Settings, Download, ThumbsUp, Bookmark, Share, Star, Heart, HelpCircle, Moon, Sun, Bell, Phone, Mail, User, Home, ChevronRight, ChevronLeft, Flame, Zap, Square, Pause, Play, Cloud, icons } from 'lucide-react';
9
+ import { X, ChevronDown, ChevronUp, Check, Copy, Trash, Edit, Minus, Plus, Menu, Search, Settings, Download, ThumbsUp, Bookmark, Share, Star, Heart, HelpCircle, Moon, Sun, Bell, Phone, Mail, User, Home, ChevronRight, ChevronLeft, Flame, Zap, Square, Pause, Play, Cloud, icons, Loader2, Info, AlertCircle, XCircle, CheckCircle, Circle } from 'lucide-react';
10
10
  import * as DialogPrimitive from '@radix-ui/react-dialog';
11
11
  import * as LabelPrimitive from '@radix-ui/react-label';
12
12
  import * as TabsPrimitive from '@radix-ui/react-tabs';
@@ -16,6 +16,7 @@ import * as RechartsPrimitive from 'recharts';
16
16
  import { AreaChart, CartesianGrid, XAxis, YAxis, Area, BarChart, Bar, Cell, LineChart, Line, PieChart, Pie } from 'recharts';
17
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
18
18
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
19
+ import ReactMarkdown from 'react-markdown';
19
20
  import * as SliderPrimitive from '@radix-ui/react-slider';
20
21
 
21
22
  // ../core/dist/index.mjs
@@ -139,6 +140,32 @@ var c = {
139
140
  ...props
140
141
  })
141
142
  };
143
+ function isV09Format(update) {
144
+ return typeof update.component === "string";
145
+ }
146
+ function normalizeComponentUpdate(update) {
147
+ if (isV09Format(update)) {
148
+ const { id, component: type, ...rest } = update;
149
+ return { id, type, ...rest };
150
+ }
151
+ const component = update.component;
152
+ if (!component.id) {
153
+ component.id = update.id;
154
+ }
155
+ if (component.type === "Text") {
156
+ const textComponent = component;
157
+ if (textComponent.content && !textComponent.text) {
158
+ textComponent.text = textComponent.content;
159
+ }
160
+ }
161
+ return component;
162
+ }
163
+ function getTextContent(component) {
164
+ return component.text ?? component.content ?? "";
165
+ }
166
+ function getComponentsArray(msg) {
167
+ return msg.components ?? msg.updates ?? [];
168
+ }
142
169
  var MessageParseError = class extends Error {
143
170
  constructor(message) {
144
171
  super(message);
@@ -171,6 +198,17 @@ function validateBeginRendering(msg) {
171
198
  throw new MessageParseError("beginRendering.style must be an object if provided");
172
199
  }
173
200
  }
201
+ function validateComponentUpdate(update, context) {
202
+ if (!isObject(update)) {
203
+ throw new MessageParseError(`${context}[] must be objects`);
204
+ }
205
+ if (!isNonEmptyString(update.id)) {
206
+ throw new MessageParseError(`${context}[].id must be a non-empty string`);
207
+ }
208
+ if (typeof update.component !== "string" && !isObject(update.component)) {
209
+ throw new MessageParseError(`${context}[].component must be a string (v0.9) or object (legacy)`);
210
+ }
211
+ }
174
212
  function validateSurfaceUpdate(msg) {
175
213
  if (!isObject(msg)) {
176
214
  throw new MessageParseError("surfaceUpdate must be an object");
@@ -178,19 +216,12 @@ function validateSurfaceUpdate(msg) {
178
216
  if (!isNonEmptyString(msg.surfaceId)) {
179
217
  throw new MessageParseError("surfaceUpdate.surfaceId must be a non-empty string");
180
218
  }
181
- if (!isArray(msg.updates)) {
182
- throw new MessageParseError("surfaceUpdate.updates must be an array");
219
+ const components = msg.updates ?? msg.components;
220
+ if (!isArray(components)) {
221
+ throw new MessageParseError("surfaceUpdate.updates (or .components) must be an array");
183
222
  }
184
- for (const update of msg.updates) {
185
- if (!isObject(update)) {
186
- throw new MessageParseError("surfaceUpdate.updates[] must be objects");
187
- }
188
- if (!isNonEmptyString(update.id)) {
189
- throw new MessageParseError("surfaceUpdate.updates[].id must be a non-empty string");
190
- }
191
- if (!isObject(update.component)) {
192
- throw new MessageParseError("surfaceUpdate.updates[].component must be an object");
193
- }
223
+ for (const update of components) {
224
+ validateComponentUpdate(update, "surfaceUpdate.updates");
194
225
  }
195
226
  }
196
227
  function validateDataModelUpdate(msg) {
@@ -254,15 +285,7 @@ function validateUpdateComponents(msg) {
254
285
  throw new MessageParseError("updateComponents.components must be an array");
255
286
  }
256
287
  for (const component of msg.components) {
257
- if (!isObject(component)) {
258
- throw new MessageParseError("updateComponents.components[] must be objects");
259
- }
260
- if (!isNonEmptyString(component.id)) {
261
- throw new MessageParseError("updateComponents.components[].id must be a non-empty string");
262
- }
263
- if (!isObject(component.component)) {
264
- throw new MessageParseError("updateComponents.components[].component must be an object");
265
- }
288
+ validateComponentUpdate(component, "updateComponents.components");
266
289
  }
267
290
  }
268
291
  function validateUpdateDataModel(msg) {
@@ -593,15 +616,9 @@ function processMessage(message, store) {
593
616
  data: {}
594
617
  });
595
618
  } else if (isUpdateComponentsMessage(message) || isSurfaceUpdateMessage(message)) {
596
- let surfaceId;
597
- let componentUpdates;
598
- if (isUpdateComponentsMessage(message)) {
599
- surfaceId = message.updateComponents.surfaceId;
600
- componentUpdates = message.updateComponents.components;
601
- } else {
602
- surfaceId = message.surfaceUpdate.surfaceId;
603
- componentUpdates = message.surfaceUpdate.updates;
604
- }
619
+ const payload = isUpdateComponentsMessage(message) ? message.updateComponents : message.surfaceUpdate;
620
+ const surfaceId = payload.surfaceId;
621
+ const componentUpdates = getComponentsArray(payload);
605
622
  const surface = store.getSurface(surfaceId);
606
623
  if (!surface) {
607
624
  console.warn(`Surface not found for update: ${surfaceId}`);
@@ -609,7 +626,8 @@ function processMessage(message, store) {
609
626
  }
610
627
  const updatedComponents = { ...surface.components };
611
628
  for (const update of componentUpdates) {
612
- updatedComponents[update.id] = update.component;
629
+ const component = normalizeComponentUpdate(update);
630
+ updatedComponents[update.id] = component;
613
631
  }
614
632
  surface.components = updatedComponents;
615
633
  store.setSurface(surfaceId, { ...surface });
@@ -1051,10 +1069,10 @@ function useReducedMotion() {
1051
1069
  return prefersReducedMotion;
1052
1070
  }
1053
1071
  var variantStyles = {
1054
- info: "bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950 dark:border-blue-800 dark:text-blue-100",
1055
- warning: "bg-yellow-50 border-yellow-200 text-yellow-900 dark:bg-yellow-950 dark:border-yellow-800 dark:text-yellow-100",
1056
- error: "bg-red-50 border-red-200 text-red-900 dark:bg-red-950 dark:border-red-800 dark:text-red-100",
1057
- success: "bg-green-50 border-green-200 text-green-900 dark:bg-green-950 dark:border-green-800 dark:text-green-100"
1072
+ info: "bg-info border-info-border text-info-foreground",
1073
+ warning: "bg-warning border-warning-border text-warning-foreground",
1074
+ error: "bg-error border-error-border text-error-foreground",
1075
+ success: "bg-success border-success-border text-success-foreground"
1058
1076
  };
1059
1077
  var variantIcons = {
1060
1078
  info: "\u{1F4A1}",
@@ -1070,6 +1088,7 @@ var AlertRenderer = {
1070
1088
  "div",
1071
1089
  {
1072
1090
  id,
1091
+ "data-a2ui-component": "Alert",
1073
1092
  role: "alert",
1074
1093
  className: cn("relative rounded-lg border p-4", variantStyles[variant]),
1075
1094
  children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
@@ -1085,7 +1104,7 @@ var AlertRenderer = {
1085
1104
  example: {
1086
1105
  name: "Alert",
1087
1106
  description: "Accessible alert component with screen reader announcement",
1088
- category: "a11y",
1107
+ category: "display",
1089
1108
  messages: [
1090
1109
  { createSurface: { surfaceId: "alert-example", root: "col-1" } },
1091
1110
  {
@@ -1581,7 +1600,7 @@ var ProgressRenderer = {
1581
1600
  const value = component.value;
1582
1601
  const isIndeterminate = value === void 0;
1583
1602
  const percentage = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
1584
- return /* @__PURE__ */ jsxs("div", { className: "w-full space-y-1", children: [
1603
+ return /* @__PURE__ */ jsxs("div", { "data-a2ui-component": "Progress", className: "w-full space-y-1", children: [
1585
1604
  component.label && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
1586
1605
  /* @__PURE__ */ jsx("span", { children: component.label }),
1587
1606
  !isIndeterminate && /* @__PURE__ */ jsxs("span", { children: [
@@ -1617,7 +1636,7 @@ var ProgressRenderer = {
1617
1636
  example: {
1618
1637
  name: "Progress",
1619
1638
  description: "Accessible progress indicator with determinate and indeterminate states",
1620
- category: "a11y",
1639
+ category: "display",
1621
1640
  messages: [
1622
1641
  { createSurface: { surfaceId: "progress-example", root: "col-1" } },
1623
1642
  {
@@ -6025,7 +6044,7 @@ var AnimatedTextOverride = {
6025
6044
  type: "Text",
6026
6045
  render: ({ component, data }) => {
6027
6046
  const className = styleClasses6[component.style || "body"] || styleClasses6.body;
6028
- let content = component.content;
6047
+ let content = getTextContent(component);
6029
6048
  if (component.dataPath) {
6030
6049
  const value = data.get(component.dataPath);
6031
6050
  if (value !== void 0) {
@@ -6991,6 +7010,155 @@ var ModalRenderer = {
6991
7010
  ]
6992
7011
  }
6993
7012
  };
7013
+ var StepperRenderer = {
7014
+ type: "Stepper",
7015
+ render: ({ component, id }) => {
7016
+ const orientation = component.orientation || "horizontal";
7017
+ const activeStep = component.activeStep ?? 0;
7018
+ const getStepStatus = (index, step) => {
7019
+ if (step.status) return step.status;
7020
+ if (index < activeStep) return "completed";
7021
+ if (index === activeStep) return "current";
7022
+ return "pending";
7023
+ };
7024
+ const statusStyles = {
7025
+ pending: "border-muted-foreground/30 bg-background text-muted-foreground",
7026
+ current: "border-primary bg-primary text-primary-foreground",
7027
+ completed: "border-primary bg-primary text-primary-foreground",
7028
+ error: "border-destructive bg-destructive text-destructive-foreground"
7029
+ };
7030
+ const StatusIcon = ({ status }) => {
7031
+ switch (status) {
7032
+ case "completed":
7033
+ return /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" });
7034
+ case "error":
7035
+ return /* @__PURE__ */ jsx(X, { className: "h-4 w-4" });
7036
+ default:
7037
+ return /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" });
7038
+ }
7039
+ };
7040
+ return /* @__PURE__ */ jsx(
7041
+ "div",
7042
+ {
7043
+ id,
7044
+ "data-a2ui-component": "Stepper",
7045
+ className: cn(
7046
+ "flex",
7047
+ orientation === "horizontal" ? "flex-row items-start" : "flex-col"
7048
+ ),
7049
+ role: "list",
7050
+ "aria-label": "Progress steps",
7051
+ children: component.steps.map((step, index) => {
7052
+ const status = getStepStatus(index, step);
7053
+ const isLast = index === component.steps.length - 1;
7054
+ return /* @__PURE__ */ jsxs(
7055
+ "div",
7056
+ {
7057
+ className: cn(
7058
+ "flex",
7059
+ orientation === "horizontal" ? "flex-1 flex-col items-center" : "flex-row items-start"
7060
+ ),
7061
+ role: "listitem",
7062
+ "aria-current": status === "current" ? "step" : void 0,
7063
+ children: [
7064
+ /* @__PURE__ */ jsxs(
7065
+ "div",
7066
+ {
7067
+ className: cn(
7068
+ "flex items-center",
7069
+ orientation === "horizontal" ? "flex-col" : "flex-row"
7070
+ ),
7071
+ children: [
7072
+ /* @__PURE__ */ jsx(
7073
+ "div",
7074
+ {
7075
+ className: cn(
7076
+ "flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",
7077
+ statusStyles[status]
7078
+ ),
7079
+ children: /* @__PURE__ */ jsx(StatusIcon, { status })
7080
+ }
7081
+ ),
7082
+ !isLast && /* @__PURE__ */ jsx(
7083
+ "div",
7084
+ {
7085
+ className: cn(
7086
+ "transition-colors",
7087
+ orientation === "horizontal" ? "mt-4 h-0.5 w-full min-w-[40px]" : "ml-4 h-full min-h-[40px] w-0.5",
7088
+ index < activeStep ? "bg-primary" : "bg-muted-foreground/30"
7089
+ )
7090
+ }
7091
+ )
7092
+ ]
7093
+ }
7094
+ ),
7095
+ /* @__PURE__ */ jsxs(
7096
+ "div",
7097
+ {
7098
+ className: cn(
7099
+ "text-center",
7100
+ orientation === "horizontal" ? "mt-2" : "ml-4"
7101
+ ),
7102
+ children: [
7103
+ /* @__PURE__ */ jsx(
7104
+ "div",
7105
+ {
7106
+ className: cn(
7107
+ "text-sm font-medium",
7108
+ status === "current" ? "text-foreground" : "text-muted-foreground"
7109
+ ),
7110
+ children: step.label
7111
+ }
7112
+ ),
7113
+ step.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: step.description })
7114
+ ]
7115
+ }
7116
+ )
7117
+ ]
7118
+ },
7119
+ step.id
7120
+ );
7121
+ })
7122
+ }
7123
+ );
7124
+ },
7125
+ example: {
7126
+ name: "Stepper",
7127
+ description: "Step-by-step progress indicator for wizards and multi-step forms",
7128
+ category: "container",
7129
+ messages: [
7130
+ { createSurface: { surfaceId: "stepper-demo", root: "root" } },
7131
+ {
7132
+ updateComponents: {
7133
+ surfaceId: "stepper-demo",
7134
+ components: [
7135
+ {
7136
+ id: "root",
7137
+ component: {
7138
+ type: "Column",
7139
+ id: "root",
7140
+ children: ["stepper"]
7141
+ }
7142
+ },
7143
+ {
7144
+ id: "stepper",
7145
+ component: {
7146
+ type: "Stepper",
7147
+ id: "stepper",
7148
+ activeStep: 1,
7149
+ steps: [
7150
+ { id: "step1", label: "Account", description: "Create your account" },
7151
+ { id: "step2", label: "Profile", description: "Set up your profile" },
7152
+ { id: "step3", label: "Review", description: "Review and submit" }
7153
+ ]
7154
+ }
7155
+ }
7156
+ ]
7157
+ }
7158
+ }
7159
+ ]
7160
+ }
7161
+ };
6994
7162
  var TabsRenderer = {
6995
7163
  type: "Tabs",
6996
7164
  render: ({ component, children }) => {
@@ -7509,11 +7677,273 @@ var ImageRenderer = {
7509
7677
  ]
7510
7678
  }
7511
7679
  };
7680
+ var MarkdownRenderer = {
7681
+ type: "Markdown",
7682
+ render: ({ component, data }) => {
7683
+ const content = component.dataPath ? data.get(component.dataPath) ?? component.text : component.text;
7684
+ return /* @__PURE__ */ jsx(
7685
+ "div",
7686
+ {
7687
+ "data-a2ui-component": "Markdown",
7688
+ className: cn(
7689
+ "prose prose-sm dark:prose-invert max-w-none",
7690
+ // Headings
7691
+ "prose-headings:font-semibold prose-headings:tracking-tight",
7692
+ "prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
7693
+ // Links
7694
+ "prose-a:text-primary prose-a:no-underline hover:prose-a:underline",
7695
+ // Code
7696
+ "prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-sm",
7697
+ "prose-pre:bg-muted prose-pre:border prose-pre:border-border",
7698
+ // Lists
7699
+ "prose-ul:my-2 prose-ol:my-2 prose-li:my-0",
7700
+ // Blockquotes
7701
+ "prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground"
7702
+ ),
7703
+ children: /* @__PURE__ */ jsx(ReactMarkdown, { children: content || "" })
7704
+ }
7705
+ );
7706
+ },
7707
+ example: {
7708
+ name: "Markdown",
7709
+ description: "Renders markdown content with full formatting support",
7710
+ category: "display",
7711
+ messages: [
7712
+ { createSurface: { surfaceId: "markdown-demo", root: "root" } },
7713
+ {
7714
+ updateComponents: {
7715
+ surfaceId: "markdown-demo",
7716
+ components: [
7717
+ {
7718
+ id: "root",
7719
+ component: {
7720
+ type: "Column",
7721
+ id: "root",
7722
+ children: ["md"]
7723
+ }
7724
+ },
7725
+ {
7726
+ id: "md",
7727
+ component: {
7728
+ type: "Markdown",
7729
+ id: "md",
7730
+ text: `# Markdown Demo
7731
+
7732
+ This is a **bold** and *italic* text example.
7733
+
7734
+ ## Features
7735
+
7736
+ - Headings (h1-h6)
7737
+ - **Bold** and *italic* text
7738
+ - [Links](https://example.com)
7739
+ - Lists (ordered and unordered)
7740
+
7741
+ ### Code
7742
+
7743
+ Inline \`code\` and code blocks:
7744
+
7745
+ \`\`\`javascript
7746
+ const hello = "world";
7747
+ \`\`\`
7748
+
7749
+ > Blockquotes are also supported!
7750
+ `
7751
+ }
7752
+ }
7753
+ ]
7754
+ }
7755
+ }
7756
+ ]
7757
+ }
7758
+ };
7759
+ var SkeletonRenderer = {
7760
+ type: "Skeleton",
7761
+ render: ({ component, id }) => {
7762
+ const variant = component.variant || "rectangular";
7763
+ const variantClasses = {
7764
+ text: "rounded",
7765
+ circular: "rounded-full",
7766
+ rectangular: "rounded-md"
7767
+ };
7768
+ return /* @__PURE__ */ jsx(
7769
+ "div",
7770
+ {
7771
+ id,
7772
+ "data-a2ui-component": "Skeleton",
7773
+ role: "status",
7774
+ "aria-label": "Loading content",
7775
+ className: cn(
7776
+ "animate-pulse bg-muted",
7777
+ variantClasses[variant]
7778
+ ),
7779
+ style: {
7780
+ width: component.width || "100%",
7781
+ height: component.height || (variant === "text" ? "1rem" : "100px")
7782
+ },
7783
+ children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading..." })
7784
+ }
7785
+ );
7786
+ },
7787
+ example: {
7788
+ name: "Skeleton",
7789
+ description: "Content placeholder while loading",
7790
+ category: "display",
7791
+ messages: [
7792
+ { createSurface: { surfaceId: "skeleton-demo", root: "root" } },
7793
+ {
7794
+ updateComponents: {
7795
+ surfaceId: "skeleton-demo",
7796
+ components: [
7797
+ {
7798
+ id: "root",
7799
+ component: {
7800
+ type: "Column",
7801
+ id: "root",
7802
+ children: ["card-skeleton"]
7803
+ }
7804
+ },
7805
+ {
7806
+ id: "card-skeleton",
7807
+ component: {
7808
+ type: "Row",
7809
+ id: "card-skeleton",
7810
+ children: ["avatar", "content"],
7811
+ alignment: "start"
7812
+ }
7813
+ },
7814
+ {
7815
+ id: "avatar",
7816
+ component: {
7817
+ type: "Skeleton",
7818
+ id: "avatar",
7819
+ variant: "circular",
7820
+ width: "48px",
7821
+ height: "48px"
7822
+ }
7823
+ },
7824
+ {
7825
+ id: "content",
7826
+ component: {
7827
+ type: "Column",
7828
+ id: "content",
7829
+ children: ["line1", "line2"]
7830
+ }
7831
+ },
7832
+ {
7833
+ id: "line1",
7834
+ component: {
7835
+ type: "Skeleton",
7836
+ id: "line1",
7837
+ variant: "text",
7838
+ width: "200px",
7839
+ height: "1rem"
7840
+ }
7841
+ },
7842
+ {
7843
+ id: "line2",
7844
+ component: {
7845
+ type: "Skeleton",
7846
+ id: "line2",
7847
+ variant: "text",
7848
+ width: "150px",
7849
+ height: "1rem"
7850
+ }
7851
+ }
7852
+ ]
7853
+ }
7854
+ }
7855
+ ]
7856
+ }
7857
+ };
7858
+ var sizeClasses = {
7859
+ sm: "h-4 w-4",
7860
+ md: "h-6 w-6",
7861
+ lg: "h-10 w-10"
7862
+ };
7863
+ var SpinnerRenderer = {
7864
+ type: "Spinner",
7865
+ render: ({ component, id }) => {
7866
+ const size = component.size || "md";
7867
+ return /* @__PURE__ */ jsxs(
7868
+ "div",
7869
+ {
7870
+ id,
7871
+ "data-a2ui-component": "Spinner",
7872
+ role: "status",
7873
+ "aria-label": component.label || "Loading",
7874
+ className: "inline-flex items-center justify-center",
7875
+ children: [
7876
+ /* @__PURE__ */ jsx(
7877
+ Loader2,
7878
+ {
7879
+ className: cn("animate-spin text-muted-foreground", sizeClasses[size]),
7880
+ "aria-hidden": "true"
7881
+ }
7882
+ ),
7883
+ component.label && /* @__PURE__ */ jsx("span", { className: "sr-only", children: component.label })
7884
+ ]
7885
+ }
7886
+ );
7887
+ },
7888
+ example: {
7889
+ name: "Spinner",
7890
+ description: "Loading indicator with different sizes",
7891
+ category: "display",
7892
+ messages: [
7893
+ { createSurface: { surfaceId: "spinner-demo", root: "root" } },
7894
+ {
7895
+ updateComponents: {
7896
+ surfaceId: "spinner-demo",
7897
+ components: [
7898
+ {
7899
+ id: "root",
7900
+ component: {
7901
+ type: "Row",
7902
+ id: "root",
7903
+ children: ["spinner-sm", "spinner-md", "spinner-lg"],
7904
+ distribution: "spaceAround",
7905
+ alignment: "center"
7906
+ }
7907
+ },
7908
+ {
7909
+ id: "spinner-sm",
7910
+ component: {
7911
+ type: "Spinner",
7912
+ id: "spinner-sm",
7913
+ size: "sm",
7914
+ label: "Loading small"
7915
+ }
7916
+ },
7917
+ {
7918
+ id: "spinner-md",
7919
+ component: {
7920
+ type: "Spinner",
7921
+ id: "spinner-md",
7922
+ size: "md",
7923
+ label: "Loading medium"
7924
+ }
7925
+ },
7926
+ {
7927
+ id: "spinner-lg",
7928
+ component: {
7929
+ type: "Spinner",
7930
+ id: "spinner-lg",
7931
+ size: "lg",
7932
+ label: "Loading large"
7933
+ }
7934
+ }
7935
+ ]
7936
+ }
7937
+ }
7938
+ ]
7939
+ }
7940
+ };
7512
7941
  var TextRenderer = {
7513
7942
  type: "Text",
7514
7943
  render: ({ component, data }) => {
7515
- const { content, style = "body", dataPath } = component;
7516
- const displayContent = dataPath ? data.get(dataPath) ?? content : content;
7944
+ const { style = "body", dataPath } = component;
7945
+ const textContent = getTextContent(component);
7946
+ const displayContent = dataPath ? data.get(dataPath) ?? textContent : textContent;
7517
7947
  const styleMap = {
7518
7948
  h1: { tag: "h1", className: "text-4xl font-bold" },
7519
7949
  h2: { tag: "h2", className: "text-3xl font-semibold" },
@@ -7557,7 +7987,7 @@ var TextRenderer = {
7557
7987
  component: {
7558
7988
  type: "Text",
7559
7989
  id: "h1",
7560
- content: "Heading 1 - Large Title",
7990
+ text: "Heading 1 - Large Title",
7561
7991
  style: "h1"
7562
7992
  }
7563
7993
  },
@@ -7566,7 +7996,7 @@ var TextRenderer = {
7566
7996
  component: {
7567
7997
  type: "Text",
7568
7998
  id: "h2",
7569
- content: "Heading 2 - Section Title",
7999
+ text: "Heading 2 - Section Title",
7570
8000
  style: "h2"
7571
8001
  }
7572
8002
  },
@@ -7575,7 +8005,7 @@ var TextRenderer = {
7575
8005
  component: {
7576
8006
  type: "Text",
7577
8007
  id: "h3",
7578
- content: "Heading 3 - Subsection",
8008
+ text: "Heading 3 - Subsection",
7579
8009
  style: "h3"
7580
8010
  }
7581
8011
  },
@@ -7584,7 +8014,7 @@ var TextRenderer = {
7584
8014
  component: {
7585
8015
  type: "Text",
7586
8016
  id: "h4",
7587
- content: "Heading 4 - Component Title",
8017
+ text: "Heading 4 - Component Title",
7588
8018
  style: "h4"
7589
8019
  }
7590
8020
  },
@@ -7593,7 +8023,7 @@ var TextRenderer = {
7593
8023
  component: {
7594
8024
  type: "Text",
7595
8025
  id: "h5",
7596
- content: "Heading 5 - Small Title",
8026
+ text: "Heading 5 - Small Title",
7597
8027
  style: "h5"
7598
8028
  }
7599
8029
  },
@@ -7602,7 +8032,7 @@ var TextRenderer = {
7602
8032
  component: {
7603
8033
  type: "Text",
7604
8034
  id: "body",
7605
- content: "Body text paragraph with regular content and default styling.",
8035
+ text: "Body text paragraph with regular content and default styling.",
7606
8036
  style: "body"
7607
8037
  }
7608
8038
  },
@@ -7611,7 +8041,7 @@ var TextRenderer = {
7611
8041
  component: {
7612
8042
  type: "Text",
7613
8043
  id: "caption",
7614
- content: "Caption text - muted and small",
8044
+ text: "Caption text - muted and small",
7615
8045
  style: "caption"
7616
8046
  }
7617
8047
  }
@@ -7621,6 +8051,122 @@ var TextRenderer = {
7621
8051
  ]
7622
8052
  }
7623
8053
  };
8054
+ var variantStyles2 = {
8055
+ default: "bg-background border-border",
8056
+ success: "bg-success border-success-border text-success-foreground",
8057
+ error: "bg-error border-error-border text-error-foreground",
8058
+ warning: "bg-warning border-warning-border text-warning-foreground",
8059
+ info: "bg-info border-info-border text-info-foreground"
8060
+ };
8061
+ var variantIcons2 = {
8062
+ default: null,
8063
+ success: CheckCircle,
8064
+ error: XCircle,
8065
+ warning: AlertCircle,
8066
+ info: Info
8067
+ };
8068
+ var ToastRenderer = {
8069
+ type: "Toast",
8070
+ render: ({ component, id, onAction }) => {
8071
+ const variant = component.variant || "default";
8072
+ const Icon2 = variantIcons2[variant];
8073
+ return /* @__PURE__ */ jsxs(
8074
+ "div",
8075
+ {
8076
+ id,
8077
+ "data-a2ui-component": "Toast",
8078
+ role: "alert",
8079
+ "aria-live": "polite",
8080
+ className: cn(
8081
+ "pointer-events-auto relative flex w-full max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg",
8082
+ variantStyles2[variant]
8083
+ ),
8084
+ children: [
8085
+ Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-5 w-5 flex-shrink-0 mt-0.5", "aria-hidden": "true" }),
8086
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1", children: [
8087
+ component.title && /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-foreground", children: component.title }),
8088
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: component.message }),
8089
+ component.actionLabel && component.action && /* @__PURE__ */ jsx(
8090
+ "button",
8091
+ {
8092
+ type: "button",
8093
+ onClick: () => onAction?.({ type: component.action, payload: { id: component.id } }),
8094
+ className: "text-sm font-medium text-primary hover:underline mt-2",
8095
+ children: component.actionLabel
8096
+ }
8097
+ )
8098
+ ] }),
8099
+ /* @__PURE__ */ jsx(
8100
+ "button",
8101
+ {
8102
+ type: "button",
8103
+ onClick: () => onAction?.({ type: "toast.dismiss", payload: { id: component.id } }),
8104
+ className: "absolute right-2 top-2 rounded-md p-1 text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
8105
+ "aria-label": "Dismiss",
8106
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
8107
+ }
8108
+ )
8109
+ ]
8110
+ }
8111
+ );
8112
+ },
8113
+ example: {
8114
+ name: "Toast",
8115
+ description: "Notification toast with variants and optional action",
8116
+ category: "display",
8117
+ messages: [
8118
+ { createSurface: { surfaceId: "toast-demo", root: "root" } },
8119
+ {
8120
+ updateComponents: {
8121
+ surfaceId: "toast-demo",
8122
+ components: [
8123
+ {
8124
+ id: "root",
8125
+ component: {
8126
+ type: "Column",
8127
+ id: "root",
8128
+ children: ["toast-success", "toast-error", "toast-info"]
8129
+ }
8130
+ },
8131
+ {
8132
+ id: "toast-success",
8133
+ component: {
8134
+ type: "Toast",
8135
+ id: "toast-success",
8136
+ variant: "success",
8137
+ title: "Success!",
8138
+ message: "Your changes have been saved."
8139
+ }
8140
+ },
8141
+ {
8142
+ id: "toast-error",
8143
+ component: {
8144
+ type: "Toast",
8145
+ id: "toast-error",
8146
+ variant: "error",
8147
+ title: "Error",
8148
+ message: "Something went wrong. Please try again.",
8149
+ actionLabel: "Retry",
8150
+ action: "retry"
8151
+ }
8152
+ },
8153
+ {
8154
+ id: "toast-info",
8155
+ component: {
8156
+ type: "Toast",
8157
+ id: "toast-info",
8158
+ variant: "info",
8159
+ message: "New version available!",
8160
+ actionLabel: "Update",
8161
+ action: "update"
8162
+ }
8163
+ }
8164
+ ]
8165
+ }
8166
+ }
8167
+ ]
8168
+ }
8169
+ };
7624
8170
  var VideoRenderer = {
7625
8171
  type: "Video",
7626
8172
  render: ({ component }) => {
@@ -8901,6 +9447,12 @@ var shadcnRenderers = [
8901
9447
  ColumnRenderer,
8902
9448
  // Display
8903
9449
  TextRenderer,
9450
+ MarkdownRenderer,
9451
+ SpinnerRenderer,
9452
+ SkeletonRenderer,
9453
+ ToastRenderer,
9454
+ AlertRenderer,
9455
+ ProgressRenderer,
8904
9456
  ImageRenderer,
8905
9457
  IconRenderer,
8906
9458
  DividerRenderer,
@@ -8919,6 +9471,7 @@ var shadcnRenderers = [
8919
9471
  CardRenderer,
8920
9472
  ModalRenderer,
8921
9473
  TabsRenderer,
9474
+ StepperRenderer,
8922
9475
  ListRenderer,
8923
9476
  // Charts
8924
9477
  PieChartRenderer,
@@ -9054,6 +9607,6 @@ function createCompleteRegistry() {
9054
9607
  // src/index.ts
9055
9608
  var version = "0.1.0";
9056
9609
 
9057
- export { A2UIContext, A2UIProvider, A2UISurface, AlertRenderer, AnimatedAccordionRenderer, AnimatedAvatarGroupRenderer, AnimatedButtonOverride, AnimatedCardOverride, AnimatedCardRenderer, AnimatedCheckboxOverride, AnimatedDialogRenderer, AnimatedModalOverride, AnimatedSelectOverride, AnimatedTabsOverride, AnimatedTabsRenderer, AnimatedTextOverride, AnimatedTooltipRenderer, AreaChartRenderer, ArticleRenderer, AsideRenderer, AuroraBackgroundRenderer, BarChartRenderer, BlurRevealTextRenderer, BubbleBackgroundRenderer, Button, Checkbox, ComponentRenderer, CopyButtonRenderer, CountUpRenderer, CursorRenderer, DEFAULT_CHART_COLORS, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FireworksBackgroundRenderer, FlipButtonRenderer, FlipCardRenderer, FooterRenderer, GlowButtonRenderer, GradientBackgroundRenderer, GradientTextRenderer, GravityStarsBackgroundRenderer, HeaderRenderer, HexagonBackgroundRenderer, HoleBackgroundRenderer, IconButtonRenderer, Input, Label, LineChartRenderer, LiquidButtonRenderer, LiveRegionRenderer, MagneticButtonRenderer, MainRenderer, MessageParseError, MorphingIconRenderer, NavRenderer, ParticlesBackgroundRenderer, PieChartRenderer, ProgressRenderer, RippleButtonRenderer, SectionRenderer, ShimmerButtonRenderer, SkipLinkRenderer, SpotlightRenderer, StarsBackgroundRenderer, Tabs, TabsContent, TabsList, TabsTrigger, TextScrambleRenderer, Textarea, ThemeTogglerButtonRenderer, TypewriterTextRenderer, a11yRenderers, allAnimatedRenderers, allRenderers, animatedOverrides, animatedRenderers, buildChartConfig, buildMessages, buttonVariants, c, chartRenderers, cn, createAccessibleRegistry, createAnimatedRegistry, createCompleteRegistry, createFullyAnimatedRegistry, createRegistry, createShadcnRegistry, createStore, createStreamParser, getChartColor, getChartData, getDataByPath, isBeginRenderingMessage, isDataModelUpdateMessage, isDeleteSurfaceMessage, isSurfaceUpdateMessage, parseJSONL, parseMessage, setDataByPath, shadcnRenderers, transformToRechartsData, useA2UI, useAction, useContainerDimensions, useDataBinding, useReducedMotion, useSurface, version };
9610
+ export { A2UIContext, A2UIProvider, A2UISurface, AlertRenderer, AnimatedAccordionRenderer, AnimatedAvatarGroupRenderer, AnimatedButtonOverride, AnimatedCardOverride, AnimatedCardRenderer, AnimatedCheckboxOverride, AnimatedDialogRenderer, AnimatedModalOverride, AnimatedSelectOverride, AnimatedTabsOverride, AnimatedTabsRenderer, AnimatedTextOverride, AnimatedTooltipRenderer, AreaChartRenderer, ArticleRenderer, AsideRenderer, AudioPlayerRenderer, AuroraBackgroundRenderer, BarChartRenderer, BlurRevealTextRenderer, BubbleBackgroundRenderer, Button, CardRenderer, Checkbox, ComponentRenderer, CopyButtonRenderer, CountUpRenderer, CursorRenderer, DEFAULT_CHART_COLORS, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DividerRenderer, FireworksBackgroundRenderer, FlipButtonRenderer, FlipCardRenderer, FooterRenderer, GlowButtonRenderer, GradientBackgroundRenderer, GradientTextRenderer, GravityStarsBackgroundRenderer, HeaderRenderer, HexagonBackgroundRenderer, HoleBackgroundRenderer, IconButtonRenderer, IconRenderer, ImageRenderer, Input, Label, LineChartRenderer, LiquidButtonRenderer, ListRenderer, LiveRegionRenderer, MagneticButtonRenderer, MainRenderer, MarkdownRenderer, MessageParseError, ModalRenderer, MorphingIconRenderer, NavRenderer, ParticlesBackgroundRenderer, PieChartRenderer, ProgressRenderer, RippleButtonRenderer, SectionRenderer, ShimmerButtonRenderer, SkeletonRenderer, SkipLinkRenderer, SpinnerRenderer, SpotlightRenderer, StarsBackgroundRenderer, StepperRenderer, Tabs, TabsContent, TabsList, TabsRenderer, TabsTrigger, TextRenderer, TextScrambleRenderer, Textarea, ThemeTogglerButtonRenderer, ToastRenderer, TypewriterTextRenderer, VideoRenderer, a11yRenderers, allAnimatedRenderers, allRenderers, animatedOverrides, animatedRenderers, buildChartConfig, buildMessages, buttonVariants, c, chartRenderers, cn, createAccessibleRegistry, createAnimatedRegistry, createCompleteRegistry, createFullyAnimatedRegistry, createRegistry, createShadcnRegistry, createStore, createStreamParser, getChartColor, getChartData, getDataByPath, isBeginRenderingMessage, isDataModelUpdateMessage, isDeleteSurfaceMessage, isSurfaceUpdateMessage, parseJSONL, parseMessage, setDataByPath, shadcnRenderers, transformToRechartsData, useA2UI, useAction, useContainerDimensions, useDataBinding, useReducedMotion, useSurface, version };
9058
9611
  //# sourceMappingURL=index.mjs.map
9059
9612
  //# sourceMappingURL=index.mjs.map