@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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
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 {
|
|
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
|
-
...
|
|
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
|
|
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
|
-
|
|
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(", ")}.
|
|
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
|
|