@flowgram.ai/form-materials 0.3.3 → 0.3.5

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 (103) hide show
  1. package/bin/index.ts +5 -19
  2. package/bin/materials.ts +31 -89
  3. package/bin/project.ts +4 -0
  4. package/bin/utils/import.ts +127 -0
  5. package/bin/utils/traverse-file.ts +60 -0
  6. package/dist/esm/index.js +431 -505
  7. package/dist/esm/index.js.map +1 -1
  8. package/dist/index.d.mts +77 -23
  9. package/dist/index.d.ts +77 -23
  10. package/dist/index.js +657 -731
  11. package/dist/index.js.map +1 -1
  12. package/package.json +5 -5
  13. package/src/components/assign-row/index.tsx +4 -4
  14. package/src/components/assign-rows/index.tsx +1 -1
  15. package/src/components/batch-outputs/index.tsx +4 -3
  16. package/src/components/batch-outputs/types.ts +1 -1
  17. package/src/components/batch-variable-selector/index.tsx +1 -1
  18. package/src/components/code-editor-mini/index.tsx +1 -1
  19. package/src/components/condition-row/constants.ts +2 -2
  20. package/src/components/condition-row/hooks/useOp.tsx +13 -9
  21. package/src/components/condition-row/hooks/useRule.ts +8 -4
  22. package/src/components/condition-row/index.tsx +27 -10
  23. package/src/components/condition-row/types.ts +5 -7
  24. package/src/components/constant-input/index.tsx +5 -2
  25. package/src/components/constant-input/types.ts +1 -1
  26. package/src/components/display-flow-value/index.tsx +2 -2
  27. package/src/components/display-inputs-values/index.tsx +3 -2
  28. package/src/components/display-outputs/index.tsx +2 -1
  29. package/src/components/display-schema-tag/index.tsx +3 -2
  30. package/src/components/display-schema-tree/index.tsx +2 -1
  31. package/src/components/dynamic-value-input/hooks.ts +1 -1
  32. package/src/components/dynamic-value-input/index.tsx +13 -9
  33. package/src/components/inputs-values/index.tsx +7 -5
  34. package/src/components/inputs-values/types.ts +3 -3
  35. package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +1 -1
  36. package/src/components/json-editor-with-variables/index.tsx +2 -1
  37. package/src/components/json-schema-editor/default-value.tsx +11 -105
  38. package/src/components/json-schema-editor/hooks.tsx +53 -94
  39. package/src/components/json-schema-editor/index.tsx +18 -12
  40. package/src/components/json-schema-editor/styles.tsx +0 -29
  41. package/src/components/prompt-editor/types.tsx +1 -1
  42. package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +2 -1
  43. package/src/components/prompt-editor-with-inputs/index.tsx +3 -2
  44. package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
  45. package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +1 -1
  46. package/src/components/prompt-editor-with-variables/index.tsx +2 -1
  47. package/src/components/type-selector/index.tsx +9 -7
  48. package/src/components/variable-selector/index.tsx +9 -5
  49. package/src/components/variable-selector/use-variable-tree.tsx +1 -1
  50. package/src/effects/auto-rename-ref/index.ts +1 -1
  51. package/src/effects/listen-ref-schema-change/index.ts +1 -1
  52. package/src/effects/listen-ref-value-change/index.ts +1 -1
  53. package/src/effects/provide-batch-input/index.ts +1 -1
  54. package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
  55. package/src/form-plugins/infer-assign-plugin/index.ts +1 -1
  56. package/src/form-plugins/infer-inputs-plugin/index.ts +1 -1
  57. package/src/plugins/json-schema-preset/type-definition/array.tsx +3 -1
  58. package/src/plugins/json-schema-preset/type-definition/boolean.tsx +4 -3
  59. package/src/plugins/json-schema-preset/type-definition/integer.tsx +2 -1
  60. package/src/plugins/json-schema-preset/type-definition/number.tsx +2 -1
  61. package/src/plugins/json-schema-preset/type-definition/object.tsx +3 -1
  62. package/src/plugins/json-schema-preset/type-definition/string.tsx +7 -1
  63. package/src/shared/index.ts +1 -0
  64. package/src/shared/inject-material/README.md +170 -0
  65. package/src/shared/inject-material/README.zh.md +174 -0
  66. package/src/shared/inject-material/index.tsx +87 -0
  67. package/src/components/assign-row/config.json +0 -11
  68. package/src/components/assign-rows/config.json +0 -11
  69. package/src/components/batch-outputs/config.json +0 -13
  70. package/src/components/batch-variable-selector/config.json +0 -9
  71. package/src/components/code-editor/config.json +0 -10
  72. package/src/components/code-editor-mini/config.json +0 -7
  73. package/src/components/condition-row/config.json +0 -13
  74. package/src/components/constant-input/config.json +0 -9
  75. package/src/components/display-flow-value/config.json +0 -8
  76. package/src/components/display-inputs-values/config.json +0 -9
  77. package/src/components/display-outputs/config.json +0 -10
  78. package/src/components/display-schema-tag/config.json +0 -10
  79. package/src/components/display-schema-tree/config.json +0 -11
  80. package/src/components/dynamic-value-input/config.json +0 -14
  81. package/src/components/inputs-values/config.json +0 -13
  82. package/src/components/json-editor-with-variables/config.json +0 -13
  83. package/src/components/json-schema-editor/config.json +0 -13
  84. package/src/components/json-schema-editor/utils.ts +0 -29
  85. package/src/components/prompt-editor/config.json +0 -9
  86. package/src/components/prompt-editor-with-inputs/config.json +0 -13
  87. package/src/components/prompt-editor-with-variables/config.json +0 -13
  88. package/src/components/type-selector/config.json +0 -9
  89. package/src/components/variable-selector/config.json +0 -9
  90. package/src/effects/auto-rename-ref/config.json +0 -5
  91. package/src/effects/listen-ref-schema-change/config.json +0 -10
  92. package/src/effects/listen-ref-value-change/config.json +0 -9
  93. package/src/effects/provide-batch-input/config.json +0 -5
  94. package/src/effects/provide-json-schema-outputs/config.json +0 -7
  95. package/src/effects/sync-variable-title/config.json +0 -5
  96. package/src/effects/validate-when-variable-sync/config.json +0 -5
  97. package/src/form-plugins/batch-outputs-plugin/config.json +0 -7
  98. package/src/form-plugins/infer-assign-plugin/config.json +0 -7
  99. package/src/form-plugins/infer-inputs-plugin/config.json +0 -9
  100. package/src/hooks/use-object-list/config.json +0 -8
  101. package/src/shared/format-legacy-refs/config.json +0 -5
  102. package/src/typings/flow-value/config.json +0 -7
  103. package/src/validate/validate-flow-value/config.json +0 -7
@@ -1,13 +0,0 @@
1
- {
2
- "name": "condition-row",
3
- "depMaterials": [
4
- "variable-selector",
5
- "dynamic-value-input",
6
- "flow-value"
7
- ],
8
- "depPackages": [
9
- "@douyinfe/semi-ui",
10
- "styled-components",
11
- "@flowgram.ai/json-schema"
12
- ]
13
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "constant-input",
3
- "depMaterials": [
4
- "plugins/json-schema-preset"
5
- ],
6
- "depPackages": [
7
- "@douyinfe/semi-ui"
8
- ]
9
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "display-flow-value",
3
- "depMaterials": [
4
- "components/display-schema-tag",
5
- "typings/flow-value"
6
- ],
7
- "depPackages": []
8
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "display-outputs",
3
- "depMaterials": [
4
- "components/display-schema-tag"
5
- ],
6
- "depPackages": [
7
- "@douyinfe/semi-ui"
8
- ]
9
- }
@@ -1,10 +0,0 @@
1
- {
2
- "name": "display-outputs",
3
- "depMaterials": [
4
- "components/display-flow-value"
5
- ],
6
- "depPackages": [
7
- "@douyinfe/semi-ui",
8
- "styled-components"
9
- ]
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "name": "display-schema-tag",
3
- "depMaterials": [
4
- "components/display-schema-tree"
5
- ],
6
- "depPackages": [
7
- "@douyinfe/semi-ui",
8
- "styled-components"
9
- ]
10
- }
@@ -1,11 +0,0 @@
1
- {
2
- "name": "display-schema-tree",
3
- "depMaterials": [
4
- "plugins/json-schema-preset"
5
- ],
6
- "depPackages": [
7
- "@douyinfe/semi-ui",
8
- "styled-components",
9
- "@flowgram.ai/json-schema"
10
- ]
11
- }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "dynamic-value-input",
3
- "depMaterials": [
4
- "flow-value",
5
- "constant-input",
6
- "variable-selector"
7
- ],
8
- "depPackages": [
9
- "@douyinfe/semi-ui",
10
- "@douyinfe/semi-icons",
11
- "styled-components",
12
- "@flowgram.ai/json-schema"
13
- ]
14
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "inputs-values",
3
- "depMaterials": [
4
- "flow-value",
5
- "dynamic-value-input"
6
- ],
7
- "depPackages": [
8
- "@douyinfe/semi-ui",
9
- "@douyinfe/semi-icons",
10
- "styled-components",
11
- "@flowgram.ai/json-schema"
12
- ]
13
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "json-editor-with-variables",
3
- "depMaterials": [
4
- "variable-selector",
5
- "code-editor"
6
- ],
7
- "depPackages": [
8
- "@coze-editor/editor@0.1.0-alpha.879fbb",
9
- "@codemirror/view",
10
- "styled-components",
11
- "@douyinfe/semi-ui"
12
- ]
13
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "json-schema-editor",
3
- "depMaterials": [
4
- "type-selector",
5
- "constant-inputs"
6
- ],
7
- "depPackages": [
8
- "@douyinfe/semi-ui",
9
- "@douyinfe/semi-icons",
10
- "styled-components",
11
- "@flowgram.ai/json-schema"
12
- ]
13
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
- * SPDX-License-Identifier: MIT
4
- */
5
-
6
- /**
7
- * Return the corresponding string description according to the type of the input value.根据输入值的类型返回对应的字符串描述。
8
- * @param value - 需要判断类型的值。The value whose type needs to be judged.
9
- * @returns 返回值的类型字符串 The type string of the return value('string', 'integer', 'number', 'boolean', 'object', 'array', 'other')。
10
- */
11
- export function getValueType(value: any): string {
12
- const type = typeof value;
13
-
14
- if (type === 'string') {
15
- return 'string';
16
- } else if (type === 'number') {
17
- return Number.isInteger(value) ? 'integer' : 'number';
18
- } else if (type === 'boolean') {
19
- return 'boolean';
20
- } else if (type === 'object') {
21
- if (value === null) {
22
- return 'other';
23
- }
24
- return Array.isArray(value) ? 'array' : 'object';
25
- } else {
26
- // undefined, function, symbol, bigint etc.
27
- return 'other';
28
- }
29
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "prompt-editor",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "@coze-editor/editor@0.1.0-alpha.879fbb",
6
- "@codemirror/view",
7
- "styled-components"
8
- ]
9
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "prompt-editor-with-inputs",
3
- "depMaterials": [
4
- "prompt-editor",
5
- "flow-value"
6
- ],
7
- "depPackages": [
8
- "@coze-editor/editor@0.1.0-alpha.879fbb",
9
- "@codemirror/view",
10
- "styled-components",
11
- "@douyinfe/semi-ui"
12
- ]
13
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "prompt-editor-with-variables",
3
- "depMaterials": [
4
- "variable-selector",
5
- "prompt-editor"
6
- ],
7
- "depPackages": [
8
- "@coze-editor/editor@0.1.0-alpha.879fbb",
9
- "@codemirror/view",
10
- "styled-components",
11
- "@douyinfe/semi-ui"
12
- ]
13
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "type-selector",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "@douyinfe/semi-ui",
6
- "@douyinfe/semi-icons",
7
- "@flowgram.ai/json-schema"
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "variable-selector",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "@douyinfe/semi-ui",
6
- "styled-components",
7
- "@flowgram.ai/json-schema"
8
- ]
9
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "auto-rename-ref",
3
- "depMaterials": ["flow-value"],
4
- "depPackages": ["lodash"]
5
- }
@@ -1,10 +0,0 @@
1
- {
2
- "name": "listen-ref-schema-change",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": [
7
- "lodash",
8
- "@flowgram.ai/json-schema"
9
- ]
10
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "listen-ref-value-change",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": [
7
- "lodash"
8
- ]
9
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "provide-batch-input",
3
- "depMaterials": ["flow-value"],
4
- "depPackages": []
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "provide-json-schema-outputs",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "@flowgram.ai/json-schema"
6
- ]
7
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "sync-variable-title",
3
- "depMaterials": [],
4
- "depPackages": []
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "validate-when-variable-sync",
3
- "depMaterials": [],
4
- "depPackages": []
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "batch-outputs-plugin",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "infer-assign-plugin",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": []
7
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "infer-inputs-plugin",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": [
7
- "@flowgram.ai/json-schema"
8
- ]
9
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "use-object-list",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "lodash",
6
- "nanoid"
7
- ]
8
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "format-legacy-ref",
3
- "depMaterials": [],
4
- "depPackages": []
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "flow-value",
3
- "depMaterials": [],
4
- "depPackages": [
5
- "@flowgram.ai/json-schema"
6
- ]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "validate-flow-value",
3
- "depMaterials": [
4
- "flow-value"
5
- ],
6
- "depPackages": []
7
- }