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.js CHANGED
@@ -16,8 +16,11 @@ var SelectPrimitive = require('@radix-ui/react-select');
16
16
  var RechartsPrimitive = require('recharts');
17
17
  var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
18
18
  var SeparatorPrimitive = require('@radix-ui/react-separator');
19
+ var ReactMarkdown = require('react-markdown');
19
20
  var SliderPrimitive = require('@radix-ui/react-slider');
20
21
 
22
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
23
+
21
24
  function _interopNamespace(e) {
22
25
  if (e && e.__esModule) return e;
23
26
  var n = Object.create(null);
@@ -45,6 +48,7 @@ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive)
45
48
  var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
46
49
  var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
47
50
  var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
51
+ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
48
52
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
49
53
 
50
54
  // ../core/dist/index.mjs
@@ -168,6 +172,32 @@ var c = {
168
172
  ...props
169
173
  })
170
174
  };
175
+ function isV09Format(update) {
176
+ return typeof update.component === "string";
177
+ }
178
+ function normalizeComponentUpdate(update) {
179
+ if (isV09Format(update)) {
180
+ const { id, component: type, ...rest } = update;
181
+ return { id, type, ...rest };
182
+ }
183
+ const component = update.component;
184
+ if (!component.id) {
185
+ component.id = update.id;
186
+ }
187
+ if (component.type === "Text") {
188
+ const textComponent = component;
189
+ if (textComponent.content && !textComponent.text) {
190
+ textComponent.text = textComponent.content;
191
+ }
192
+ }
193
+ return component;
194
+ }
195
+ function getTextContent(component) {
196
+ return component.text ?? component.content ?? "";
197
+ }
198
+ function getComponentsArray(msg) {
199
+ return msg.components ?? msg.updates ?? [];
200
+ }
171
201
  var MessageParseError = class extends Error {
172
202
  constructor(message) {
173
203
  super(message);
@@ -200,6 +230,17 @@ function validateBeginRendering(msg) {
200
230
  throw new MessageParseError("beginRendering.style must be an object if provided");
201
231
  }
202
232
  }
233
+ function validateComponentUpdate(update, context) {
234
+ if (!isObject(update)) {
235
+ throw new MessageParseError(`${context}[] must be objects`);
236
+ }
237
+ if (!isNonEmptyString(update.id)) {
238
+ throw new MessageParseError(`${context}[].id must be a non-empty string`);
239
+ }
240
+ if (typeof update.component !== "string" && !isObject(update.component)) {
241
+ throw new MessageParseError(`${context}[].component must be a string (v0.9) or object (legacy)`);
242
+ }
243
+ }
203
244
  function validateSurfaceUpdate(msg) {
204
245
  if (!isObject(msg)) {
205
246
  throw new MessageParseError("surfaceUpdate must be an object");
@@ -207,19 +248,12 @@ function validateSurfaceUpdate(msg) {
207
248
  if (!isNonEmptyString(msg.surfaceId)) {
208
249
  throw new MessageParseError("surfaceUpdate.surfaceId must be a non-empty string");
209
250
  }
210
- if (!isArray(msg.updates)) {
211
- throw new MessageParseError("surfaceUpdate.updates must be an array");
251
+ const components = msg.updates ?? msg.components;
252
+ if (!isArray(components)) {
253
+ throw new MessageParseError("surfaceUpdate.updates (or .components) must be an array");
212
254
  }
213
- for (const update of msg.updates) {
214
- if (!isObject(update)) {
215
- throw new MessageParseError("surfaceUpdate.updates[] must be objects");
216
- }
217
- if (!isNonEmptyString(update.id)) {
218
- throw new MessageParseError("surfaceUpdate.updates[].id must be a non-empty string");
219
- }
220
- if (!isObject(update.component)) {
221
- throw new MessageParseError("surfaceUpdate.updates[].component must be an object");
222
- }
255
+ for (const update of components) {
256
+ validateComponentUpdate(update, "surfaceUpdate.updates");
223
257
  }
224
258
  }
225
259
  function validateDataModelUpdate(msg) {
@@ -283,15 +317,7 @@ function validateUpdateComponents(msg) {
283
317
  throw new MessageParseError("updateComponents.components must be an array");
284
318
  }
285
319
  for (const component of msg.components) {
286
- if (!isObject(component)) {
287
- throw new MessageParseError("updateComponents.components[] must be objects");
288
- }
289
- if (!isNonEmptyString(component.id)) {
290
- throw new MessageParseError("updateComponents.components[].id must be a non-empty string");
291
- }
292
- if (!isObject(component.component)) {
293
- throw new MessageParseError("updateComponents.components[].component must be an object");
294
- }
320
+ validateComponentUpdate(component, "updateComponents.components");
295
321
  }
296
322
  }
297
323
  function validateUpdateDataModel(msg) {
@@ -622,15 +648,9 @@ function processMessage(message, store) {
622
648
  data: {}
623
649
  });
624
650
  } else if (isUpdateComponentsMessage(message) || isSurfaceUpdateMessage(message)) {
625
- let surfaceId;
626
- let componentUpdates;
627
- if (isUpdateComponentsMessage(message)) {
628
- surfaceId = message.updateComponents.surfaceId;
629
- componentUpdates = message.updateComponents.components;
630
- } else {
631
- surfaceId = message.surfaceUpdate.surfaceId;
632
- componentUpdates = message.surfaceUpdate.updates;
633
- }
651
+ const payload = isUpdateComponentsMessage(message) ? message.updateComponents : message.surfaceUpdate;
652
+ const surfaceId = payload.surfaceId;
653
+ const componentUpdates = getComponentsArray(payload);
634
654
  const surface = store.getSurface(surfaceId);
635
655
  if (!surface) {
636
656
  console.warn(`Surface not found for update: ${surfaceId}`);
@@ -638,7 +658,8 @@ function processMessage(message, store) {
638
658
  }
639
659
  const updatedComponents = { ...surface.components };
640
660
  for (const update of componentUpdates) {
641
- updatedComponents[update.id] = update.component;
661
+ const component = normalizeComponentUpdate(update);
662
+ updatedComponents[update.id] = component;
642
663
  }
643
664
  surface.components = updatedComponents;
644
665
  store.setSurface(surfaceId, { ...surface });
@@ -1080,10 +1101,10 @@ function useReducedMotion() {
1080
1101
  return prefersReducedMotion;
1081
1102
  }
1082
1103
  var variantStyles = {
1083
- info: "bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950 dark:border-blue-800 dark:text-blue-100",
1084
- warning: "bg-yellow-50 border-yellow-200 text-yellow-900 dark:bg-yellow-950 dark:border-yellow-800 dark:text-yellow-100",
1085
- error: "bg-red-50 border-red-200 text-red-900 dark:bg-red-950 dark:border-red-800 dark:text-red-100",
1086
- success: "bg-green-50 border-green-200 text-green-900 dark:bg-green-950 dark:border-green-800 dark:text-green-100"
1104
+ info: "bg-info border-info-border text-info-foreground",
1105
+ warning: "bg-warning border-warning-border text-warning-foreground",
1106
+ error: "bg-error border-error-border text-error-foreground",
1107
+ success: "bg-success border-success-border text-success-foreground"
1087
1108
  };
1088
1109
  var variantIcons = {
1089
1110
  info: "\u{1F4A1}",
@@ -1099,6 +1120,7 @@ var AlertRenderer = {
1099
1120
  "div",
1100
1121
  {
1101
1122
  id,
1123
+ "data-a2ui-component": "Alert",
1102
1124
  role: "alert",
1103
1125
  className: cn("relative rounded-lg border p-4", variantStyles[variant]),
1104
1126
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
@@ -1114,7 +1136,7 @@ var AlertRenderer = {
1114
1136
  example: {
1115
1137
  name: "Alert",
1116
1138
  description: "Accessible alert component with screen reader announcement",
1117
- category: "a11y",
1139
+ category: "display",
1118
1140
  messages: [
1119
1141
  { createSurface: { surfaceId: "alert-example", root: "col-1" } },
1120
1142
  {
@@ -1610,7 +1632,7 @@ var ProgressRenderer = {
1610
1632
  const value = component.value;
1611
1633
  const isIndeterminate = value === void 0;
1612
1634
  const percentage = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
1613
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full space-y-1", children: [
1635
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-a2ui-component": "Progress", className: "w-full space-y-1", children: [
1614
1636
  component.label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
1615
1637
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: component.label }),
1616
1638
  !isIndeterminate && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
@@ -1646,7 +1668,7 @@ var ProgressRenderer = {
1646
1668
  example: {
1647
1669
  name: "Progress",
1648
1670
  description: "Accessible progress indicator with determinate and indeterminate states",
1649
- category: "a11y",
1671
+ category: "display",
1650
1672
  messages: [
1651
1673
  { createSurface: { surfaceId: "progress-example", root: "col-1" } },
1652
1674
  {
@@ -6054,7 +6076,7 @@ var AnimatedTextOverride = {
6054
6076
  type: "Text",
6055
6077
  render: ({ component, data }) => {
6056
6078
  const className = styleClasses6[component.style || "body"] || styleClasses6.body;
6057
- let content = component.content;
6079
+ let content = getTextContent(component);
6058
6080
  if (component.dataPath) {
6059
6081
  const value = data.get(component.dataPath);
6060
6082
  if (value !== void 0) {
@@ -7020,6 +7042,155 @@ var ModalRenderer = {
7020
7042
  ]
7021
7043
  }
7022
7044
  };
7045
+ var StepperRenderer = {
7046
+ type: "Stepper",
7047
+ render: ({ component, id }) => {
7048
+ const orientation = component.orientation || "horizontal";
7049
+ const activeStep = component.activeStep ?? 0;
7050
+ const getStepStatus = (index, step) => {
7051
+ if (step.status) return step.status;
7052
+ if (index < activeStep) return "completed";
7053
+ if (index === activeStep) return "current";
7054
+ return "pending";
7055
+ };
7056
+ const statusStyles = {
7057
+ pending: "border-muted-foreground/30 bg-background text-muted-foreground",
7058
+ current: "border-primary bg-primary text-primary-foreground",
7059
+ completed: "border-primary bg-primary text-primary-foreground",
7060
+ error: "border-destructive bg-destructive text-destructive-foreground"
7061
+ };
7062
+ const StatusIcon = ({ status }) => {
7063
+ switch (status) {
7064
+ case "completed":
7065
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" });
7066
+ case "error":
7067
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" });
7068
+ default:
7069
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2 w-2 fill-current" });
7070
+ }
7071
+ };
7072
+ return /* @__PURE__ */ jsxRuntime.jsx(
7073
+ "div",
7074
+ {
7075
+ id,
7076
+ "data-a2ui-component": "Stepper",
7077
+ className: cn(
7078
+ "flex",
7079
+ orientation === "horizontal" ? "flex-row items-start" : "flex-col"
7080
+ ),
7081
+ role: "list",
7082
+ "aria-label": "Progress steps",
7083
+ children: component.steps.map((step, index) => {
7084
+ const status = getStepStatus(index, step);
7085
+ const isLast = index === component.steps.length - 1;
7086
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7087
+ "div",
7088
+ {
7089
+ className: cn(
7090
+ "flex",
7091
+ orientation === "horizontal" ? "flex-1 flex-col items-center" : "flex-row items-start"
7092
+ ),
7093
+ role: "listitem",
7094
+ "aria-current": status === "current" ? "step" : void 0,
7095
+ children: [
7096
+ /* @__PURE__ */ jsxRuntime.jsxs(
7097
+ "div",
7098
+ {
7099
+ className: cn(
7100
+ "flex items-center",
7101
+ orientation === "horizontal" ? "flex-col" : "flex-row"
7102
+ ),
7103
+ children: [
7104
+ /* @__PURE__ */ jsxRuntime.jsx(
7105
+ "div",
7106
+ {
7107
+ className: cn(
7108
+ "flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",
7109
+ statusStyles[status]
7110
+ ),
7111
+ children: /* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { status })
7112
+ }
7113
+ ),
7114
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx(
7115
+ "div",
7116
+ {
7117
+ className: cn(
7118
+ "transition-colors",
7119
+ orientation === "horizontal" ? "mt-4 h-0.5 w-full min-w-[40px]" : "ml-4 h-full min-h-[40px] w-0.5",
7120
+ index < activeStep ? "bg-primary" : "bg-muted-foreground/30"
7121
+ )
7122
+ }
7123
+ )
7124
+ ]
7125
+ }
7126
+ ),
7127
+ /* @__PURE__ */ jsxRuntime.jsxs(
7128
+ "div",
7129
+ {
7130
+ className: cn(
7131
+ "text-center",
7132
+ orientation === "horizontal" ? "mt-2" : "ml-4"
7133
+ ),
7134
+ children: [
7135
+ /* @__PURE__ */ jsxRuntime.jsx(
7136
+ "div",
7137
+ {
7138
+ className: cn(
7139
+ "text-sm font-medium",
7140
+ status === "current" ? "text-foreground" : "text-muted-foreground"
7141
+ ),
7142
+ children: step.label
7143
+ }
7144
+ ),
7145
+ step.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: step.description })
7146
+ ]
7147
+ }
7148
+ )
7149
+ ]
7150
+ },
7151
+ step.id
7152
+ );
7153
+ })
7154
+ }
7155
+ );
7156
+ },
7157
+ example: {
7158
+ name: "Stepper",
7159
+ description: "Step-by-step progress indicator for wizards and multi-step forms",
7160
+ category: "container",
7161
+ messages: [
7162
+ { createSurface: { surfaceId: "stepper-demo", root: "root" } },
7163
+ {
7164
+ updateComponents: {
7165
+ surfaceId: "stepper-demo",
7166
+ components: [
7167
+ {
7168
+ id: "root",
7169
+ component: {
7170
+ type: "Column",
7171
+ id: "root",
7172
+ children: ["stepper"]
7173
+ }
7174
+ },
7175
+ {
7176
+ id: "stepper",
7177
+ component: {
7178
+ type: "Stepper",
7179
+ id: "stepper",
7180
+ activeStep: 1,
7181
+ steps: [
7182
+ { id: "step1", label: "Account", description: "Create your account" },
7183
+ { id: "step2", label: "Profile", description: "Set up your profile" },
7184
+ { id: "step3", label: "Review", description: "Review and submit" }
7185
+ ]
7186
+ }
7187
+ }
7188
+ ]
7189
+ }
7190
+ }
7191
+ ]
7192
+ }
7193
+ };
7023
7194
  var TabsRenderer = {
7024
7195
  type: "Tabs",
7025
7196
  render: ({ component, children }) => {
@@ -7538,11 +7709,273 @@ var ImageRenderer = {
7538
7709
  ]
7539
7710
  }
7540
7711
  };
7712
+ var MarkdownRenderer = {
7713
+ type: "Markdown",
7714
+ render: ({ component, data }) => {
7715
+ const content = component.dataPath ? data.get(component.dataPath) ?? component.text : component.text;
7716
+ return /* @__PURE__ */ jsxRuntime.jsx(
7717
+ "div",
7718
+ {
7719
+ "data-a2ui-component": "Markdown",
7720
+ className: cn(
7721
+ "prose prose-sm dark:prose-invert max-w-none",
7722
+ // Headings
7723
+ "prose-headings:font-semibold prose-headings:tracking-tight",
7724
+ "prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
7725
+ // Links
7726
+ "prose-a:text-primary prose-a:no-underline hover:prose-a:underline",
7727
+ // Code
7728
+ "prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-sm",
7729
+ "prose-pre:bg-muted prose-pre:border prose-pre:border-border",
7730
+ // Lists
7731
+ "prose-ul:my-2 prose-ol:my-2 prose-li:my-0",
7732
+ // Blockquotes
7733
+ "prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground"
7734
+ ),
7735
+ children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { children: content || "" })
7736
+ }
7737
+ );
7738
+ },
7739
+ example: {
7740
+ name: "Markdown",
7741
+ description: "Renders markdown content with full formatting support",
7742
+ category: "display",
7743
+ messages: [
7744
+ { createSurface: { surfaceId: "markdown-demo", root: "root" } },
7745
+ {
7746
+ updateComponents: {
7747
+ surfaceId: "markdown-demo",
7748
+ components: [
7749
+ {
7750
+ id: "root",
7751
+ component: {
7752
+ type: "Column",
7753
+ id: "root",
7754
+ children: ["md"]
7755
+ }
7756
+ },
7757
+ {
7758
+ id: "md",
7759
+ component: {
7760
+ type: "Markdown",
7761
+ id: "md",
7762
+ text: `# Markdown Demo
7763
+
7764
+ This is a **bold** and *italic* text example.
7765
+
7766
+ ## Features
7767
+
7768
+ - Headings (h1-h6)
7769
+ - **Bold** and *italic* text
7770
+ - [Links](https://example.com)
7771
+ - Lists (ordered and unordered)
7772
+
7773
+ ### Code
7774
+
7775
+ Inline \`code\` and code blocks:
7776
+
7777
+ \`\`\`javascript
7778
+ const hello = "world";
7779
+ \`\`\`
7780
+
7781
+ > Blockquotes are also supported!
7782
+ `
7783
+ }
7784
+ }
7785
+ ]
7786
+ }
7787
+ }
7788
+ ]
7789
+ }
7790
+ };
7791
+ var SkeletonRenderer = {
7792
+ type: "Skeleton",
7793
+ render: ({ component, id }) => {
7794
+ const variant = component.variant || "rectangular";
7795
+ const variantClasses = {
7796
+ text: "rounded",
7797
+ circular: "rounded-full",
7798
+ rectangular: "rounded-md"
7799
+ };
7800
+ return /* @__PURE__ */ jsxRuntime.jsx(
7801
+ "div",
7802
+ {
7803
+ id,
7804
+ "data-a2ui-component": "Skeleton",
7805
+ role: "status",
7806
+ "aria-label": "Loading content",
7807
+ className: cn(
7808
+ "animate-pulse bg-muted",
7809
+ variantClasses[variant]
7810
+ ),
7811
+ style: {
7812
+ width: component.width || "100%",
7813
+ height: component.height || (variant === "text" ? "1rem" : "100px")
7814
+ },
7815
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
7816
+ }
7817
+ );
7818
+ },
7819
+ example: {
7820
+ name: "Skeleton",
7821
+ description: "Content placeholder while loading",
7822
+ category: "display",
7823
+ messages: [
7824
+ { createSurface: { surfaceId: "skeleton-demo", root: "root" } },
7825
+ {
7826
+ updateComponents: {
7827
+ surfaceId: "skeleton-demo",
7828
+ components: [
7829
+ {
7830
+ id: "root",
7831
+ component: {
7832
+ type: "Column",
7833
+ id: "root",
7834
+ children: ["card-skeleton"]
7835
+ }
7836
+ },
7837
+ {
7838
+ id: "card-skeleton",
7839
+ component: {
7840
+ type: "Row",
7841
+ id: "card-skeleton",
7842
+ children: ["avatar", "content"],
7843
+ alignment: "start"
7844
+ }
7845
+ },
7846
+ {
7847
+ id: "avatar",
7848
+ component: {
7849
+ type: "Skeleton",
7850
+ id: "avatar",
7851
+ variant: "circular",
7852
+ width: "48px",
7853
+ height: "48px"
7854
+ }
7855
+ },
7856
+ {
7857
+ id: "content",
7858
+ component: {
7859
+ type: "Column",
7860
+ id: "content",
7861
+ children: ["line1", "line2"]
7862
+ }
7863
+ },
7864
+ {
7865
+ id: "line1",
7866
+ component: {
7867
+ type: "Skeleton",
7868
+ id: "line1",
7869
+ variant: "text",
7870
+ width: "200px",
7871
+ height: "1rem"
7872
+ }
7873
+ },
7874
+ {
7875
+ id: "line2",
7876
+ component: {
7877
+ type: "Skeleton",
7878
+ id: "line2",
7879
+ variant: "text",
7880
+ width: "150px",
7881
+ height: "1rem"
7882
+ }
7883
+ }
7884
+ ]
7885
+ }
7886
+ }
7887
+ ]
7888
+ }
7889
+ };
7890
+ var sizeClasses = {
7891
+ sm: "h-4 w-4",
7892
+ md: "h-6 w-6",
7893
+ lg: "h-10 w-10"
7894
+ };
7895
+ var SpinnerRenderer = {
7896
+ type: "Spinner",
7897
+ render: ({ component, id }) => {
7898
+ const size = component.size || "md";
7899
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7900
+ "div",
7901
+ {
7902
+ id,
7903
+ "data-a2ui-component": "Spinner",
7904
+ role: "status",
7905
+ "aria-label": component.label || "Loading",
7906
+ className: "inline-flex items-center justify-center",
7907
+ children: [
7908
+ /* @__PURE__ */ jsxRuntime.jsx(
7909
+ lucideReact.Loader2,
7910
+ {
7911
+ className: cn("animate-spin text-muted-foreground", sizeClasses[size]),
7912
+ "aria-hidden": "true"
7913
+ }
7914
+ ),
7915
+ component.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: component.label })
7916
+ ]
7917
+ }
7918
+ );
7919
+ },
7920
+ example: {
7921
+ name: "Spinner",
7922
+ description: "Loading indicator with different sizes",
7923
+ category: "display",
7924
+ messages: [
7925
+ { createSurface: { surfaceId: "spinner-demo", root: "root" } },
7926
+ {
7927
+ updateComponents: {
7928
+ surfaceId: "spinner-demo",
7929
+ components: [
7930
+ {
7931
+ id: "root",
7932
+ component: {
7933
+ type: "Row",
7934
+ id: "root",
7935
+ children: ["spinner-sm", "spinner-md", "spinner-lg"],
7936
+ distribution: "spaceAround",
7937
+ alignment: "center"
7938
+ }
7939
+ },
7940
+ {
7941
+ id: "spinner-sm",
7942
+ component: {
7943
+ type: "Spinner",
7944
+ id: "spinner-sm",
7945
+ size: "sm",
7946
+ label: "Loading small"
7947
+ }
7948
+ },
7949
+ {
7950
+ id: "spinner-md",
7951
+ component: {
7952
+ type: "Spinner",
7953
+ id: "spinner-md",
7954
+ size: "md",
7955
+ label: "Loading medium"
7956
+ }
7957
+ },
7958
+ {
7959
+ id: "spinner-lg",
7960
+ component: {
7961
+ type: "Spinner",
7962
+ id: "spinner-lg",
7963
+ size: "lg",
7964
+ label: "Loading large"
7965
+ }
7966
+ }
7967
+ ]
7968
+ }
7969
+ }
7970
+ ]
7971
+ }
7972
+ };
7541
7973
  var TextRenderer = {
7542
7974
  type: "Text",
7543
7975
  render: ({ component, data }) => {
7544
- const { content, style = "body", dataPath } = component;
7545
- const displayContent = dataPath ? data.get(dataPath) ?? content : content;
7976
+ const { style = "body", dataPath } = component;
7977
+ const textContent = getTextContent(component);
7978
+ const displayContent = dataPath ? data.get(dataPath) ?? textContent : textContent;
7546
7979
  const styleMap = {
7547
7980
  h1: { tag: "h1", className: "text-4xl font-bold" },
7548
7981
  h2: { tag: "h2", className: "text-3xl font-semibold" },
@@ -7586,7 +8019,7 @@ var TextRenderer = {
7586
8019
  component: {
7587
8020
  type: "Text",
7588
8021
  id: "h1",
7589
- content: "Heading 1 - Large Title",
8022
+ text: "Heading 1 - Large Title",
7590
8023
  style: "h1"
7591
8024
  }
7592
8025
  },
@@ -7595,7 +8028,7 @@ var TextRenderer = {
7595
8028
  component: {
7596
8029
  type: "Text",
7597
8030
  id: "h2",
7598
- content: "Heading 2 - Section Title",
8031
+ text: "Heading 2 - Section Title",
7599
8032
  style: "h2"
7600
8033
  }
7601
8034
  },
@@ -7604,7 +8037,7 @@ var TextRenderer = {
7604
8037
  component: {
7605
8038
  type: "Text",
7606
8039
  id: "h3",
7607
- content: "Heading 3 - Subsection",
8040
+ text: "Heading 3 - Subsection",
7608
8041
  style: "h3"
7609
8042
  }
7610
8043
  },
@@ -7613,7 +8046,7 @@ var TextRenderer = {
7613
8046
  component: {
7614
8047
  type: "Text",
7615
8048
  id: "h4",
7616
- content: "Heading 4 - Component Title",
8049
+ text: "Heading 4 - Component Title",
7617
8050
  style: "h4"
7618
8051
  }
7619
8052
  },
@@ -7622,7 +8055,7 @@ var TextRenderer = {
7622
8055
  component: {
7623
8056
  type: "Text",
7624
8057
  id: "h5",
7625
- content: "Heading 5 - Small Title",
8058
+ text: "Heading 5 - Small Title",
7626
8059
  style: "h5"
7627
8060
  }
7628
8061
  },
@@ -7631,7 +8064,7 @@ var TextRenderer = {
7631
8064
  component: {
7632
8065
  type: "Text",
7633
8066
  id: "body",
7634
- content: "Body text paragraph with regular content and default styling.",
8067
+ text: "Body text paragraph with regular content and default styling.",
7635
8068
  style: "body"
7636
8069
  }
7637
8070
  },
@@ -7640,7 +8073,7 @@ var TextRenderer = {
7640
8073
  component: {
7641
8074
  type: "Text",
7642
8075
  id: "caption",
7643
- content: "Caption text - muted and small",
8076
+ text: "Caption text - muted and small",
7644
8077
  style: "caption"
7645
8078
  }
7646
8079
  }
@@ -7650,6 +8083,122 @@ var TextRenderer = {
7650
8083
  ]
7651
8084
  }
7652
8085
  };
8086
+ var variantStyles2 = {
8087
+ default: "bg-background border-border",
8088
+ success: "bg-success border-success-border text-success-foreground",
8089
+ error: "bg-error border-error-border text-error-foreground",
8090
+ warning: "bg-warning border-warning-border text-warning-foreground",
8091
+ info: "bg-info border-info-border text-info-foreground"
8092
+ };
8093
+ var variantIcons2 = {
8094
+ default: null,
8095
+ success: lucideReact.CheckCircle,
8096
+ error: lucideReact.XCircle,
8097
+ warning: lucideReact.AlertCircle,
8098
+ info: lucideReact.Info
8099
+ };
8100
+ var ToastRenderer = {
8101
+ type: "Toast",
8102
+ render: ({ component, id, onAction }) => {
8103
+ const variant = component.variant || "default";
8104
+ const Icon2 = variantIcons2[variant];
8105
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8106
+ "div",
8107
+ {
8108
+ id,
8109
+ "data-a2ui-component": "Toast",
8110
+ role: "alert",
8111
+ "aria-live": "polite",
8112
+ className: cn(
8113
+ "pointer-events-auto relative flex w-full max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg",
8114
+ variantStyles2[variant]
8115
+ ),
8116
+ children: [
8117
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-5 w-5 flex-shrink-0 mt-0.5", "aria-hidden": "true" }),
8118
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1", children: [
8119
+ component.title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-foreground", children: component.title }),
8120
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: component.message }),
8121
+ component.actionLabel && component.action && /* @__PURE__ */ jsxRuntime.jsx(
8122
+ "button",
8123
+ {
8124
+ type: "button",
8125
+ onClick: () => onAction?.({ type: component.action, payload: { id: component.id } }),
8126
+ className: "text-sm font-medium text-primary hover:underline mt-2",
8127
+ children: component.actionLabel
8128
+ }
8129
+ )
8130
+ ] }),
8131
+ /* @__PURE__ */ jsxRuntime.jsx(
8132
+ "button",
8133
+ {
8134
+ type: "button",
8135
+ onClick: () => onAction?.({ type: "toast.dismiss", payload: { id: component.id } }),
8136
+ 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",
8137
+ "aria-label": "Dismiss",
8138
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
8139
+ }
8140
+ )
8141
+ ]
8142
+ }
8143
+ );
8144
+ },
8145
+ example: {
8146
+ name: "Toast",
8147
+ description: "Notification toast with variants and optional action",
8148
+ category: "display",
8149
+ messages: [
8150
+ { createSurface: { surfaceId: "toast-demo", root: "root" } },
8151
+ {
8152
+ updateComponents: {
8153
+ surfaceId: "toast-demo",
8154
+ components: [
8155
+ {
8156
+ id: "root",
8157
+ component: {
8158
+ type: "Column",
8159
+ id: "root",
8160
+ children: ["toast-success", "toast-error", "toast-info"]
8161
+ }
8162
+ },
8163
+ {
8164
+ id: "toast-success",
8165
+ component: {
8166
+ type: "Toast",
8167
+ id: "toast-success",
8168
+ variant: "success",
8169
+ title: "Success!",
8170
+ message: "Your changes have been saved."
8171
+ }
8172
+ },
8173
+ {
8174
+ id: "toast-error",
8175
+ component: {
8176
+ type: "Toast",
8177
+ id: "toast-error",
8178
+ variant: "error",
8179
+ title: "Error",
8180
+ message: "Something went wrong. Please try again.",
8181
+ actionLabel: "Retry",
8182
+ action: "retry"
8183
+ }
8184
+ },
8185
+ {
8186
+ id: "toast-info",
8187
+ component: {
8188
+ type: "Toast",
8189
+ id: "toast-info",
8190
+ variant: "info",
8191
+ message: "New version available!",
8192
+ actionLabel: "Update",
8193
+ action: "update"
8194
+ }
8195
+ }
8196
+ ]
8197
+ }
8198
+ }
8199
+ ]
8200
+ }
8201
+ };
7653
8202
  var VideoRenderer = {
7654
8203
  type: "Video",
7655
8204
  render: ({ component }) => {
@@ -8930,6 +9479,12 @@ var shadcnRenderers = [
8930
9479
  ColumnRenderer,
8931
9480
  // Display
8932
9481
  TextRenderer,
9482
+ MarkdownRenderer,
9483
+ SpinnerRenderer,
9484
+ SkeletonRenderer,
9485
+ ToastRenderer,
9486
+ AlertRenderer,
9487
+ ProgressRenderer,
8933
9488
  ImageRenderer,
8934
9489
  IconRenderer,
8935
9490
  DividerRenderer,
@@ -8948,6 +9503,7 @@ var shadcnRenderers = [
8948
9503
  CardRenderer,
8949
9504
  ModalRenderer,
8950
9505
  TabsRenderer,
9506
+ StepperRenderer,
8951
9507
  ListRenderer,
8952
9508
  // Charts
8953
9509
  PieChartRenderer,
@@ -9103,11 +9659,13 @@ exports.AnimatedTooltipRenderer = AnimatedTooltipRenderer;
9103
9659
  exports.AreaChartRenderer = AreaChartRenderer;
9104
9660
  exports.ArticleRenderer = ArticleRenderer;
9105
9661
  exports.AsideRenderer = AsideRenderer;
9662
+ exports.AudioPlayerRenderer = AudioPlayerRenderer;
9106
9663
  exports.AuroraBackgroundRenderer = AuroraBackgroundRenderer;
9107
9664
  exports.BarChartRenderer = BarChartRenderer;
9108
9665
  exports.BlurRevealTextRenderer = BlurRevealTextRenderer;
9109
9666
  exports.BubbleBackgroundRenderer = BubbleBackgroundRenderer;
9110
9667
  exports.Button = Button;
9668
+ exports.CardRenderer = CardRenderer;
9111
9669
  exports.Checkbox = Checkbox;
9112
9670
  exports.ComponentRenderer = ComponentRenderer;
9113
9671
  exports.CopyButtonRenderer = CopyButtonRenderer;
@@ -9124,6 +9682,7 @@ exports.DialogOverlay = DialogOverlay;
9124
9682
  exports.DialogPortal = DialogPortal;
9125
9683
  exports.DialogTitle = DialogTitle;
9126
9684
  exports.DialogTrigger = DialogTrigger;
9685
+ exports.DividerRenderer = DividerRenderer;
9127
9686
  exports.FireworksBackgroundRenderer = FireworksBackgroundRenderer;
9128
9687
  exports.FlipButtonRenderer = FlipButtonRenderer;
9129
9688
  exports.FlipCardRenderer = FlipCardRenderer;
@@ -9136,14 +9695,19 @@ exports.HeaderRenderer = HeaderRenderer;
9136
9695
  exports.HexagonBackgroundRenderer = HexagonBackgroundRenderer;
9137
9696
  exports.HoleBackgroundRenderer = HoleBackgroundRenderer;
9138
9697
  exports.IconButtonRenderer = IconButtonRenderer;
9698
+ exports.IconRenderer = IconRenderer;
9699
+ exports.ImageRenderer = ImageRenderer;
9139
9700
  exports.Input = Input;
9140
9701
  exports.Label = Label;
9141
9702
  exports.LineChartRenderer = LineChartRenderer;
9142
9703
  exports.LiquidButtonRenderer = LiquidButtonRenderer;
9704
+ exports.ListRenderer = ListRenderer;
9143
9705
  exports.LiveRegionRenderer = LiveRegionRenderer;
9144
9706
  exports.MagneticButtonRenderer = MagneticButtonRenderer;
9145
9707
  exports.MainRenderer = MainRenderer;
9708
+ exports.MarkdownRenderer = MarkdownRenderer;
9146
9709
  exports.MessageParseError = MessageParseError;
9710
+ exports.ModalRenderer = ModalRenderer;
9147
9711
  exports.MorphingIconRenderer = MorphingIconRenderer;
9148
9712
  exports.NavRenderer = NavRenderer;
9149
9713
  exports.ParticlesBackgroundRenderer = ParticlesBackgroundRenderer;
@@ -9152,17 +9716,24 @@ exports.ProgressRenderer = ProgressRenderer;
9152
9716
  exports.RippleButtonRenderer = RippleButtonRenderer;
9153
9717
  exports.SectionRenderer = SectionRenderer;
9154
9718
  exports.ShimmerButtonRenderer = ShimmerButtonRenderer;
9719
+ exports.SkeletonRenderer = SkeletonRenderer;
9155
9720
  exports.SkipLinkRenderer = SkipLinkRenderer;
9721
+ exports.SpinnerRenderer = SpinnerRenderer;
9156
9722
  exports.SpotlightRenderer = SpotlightRenderer;
9157
9723
  exports.StarsBackgroundRenderer = StarsBackgroundRenderer;
9724
+ exports.StepperRenderer = StepperRenderer;
9158
9725
  exports.Tabs = Tabs;
9159
9726
  exports.TabsContent = TabsContent;
9160
9727
  exports.TabsList = TabsList;
9728
+ exports.TabsRenderer = TabsRenderer;
9161
9729
  exports.TabsTrigger = TabsTrigger;
9730
+ exports.TextRenderer = TextRenderer;
9162
9731
  exports.TextScrambleRenderer = TextScrambleRenderer;
9163
9732
  exports.Textarea = Textarea;
9164
9733
  exports.ThemeTogglerButtonRenderer = ThemeTogglerButtonRenderer;
9734
+ exports.ToastRenderer = ToastRenderer;
9165
9735
  exports.TypewriterTextRenderer = TypewriterTextRenderer;
9736
+ exports.VideoRenderer = VideoRenderer;
9166
9737
  exports.a11yRenderers = a11yRenderers;
9167
9738
  exports.allAnimatedRenderers = allAnimatedRenderers;
9168
9739
  exports.allRenderers = allRenderers;