@genfeedai/workflow-ui 0.1.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.
Files changed (86) hide show
  1. package/dist/canvas.d.mts +27 -0
  2. package/dist/canvas.d.ts +27 -0
  3. package/dist/canvas.js +45 -0
  4. package/dist/canvas.mjs +16 -0
  5. package/dist/chunk-22PDGHNQ.mjs +737 -0
  6. package/dist/chunk-3SPPKCWR.js +458 -0
  7. package/dist/chunk-3YFFDHC5.js +300 -0
  8. package/dist/chunk-5HJFQVUR.js +61 -0
  9. package/dist/chunk-5LQ4QBR5.js +2 -0
  10. package/dist/chunk-6DOEUDD5.js +254 -0
  11. package/dist/chunk-7SKSRSS7.mjs +57 -0
  12. package/dist/chunk-AC6TWLRT.mjs +27 -0
  13. package/dist/chunk-ADWNF7V3.js +120 -0
  14. package/dist/chunk-BJ3R5R32.mjs +2163 -0
  15. package/dist/chunk-CETJJ73S.js +1555 -0
  16. package/dist/chunk-CSUBLSKZ.mjs +1002 -0
  17. package/dist/chunk-CV4M7CNU.mjs +251 -0
  18. package/dist/chunk-E323WAZG.mjs +272 -0
  19. package/dist/chunk-E544XUBL.js +378 -0
  20. package/dist/chunk-EC2ZIWOK.js +1007 -0
  21. package/dist/chunk-EFXQT23N.mjs +99 -0
  22. package/dist/chunk-EMUMKW5C.js +107 -0
  23. package/dist/chunk-FOMOOERN.js +2 -0
  24. package/dist/chunk-FT33LFII.mjs +21 -0
  25. package/dist/chunk-FT64PCUP.mjs +533 -0
  26. package/dist/chunk-H6LZKSLY.js +5678 -0
  27. package/dist/chunk-HPQT36RR.js +543 -0
  28. package/dist/chunk-JLWKW3G5.js +2 -0
  29. package/dist/chunk-L5TF4EHW.mjs +1 -0
  30. package/dist/chunk-LAJ34AH2.mjs +374 -0
  31. package/dist/chunk-LDN7IX4Y.mjs +1 -0
  32. package/dist/chunk-MLJJBBTB.mjs +1 -0
  33. package/dist/chunk-NSDLGLAQ.js +2166 -0
  34. package/dist/chunk-RJ262NXS.js +24 -0
  35. package/dist/chunk-RXNEDWK2.js +141 -0
  36. package/dist/chunk-SW7QNEZU.js +744 -0
  37. package/dist/chunk-UQQUWGHW.mjs +118 -0
  38. package/dist/chunk-VOGL2WCE.mjs +1542 -0
  39. package/dist/chunk-VRN3UWE5.mjs +138 -0
  40. package/dist/chunk-XV5Z5XYR.mjs +5640 -0
  41. package/dist/chunk-Z7PWFZG5.js +30 -0
  42. package/dist/chunk-ZJD5WMR3.mjs +418 -0
  43. package/dist/hooks.d.mts +255 -0
  44. package/dist/hooks.d.ts +255 -0
  45. package/dist/hooks.js +56 -0
  46. package/dist/hooks.mjs +11 -0
  47. package/dist/index.d.mts +29 -0
  48. package/dist/index.d.ts +29 -0
  49. package/dist/index.js +180 -0
  50. package/dist/index.mjs +19 -0
  51. package/dist/lib.d.mts +164 -0
  52. package/dist/lib.d.ts +164 -0
  53. package/dist/lib.js +144 -0
  54. package/dist/lib.mjs +3 -0
  55. package/dist/nodes.d.mts +128 -0
  56. package/dist/nodes.d.ts +128 -0
  57. package/dist/nodes.js +151 -0
  58. package/dist/nodes.mjs +14 -0
  59. package/dist/panels.d.mts +22 -0
  60. package/dist/panels.d.ts +22 -0
  61. package/dist/panels.js +21 -0
  62. package/dist/panels.mjs +4 -0
  63. package/dist/promptLibraryStore-BZnfmEkc.d.ts +464 -0
  64. package/dist/promptLibraryStore-zqb59nsu.d.mts +464 -0
  65. package/dist/provider.d.mts +29 -0
  66. package/dist/provider.d.ts +29 -0
  67. package/dist/provider.js +17 -0
  68. package/dist/provider.mjs +4 -0
  69. package/dist/stores.d.mts +96 -0
  70. package/dist/stores.d.ts +96 -0
  71. package/dist/stores.js +113 -0
  72. package/dist/stores.mjs +43 -0
  73. package/dist/toolbar.d.mts +73 -0
  74. package/dist/toolbar.d.ts +73 -0
  75. package/dist/toolbar.js +34 -0
  76. package/dist/toolbar.mjs +5 -0
  77. package/dist/types-ipAnBzAJ.d.mts +46 -0
  78. package/dist/types-ipAnBzAJ.d.ts +46 -0
  79. package/dist/ui.d.mts +67 -0
  80. package/dist/ui.d.ts +67 -0
  81. package/dist/ui.js +84 -0
  82. package/dist/ui.mjs +3 -0
  83. package/dist/workflowStore-4EGKJLYK.mjs +3 -0
  84. package/dist/workflowStore-KM32FDL7.js +12 -0
  85. package/package.json +117 -0
  86. package/src/styles/workflow-ui.css +186 -0
@@ -0,0 +1,99 @@
1
+ // src/lib/schemaUtils.ts
2
+ function getSchemaDefaults(schema) {
3
+ if (!schema) return {};
4
+ const properties = schema.properties;
5
+ if (!properties) return {};
6
+ const defaults = {};
7
+ for (const [key, prop] of Object.entries(properties)) {
8
+ if (prop.default !== void 0) {
9
+ defaults[key] = prop.default;
10
+ }
11
+ }
12
+ return defaults;
13
+ }
14
+ function supportsImageInput(schema) {
15
+ if (!schema) return true;
16
+ const properties = schema.properties;
17
+ if (!properties) return true;
18
+ return !!(properties.image || properties.image_input || properties.start_image || properties.first_frame_image || properties.reference_images);
19
+ }
20
+ function extractEnumValues(componentSchemas) {
21
+ if (!componentSchemas) return void 0;
22
+ const result = {};
23
+ for (const [key, schema] of Object.entries(componentSchemas)) {
24
+ if (schema.enum && Array.isArray(schema.enum)) {
25
+ result[key] = schema.enum.map((v) => String(v));
26
+ }
27
+ }
28
+ return Object.keys(result).length > 0 ? result : void 0;
29
+ }
30
+
31
+ // src/lib/schemaValidation.ts
32
+ function validateRequiredSchemaFields(inputSchema, values, skipFields) {
33
+ if (!inputSchema) {
34
+ return { isValid: true, missingFields: [] };
35
+ }
36
+ const schema = inputSchema;
37
+ const requiredFields = schema.required ?? [];
38
+ if (requiredFields.length === 0) {
39
+ return { isValid: true, missingFields: [] };
40
+ }
41
+ const missingFields = [];
42
+ for (const field of requiredFields) {
43
+ if (skipFields.has(field)) {
44
+ continue;
45
+ }
46
+ const value = values[field];
47
+ if (value === void 0 || value === null || value === "") {
48
+ missingFields.push(field);
49
+ }
50
+ }
51
+ return {
52
+ isValid: missingFields.length === 0,
53
+ missingFields
54
+ };
55
+ }
56
+ var CONNECTION_FIELDS = /* @__PURE__ */ new Set([
57
+ "prompt",
58
+ "image",
59
+ "image_input",
60
+ "video",
61
+ "audio",
62
+ "start_image",
63
+ "first_frame_image",
64
+ "last_frame",
65
+ "reference_images",
66
+ "image_url",
67
+ "video_url",
68
+ "end_image",
69
+ "start_video_id",
70
+ "end_video_id",
71
+ "subject_reference",
72
+ "image_prompt",
73
+ "mask"
74
+ ]);
75
+
76
+ // src/lib/media.ts
77
+ function getImageDimensions(src) {
78
+ return new Promise((resolve) => {
79
+ const img = new window.Image();
80
+ img.crossOrigin = "anonymous";
81
+ img.onload = () => resolve({ width: img.width, height: img.height });
82
+ img.onerror = () => resolve({ width: 0, height: 0 });
83
+ img.src = src;
84
+ });
85
+ }
86
+ function getVideoMetadata(src) {
87
+ return new Promise((resolve) => {
88
+ const video = document.createElement("video");
89
+ video.crossOrigin = "anonymous";
90
+ video.onloadedmetadata = () => resolve({
91
+ duration: video.duration,
92
+ dimensions: { width: video.videoWidth, height: video.videoHeight }
93
+ });
94
+ video.onerror = () => resolve({ duration: 0, dimensions: { width: 0, height: 0 } });
95
+ video.src = src;
96
+ });
97
+ }
98
+
99
+ export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields };
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ // src/lib/schemaUtils.ts
4
+ function getSchemaDefaults(schema) {
5
+ if (!schema) return {};
6
+ const properties = schema.properties;
7
+ if (!properties) return {};
8
+ const defaults = {};
9
+ for (const [key, prop] of Object.entries(properties)) {
10
+ if (prop.default !== void 0) {
11
+ defaults[key] = prop.default;
12
+ }
13
+ }
14
+ return defaults;
15
+ }
16
+ function supportsImageInput(schema) {
17
+ if (!schema) return true;
18
+ const properties = schema.properties;
19
+ if (!properties) return true;
20
+ return !!(properties.image || properties.image_input || properties.start_image || properties.first_frame_image || properties.reference_images);
21
+ }
22
+ function extractEnumValues(componentSchemas) {
23
+ if (!componentSchemas) return void 0;
24
+ const result = {};
25
+ for (const [key, schema] of Object.entries(componentSchemas)) {
26
+ if (schema.enum && Array.isArray(schema.enum)) {
27
+ result[key] = schema.enum.map((v) => String(v));
28
+ }
29
+ }
30
+ return Object.keys(result).length > 0 ? result : void 0;
31
+ }
32
+
33
+ // src/lib/schemaValidation.ts
34
+ function validateRequiredSchemaFields(inputSchema, values, skipFields) {
35
+ if (!inputSchema) {
36
+ return { isValid: true, missingFields: [] };
37
+ }
38
+ const schema = inputSchema;
39
+ const requiredFields = schema.required ?? [];
40
+ if (requiredFields.length === 0) {
41
+ return { isValid: true, missingFields: [] };
42
+ }
43
+ const missingFields = [];
44
+ for (const field of requiredFields) {
45
+ if (skipFields.has(field)) {
46
+ continue;
47
+ }
48
+ const value = values[field];
49
+ if (value === void 0 || value === null || value === "") {
50
+ missingFields.push(field);
51
+ }
52
+ }
53
+ return {
54
+ isValid: missingFields.length === 0,
55
+ missingFields
56
+ };
57
+ }
58
+ var CONNECTION_FIELDS = /* @__PURE__ */ new Set([
59
+ "prompt",
60
+ "image",
61
+ "image_input",
62
+ "video",
63
+ "audio",
64
+ "start_image",
65
+ "first_frame_image",
66
+ "last_frame",
67
+ "reference_images",
68
+ "image_url",
69
+ "video_url",
70
+ "end_image",
71
+ "start_video_id",
72
+ "end_video_id",
73
+ "subject_reference",
74
+ "image_prompt",
75
+ "mask"
76
+ ]);
77
+
78
+ // src/lib/media.ts
79
+ function getImageDimensions(src) {
80
+ return new Promise((resolve) => {
81
+ const img = new window.Image();
82
+ img.crossOrigin = "anonymous";
83
+ img.onload = () => resolve({ width: img.width, height: img.height });
84
+ img.onerror = () => resolve({ width: 0, height: 0 });
85
+ img.src = src;
86
+ });
87
+ }
88
+ function getVideoMetadata(src) {
89
+ return new Promise((resolve) => {
90
+ const video = document.createElement("video");
91
+ video.crossOrigin = "anonymous";
92
+ video.onloadedmetadata = () => resolve({
93
+ duration: video.duration,
94
+ dimensions: { width: video.videoWidth, height: video.videoHeight }
95
+ });
96
+ video.onerror = () => resolve({ duration: 0, dimensions: { width: 0, height: 0 } });
97
+ video.src = src;
98
+ });
99
+ }
100
+
101
+ exports.CONNECTION_FIELDS = CONNECTION_FIELDS;
102
+ exports.extractEnumValues = extractEnumValues;
103
+ exports.getImageDimensions = getImageDimensions;
104
+ exports.getSchemaDefaults = getSchemaDefaults;
105
+ exports.getVideoMetadata = getVideoMetadata;
106
+ exports.supportsImageInput = supportsImageInput;
107
+ exports.validateRequiredSchemaFields = validateRequiredSchemaFields;
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ import { configurePromptLibrary } from './chunk-VRN3UWE5.mjs';
2
+ import { createContext, useEffect, useContext } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var WorkflowUIContext = createContext({});
6
+ function WorkflowUIProvider({
7
+ config,
8
+ children
9
+ }) {
10
+ useEffect(() => {
11
+ if (config.promptLibrary) {
12
+ configurePromptLibrary(config.promptLibrary);
13
+ }
14
+ }, [config.promptLibrary]);
15
+ return /* @__PURE__ */ jsx(WorkflowUIContext.Provider, { value: config, children });
16
+ }
17
+ function useWorkflowUIConfig() {
18
+ return useContext(WorkflowUIContext);
19
+ }
20
+
21
+ export { WorkflowUIProvider, useWorkflowUIConfig };