@kemu-io/hs-react 0.2.39 → 0.3.1

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 (75) hide show
  1. package/cjs/WidgetWrapper.d.ts +64 -4
  2. package/cjs/components/BaseWidget.d.ts +66 -0
  3. package/cjs/components/BaseWidget.js +6 -0
  4. package/cjs/components/CheckboxField.d.ts +27 -0
  5. package/cjs/components/CheckboxField.js +3 -0
  6. package/cjs/components/CommonElements.d.ts +9 -0
  7. package/cjs/components/CommonElements.js +1 -0
  8. package/cjs/components/Field.d.ts +25 -0
  9. package/cjs/components/Field.js +9 -0
  10. package/cjs/components/FieldWithLabel.d.ts +35 -0
  11. package/cjs/components/FieldWithLabel.js +1 -0
  12. package/cjs/components/HorizontalField.d.ts +24 -0
  13. package/cjs/components/HorizontalField.js +9 -0
  14. package/cjs/components/KemuLightButton.d.ts +16 -0
  15. package/cjs/components/KemuLightButton.js +43 -0
  16. package/cjs/components/KemuPrimaryButton.d.ts +16 -0
  17. package/cjs/components/KemuPrimaryButton.js +43 -0
  18. package/cjs/components/KemuThemeWrapper.d.ts +44 -0
  19. package/cjs/components/KemuThemeWrapper.js +1 -0
  20. package/cjs/components/SettingsBar.d.ts +36 -0
  21. package/cjs/components/SettingsBar.js +8 -0
  22. package/cjs/components/SettingsDialog.d.ts +81 -0
  23. package/cjs/components/SettingsDialog.js +74 -0
  24. package/cjs/components/SvgContainer.d.ts +26 -0
  25. package/cjs/components/SvgContainer.js +9 -0
  26. package/cjs/components/WidgetBody.d.ts +20 -0
  27. package/cjs/components/WidgetBody.js +9 -0
  28. package/cjs/components/index.d.ts +326 -1
  29. package/cjs/components/index.js +1 -1
  30. package/cjs/hooks/index.d.ts +64 -4
  31. package/cjs/hooks/useOnBroadcastEvent.d.ts +64 -4
  32. package/cjs/hooks/useOnParentEvent.d.ts +64 -4
  33. package/cjs/hooks/useOnSetOutputsEvent.d.ts +64 -4
  34. package/cjs/lib/InstanceContext.d.ts +64 -4
  35. package/cjs/lib/globalContext.d.ts +64 -4
  36. package/cjs/types/context_t.d.ts +64 -4
  37. package/cjs/types/widgetUI_t.d.ts +64 -4
  38. package/mjs/WidgetWrapper.d.ts +64 -4
  39. package/mjs/components/BaseWidget.d.ts +66 -0
  40. package/mjs/components/BaseWidget.js +6 -0
  41. package/mjs/components/CheckboxField.d.ts +27 -0
  42. package/mjs/components/CheckboxField.js +3 -0
  43. package/mjs/components/CommonElements.d.ts +9 -0
  44. package/mjs/components/CommonElements.js +1 -0
  45. package/mjs/components/Field.d.ts +25 -0
  46. package/mjs/components/Field.js +9 -0
  47. package/mjs/components/FieldWithLabel.d.ts +35 -0
  48. package/mjs/components/FieldWithLabel.js +1 -0
  49. package/mjs/components/HorizontalField.d.ts +24 -0
  50. package/mjs/components/HorizontalField.js +9 -0
  51. package/mjs/components/KemuLightButton.d.ts +16 -0
  52. package/mjs/components/KemuLightButton.js +43 -0
  53. package/mjs/components/KemuPrimaryButton.d.ts +16 -0
  54. package/mjs/components/KemuPrimaryButton.js +43 -0
  55. package/mjs/components/KemuThemeWrapper.d.ts +44 -0
  56. package/mjs/components/KemuThemeWrapper.js +1 -0
  57. package/mjs/components/SettingsBar.d.ts +36 -0
  58. package/mjs/components/SettingsBar.js +8 -0
  59. package/mjs/components/SettingsDialog.d.ts +81 -0
  60. package/mjs/components/SettingsDialog.js +74 -0
  61. package/mjs/components/SvgContainer.d.ts +26 -0
  62. package/mjs/components/SvgContainer.js +9 -0
  63. package/mjs/components/WidgetBody.d.ts +20 -0
  64. package/mjs/components/WidgetBody.js +9 -0
  65. package/mjs/components/index.d.ts +326 -1
  66. package/mjs/components/index.js +1 -1
  67. package/mjs/hooks/index.d.ts +64 -4
  68. package/mjs/hooks/useOnBroadcastEvent.d.ts +64 -4
  69. package/mjs/hooks/useOnParentEvent.d.ts +64 -4
  70. package/mjs/hooks/useOnSetOutputsEvent.d.ts +64 -4
  71. package/mjs/lib/InstanceContext.d.ts +64 -4
  72. package/mjs/lib/globalContext.d.ts +64 -4
  73. package/mjs/types/context_t.d.ts +64 -4
  74. package/mjs/types/widgetUI_t.d.ts +64 -4
  75. package/package.json +3 -1
@@ -124,6 +124,17 @@ export type WidgetPort = {
124
124
  * processor execution.
125
125
  */
126
126
  triggerPort?: boolean;
127
+ /**
128
+ * A path to a markdown file that will be rendered as the ports documentation.
129
+ * If provided it will override the default 'description' property. Useful if the documentation of this port requires more than a simple text.
130
+ *
131
+ * The path can be relative to the service's `docs` folder. For example:
132
+ *
133
+ * ```
134
+ * docs/ports/inputA.md
135
+ * ```
136
+ */
137
+ mdHelp?: string;
127
138
  };
128
139
  export type WidgetState<T extends Record<string, any> = Record<string, unknown>> = T;
129
140
  export type TargetOutput = {
@@ -148,6 +159,9 @@ export type TargetOutput = {
148
159
  /** id of the variant that defined the output */
149
160
  variantId?: string;
150
161
  };
162
+ export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
163
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
164
+ }[Keys];
151
165
  export type WidgetPortStr = Omit<WidgetPort, "type"> & {
152
166
  type: string;
153
167
  };
@@ -177,7 +191,20 @@ export type ServiceWidgetVariant<P extends WidgetPort | WidgetPortStr> = {
177
191
  inputs?: P[];
178
192
  outputs?: P[];
179
193
  };
180
- export type ValidPlatformArch = "win-x64" | "win-x86" | "win-arm" | "win-arm64" | "osx-x64" | "osx-arm64";
194
+ /**
195
+ * A list of supported Linux distributions. This can be extended in the future.
196
+ * Use 'generic' for distribution-agnostic services.
197
+ */
198
+ export type LinuxDistribution =
199
+ /** For distribution-agnostic services that run on most Linux systems. */
200
+ "generic"
201
+ /** Includes Debian, Ubuntu, Linux Mint, etc. (uses APT) */
202
+ | "debian"
203
+ /** Includes RHEL, Fedora, CentOS, etc. (uses YUM/DNF) */
204
+ | "rhel"
205
+ /** Includes Arch Linux, Manjaro, etc. (uses Pacman) */
206
+ | "arch";
207
+ export type ValidPlatformArch = "win-x64" | "win-x86" | "win-arm" | "win-arm64" | "osx-x64" | "osx-arm64" | `linux-${LinuxDistribution}-x64` | `linux-${LinuxDistribution}-arm64`;
181
208
  export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
182
209
  /** the unique name defined by the service */
183
210
  name: string;
@@ -187,7 +214,17 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
187
214
  title?: string;
188
215
  /** a shorten title to be used in the canvas */
189
216
  shortTitle?: string;
217
+ /** generic description shown when a service is selected from the Hub Services Grid */
190
218
  description: string;
219
+ /**
220
+ * Relative to the markdown file that will be rendered when the user clicks on the 'help' icon for this service.
221
+ * The description is meant to be short and include video/sample images or a link to the description page. Eg:
222
+ *
223
+ * ```
224
+ * docs/help.md
225
+ * ```
226
+ **/
227
+ mdHelp?: string;
191
228
  processor: ProcessorType;
192
229
  /** Id of the user that published the service */
193
230
  author: string;
@@ -269,6 +306,32 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
269
306
  * and be visually distinct.
270
307
  */
271
308
  variants?: ServiceWidgetVariant<P>[];
309
+ /**
310
+ * The default variant info. If provided, it allows overriding the default info
311
+ * of the service. Useful when the default variant behaviour does not match the service description.
312
+ */
313
+ defaultVariantInfo?: {
314
+ /**
315
+ * The title of the default variant. If provided, it will override the `title` property.
316
+ */
317
+ title?: string;
318
+ /**
319
+ * The short title of the default variant. If provided, it will override the `shortTitle` property.
320
+ */
321
+ shortTitle?: string;
322
+ /**
323
+ * The description of the default variant. If provided, it will override the `description` property.
324
+ */
325
+ description?: string;
326
+ /**
327
+ * The color of the default variant. If provided, it will override the `color` property.
328
+ */
329
+ color?: string;
330
+ /**
331
+ * The SVG icon of the default variant. If provided, it will override the `svgIcon` property.
332
+ */
333
+ svgIcon?: string;
334
+ };
272
335
  /**
273
336
  * A list of relative paths to folders containing extra services that are part of this service. Eg:
274
337
  * ```json
@@ -341,9 +404,6 @@ export type ProcessedManifest<B extends Buffer | ArrayBuffer = Buffer> = Omit<Pa
341
404
  version: string;
342
405
  };
343
406
  };
344
- export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
345
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
346
- }[Keys];
347
407
  export type DefineDynamicPortsArgs = RequireAtLeastOne<{
348
408
  /**
349
409
  * Set to null to remove any previously defined ports or
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kemu-io/hs-react",
3
3
  "type": "module",
4
- "version": "0.2.39",
4
+ "version": "0.3.1",
5
5
  "description": "Kemu Hub Service library for React",
6
6
  "author": "Kemu Pty Ltd",
7
7
  "main": "cjs/WidgetWrapper.js",
@@ -38,6 +38,8 @@
38
38
  "@emotion/cache": "^11.13.1",
39
39
  "@emotion/react": "^11.13.0",
40
40
  "@emotion/styled": "^11.13.0",
41
+ "@mui/icons-material": "^7.3.4",
42
+ "@mui/material": "^7.3.4",
41
43
  "re-resizable": "^6.9.17",
42
44
  "react": "^18.3.1",
43
45
  "react-dom": "^18.3.1"