@powerhousedao/powerhouse-vetra-packages 6.0.0-dev.100

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 (256) hide show
  1. package/LICENSE +661 -0
  2. package/dist/document-models/document-models.d.ts +3 -0
  3. package/dist/document-models/document-models.d.ts.map +1 -0
  4. package/dist/document-models/document-models.js +2 -0
  5. package/dist/document-models/document-models.js.map +1 -0
  6. package/dist/editors/document-model-editor/components/button.d.ts +2 -0
  7. package/dist/editors/document-model-editor/components/button.d.ts.map +1 -0
  8. package/dist/editors/document-model-editor/components/button.js +8 -0
  9. package/dist/editors/document-model-editor/components/button.js.map +1 -0
  10. package/dist/editors/document-model-editor/components/code-editors/constants.d.ts +3 -0
  11. package/dist/editors/document-model-editor/components/code-editors/constants.d.ts.map +1 -0
  12. package/dist/editors/document-model-editor/components/code-editors/constants.js +38 -0
  13. package/dist/editors/document-model-editor/components/code-editors/constants.js.map +1 -0
  14. package/dist/editors/document-model-editor/components/code-editors/factories.d.ts +4 -0
  15. package/dist/editors/document-model-editor/components/code-editors/factories.d.ts.map +1 -0
  16. package/dist/editors/document-model-editor/components/code-editors/factories.js +47 -0
  17. package/dist/editors/document-model-editor/components/code-editors/factories.js.map +1 -0
  18. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.d.ts +10 -0
  19. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.d.ts.map +1 -0
  20. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.js +73 -0
  21. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.js.map +1 -0
  22. package/dist/editors/document-model-editor/components/code-editors/hooks.d.ts +23 -0
  23. package/dist/editors/document-model-editor/components/code-editors/hooks.d.ts.map +1 -0
  24. package/dist/editors/document-model-editor/components/code-editors/hooks.js +59 -0
  25. package/dist/editors/document-model-editor/components/code-editors/hooks.js.map +1 -0
  26. package/dist/editors/document-model-editor/components/code-editors/json-editor.d.ts +8 -0
  27. package/dist/editors/document-model-editor/components/code-editors/json-editor.d.ts.map +1 -0
  28. package/dist/editors/document-model-editor/components/code-editors/json-editor.js +47 -0
  29. package/dist/editors/document-model-editor/components/code-editors/json-editor.js.map +1 -0
  30. package/dist/editors/document-model-editor/components/code-editors/linting.d.ts +6 -0
  31. package/dist/editors/document-model-editor/components/code-editors/linting.d.ts.map +1 -0
  32. package/dist/editors/document-model-editor/components/code-editors/linting.js +59 -0
  33. package/dist/editors/document-model-editor/components/code-editors/linting.js.map +1 -0
  34. package/dist/editors/document-model-editor/components/divider.d.ts +8 -0
  35. package/dist/editors/document-model-editor/components/divider.d.ts.map +1 -0
  36. package/dist/editors/document-model-editor/components/divider.js +22 -0
  37. package/dist/editors/document-model-editor/components/divider.js.map +1 -0
  38. package/dist/editors/document-model-editor/components/errors.d.ts +6 -0
  39. package/dist/editors/document-model-editor/components/errors.d.ts.map +1 -0
  40. package/dist/editors/document-model-editor/components/errors.js +5 -0
  41. package/dist/editors/document-model-editor/components/errors.js.map +1 -0
  42. package/dist/editors/document-model-editor/components/form.d.ts +12 -0
  43. package/dist/editors/document-model-editor/components/form.d.ts.map +1 -0
  44. package/dist/editors/document-model-editor/components/form.js +43 -0
  45. package/dist/editors/document-model-editor/components/form.js.map +1 -0
  46. package/dist/editors/document-model-editor/components/input.d.ts +6 -0
  47. package/dist/editors/document-model-editor/components/input.d.ts.map +1 -0
  48. package/dist/editors/document-model-editor/components/input.js +9 -0
  49. package/dist/editors/document-model-editor/components/input.js.map +1 -0
  50. package/dist/editors/document-model-editor/components/label.d.ts +6 -0
  51. package/dist/editors/document-model-editor/components/label.d.ts.map +1 -0
  52. package/dist/editors/document-model-editor/components/label.js +10 -0
  53. package/dist/editors/document-model-editor/components/label.js.map +1 -0
  54. package/dist/editors/document-model-editor/components/model-metadata-form.d.ts +31 -0
  55. package/dist/editors/document-model-editor/components/model-metadata-form.d.ts.map +1 -0
  56. package/dist/editors/document-model-editor/components/model-metadata-form.js +70 -0
  57. package/dist/editors/document-model-editor/components/model-metadata-form.js.map +1 -0
  58. package/dist/editors/document-model-editor/components/module-form.d.ts +10 -0
  59. package/dist/editors/document-model-editor/components/module-form.d.ts.map +1 -0
  60. package/dist/editors/document-model-editor/components/module-form.js +22 -0
  61. package/dist/editors/document-model-editor/components/module-form.js.map +1 -0
  62. package/dist/editors/document-model-editor/components/module.d.ts +22 -0
  63. package/dist/editors/document-model-editor/components/module.d.ts.map +1 -0
  64. package/dist/editors/document-model-editor/components/module.js +10 -0
  65. package/dist/editors/document-model-editor/components/module.js.map +1 -0
  66. package/dist/editors/document-model-editor/components/modules.d.ts +20 -0
  67. package/dist/editors/document-model-editor/components/modules.d.ts.map +1 -0
  68. package/dist/editors/document-model-editor/components/modules.js +17 -0
  69. package/dist/editors/document-model-editor/components/modules.js.map +1 -0
  70. package/dist/editors/document-model-editor/components/operation-description-form.d.ts +9 -0
  71. package/dist/editors/document-model-editor/components/operation-description-form.d.ts.map +1 -0
  72. package/dist/editors/document-model-editor/components/operation-description-form.js +13 -0
  73. package/dist/editors/document-model-editor/components/operation-description-form.js.map +1 -0
  74. package/dist/editors/document-model-editor/components/operation-error-form.d.ts +13 -0
  75. package/dist/editors/document-model-editor/components/operation-error-form.d.ts.map +1 -0
  76. package/dist/editors/document-model-editor/components/operation-error-form.js +40 -0
  77. package/dist/editors/document-model-editor/components/operation-error-form.js.map +1 -0
  78. package/dist/editors/document-model-editor/components/operation-errors.d.ts +10 -0
  79. package/dist/editors/document-model-editor/components/operation-errors.d.ts.map +1 -0
  80. package/dist/editors/document-model-editor/components/operation-errors.js +17 -0
  81. package/dist/editors/document-model-editor/components/operation-errors.js.map +1 -0
  82. package/dist/editors/document-model-editor/components/operation-form.d.ts +13 -0
  83. package/dist/editors/document-model-editor/components/operation-form.d.ts.map +1 -0
  84. package/dist/editors/document-model-editor/components/operation-form.js +37 -0
  85. package/dist/editors/document-model-editor/components/operation-form.js.map +1 -0
  86. package/dist/editors/document-model-editor/components/operation.d.ts +23 -0
  87. package/dist/editors/document-model-editor/components/operation.d.ts.map +1 -0
  88. package/dist/editors/document-model-editor/components/operation.js +25 -0
  89. package/dist/editors/document-model-editor/components/operation.js.map +1 -0
  90. package/dist/editors/document-model-editor/components/operations.d.ts +18 -0
  91. package/dist/editors/document-model-editor/components/operations.d.ts.map +1 -0
  92. package/dist/editors/document-model-editor/components/operations.js +20 -0
  93. package/dist/editors/document-model-editor/components/operations.js.map +1 -0
  94. package/dist/editors/document-model-editor/components/state-error.d.ts +5 -0
  95. package/dist/editors/document-model-editor/components/state-error.d.ts.map +1 -0
  96. package/dist/editors/document-model-editor/components/state-error.js +21 -0
  97. package/dist/editors/document-model-editor/components/state-error.js.map +1 -0
  98. package/dist/editors/document-model-editor/components/state-schemas.d.ts +15 -0
  99. package/dist/editors/document-model-editor/components/state-schemas.d.ts.map +1 -0
  100. package/dist/editors/document-model-editor/components/state-schemas.js +81 -0
  101. package/dist/editors/document-model-editor/components/state-schemas.js.map +1 -0
  102. package/dist/editors/document-model-editor/components/tabs.d.ts +8 -0
  103. package/dist/editors/document-model-editor/components/tabs.d.ts.map +1 -0
  104. package/dist/editors/document-model-editor/components/tabs.js +13 -0
  105. package/dist/editors/document-model-editor/components/tabs.js.map +1 -0
  106. package/dist/editors/document-model-editor/components/text-area.d.ts +9 -0
  107. package/dist/editors/document-model-editor/components/text-area.d.ts.map +1 -0
  108. package/dist/editors/document-model-editor/components/text-area.js +27 -0
  109. package/dist/editors/document-model-editor/components/text-area.js.map +1 -0
  110. package/dist/editors/document-model-editor/components/text-field.d.ts +21 -0
  111. package/dist/editors/document-model-editor/components/text-field.d.ts.map +1 -0
  112. package/dist/editors/document-model-editor/components/text-field.js +80 -0
  113. package/dist/editors/document-model-editor/components/text-field.js.map +1 -0
  114. package/dist/editors/document-model-editor/config.d.ts +3 -0
  115. package/dist/editors/document-model-editor/config.d.ts.map +1 -0
  116. package/dist/editors/document-model-editor/config.js +4 -0
  117. package/dist/editors/document-model-editor/config.js.map +1 -0
  118. package/dist/editors/document-model-editor/constants/documents.d.ts +13 -0
  119. package/dist/editors/document-model-editor/constants/documents.d.ts.map +1 -0
  120. package/dist/editors/document-model-editor/constants/documents.js +18 -0
  121. package/dist/editors/document-model-editor/constants/documents.js.map +1 -0
  122. package/dist/editors/document-model-editor/constants/graphql-kinds.d.ts +9 -0
  123. package/dist/editors/document-model-editor/constants/graphql-kinds.d.ts.map +1 -0
  124. package/dist/editors/document-model-editor/constants/graphql-kinds.js +13 -0
  125. package/dist/editors/document-model-editor/constants/graphql-kinds.js.map +1 -0
  126. package/dist/editors/document-model-editor/context/form-context.d.ts +11 -0
  127. package/dist/editors/document-model-editor/context/form-context.d.ts.map +1 -0
  128. package/dist/editors/document-model-editor/context/form-context.js +4 -0
  129. package/dist/editors/document-model-editor/context/form-context.js.map +1 -0
  130. package/dist/editors/document-model-editor/context/schema-context.d.ts +18 -0
  131. package/dist/editors/document-model-editor/context/schema-context.d.ts.map +1 -0
  132. package/dist/editors/document-model-editor/context/schema-context.js +129 -0
  133. package/dist/editors/document-model-editor/context/schema-context.js.map +1 -0
  134. package/dist/editors/document-model-editor/editor.d.ts +2 -0
  135. package/dist/editors/document-model-editor/editor.d.ts.map +1 -0
  136. package/dist/editors/document-model-editor/editor.js +217 -0
  137. package/dist/editors/document-model-editor/editor.js.map +1 -0
  138. package/dist/editors/document-model-editor/hooks/index.d.ts +3 -0
  139. package/dist/editors/document-model-editor/hooks/index.d.ts.map +1 -0
  140. package/dist/editors/document-model-editor/hooks/index.js +3 -0
  141. package/dist/editors/document-model-editor/hooks/index.js.map +1 -0
  142. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.d.ts +5 -0
  143. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +1 -0
  144. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.js +8 -0
  145. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.js.map +1 -0
  146. package/dist/editors/document-model-editor/hooks/useFormField.d.ts +13 -0
  147. package/dist/editors/document-model-editor/hooks/useFormField.d.ts.map +1 -0
  148. package/dist/editors/document-model-editor/hooks/useFormField.js +22 -0
  149. package/dist/editors/document-model-editor/hooks/useFormField.js.map +1 -0
  150. package/dist/editors/document-model-editor/index.d.ts +2 -0
  151. package/dist/editors/document-model-editor/index.d.ts.map +1 -0
  152. package/dist/editors/document-model-editor/index.js +2 -0
  153. package/dist/editors/document-model-editor/index.js.map +1 -0
  154. package/dist/editors/document-model-editor/module.d.ts +3 -0
  155. package/dist/editors/document-model-editor/module.d.ts.map +1 -0
  156. package/dist/editors/document-model-editor/module.js +10 -0
  157. package/dist/editors/document-model-editor/module.js.map +1 -0
  158. package/dist/editors/document-model-editor/schemas/inputs.d.ts +31 -0
  159. package/dist/editors/document-model-editor/schemas/inputs.d.ts.map +1 -0
  160. package/dist/editors/document-model-editor/schemas/inputs.js +71 -0
  161. package/dist/editors/document-model-editor/schemas/inputs.js.map +1 -0
  162. package/dist/editors/document-model-editor/schemas/utils.d.ts +3 -0
  163. package/dist/editors/document-model-editor/schemas/utils.d.ts.map +1 -0
  164. package/dist/editors/document-model-editor/schemas/utils.js +3 -0
  165. package/dist/editors/document-model-editor/schemas/utils.js.map +1 -0
  166. package/dist/editors/document-model-editor/types/documents.d.ts +26 -0
  167. package/dist/editors/document-model-editor/types/documents.d.ts.map +1 -0
  168. package/dist/editors/document-model-editor/types/documents.js +2 -0
  169. package/dist/editors/document-model-editor/types/documents.js.map +1 -0
  170. package/dist/editors/document-model-editor/types.d.ts +2 -0
  171. package/dist/editors/document-model-editor/types.d.ts.map +1 -0
  172. package/dist/editors/document-model-editor/types.js +2 -0
  173. package/dist/editors/document-model-editor/types.js.map +1 -0
  174. package/dist/editors/document-model-editor/utils/helpers.d.ts +112 -0
  175. package/dist/editors/document-model-editor/utils/helpers.d.ts.map +1 -0
  176. package/dist/editors/document-model-editor/utils/helpers.js +920 -0
  177. package/dist/editors/document-model-editor/utils/helpers.js.map +1 -0
  178. package/dist/editors/document-model-editor/utils/helpers.test.d.ts +2 -0
  179. package/dist/editors/document-model-editor/utils/helpers.test.d.ts.map +1 -0
  180. package/dist/editors/document-model-editor/utils/helpers.test.js +805 -0
  181. package/dist/editors/document-model-editor/utils/helpers.test.js.map +1 -0
  182. package/dist/editors/document-model-editor/utils/linting.d.ts +7 -0
  183. package/dist/editors/document-model-editor/utils/linting.d.ts.map +1 -0
  184. package/dist/editors/document-model-editor/utils/linting.js +49 -0
  185. package/dist/editors/document-model-editor/utils/linting.js.map +1 -0
  186. package/dist/editors/document-model-editor/utils/style.d.ts +3 -0
  187. package/dist/editors/document-model-editor/utils/style.d.ts.map +1 -0
  188. package/dist/editors/document-model-editor/utils/style.js +6 -0
  189. package/dist/editors/document-model-editor/utils/style.js.map +1 -0
  190. package/dist/editors/editors.d.ts +3 -0
  191. package/dist/editors/editors.d.ts.map +1 -0
  192. package/dist/editors/editors.js +7 -0
  193. package/dist/editors/editors.js.map +1 -0
  194. package/dist/editors/generic-drive-explorer/components/create-document.d.ts +2 -0
  195. package/dist/editors/generic-drive-explorer/components/create-document.d.ts.map +1 -0
  196. package/dist/editors/generic-drive-explorer/components/create-document.js +19 -0
  197. package/dist/editors/generic-drive-explorer/components/create-document.js.map +1 -0
  198. package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts +2 -0
  199. package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts.map +1 -0
  200. package/dist/editors/generic-drive-explorer/components/file-content-view.js +77 -0
  201. package/dist/editors/generic-drive-explorer/components/file-content-view.js.map +1 -0
  202. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts +5 -0
  203. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts.map +1 -0
  204. package/dist/editors/generic-drive-explorer/components/folder-view.js +19 -0
  205. package/dist/editors/generic-drive-explorer/components/folder-view.js.map +1 -0
  206. package/dist/editors/generic-drive-explorer/components/index.d.ts +6 -0
  207. package/dist/editors/generic-drive-explorer/components/index.d.ts.map +1 -0
  208. package/dist/editors/generic-drive-explorer/components/index.js +6 -0
  209. package/dist/editors/generic-drive-explorer/components/index.js.map +1 -0
  210. package/dist/editors/generic-drive-explorer/components/layout.d.ts +12 -0
  211. package/dist/editors/generic-drive-explorer/components/layout.d.ts.map +1 -0
  212. package/dist/editors/generic-drive-explorer/components/layout.js +21 -0
  213. package/dist/editors/generic-drive-explorer/components/layout.js.map +1 -0
  214. package/dist/editors/generic-drive-explorer/components/search-bar.d.ts +2 -0
  215. package/dist/editors/generic-drive-explorer/components/search-bar.d.ts.map +1 -0
  216. package/dist/editors/generic-drive-explorer/components/search-bar.js +38 -0
  217. package/dist/editors/generic-drive-explorer/components/search-bar.js.map +1 -0
  218. package/dist/editors/generic-drive-explorer/config.d.ts +3 -0
  219. package/dist/editors/generic-drive-explorer/config.d.ts.map +1 -0
  220. package/dist/editors/generic-drive-explorer/config.js +5 -0
  221. package/dist/editors/generic-drive-explorer/config.js.map +1 -0
  222. package/dist/editors/generic-drive-explorer/editor.d.ts +3 -0
  223. package/dist/editors/generic-drive-explorer/editor.d.ts.map +1 -0
  224. package/dist/editors/generic-drive-explorer/editor.js +16 -0
  225. package/dist/editors/generic-drive-explorer/editor.js.map +1 -0
  226. package/dist/editors/generic-drive-explorer/index.d.ts +3 -0
  227. package/dist/editors/generic-drive-explorer/index.d.ts.map +1 -0
  228. package/dist/editors/generic-drive-explorer/index.js +3 -0
  229. package/dist/editors/generic-drive-explorer/index.js.map +1 -0
  230. package/dist/editors/generic-drive-explorer/module.d.ts +3 -0
  231. package/dist/editors/generic-drive-explorer/module.d.ts.map +1 -0
  232. package/dist/editors/generic-drive-explorer/module.js +10 -0
  233. package/dist/editors/generic-drive-explorer/module.js.map +1 -0
  234. package/dist/editors/generic-drive-explorer/utils/cn.d.ts +3 -0
  235. package/dist/editors/generic-drive-explorer/utils/cn.d.ts.map +1 -0
  236. package/dist/editors/generic-drive-explorer/utils/cn.js +6 -0
  237. package/dist/editors/generic-drive-explorer/utils/cn.js.map +1 -0
  238. package/dist/editors/generic-drive-explorer/utils/index.d.ts +3 -0
  239. package/dist/editors/generic-drive-explorer/utils/index.d.ts.map +1 -0
  240. package/dist/editors/generic-drive-explorer/utils/index.js +3 -0
  241. package/dist/editors/generic-drive-explorer/utils/index.js.map +1 -0
  242. package/dist/editors/generic-drive-explorer/utils/types.d.ts +8 -0
  243. package/dist/editors/generic-drive-explorer/utils/types.d.ts.map +1 -0
  244. package/dist/editors/generic-drive-explorer/utils/types.js +2 -0
  245. package/dist/editors/generic-drive-explorer/utils/types.js.map +1 -0
  246. package/dist/editors/index.d.ts +3 -0
  247. package/dist/editors/index.d.ts.map +1 -0
  248. package/dist/editors/index.js +3 -0
  249. package/dist/editors/index.js.map +1 -0
  250. package/dist/editors/style.css +909 -0
  251. package/dist/index.d.ts +3 -0
  252. package/dist/index.d.ts.map +1 -0
  253. package/dist/index.js +3 -0
  254. package/dist/index.js.map +1 -0
  255. package/dist/tsconfig.tsbuildinfo +1 -0
  256. package/package.json +93 -0
@@ -0,0 +1,2 @@
1
+ export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
2
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/button.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,0NAYjB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "../utils/style.js";
4
+ export const Button = forwardRef((props, ref) => {
5
+ const { className, ...rest } = props;
6
+ return (_jsx("button", { ref: ref, ...rest, className: cn("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className) }));
7
+ });
8
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAIvC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACxE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO,CACL,iBACE,GAAG,EAAE,GAAG,KACJ,IAAI,EACR,SAAS,EAAE,EAAE,CACX,sSAAsS,EACtS,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const baseKeymap: import("@codemirror/view").KeyBinding[];
2
+ export declare const baseEditorExtensions: import("@codemirror/state").Extension[];
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/constants.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,UAAU,yCAStB,CAAC;AAEF,eAAO,MAAM,oBAAoB,yCAmBhC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap, } from "@codemirror/autocomplete";
2
+ import { defaultKeymap, history, historyKeymap, indentWithTab, } from "@codemirror/commands";
3
+ import { bracketMatching, defaultHighlightStyle, foldGutter, foldKeymap, indentOnInput, syntaxHighlighting, } from "@codemirror/language";
4
+ import { lintKeymap } from "@codemirror/lint";
5
+ import { highlightSelectionMatches, searchKeymap } from "@codemirror/search";
6
+ import { EditorState } from "@codemirror/state";
7
+ import { crosshairCursor, drawSelection, dropCursor, EditorView, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, lineNumbers, rectangularSelection, } from "@codemirror/view";
8
+ export const baseKeymap = [
9
+ ...closeBracketsKeymap,
10
+ ...defaultKeymap,
11
+ ...searchKeymap,
12
+ ...historyKeymap,
13
+ ...foldKeymap,
14
+ ...completionKeymap,
15
+ ...lintKeymap,
16
+ indentWithTab,
17
+ ];
18
+ export const baseEditorExtensions = [
19
+ lineNumbers(),
20
+ highlightActiveLineGutter(),
21
+ highlightSpecialChars(),
22
+ history(),
23
+ foldGutter(),
24
+ drawSelection(),
25
+ dropCursor(),
26
+ EditorState.allowMultipleSelections.of(true),
27
+ indentOnInput(),
28
+ syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
29
+ bracketMatching(),
30
+ closeBrackets(),
31
+ autocompletion(),
32
+ rectangularSelection(),
33
+ crosshairCursor(),
34
+ highlightActiveLine(),
35
+ highlightSelectionMatches(),
36
+ EditorView.lineWrapping,
37
+ ];
38
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,WAAW,EACX,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,mBAAmB;IACtB,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,aAAa;IAChB,GAAG,UAAU;IACb,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,aAAa;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE;IACb,yBAAyB,EAAE;IAC3B,qBAAqB,EAAE;IACvB,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,aAAa,EAAE;IACf,UAAU,EAAE;IACZ,WAAW,CAAC,uBAAuB,CAAC,EAAE,CAAC,IAAI,CAAC;IAC5C,aAAa,EAAE;IACf,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7D,eAAe,EAAE;IACjB,aAAa,EAAE;IACf,cAAc,EAAE;IAChB,oBAAoB,EAAE;IACtB,eAAe,EAAE;IACjB,mBAAmB,EAAE;IACrB,yBAAyB,EAAE;IAC3B,UAAU,CAAC,YAAY;CACxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function makeUpdateHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
2
+ export declare function makeFocusHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
3
+ export declare function makePasteHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
4
+ //# sourceMappingURL=factories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/factories.ts"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAoBjD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAWjD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAcjD"}
@@ -0,0 +1,47 @@
1
+ import { forceLinting } from "@codemirror/lint";
2
+ import { Transaction } from "@codemirror/state";
3
+ import { EditorView } from "@codemirror/view";
4
+ import { updateTimeout } from "../../constants/documents.js";
5
+ export function makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel) {
6
+ return EditorView.updateListener.of((update) => {
7
+ if (!!readonly || !update.docChanged)
8
+ return;
9
+ if (update.transactions.some((tr) => tr.annotation(Transaction.userEvent) === "external"))
10
+ return;
11
+ const newDoc = update.state.doc.toString();
12
+ if (timeoutRef.current) {
13
+ clearTimeout(timeoutRef.current);
14
+ }
15
+ timeoutRef.current = setTimeout(() => {
16
+ updateDocumentInModel?.(newDoc);
17
+ }, updateTimeout);
18
+ });
19
+ }
20
+ export function makeFocusHandler(readonly, timeoutRef, updateDocumentInModel) {
21
+ return EditorView.focusChangeEffect.of((state, focusing) => {
22
+ if (!!readonly || focusing)
23
+ return null;
24
+ if (timeoutRef.current) {
25
+ clearTimeout(timeoutRef.current);
26
+ }
27
+ const newDoc = state.doc.toString();
28
+ updateDocumentInModel?.(newDoc);
29
+ return null;
30
+ });
31
+ }
32
+ export function makePasteHandler(readonly, timeoutRef, updateDocumentInModel) {
33
+ return EditorView.domEventHandlers({
34
+ paste: (event, view) => {
35
+ if (readonly)
36
+ return false;
37
+ const newDoc = view.state.doc.toString();
38
+ if (timeoutRef.current) {
39
+ clearTimeout(timeoutRef.current);
40
+ }
41
+ updateDocumentInModel?.(newDoc);
42
+ forceLinting(view);
43
+ return false;
44
+ },
45
+ });
46
+ }
47
+ //# sourceMappingURL=factories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factories.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,UAAU,iBAAiB,CAC/B,QAA6B,EAC7B,UAAyD,EACzD,qBAAgD;IAEhD,OAAO,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,MAAkB,EAAE,EAAE;QACzD,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QAC7C,IACE,MAAM,CAAC,YAAY,CAAC,IAAI,CACtB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,UAAU,CAC5D;YAED,OAAO;QAET,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAE3C,IAAI,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OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Diagnostic } from "@codemirror/lint";
2
+ type Props = {
3
+ doc: string;
4
+ readonly?: boolean;
5
+ updateDocumentInModel?: (newDoc: string) => void;
6
+ customLinter?: (doc: string) => Diagnostic[];
7
+ };
8
+ declare const GraphqlEditor: import("react").NamedExoticComponent<Props>;
9
+ export default GraphqlEditor;
10
+ //# sourceMappingURL=graphql-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-editor.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/graphql-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAuBnD,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAM,aAAa,6CAoFjB,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forceLinting } from "@codemirror/lint";
3
+ import { Compartment, EditorState } from "@codemirror/state";
4
+ import { EditorView, keymap } from "@codemirror/view";
5
+ import { graphql } from "cm6-graphql";
6
+ import { buildSchema } from "graphql";
7
+ import { memo, useEffect, useRef } from "react";
8
+ import { ayuLight } from "thememirror";
9
+ import { useSchemaContext } from "../../context/schema-context.js";
10
+ import { baseEditorExtensions, baseKeymap } from "./constants.js";
11
+ import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
12
+ import { useDocumentSync, useEditorCleanup, useEditorRefs, useHandlerReconfiguration, } from "./hooks.js";
13
+ import { makeLinter } from "./linting.js";
14
+ const GraphqlEditor = memo(function GraphqlEditor(props) {
15
+ const { doc, readonly = false, updateDocumentInModel, customLinter } = props;
16
+ const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef, } = useEditorRefs();
17
+ // GraphQL-specific refs
18
+ const graphqlCompartment = useRef(new Compartment());
19
+ const linterCompartment = useRef(new Compartment());
20
+ const { sharedSchema } = useSchemaContext();
21
+ useEffect(() => {
22
+ if (!viewRef.current) {
23
+ const schema = buildSchema(sharedSchema);
24
+ viewRef.current = new EditorView({
25
+ state: EditorState.create({
26
+ doc,
27
+ extensions: [
28
+ ...baseEditorExtensions,
29
+ keymap.of(baseKeymap),
30
+ ayuLight,
31
+ graphqlCompartment.current.of(graphql(schema)),
32
+ linterCompartment.current.of(makeLinter(schema, customLinter)),
33
+ updateListenerCompartment.current.of(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
34
+ focusHandlerCompartment.current.of(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
35
+ pasteHandlerCompartment.current.of(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
36
+ EditorState.readOnly.of(readonly),
37
+ ],
38
+ }),
39
+ parent: editorRef.current,
40
+ });
41
+ forceLinting(viewRef.current);
42
+ }
43
+ }, []);
44
+ useEditorCleanup(viewRef);
45
+ /* GraphQL-specific: Reconfigures the editor when the schema changes */
46
+ useEffect(() => {
47
+ const view = viewRef.current;
48
+ if (!view)
49
+ return;
50
+ try {
51
+ const newSchema = buildSchema(sharedSchema);
52
+ view.dispatch({
53
+ effects: [
54
+ graphqlCompartment.current.reconfigure(graphql(newSchema)),
55
+ linterCompartment.current.reconfigure(makeLinter(newSchema, customLinter)),
56
+ ],
57
+ });
58
+ forceLinting(view);
59
+ }
60
+ catch (error) {
61
+ console.debug("in schema update", error);
62
+ }
63
+ }, [sharedSchema, customLinter]);
64
+ useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
65
+ updateListener: updateListenerCompartment.current,
66
+ focusHandler: focusHandlerCompartment.current,
67
+ pasteHandler: pasteHandlerCompartment.current,
68
+ });
69
+ useDocumentSync(viewRef.current, doc);
70
+ return _jsx("div", { ref: editorRef });
71
+ });
72
+ export default GraphqlEditor;
73
+ //# sourceMappingURL=graphql-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-editor.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/graphql-editor.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,aAAa,CAAC,KAAY;IAC5D,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;I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artment } from "@codemirror/state";
2
+ import type { EditorView } from "@codemirror/view";
3
+ export type EditorConfig = {
4
+ doc: string;
5
+ readonly?: boolean;
6
+ updateDocumentInModel?: (newDoc: string) => void;
7
+ };
8
+ export declare function useEditorRefs(): {
9
+ editorRef: import("react").RefObject<HTMLDivElement | null>;
10
+ viewRef: import("react").RefObject<EditorView | null>;
11
+ updateListenerCompartment: import("react").RefObject<Compartment>;
12
+ focusHandlerCompartment: import("react").RefObject<Compartment>;
13
+ pasteHandlerCompartment: import("react").RefObject<Compartment>;
14
+ timeoutRef: import("react").RefObject<NodeJS.Timeout | null>;
15
+ };
16
+ export declare function useEditorCleanup(viewRef: React.MutableRefObject<EditorView | null>): void;
17
+ export declare function useHandlerReconfiguration(view: EditorView | null, readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel: ((newDoc: string) => void) | undefined, compartments: {
18
+ updateListener: Compartment;
19
+ focusHandler: Compartment;
20
+ pasteHandler: Compartment;
21
+ }): void;
22
+ export declare function useDocumentSync(view: EditorView | null, doc: string): void;
23
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,wBAAgB,aAAa;;;;;;;EAgB5B;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAC,QAUnD;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,UAAU,GAAG,IAAI,EACvB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC7D,YAAY,EAAE;IACZ,cAAc,EAAE,WAAW,CAAC;IAC5B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;CAC3B,QAmBF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,QAYnE"}
@@ -0,0 +1,59 @@
1
+ import { forceLinting } from "@codemirror/lint";
2
+ import { Compartment, Transaction } from "@codemirror/state";
3
+ import { useEffect, useRef } from "react";
4
+ import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
5
+ export function useEditorRefs() {
6
+ const editorRef = useRef(null);
7
+ const viewRef = useRef(null);
8
+ const updateListenerCompartment = useRef(new Compartment());
9
+ const focusHandlerCompartment = useRef(new Compartment());
10
+ const pasteHandlerCompartment = useRef(new Compartment());
11
+ const timeoutRef = useRef(null);
12
+ return {
13
+ editorRef,
14
+ viewRef,
15
+ updateListenerCompartment,
16
+ focusHandlerCompartment,
17
+ pasteHandlerCompartment,
18
+ timeoutRef,
19
+ };
20
+ }
21
+ export function useEditorCleanup(viewRef) {
22
+ useEffect(() => {
23
+ return () => {
24
+ if (viewRef.current) {
25
+ viewRef.current.destroy();
26
+ viewRef.current = null;
27
+ }
28
+ };
29
+ }, []);
30
+ }
31
+ export function useHandlerReconfiguration(view, readonly, timeoutRef, updateDocumentInModel, compartments) {
32
+ useEffect(() => {
33
+ if (!view)
34
+ return;
35
+ view.dispatch({
36
+ effects: [
37
+ compartments.updateListener.reconfigure(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
38
+ compartments.focusHandler.reconfigure(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
39
+ compartments.pasteHandler.reconfigure(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
40
+ ],
41
+ });
42
+ forceLinting(view);
43
+ }, [readonly, updateDocumentInModel]);
44
+ }
45
+ export function useDocumentSync(view, doc) {
46
+ useEffect(() => {
47
+ if (!view)
48
+ return;
49
+ const currentDoc = view.state.doc.toString();
50
+ if (currentDoc !== doc) {
51
+ view.dispatch({
52
+ changes: { from: 0, to: currentDoc.length, insert: doc },
53
+ annotations: [Transaction.userEvent.of("external")],
54
+ });
55
+ forceLinting(view);
56
+ }
57
+ }, [doc]);
58
+ }
59
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAQxB,MAAM,UAAU,aAAa;IAC3B,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAChD,MAAM,yBAAyB,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IAC5D,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IAC1D,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,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CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;gBACxD,WAAW,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;aACpD,CAAC,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ type Props = {
2
+ doc: string;
3
+ readonly?: boolean;
4
+ updateDocumentInModel?: (newDoc: string) => void;
5
+ };
6
+ declare const JSONEditor: import("react").NamedExoticComponent<Props>;
7
+ export default JSONEditor;
8
+ //# sourceMappingURL=json-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/json-editor.tsx"],"names":[],"mappings":"AAmBA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,QAAA,MAAM,UAAU,6CA0Dd,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { json, jsonLanguage, jsonParseLinter } from "@codemirror/lang-json";
3
+ import { forceLinting, linter } from "@codemirror/lint";
4
+ import { EditorState } from "@codemirror/state";
5
+ import { EditorView, keymap } from "@codemirror/view";
6
+ import { memo, useEffect } from "react";
7
+ import { ayuLight } from "thememirror";
8
+ import { baseEditorExtensions, baseKeymap } from "./constants.js";
9
+ import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
10
+ import { useDocumentSync, useEditorCleanup, useEditorRefs, useHandlerReconfiguration, } from "./hooks.js";
11
+ const JSONEditor = memo(function JSONEditor(props) {
12
+ const { doc, readonly = false, updateDocumentInModel } = props;
13
+ const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef, } = useEditorRefs();
14
+ useEffect(() => {
15
+ if (!viewRef.current) {
16
+ viewRef.current = new EditorView({
17
+ state: EditorState.create({
18
+ doc,
19
+ extensions: [
20
+ ...baseEditorExtensions,
21
+ keymap.of(baseKeymap),
22
+ ayuLight,
23
+ jsonLanguage,
24
+ json(),
25
+ linter(jsonParseLinter()),
26
+ updateListenerCompartment.current.of(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
27
+ focusHandlerCompartment.current.of(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
28
+ pasteHandlerCompartment.current.of(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
29
+ EditorState.readOnly.of(readonly),
30
+ ],
31
+ }),
32
+ parent: editorRef.current,
33
+ });
34
+ forceLinting(viewRef.current);
35
+ }
36
+ }, []);
37
+ useEditorCleanup(viewRef);
38
+ useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
39
+ updateListener: updateListenerCompartment.current,
40
+ focusHandler: focusHandlerCompartment.current,
41
+ pasteHandler: pasteHandlerCompartment.current,
42
+ });
43
+ useDocumentSync(viewRef.current, doc);
44
+ return _jsx("div", { ref: editorRef });
45
+ });
46
+ export default JSONEditor;
47
+ //# sourceMappingURL=json-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-editor.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/json-editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC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C/D;wBACD,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAChC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAC9D;wBACD,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAChC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAC9D;wBACD,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC;qBAClC;iBACF,CAAC;gBACF,MAAM,EAAE,SAAS,CAAC,OAAQ;aAC3B,CAAC,CAAC;YACH,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE1B,yBAAyB,CACvB,OAAO,CAAC,OAAO,EACf,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB;QACE,cAAc,EAAE,yBAAyB,CAAC,OAAO;QACjD,YAAY,EAAE,uBAAuB,CAAC,OAAO;QAC7C,YAAY,EAAE,uBAAuB,CAAC,OAAO;KAC9C,CACF,CAAC;IAEF,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEtC,OAAO,cAAK,GAAG,EAAE,SAAS,GAAI,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Diagnostic } from "@codemirror/lint";
2
+ import type { GraphQLSchema } from "graphql";
3
+ import { GraphQLError } from "graphql";
4
+ export declare function convertGraphQLErrorToDiagnostic(error: GraphQLError): Diagnostic;
5
+ export declare function makeLinter(schema: GraphQLSchema, customLinter?: (doc: string) => Diagnostic[]): import("@codemirror/state").Extension;
6
+ //# sourceMappingURL=linting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linting.d.ts","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/linting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAOrD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,YAAY,GAClB,UAAU,CAOZ;AASD,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,EAAE,yCAmD7C"}
@@ -0,0 +1,59 @@
1
+ import { linter } from "@codemirror/lint";
2
+ import { filterSchema } from "@graphql-tools/utils";
3
+ import { GraphQLError, locatedError } from "graphql";
4
+ import { validateSDL } from "graphql/validation/validate.js";
5
+ import { safeParseSdl } from "../../context/schema-context.js";
6
+ /* Converts a GraphQLError to a Diagnostic
7
+ GraphQLError uses a zero-indexed line and column, but the editor uses a one-indexed line and column
8
+ */
9
+ export function convertGraphQLErrorToDiagnostic(error) {
10
+ return {
11
+ from: error.locations?.[0] ? (error.positions?.[0] ?? 0) : 0,
12
+ to: error.locations?.[0] ? (error.positions?.[0] ?? 0) + 1 : 1,
13
+ severity: "error",
14
+ message: error.message,
15
+ };
16
+ }
17
+ /* Creates a linter that checks the document for errors
18
+ This works in combination with the built-in linting provided by the graphql extension
19
+ We need to recreate this linter when the schema changes or if a custom linter is provided
20
+ It first checks the document for linting errors
21
+ Then it checks if the document is a valid document string
22
+ Then it checks if the document is valid against the schema
23
+ */
24
+ export function makeLinter(schema, customLinter) {
25
+ return linter((view) => {
26
+ const doc = view.state.doc.toString();
27
+ let diagnostics = [];
28
+ if (customLinter) {
29
+ diagnostics = diagnostics.concat(customLinter(doc));
30
+ }
31
+ const newDocNode = safeParseSdl(doc);
32
+ if (newDocNode) {
33
+ try {
34
+ const currentTypeNames = new Set(newDocNode.definitions
35
+ .filter((def) => "name" in def && def.name)
36
+ .map((def) => def.name.value));
37
+ // we need to filter out the existing types in the document from the schema to prevent duplicate type errors in the validation
38
+ const filteredSchema = filterSchema({
39
+ schema,
40
+ typeFilter: (typeName) => !currentTypeNames.has(typeName),
41
+ });
42
+ const errors = validateSDL(newDocNode, filteredSchema)
43
+ .map((error) => locatedError(error, newDocNode))
44
+ .filter((error, index, self) => index ===
45
+ self.findIndex((e) => e.message === error.message &&
46
+ e.locations?.[0]?.line === error.locations?.[0]?.line &&
47
+ e.locations?.[0]?.column === error.locations?.[0]?.column));
48
+ diagnostics = diagnostics.concat(errors.map(convertGraphQLErrorToDiagnostic));
49
+ }
50
+ catch (error) {
51
+ if (error instanceof GraphQLError) {
52
+ diagnostics.push(convertGraphQLErrorToDiagnostic(error));
53
+ }
54
+ }
55
+ }
56
+ return diagnostics;
57
+ });
58
+ }
59
+ //# sourceMappingURL=linting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linting.js","sourceRoot":"","sources":["../../../../../editors/document-model-editor/components/code-editors/linting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;EAEE;AACF,MAAM,UAAU,+BAA+B,CAC7C,KAAmB;IAEnB,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CA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,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACrB,KAAK;oBACL,IAAI,CAAC,SAAS,CACZ,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;wBAC3B,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI;wBACrD,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAC5D,CACJ,CAAC;gBAEJ,WAAW,GAAG,WAAW,CAAC,MAAM,CAC9B,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAC5C,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;oBAClC,WAAW,CAAC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ type Props = {
2
+ className?: string;
3
+ size?: "sm" | "md" | "lg";
4
+ margin?: "sm" | "md" | "lg";
5
+ };
6
+ export declare function Divider({ className, size, margin }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/divider.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B,CAAC;AACF,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,IAAW,EAAE,MAAa,EAAE,EAAE,KAAK,2CAkBvE"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@powerhousedao/design-system";
3
+ export function Divider({ className, size = "sm", margin = "md" }) {
4
+ function getSize() {
5
+ if (size === "sm")
6
+ return "h-px";
7
+ if (size === "md")
8
+ return "h-1";
9
+ return "h-1.5";
10
+ }
11
+ function getMargin() {
12
+ if (margin === "sm")
13
+ return "my-4";
14
+ if (margin === "md")
15
+ return "my-6";
16
+ return "my-8";
17
+ }
18
+ const sizeClass = getSize();
19
+ const marginClass = getMargin();
20
+ return (_jsx("div", { className: cn("bg-gray-200", sizeClass, marginClass, className) }));
21
+ }
22
+ //# sourceMappingURL=divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.js","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;AAOlD,MAAM,UAAU,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAS;IACtE,SAAS,OAAO;QACd,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QACjC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS,SAAS;QAChB,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QACnC,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAG,SAAS,EAAE,CAAC;IAChC,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,GAAI,CACzE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ errors: string;
3
+ };
4
+ export declare function Errors({ errors }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/errors.tsx"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,2CAUvC"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function Errors({ errors }) {
3
+ return (_jsx("div", { className: "mt-1", children: Array.from(new Set(errors.split("\n"))).map((error) => (_jsx("p", { className: "text-sm font-semibold text-red-900", children: error }, error))) }));
4
+ }
5
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/errors.tsx"],"names":[],"mappings":";AAIA,MAAM,UAAU,MAAM,CAAC,EAAE,MAAM,EAAS;IACtC,OAAO,CACL,cAAK,SAAS,EAAC,MAAM,YAClB,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACtD,YAAG,SAAS,EAAC,oCAAoC,YAC9C,KAAK,IAD+C,KAAK,CAExD,CACL,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import type * as LabelPrimitive from "@radix-ui/react-label";
3
+ import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
4
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
6
+ declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
8
+ declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
9
+ declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
10
+ declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
11
+ export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
12
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../editors/document-model-editor/components/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO/E,QAAA,MAAM,IAAI,4MAAe,CAAC;AAE1B,QAAA,MAAM,SAAS,GACb,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,cAEC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,4CAMtC,CAAC;AAEF,QAAA,MAAM,QAAQ,6GAWZ,CAAC;AAGH,QAAA,MAAM,SAAS,yJAcb,CAAC;AAGH,QAAA,MAAM,WAAW,8JAkBf,CAAC;AAGH,QAAA,MAAM,eAAe,yHAcnB,CAAC;AAGH,QAAA,MAAM,WAAW,yHAqBf,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,WAAW,EACX,SAAS,GACV,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { Controller, FormProvider } from "react-hook-form";
5
+ import { FormFieldContext, FormItemContext } from "../context/form-context.js";
6
+ import { useFormField } from "../hooks/useFormField.js";
7
+ import { cn } from "../utils/style.js";
8
+ import { Label } from "./label.js";
9
+ const Form = FormProvider;
10
+ const FormField = ({ ...props }) => {
11
+ return (_jsx(FormFieldContext.Provider, { value: { name: props.name }, children: _jsx(Controller, { ...props }) }));
12
+ };
13
+ const FormItem = React.forwardRef(({ className, ...props }, ref) => {
14
+ const id = React.useId();
15
+ return (_jsx(FormItemContext.Provider, { value: { id }, children: _jsx("div", { ref: ref, className: cn("", className), ...props }) }));
16
+ });
17
+ FormItem.displayName = "FormItem";
18
+ const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
19
+ const { error, formItemId } = useFormField();
20
+ return (_jsx(Label, { ref: ref, className: cn(error && "text-destructive", className), htmlFor: formItemId, ...props }));
21
+ });
22
+ FormLabel.displayName = "FormLabel";
23
+ const FormControl = React.forwardRef(({ ...props }, ref) => {
24
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
25
+ return (_jsx(Slot, { ref: ref, id: formItemId, "aria-describedby": !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error, ...props }));
26
+ });
27
+ FormControl.displayName = "FormControl";
28
+ const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
29
+ const { formDescriptionId } = useFormField();
30
+ return (_jsx("p", { ref: ref, id: formDescriptionId, className: cn("text-[0.8rem] text-gray-600", className), ...props }));
31
+ });
32
+ FormDescription.displayName = "FormDescription";
33
+ const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
34
+ const { error, formMessageId } = useFormField();
35
+ const body = error ? String(error.message) : children;
36
+ if (!body) {
37
+ return null;
38
+ }
39
+ return (_jsx("p", { ref: ref, id: formMessageId, className: cn("text-[0.8rem] font-medium text-red-800", className), ...props, children: body }));
40
+ });
41
+ FormMessage.displayName = "FormMessage";
42
+ export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
43
+ //# sourceMappingURL=form.js.map