@optiaxiom/proteus 0.2.4 → 0.2.6

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.
Files changed (25) hide show
  1. package/dist/esm/_virtual/_openai-shim-script.js +1 -1
  2. package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BMEbDhgW.css → ProteusChart.css.ts.vanilla-UlV5bM-e.css} +2 -2
  3. package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-DeE905en.css → ProteusChartTooltipContent.css.ts.vanilla-DFvGuq6I.css} +2 -2
  4. package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-JoQXI97u.css → ProteusDocumentShell.css.ts.vanilla-C3__yEhR.css} +2 -2
  5. package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-D8aYxZmX.css → ProteusImageCarousel.css.ts.vanilla-bCVJ5JAJ.css} +2 -2
  6. package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-CyslVupM.css → ProteusQuestion.css.ts.vanilla-usVGixHc.css} +2 -2
  7. package/dist/esm/index.js +1 -0
  8. package/dist/esm/proteus-bridge/ProteusBridge.js +1 -1
  9. package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
  10. package/dist/esm/proteus-chart/ProteusChart.js +1 -1
  11. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
  12. package/dist/esm/proteus-data-table/ProteusDataTable.js +1 -1
  13. package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
  14. package/dist/esm/proteus-document/ProteusDocumentShell.js +2 -0
  15. package/dist/esm/proteus-document/resolveProteusValue.js +18 -6
  16. package/dist/esm/proteus-element/ProteusElement.js +3 -0
  17. package/dist/esm/proteus-file-upload/ProteusFileUpload.js +66 -0
  18. package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +1 -1
  19. package/dist/esm/proteus-image-carousel/ProteusImageCarousel.js +4 -1
  20. package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
  21. package/dist/esm/schema/public-schema.json.js +128 -18
  22. package/dist/esm/schema/runtime-schema.json.js +124 -17
  23. package/dist/index.d.ts +45 -8
  24. package/dist/spec.d.ts +864 -749
  25. package/package.json +3 -3
@@ -2722,6 +2722,9 @@ var definitions = {
2722
2722
  {
2723
2723
  $ref: "#/definitions/ProteusField"
2724
2724
  },
2725
+ {
2726
+ $ref: "#/definitions/ProteusFileUpload"
2727
+ },
2725
2728
  {
2726
2729
  $ref: "#/definitions/ProteusGroup"
2727
2730
  },
@@ -2819,9 +2822,12 @@ var definitions = {
2819
2822
  },
2820
2823
  {
2821
2824
  type: "string"
2825
+ },
2826
+ {
2827
+ $ref: "#/definitions/ProteusStructuredMessage"
2822
2828
  }
2823
2829
  ],
2824
- description: "Message to send to LLM via sendNewMessage(). Can be a string, a Value reference, or a Map expression."
2830
+ description: "Message to send to LLM via sendNewMessage(). Can be a string, a Value reference, a Map expression, or a structured payload with parts and files."
2825
2831
  }
2826
2832
  },
2827
2833
  required: [
@@ -2917,6 +2923,54 @@ var definitions = {
2917
2923
  ],
2918
2924
  description: "A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)"
2919
2925
  },
2926
+ ProteusStructuredMessage: {
2927
+ description: "Structured message payload that lets file URLs travel as a typed list alongside the text parts, instead of being joined into the text.",
2928
+ properties: {
2929
+ files: {
2930
+ anyOf: [
2931
+ {
2932
+ items: {
2933
+ type: "string"
2934
+ },
2935
+ type: "array"
2936
+ },
2937
+ {
2938
+ $ref: "#/definitions/ProteusExpression"
2939
+ }
2940
+ ],
2941
+ description: "List of file URLs (typically signed URLs from a host upload)."
2942
+ },
2943
+ parts: {
2944
+ items: {
2945
+ properties: {
2946
+ content: {
2947
+ anyOf: [
2948
+ {
2949
+ type: "string"
2950
+ },
2951
+ {
2952
+ $ref: "#/definitions/ProteusExpression"
2953
+ }
2954
+ ]
2955
+ },
2956
+ type: {
2957
+ "const": "text"
2958
+ }
2959
+ },
2960
+ required: [
2961
+ "type",
2962
+ "content"
2963
+ ],
2964
+ type: "object"
2965
+ },
2966
+ type: "array"
2967
+ }
2968
+ },
2969
+ required: [
2970
+ "parts"
2971
+ ],
2972
+ type: "object"
2973
+ },
2920
2974
  ProteusZip: {
2921
2975
  description: "Zips multiple parallel arrays into an array of objects. Each key in 'sources' becomes a property in the resulting row objects.",
2922
2976
  examples: [
@@ -4663,24 +4717,31 @@ var definitions = {
4663
4717
  description: "Chart layout direction"
4664
4718
  },
4665
4719
  series: {
4666
- description: "Data series configuration",
4667
- items: {
4668
- properties: {
4669
- dataKey: {
4670
- description: "Key in data records for this series",
4671
- type: "string"
4720
+ anyOf: [
4721
+ {
4722
+ description: "Data series configuration",
4723
+ items: {
4724
+ properties: {
4725
+ dataKey: {
4726
+ description: "Key in data records for this series",
4727
+ type: "string"
4728
+ },
4729
+ name: {
4730
+ description: "Display name for legend",
4731
+ type: "string"
4732
+ }
4733
+ },
4734
+ required: [
4735
+ "dataKey"
4736
+ ],
4737
+ type: "object"
4672
4738
  },
4673
- name: {
4674
- description: "Display name for legend",
4675
- type: "string"
4676
- }
4739
+ type: "array"
4677
4740
  },
4678
- required: [
4679
- "dataKey"
4680
- ],
4681
- type: "object"
4682
- },
4683
- type: "array"
4741
+ {
4742
+ $ref: "#/definitions/ProteusExpression"
4743
+ }
4744
+ ]
4684
4745
  },
4685
4746
  type: {
4686
4747
  anyOf: [
@@ -5049,6 +5110,52 @@ var definitions = {
5049
5110
  ],
5050
5111
  type: "object"
5051
5112
  },
5113
+ ProteusFileUpload: {
5114
+ examples: [
5115
+ {
5116
+ $type: "FileUpload",
5117
+ name: "value"
5118
+ }
5119
+ ],
5120
+ properties: {
5121
+ $type: {
5122
+ "const": "FileUpload"
5123
+ },
5124
+ accept: {
5125
+ description: "File types to accept; array of MIME types or extensions.",
5126
+ items: {
5127
+ type: "string"
5128
+ },
5129
+ type: "array"
5130
+ },
5131
+ name: {
5132
+ anyOf: [
5133
+ {
5134
+ type: "string"
5135
+ },
5136
+ {
5137
+ $ref: "#/definitions/ProteusExpression"
5138
+ }
5139
+ ],
5140
+ description: "The name of the form control element. The resolved URL is written at parentPath/name in form data."
5141
+ },
5142
+ required: {
5143
+ anyOf: [
5144
+ {
5145
+ type: "boolean"
5146
+ },
5147
+ {
5148
+ $ref: "#/definitions/ProteusExpression"
5149
+ }
5150
+ ],
5151
+ description: "Whether a file is required."
5152
+ }
5153
+ },
5154
+ required: [
5155
+ "$type"
5156
+ ],
5157
+ type: "object"
5158
+ },
5052
5159
  ProteusGroup: {
5053
5160
  examples: [
5054
5161
  {
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ type ProteusChartProps = {
38
38
  /**
39
39
  * Data series configuration
40
40
  */
41
- series: Series[];
41
+ series?: Series[];
42
42
  /**
43
43
  * Chart type
44
44
  */
@@ -57,7 +57,7 @@ type ProteusDataTableProps = {
57
57
  /**
58
58
  * Column definitions
59
59
  */
60
- columns: ColumnDef[];
60
+ columns?: ColumnDef[];
61
61
  /**
62
62
  * Column data
63
63
  */
@@ -77,6 +77,28 @@ declare const ProteusDataTable: {
77
77
  displayName: string;
78
78
  };
79
79
 
80
+ type ProteusFileUploadProps = {
81
+ /**
82
+ * File types to accept; array of MIME types or extensions.
83
+ *
84
+ * @example ["image/*", ".pdf"]
85
+ */
86
+ accept?: string[];
87
+ /**
88
+ * The name of the form control element. The resolved URL is written at
89
+ * `parentPath/name` in form data once the host's `onUpload` resolves.
90
+ */
91
+ name?: string;
92
+ /**
93
+ * Whether a file is required.
94
+ */
95
+ required?: boolean;
96
+ };
97
+ declare function ProteusFileUpload({ accept, name }: ProteusFileUploadProps): react_jsx_runtime.JSX.Element;
98
+ declare namespace ProteusFileUpload {
99
+ var displayName: string;
100
+ }
101
+
80
102
  type ProteusImageCarouselProps = {
81
103
  /**
82
104
  * Array of image data to display in the carousel.
@@ -213,6 +235,7 @@ type ProteusValueProps = {
213
235
  path: string;
214
236
  };
215
237
 
238
+ type UploadFile = (file: File) => Promise<string>;
216
239
  type UseResource = (resource: string) => {
217
240
  data: undefined | {
218
241
  mimeType: string;
@@ -249,13 +272,20 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
249
272
  */
250
273
  onInteraction?: (name: string, params?: Record<string, unknown>) => Promise<unknown> | unknown;
251
274
  /**
252
- * Callback when user sends a message action
275
+ * Callback when user sends a message action. The payload may be a plain
276
+ * string or a structured object (parts + optional files), depending on
277
+ * what the document declares for `Action.onClick.message`.
253
278
  */
254
- onMessage?: (message: string) => Promise<void> | void;
279
+ onMessage?: (message: string | StructuredMessage) => Promise<void> | void;
255
280
  /**
256
281
  * Callback when an analytics event is fired
257
282
  */
258
283
  onTrack?: (event: string, properties: Record<string, string>) => void;
284
+ /**
285
+ * Async upload callback used by FileUpload elements. Receives a File and
286
+ * resolves to a URL string the document writes into form data.
287
+ */
288
+ onUpload?: UploadFile;
259
289
  /**
260
290
  * Whether form is readonly
261
291
  */
@@ -280,7 +310,7 @@ type ProteusDocument$2 = {
280
310
  title?: ReactNode;
281
311
  titleIcon?: string;
282
312
  };
283
- declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, onTrack, open: openProp, readOnly, strict, useResource, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
313
+ declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, onTrack, onUpload, open: openProp, readOnly, strict, useResource, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
284
314
  declare namespace ProteusDocumentShell {
285
315
  var displayName: string;
286
316
  }
@@ -294,7 +324,14 @@ type ProteusEventHandler = {
294
324
  interaction: string;
295
325
  params?: Record<string, unknown>;
296
326
  } | {
297
- message: string;
327
+ message: string | StructuredMessage;
328
+ };
329
+ type StructuredMessage = {
330
+ files?: string[];
331
+ parts: Array<{
332
+ content: string;
333
+ type: "text";
334
+ }>;
298
335
  };
299
336
  type ProteusDocument$1 = ProteusDocumentShellProps["element"] & {
300
337
  $type: "Document";
@@ -358,5 +395,5 @@ declare namespace ProteusTextarea {
358
395
 
359
396
  declare function useProteusValue(element: ProteusValueProps): any;
360
397
 
361
- export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
362
- export type { ProteusDocumentRendererProps, ProteusDocumentShellProps };
398
+ export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
399
+ export type { ProteusDocumentRendererProps, ProteusDocumentShellProps, ProteusFileUploadProps, StructuredMessage, UploadFile };