@apteva/apteva-kit 0.1.80 → 0.1.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -22,7 +22,7 @@ interface Widget {
22
22
  props: Record<string, any>;
23
23
  actions?: Action[];
24
24
  /** Additional data not displayed but captured via onWidgetRender */
25
- meta?: Record<string, any>;
25
+ metadata?: Record<string, any>;
26
26
  /** Whether the widget is still receiving streaming data */
27
27
  isStreaming?: boolean;
28
28
  }
@@ -192,8 +192,8 @@ declare const WIDGET_DEFINITIONS: {
192
192
  readonly example: "@ui:card[{\"title\": \"Summary\", \"description\": \"Details here\"}]";
193
193
  };
194
194
  readonly list: {
195
- readonly schema: "items: [{id, title, subtitle?, description?}], actions?: [{type, label}]";
196
- readonly example: "@ui:list[{\"items\": [{\"id\": \"1\", \"title\": \"Item\", \"subtitle\": \"Info\"}]}]";
195
+ readonly schema: "items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked";
196
+ readonly example: "@ui:list[{\"items\": [{\"id\": \"1\", \"title\": \"Item\", \"subtitle\": \"Info\", \"metadata\": {\"key\": \"value\"}}]}]";
197
197
  };
198
198
  readonly button_group: {
199
199
  readonly schema: "buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits";
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@ interface Widget {
22
22
  props: Record<string, any>;
23
23
  actions?: Action[];
24
24
  /** Additional data not displayed but captured via onWidgetRender */
25
- meta?: Record<string, any>;
25
+ metadata?: Record<string, any>;
26
26
  /** Whether the widget is still receiving streaming data */
27
27
  isStreaming?: boolean;
28
28
  }
@@ -192,8 +192,8 @@ declare const WIDGET_DEFINITIONS: {
192
192
  readonly example: "@ui:card[{\"title\": \"Summary\", \"description\": \"Details here\"}]";
193
193
  };
194
194
  readonly list: {
195
- readonly schema: "items: [{id, title, subtitle?, description?}], actions?: [{type, label}]";
196
- readonly example: "@ui:list[{\"items\": [{\"id\": \"1\", \"title\": \"Item\", \"subtitle\": \"Info\"}]}]";
195
+ readonly schema: "items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked";
196
+ readonly example: "@ui:list[{\"items\": [{\"id\": \"1\", \"title\": \"Item\", \"subtitle\": \"Info\", \"metadata\": {\"key\": \"value\"}}]}]";
197
197
  };
198
198
  readonly button_group: {
199
199
  readonly schema: "buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits";
package/dist/index.js CHANGED
@@ -691,7 +691,7 @@ function parseWidgetsFromText(text) {
691
691
  const trimmedJson = jsonContent.trim();
692
692
  const parsed = JSON.parse(trimmedJson);
693
693
  const widgetId = `widget-${widgetType}-${simpleHash(trimmedJson)}`;
694
- const { meta, actions, ...props } = parsed;
694
+ const { metadata, actions, ...props } = parsed;
695
695
  segments.push({
696
696
  type: "widget",
697
697
  widget: {
@@ -699,7 +699,7 @@ function parseWidgetsFromText(text) {
699
699
  id: widgetId,
700
700
  props,
701
701
  ...actions && { actions },
702
- ...meta && { meta }
702
+ ...metadata && { metadata }
703
703
  }
704
704
  });
705
705
  hasWidgets = true;
@@ -739,8 +739,8 @@ var WIDGET_DEFINITIONS = {
739
739
  example: '@ui:card[{"title": "Summary", "description": "Details here"}]'
740
740
  },
741
741
  list: {
742
- schema: "items: [{id, title, subtitle?, description?}], actions?: [{type, label}]",
743
- example: '@ui:list[{"items": [{"id": "1", "title": "Item", "subtitle": "Info"}]}]'
742
+ schema: "items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked",
743
+ example: '@ui:list[{"items": [{"id": "1", "title": "Item", "subtitle": "Info", "metadata": {"key": "value"}}]}]'
744
744
  },
745
745
  button_group: {
746
746
  schema: "buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits",
@@ -772,8 +772,6 @@ SYNTAX: @ui:type[{json}] - MUST use SQUARE BRACKETS [] around the JSON object.
772
772
  CORRECT: @ui:list[{"items": [...]}]
773
773
  WRONG: @ui:list{"items": [...]} (missing square brackets)
774
774
 
775
- "meta" field (at root level, NOT inside items) holds extended data captured by UI.
776
-
777
775
  `;
778
776
  for (const type of widgets) {
779
777
  const def = WIDGET_DEFINITIONS[type];
@@ -782,14 +780,14 @@ WRONG: @ui:list{"items": [...]} (missing square brackets)
782
780
  `;
783
781
  }
784
782
  context += `
785
- Meta example: @ui:list[{"items": [{"id": "1", "title": "X"}], "meta": {"items": [{"id": "1", "title": "X", "extra": "..."}]}}]
783
+ Per-item "metadata" is sent as payload on action click.
786
784
  `;
787
785
  return context;
788
786
  }
789
787
  function generateCompactWidgetContext(enabledWidgets) {
790
788
  const widgets = enabledWidgets || ALL_WIDGET_TYPES;
791
789
  return `
792
- Widgets: @ui:type[{json}] - MUST use square brackets []. Example: @ui:list[{"items": [...]}]. Types: ${widgets.join(", ")}. Add "meta" at root for extended data.
790
+ Widgets: @ui:type[{json}] - MUST use square brackets []. Example: @ui:list[{"items": [...]}]. Types: ${widgets.join(", ")}. Per-item "metadata" is sent as action payload.
793
791
  `;
794
792
  }
795
793