@satoshibits/react-json-schema-builder 1.0.2 → 1.0.3

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 (219) hide show
  1. package/dist/index.cjs100.js +1 -1
  2. package/dist/index.cjs100.js.map +1 -1
  3. package/dist/index.cjs101.js +1 -1
  4. package/dist/index.cjs101.js.map +1 -1
  5. package/dist/index.cjs102.js +1 -1
  6. package/dist/index.cjs102.js.map +1 -1
  7. package/dist/index.cjs103.js +1 -1
  8. package/dist/index.cjs103.js.map +1 -1
  9. package/dist/index.cjs12.js +1 -1
  10. package/dist/index.cjs13.js +1 -1
  11. package/dist/index.cjs15.js +1 -1
  12. package/dist/index.cjs2.js +1 -1
  13. package/dist/index.cjs2.js.map +1 -1
  14. package/dist/index.cjs20.js +1 -1
  15. package/dist/index.cjs22.js +1 -1
  16. package/dist/index.cjs23.js +1 -1
  17. package/dist/index.cjs24.js +1 -1
  18. package/dist/index.cjs25.js +1 -1
  19. package/dist/index.cjs26.js +1 -1
  20. package/dist/index.cjs29.js +1 -1
  21. package/dist/index.cjs3.js +1 -1
  22. package/dist/index.cjs3.js.map +1 -1
  23. package/dist/index.cjs30.js +1 -1
  24. package/dist/index.cjs33.js +1 -1
  25. package/dist/index.cjs35.js +1 -1
  26. package/dist/index.cjs35.js.map +1 -1
  27. package/dist/index.cjs36.js +6 -1
  28. package/dist/index.cjs36.js.map +1 -1
  29. package/dist/index.cjs37.js +6 -1
  30. package/dist/index.cjs37.js.map +1 -1
  31. package/dist/index.cjs38.js +6 -1
  32. package/dist/index.cjs38.js.map +1 -1
  33. package/dist/index.cjs39.js +1 -1
  34. package/dist/index.cjs39.js.map +1 -1
  35. package/dist/index.cjs40.js +1 -1
  36. package/dist/index.cjs40.js.map +1 -1
  37. package/dist/index.cjs41.js +1 -1
  38. package/dist/index.cjs41.js.map +1 -1
  39. package/dist/index.cjs42.js +1 -1
  40. package/dist/index.cjs42.js.map +1 -1
  41. package/dist/index.cjs43.js +1 -6
  42. package/dist/index.cjs43.js.map +1 -1
  43. package/dist/index.cjs44.js +1 -6
  44. package/dist/index.cjs44.js.map +1 -1
  45. package/dist/index.cjs45.js +1 -6
  46. package/dist/index.cjs45.js.map +1 -1
  47. package/dist/index.cjs46.js +1 -1
  48. package/dist/index.cjs48.js +1 -6
  49. package/dist/index.cjs48.js.map +1 -1
  50. package/dist/index.cjs49.js +1 -6
  51. package/dist/index.cjs49.js.map +1 -1
  52. package/dist/index.cjs50.js +2 -2
  53. package/dist/index.cjs50.js.map +1 -1
  54. package/dist/index.cjs51.js +2 -2
  55. package/dist/index.cjs51.js.map +1 -1
  56. package/dist/index.cjs52.js +6 -1
  57. package/dist/index.cjs52.js.map +1 -1
  58. package/dist/index.cjs53.js +6 -1
  59. package/dist/index.cjs53.js.map +1 -1
  60. package/dist/index.cjs54.js +1 -1
  61. package/dist/index.cjs55.js +1 -1
  62. package/dist/index.cjs56.js +1 -1
  63. package/dist/index.cjs56.js.map +1 -1
  64. package/dist/index.cjs58.js +1 -1
  65. package/dist/index.cjs58.js.map +1 -1
  66. package/dist/index.cjs59.js +1 -1
  67. package/dist/index.cjs59.js.map +1 -1
  68. package/dist/index.cjs60.js +1 -1
  69. package/dist/index.cjs60.js.map +1 -1
  70. package/dist/index.cjs61.js +1 -1
  71. package/dist/index.cjs61.js.map +1 -1
  72. package/dist/index.cjs62.js +1 -1
  73. package/dist/index.cjs62.js.map +1 -1
  74. package/dist/index.cjs63.js +1 -1
  75. package/dist/index.cjs63.js.map +1 -1
  76. package/dist/index.cjs64.js +1 -1
  77. package/dist/index.cjs64.js.map +1 -1
  78. package/dist/index.cjs65.js +1 -1
  79. package/dist/index.cjs65.js.map +1 -1
  80. package/dist/index.cjs66.js +1 -1
  81. package/dist/index.cjs66.js.map +1 -1
  82. package/dist/index.cjs67.js +1 -1
  83. package/dist/index.cjs67.js.map +1 -1
  84. package/dist/index.cjs68.js +1 -1
  85. package/dist/index.cjs68.js.map +1 -1
  86. package/dist/index.cjs69.js +1 -1
  87. package/dist/index.cjs69.js.map +1 -1
  88. package/dist/index.cjs70.js +1 -1
  89. package/dist/index.cjs70.js.map +1 -1
  90. package/dist/index.cjs71.js +1 -1
  91. package/dist/index.cjs71.js.map +1 -1
  92. package/dist/index.cjs72.js +1 -1
  93. package/dist/index.cjs72.js.map +1 -1
  94. package/dist/index.cjs73.js +1 -1
  95. package/dist/index.cjs73.js.map +1 -1
  96. package/dist/index.cjs74.js +1 -1
  97. package/dist/index.cjs74.js.map +1 -1
  98. package/dist/index.cjs75.js +1 -1
  99. package/dist/index.cjs75.js.map +1 -1
  100. package/dist/index.cjs76.js +1 -1
  101. package/dist/index.cjs76.js.map +1 -1
  102. package/dist/index.cjs77.js +1 -1
  103. package/dist/index.cjs78.js +1 -1
  104. package/dist/index.cjs80.js +1 -1
  105. package/dist/index.cjs9.js +1 -1
  106. package/dist/index.cjs94.js +1 -1
  107. package/dist/index.cjs95.js +1 -1
  108. package/dist/index.es100.js +11 -21
  109. package/dist/index.es100.js.map +1 -1
  110. package/dist/index.es101.js +26 -11
  111. package/dist/index.es101.js.map +1 -1
  112. package/dist/index.es102.js +4 -27
  113. package/dist/index.es102.js.map +1 -1
  114. package/dist/index.es103.js +22 -4
  115. package/dist/index.es103.js.map +1 -1
  116. package/dist/index.es12.js +1 -1
  117. package/dist/index.es13.js +4 -4
  118. package/dist/index.es15.js +5 -5
  119. package/dist/index.es2.js +21 -20
  120. package/dist/index.es2.js.map +1 -1
  121. package/dist/index.es20.js +6 -6
  122. package/dist/index.es22.js +1 -1
  123. package/dist/index.es23.js +1 -1
  124. package/dist/index.es24.js +1 -1
  125. package/dist/index.es25.js +1 -1
  126. package/dist/index.es26.js +1 -1
  127. package/dist/index.es29.js +1 -1
  128. package/dist/index.es3.js +1 -0
  129. package/dist/index.es3.js.map +1 -1
  130. package/dist/index.es30.js +1 -1
  131. package/dist/index.es33.js +1 -1
  132. package/dist/index.es35.js +811 -95
  133. package/dist/index.es35.js.map +1 -1
  134. package/dist/index.es36.js +10 -114
  135. package/dist/index.es36.js.map +1 -1
  136. package/dist/index.es37.js +10 -56
  137. package/dist/index.es37.js.map +1 -1
  138. package/dist/index.es38.js +10 -24
  139. package/dist/index.es38.js.map +1 -1
  140. package/dist/index.es39.js +113 -42
  141. package/dist/index.es39.js.map +1 -1
  142. package/dist/index.es40.js +99 -71
  143. package/dist/index.es40.js.map +1 -1
  144. package/dist/index.es41.js +52 -56
  145. package/dist/index.es41.js.map +1 -1
  146. package/dist/index.es42.js +19 -827
  147. package/dist/index.es42.js.map +1 -1
  148. package/dist/index.es43.js +45 -10
  149. package/dist/index.es43.js.map +1 -1
  150. package/dist/index.es44.js +86 -10
  151. package/dist/index.es44.js.map +1 -1
  152. package/dist/index.es45.js +60 -10
  153. package/dist/index.es45.js.map +1 -1
  154. package/dist/index.es46.js +2 -2
  155. package/dist/index.es48.js +8 -21
  156. package/dist/index.es48.js.map +1 -1
  157. package/dist/index.es49.js +5 -9
  158. package/dist/index.es49.js.map +1 -1
  159. package/dist/index.es50.js +15 -32
  160. package/dist/index.es50.js.map +1 -1
  161. package/dist/index.es51.js +3 -12
  162. package/dist/index.es51.js.map +1 -1
  163. package/dist/index.es52.js +38 -8
  164. package/dist/index.es52.js.map +1 -1
  165. package/dist/index.es53.js +18 -5
  166. package/dist/index.es53.js.map +1 -1
  167. package/dist/index.es54.js +11 -11
  168. package/dist/index.es55.js +1 -1
  169. package/dist/index.es56.js +3 -26
  170. package/dist/index.es56.js.map +1 -1
  171. package/dist/index.es58.js +42 -62
  172. package/dist/index.es58.js.map +1 -1
  173. package/dist/index.es59.js +25 -28
  174. package/dist/index.es59.js.map +1 -1
  175. package/dist/index.es60.js +64 -4
  176. package/dist/index.es60.js.map +1 -1
  177. package/dist/index.es61.js +7 -24
  178. package/dist/index.es61.js.map +1 -1
  179. package/dist/index.es62.js +123 -31
  180. package/dist/index.es62.js.map +1 -1
  181. package/dist/index.es63.js +14 -3
  182. package/dist/index.es63.js.map +1 -1
  183. package/dist/index.es64.js +129 -41
  184. package/dist/index.es64.js.map +1 -1
  185. package/dist/index.es65.js +10 -7
  186. package/dist/index.es65.js.map +1 -1
  187. package/dist/index.es66.js +204 -113
  188. package/dist/index.es66.js.map +1 -1
  189. package/dist/index.es67.js +13 -15
  190. package/dist/index.es67.js.map +1 -1
  191. package/dist/index.es68.js +31 -132
  192. package/dist/index.es68.js.map +1 -1
  193. package/dist/index.es69.js +7 -10
  194. package/dist/index.es69.js.map +1 -1
  195. package/dist/index.es70.js +26 -212
  196. package/dist/index.es70.js.map +1 -1
  197. package/dist/index.es71.js +4 -13
  198. package/dist/index.es71.js.map +1 -1
  199. package/dist/index.es72.js +5 -7
  200. package/dist/index.es72.js.map +1 -1
  201. package/dist/index.es73.js +27 -3
  202. package/dist/index.es73.js.map +1 -1
  203. package/dist/index.es74.js +50 -28
  204. package/dist/index.es74.js.map +1 -1
  205. package/dist/index.es75.js +9 -50
  206. package/dist/index.es75.js.map +1 -1
  207. package/dist/index.es76.js +25 -9
  208. package/dist/index.es76.js.map +1 -1
  209. package/dist/index.es77.js +2 -2
  210. package/dist/index.es78.js +1 -1
  211. package/dist/index.es80.js +1 -1
  212. package/dist/index.es9.js +1 -1
  213. package/dist/index.es94.js +1 -1
  214. package/dist/index.es95.js +1 -1
  215. package/dist/packages/builder/context.d.ts +1 -0
  216. package/dist/packages/builder/context.d.ts.map +1 -1
  217. package/dist/packages/builder/schema-builder.d.ts.map +1 -1
  218. package/dist/style.css +1 -1
  219. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var a={left:0,top:0,right:0,gap:0},r=function(t){return parseInt(t||"",10)||0},o=function(t){var i=window.getComputedStyle(document.body),n=i[t==="padding"?"paddingLeft":"marginLeft"],e=i[t==="padding"?"paddingTop":"marginTop"],d=i[t==="padding"?"paddingRight":"marginRight"];return[r(n),r(e),r(d)]},g=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return a;var i=o(t),n=document.documentElement.clientWidth,e=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,e-n+i[2]-i[0])}};exports.getGapWidth=g;exports.zeroGap=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),c=require("./index.cjs101.js");function u(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const i=u(r);var a=function(){var e=c.stylesheetSingleton();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};exports.styleHookSingleton=a;
2
2
  //# sourceMappingURL=index.cjs100.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs100.js","sources":["../../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.18_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/utils.js"],"sourcesContent":["export var zeroGap = {\n left: 0,\n top: 0,\n right: 0,\n gap: 0,\n};\nvar parse = function (x) { return parseInt(x || '', 10) || 0; };\nvar getOffset = function (gapMode) {\n var cs = window.getComputedStyle(document.body);\n var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];\n var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];\n var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];\n return [parse(left), parse(top), parse(right)];\n};\nexport var getGapWidth = function (gapMode) {\n if (gapMode === void 0) { gapMode = 'margin'; }\n if (typeof window === 'undefined') {\n return zeroGap;\n }\n var offsets = getOffset(gapMode);\n var documentWidth = document.documentElement.clientWidth;\n var windowWidth = window.innerWidth;\n return {\n left: offsets[0],\n top: offsets[1],\n right: offsets[2],\n gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),\n };\n};\n"],"names":["zeroGap","parse","x","getOffset","gapMode","cs","left","top","right","getGapWidth","offsets","documentWidth","windowWidth"],"mappings":"gFAAU,IAACA,EAAU,CACjB,KAAM,EACN,IAAK,EACL,MAAO,EACP,IAAK,CACT,EACIC,EAAQ,SAAUC,EAAG,CAAE,OAAO,SAASA,GAAK,GAAI,EAAE,GAAK,CAAI,EAC3DC,EAAY,SAAUC,EAAS,CAC/B,IAAIC,EAAK,OAAO,iBAAiB,SAAS,IAAI,EAC1CC,EAAOD,EAAGD,IAAY,UAAY,cAAgB,YAAY,EAC9DG,EAAMF,EAAGD,IAAY,UAAY,aAAe,WAAW,EAC3DI,EAAQH,EAAGD,IAAY,UAAY,eAAiB,aAAa,EACrE,MAAO,CAACH,EAAMK,CAAI,EAAGL,EAAMM,CAAG,EAAGN,EAAMO,CAAK,CAAC,CACjD,EACWC,EAAc,SAAUL,EAAS,CAExC,GADIA,IAAY,SAAUA,EAAU,UAChC,OAAO,OAAW,IAClB,OAAOJ,EAEX,IAAIU,EAAUP,EAAUC,CAAO,EAC3BO,EAAgB,SAAS,gBAAgB,YACzCC,EAAc,OAAO,WACzB,MAAO,CACH,KAAMF,EAAQ,CAAC,EACf,IAAKA,EAAQ,CAAC,EACd,MAAOA,EAAQ,CAAC,EAChB,IAAK,KAAK,IAAI,EAAGE,EAAcD,EAAgBD,EAAQ,CAAC,EAAIA,EAAQ,CAAC,CAAC,CACzE,CACL","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs100.js","sources":["../../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.18_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js"],"sourcesContent":["import * as React from 'react';\nimport { stylesheetSingleton } from './singleton';\n/**\n * creates a hook to control style singleton\n * @see {@link styleSingleton} for a safer component version\n * @example\n * ```tsx\n * const useStyle = styleHookSingleton();\n * ///\n * useStyle('body { overflow: hidden}');\n */\nexport var styleHookSingleton = function () {\n var sheet = stylesheetSingleton();\n return function (styles, isDynamic) {\n React.useEffect(function () {\n sheet.add(styles);\n return function () {\n sheet.remove();\n };\n }, [styles && isDynamic]);\n };\n};\n"],"names":["styleHookSingleton","sheet","stylesheetSingleton","styles","isDynamic","React"],"mappings":"kaAWU,IAACA,EAAqB,UAAY,CACxC,IAAIC,EAAQC,EAAAA,oBAAqB,EACjC,OAAO,SAAUC,EAAQC,EAAW,CAChCC,EAAM,UAAU,UAAY,CACxB,OAAAJ,EAAM,IAAIE,CAAM,EACT,UAAY,CACfF,EAAM,OAAQ,CACjB,CACb,EAAW,CAACE,GAAUC,CAAS,CAAC,CAC3B,CACL","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),c=require("./index.cjs102.js");function u(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const i=u(r);var a=function(){var e=c.stylesheetSingleton();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};exports.styleHookSingleton=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index.cjs102.js");function r(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=o.getNonce();return e&&t.setAttribute("nonce",e),t}function l(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function i(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var u=function(){var t=0,e=null;return{add:function(n){t==0&&(e=r())&&(l(e,n),i(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};exports.stylesheetSingleton=u;
2
2
  //# sourceMappingURL=index.cjs101.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs101.js","sources":["../../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.18_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js"],"sourcesContent":["import * as React from 'react';\nimport { stylesheetSingleton } from './singleton';\n/**\n * creates a hook to control style singleton\n * @see {@link styleSingleton} for a safer component version\n * @example\n * ```tsx\n * const useStyle = styleHookSingleton();\n * ///\n * useStyle('body { overflow: hidden}');\n */\nexport var styleHookSingleton = function () {\n var sheet = stylesheetSingleton();\n return function (styles, isDynamic) {\n React.useEffect(function () {\n sheet.add(styles);\n return function () {\n sheet.remove();\n };\n }, [styles && isDynamic]);\n };\n};\n"],"names":["styleHookSingleton","sheet","stylesheetSingleton","styles","isDynamic","React"],"mappings":"kaAWU,IAACA,EAAqB,UAAY,CACxC,IAAIC,EAAQC,EAAAA,oBAAqB,EACjC,OAAO,SAAUC,EAAQC,EAAW,CAChCC,EAAM,UAAU,UAAY,CACxB,OAAAJ,EAAM,IAAIE,CAAM,EACT,UAAY,CACfF,EAAM,OAAQ,CACjB,CACb,EAAW,CAACE,GAAUC,CAAS,CAAC,CAC3B,CACL","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs101.js","sources":["../../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.18_react@18.3.1/node_modules/react-style-singleton/dist/es2015/singleton.js"],"sourcesContent":["import { getNonce } from 'get-nonce';\nfunction makeStyleTag() {\n if (!document)\n return null;\n var tag = document.createElement('style');\n tag.type = 'text/css';\n var nonce = getNonce();\n if (nonce) {\n tag.setAttribute('nonce', nonce);\n }\n return tag;\n}\nfunction injectStyles(tag, css) {\n // @ts-ignore\n if (tag.styleSheet) {\n // @ts-ignore\n tag.styleSheet.cssText = css;\n }\n else {\n tag.appendChild(document.createTextNode(css));\n }\n}\nfunction insertStyleTag(tag) {\n var head = document.head || document.getElementsByTagName('head')[0];\n head.appendChild(tag);\n}\nexport var stylesheetSingleton = function () {\n var counter = 0;\n var stylesheet = null;\n return {\n add: function (style) {\n if (counter == 0) {\n if ((stylesheet = makeStyleTag())) {\n injectStyles(stylesheet, style);\n insertStyleTag(stylesheet);\n }\n }\n counter++;\n },\n remove: function () {\n counter--;\n if (!counter && stylesheet) {\n stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);\n stylesheet = null;\n }\n },\n };\n};\n"],"names":["makeStyleTag","tag","nonce","getNonce","injectStyles","css","insertStyleTag","head","stylesheetSingleton","counter","stylesheet","style"],"mappings":"qHACA,SAASA,GAAe,CACpB,GAAI,CAAC,SACD,OAAO,KACX,IAAIC,EAAM,SAAS,cAAc,OAAO,EACxCA,EAAI,KAAO,WACX,IAAIC,EAAQC,EAAAA,SAAU,EACtB,OAAID,GACAD,EAAI,aAAa,QAASC,CAAK,EAE5BD,CACX,CACA,SAASG,EAAaH,EAAKI,EAAK,CAExBJ,EAAI,WAEJA,EAAI,WAAW,QAAUI,EAGzBJ,EAAI,YAAY,SAAS,eAAeI,CAAG,CAAC,CAEpD,CACA,SAASC,EAAeL,EAAK,CACzB,IAAIM,EAAO,SAAS,MAAQ,SAAS,qBAAqB,MAAM,EAAE,CAAC,EACnEA,EAAK,YAAYN,CAAG,CACxB,CACU,IAACO,EAAsB,UAAY,CACzC,IAAIC,EAAU,EACVC,EAAa,KACjB,MAAO,CACH,IAAK,SAAUC,EAAO,CACdF,GAAW,IACNC,EAAaV,OACdI,EAAaM,EAAYC,CAAK,EAC9BL,EAAeI,CAAU,GAGjCD,GACH,EACD,OAAQ,UAAY,CAChBA,IACI,CAACA,GAAWC,IACZA,EAAW,YAAcA,EAAW,WAAW,YAAYA,CAAU,EACrEA,EAAa,KAEpB,CACJ,CACL","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index.cjs103.js");function r(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=o.getNonce();return e&&t.setAttribute("nonce",e),t}function l(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function i(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var u=function(){var t=0,e=null;return{add:function(n){t==0&&(e=r())&&(l(e,n),i(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};exports.stylesheetSingleton=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};exports.getNonce=e;
2
2
  //# sourceMappingURL=index.cjs102.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs102.js","sources":["../../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.18_react@18.3.1/node_modules/react-style-singleton/dist/es2015/singleton.js"],"sourcesContent":["import { getNonce } from 'get-nonce';\nfunction makeStyleTag() {\n if (!document)\n return null;\n var tag = document.createElement('style');\n tag.type = 'text/css';\n var nonce = getNonce();\n if (nonce) {\n tag.setAttribute('nonce', nonce);\n }\n return tag;\n}\nfunction injectStyles(tag, css) {\n // @ts-ignore\n if (tag.styleSheet) {\n // @ts-ignore\n tag.styleSheet.cssText = css;\n }\n else {\n tag.appendChild(document.createTextNode(css));\n }\n}\nfunction insertStyleTag(tag) {\n var head = document.head || document.getElementsByTagName('head')[0];\n head.appendChild(tag);\n}\nexport var stylesheetSingleton = function () {\n var counter = 0;\n var stylesheet = null;\n return {\n add: function (style) {\n if (counter == 0) {\n if ((stylesheet = makeStyleTag())) {\n injectStyles(stylesheet, style);\n insertStyleTag(stylesheet);\n }\n }\n counter++;\n },\n remove: function () {\n counter--;\n if (!counter && stylesheet) {\n stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);\n stylesheet = null;\n }\n },\n };\n};\n"],"names":["makeStyleTag","tag","nonce","getNonce","injectStyles","css","insertStyleTag","head","stylesheetSingleton","counter","stylesheet","style"],"mappings":"qHACA,SAASA,GAAe,CACpB,GAAI,CAAC,SACD,OAAO,KACX,IAAIC,EAAM,SAAS,cAAc,OAAO,EACxCA,EAAI,KAAO,WACX,IAAIC,EAAQC,EAAAA,SAAU,EACtB,OAAID,GACAD,EAAI,aAAa,QAASC,CAAK,EAE5BD,CACX,CACA,SAASG,EAAaH,EAAKI,EAAK,CAExBJ,EAAI,WAEJA,EAAI,WAAW,QAAUI,EAGzBJ,EAAI,YAAY,SAAS,eAAeI,CAAG,CAAC,CAEpD,CACA,SAASC,EAAeL,EAAK,CACzB,IAAIM,EAAO,SAAS,MAAQ,SAAS,qBAAqB,MAAM,EAAE,CAAC,EACnEA,EAAK,YAAYN,CAAG,CACxB,CACU,IAACO,EAAsB,UAAY,CACzC,IAAIC,EAAU,EACVC,EAAa,KACjB,MAAO,CACH,IAAK,SAAUC,EAAO,CACdF,GAAW,IACNC,EAAaV,OACdI,EAAaM,EAAYC,CAAK,EAC9BL,EAAeI,CAAU,GAGjCD,GACH,EACD,OAAQ,UAAY,CAChBA,IACI,CAACA,GAAWC,IACZA,EAAW,YAAcA,EAAW,WAAW,YAAYA,CAAU,EACrEA,EAAa,KAEpB,CACJ,CACL","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs102.js","sources":["../../../node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js"],"sourcesContent":["var currentNonce;\nexport var setNonce = function (nonce) {\n currentNonce = nonce;\n};\nexport var getNonce = function () {\n if (currentNonce) {\n return currentNonce;\n }\n if (typeof __webpack_nonce__ !== 'undefined') {\n return __webpack_nonce__;\n }\n return undefined;\n};\n"],"names":["getNonce"],"mappings":"gFAIU,IAACA,EAAW,UAAY,CAI9B,GAAI,OAAO,kBAAsB,IAC7B,OAAO,iBAGf","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};exports.getNonce=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var a={left:0,top:0,right:0,gap:0},r=function(t){return parseInt(t||"",10)||0},o=function(t){var i=window.getComputedStyle(document.body),n=i[t==="padding"?"paddingLeft":"marginLeft"],e=i[t==="padding"?"paddingTop":"marginTop"],d=i[t==="padding"?"paddingRight":"marginRight"];return[r(n),r(e),r(d)]},g=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return a;var i=o(t),n=document.documentElement.clientWidth,e=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,e-n+i[2]-i[0])}};exports.getGapWidth=g;exports.zeroGap=a;
2
2
  //# sourceMappingURL=index.cjs103.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs103.js","sources":["../../../node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js"],"sourcesContent":["var currentNonce;\nexport var setNonce = function (nonce) {\n currentNonce = nonce;\n};\nexport var getNonce = function () {\n if (currentNonce) {\n return currentNonce;\n }\n if (typeof __webpack_nonce__ !== 'undefined') {\n return __webpack_nonce__;\n }\n return undefined;\n};\n"],"names":["getNonce"],"mappings":"gFAIU,IAACA,EAAW,UAAY,CAI9B,GAAI,OAAO,kBAAsB,IAC7B,OAAO,iBAGf","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs103.js","sources":["../../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.18_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/utils.js"],"sourcesContent":["export var zeroGap = {\n left: 0,\n top: 0,\n right: 0,\n gap: 0,\n};\nvar parse = function (x) { return parseInt(x || '', 10) || 0; };\nvar getOffset = function (gapMode) {\n var cs = window.getComputedStyle(document.body);\n var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];\n var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];\n var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];\n return [parse(left), parse(top), parse(right)];\n};\nexport var getGapWidth = function (gapMode) {\n if (gapMode === void 0) { gapMode = 'margin'; }\n if (typeof window === 'undefined') {\n return zeroGap;\n }\n var offsets = getOffset(gapMode);\n var documentWidth = document.documentElement.clientWidth;\n var windowWidth = window.innerWidth;\n return {\n left: offsets[0],\n top: offsets[1],\n right: offsets[2],\n gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),\n };\n};\n"],"names":["zeroGap","parse","x","getOffset","gapMode","cs","left","top","right","getGapWidth","offsets","documentWidth","windowWidth"],"mappings":"gFAAU,IAACA,EAAU,CACjB,KAAM,EACN,IAAK,EACL,MAAO,EACP,IAAK,CACT,EACIC,EAAQ,SAAUC,EAAG,CAAE,OAAO,SAASA,GAAK,GAAI,EAAE,GAAK,CAAI,EAC3DC,EAAY,SAAUC,EAAS,CAC/B,IAAIC,EAAK,OAAO,iBAAiB,SAAS,IAAI,EAC1CC,EAAOD,EAAGD,IAAY,UAAY,cAAgB,YAAY,EAC9DG,EAAMF,EAAGD,IAAY,UAAY,aAAe,WAAW,EAC3DI,EAAQH,EAAGD,IAAY,UAAY,eAAiB,aAAa,EACrE,MAAO,CAACH,EAAMK,CAAI,EAAGL,EAAMM,CAAG,EAAGN,EAAMO,CAAK,CAAC,CACjD,EACWC,EAAc,SAAUL,EAAS,CAExC,GADIA,IAAY,SAAUA,EAAU,UAChC,OAAO,OAAW,IAClB,OAAOJ,EAEX,IAAIU,EAAUP,EAAUC,CAAO,EAC3BO,EAAgB,SAAS,gBAAgB,YACzCC,EAAc,OAAO,WACzB,MAAO,CACH,KAAMF,EAAQ,CAAC,EACf,IAAKA,EAAQ,CAAC,EACd,MAAOA,EAAQ,CAAC,EAChB,IAAK,KAAK,IAAI,EAAGE,EAAcD,EAAgBD,EAAQ,CAAC,EAAIA,EAAQ,CAAC,CAAC,CACzE,CACL","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index.cjs35.js"),n=require("./index.cjs21.js");function i({className:r,...s}){return e.jsx(t.Root,{"data-slot":"switch",className:n.cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),...s,children:e.jsx(t.Thumb,{"data-slot":"switch-thumb",className:n.cn("bg-background pointer-events-none block size-4 rounded-full ring-0 shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}exports.Switch=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index.cjs39.js"),n=require("./index.cjs21.js");function i({className:r,...s}){return e.jsx(t.Root,{"data-slot":"switch",className:n.cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),...s,children:e.jsx(t.Thumb,{"data-slot":"switch-thumb",className:n.cn("bg-background pointer-events-none block size-4 rounded-full ring-0 shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}exports.Switch=i;
2
2
  //# sourceMappingURL=index.cjs12.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index.cjs42.js"),l=require("./index.cjs21.js"),n=require("./index.cjs43.js"),d=require("./index.cjs44.js"),u=require("./index.cjs45.js");function p({...t}){return e.jsx(s.Root,{"data-slot":"select",...t})}function m({...t}){return e.jsx(s.Value,{"data-slot":"select-value",...t})}function f({className:t,children:a,...r}){return e.jsxs(s.Trigger,{"data-slot":"select-trigger","data-testid":"select-trigger",className:l.cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[a,e.jsx(s.Icon,{asChild:!0,children:e.jsx(n.default,{className:"size-4 opacity-50"})})]})}function g({className:t,children:a,position:r="popper",...c}){return e.jsx(s.Portal,{children:e.jsxs(s.Content,{"data-slot":"select-content",className:l.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...c,children:[e.jsx(o,{}),e.jsx(s.Viewport,{className:l.cn("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(i,{})]})})}function x({className:t,children:a,...r}){return e.jsxs(s.Item,{"data-slot":"select-item",className:l.cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(s.ItemIndicator,{children:e.jsx(d.default,{className:"size-4"})})}),e.jsx(s.ItemText,{children:a})]})}function o({className:t,...a}){return e.jsx(s.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:l.cn("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(u.default,{className:"size-4"})})}function i({className:t,...a}){return e.jsx(s.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:l.cn("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(n.default,{className:"size-4"})})}exports.Select=p;exports.SelectContent=g;exports.SelectItem=x;exports.SelectScrollDownButton=i;exports.SelectScrollUpButton=o;exports.SelectTrigger=f;exports.SelectValue=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index.cjs35.js"),l=require("./index.cjs21.js"),n=require("./index.cjs36.js"),d=require("./index.cjs37.js"),u=require("./index.cjs38.js");function p({...t}){return e.jsx(s.Root,{"data-slot":"select",...t})}function m({...t}){return e.jsx(s.Value,{"data-slot":"select-value",...t})}function f({className:t,children:a,...r}){return e.jsxs(s.Trigger,{"data-slot":"select-trigger","data-testid":"select-trigger",className:l.cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[a,e.jsx(s.Icon,{asChild:!0,children:e.jsx(n.default,{className:"size-4 opacity-50"})})]})}function g({className:t,children:a,position:r="popper",...c}){return e.jsx(s.Portal,{children:e.jsxs(s.Content,{"data-slot":"select-content",className:l.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...c,children:[e.jsx(o,{}),e.jsx(s.Viewport,{className:l.cn("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),e.jsx(i,{})]})})}function x({className:t,children:a,...r}){return e.jsxs(s.Item,{"data-slot":"select-item",className:l.cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(s.ItemIndicator,{children:e.jsx(d.default,{className:"size-4"})})}),e.jsx(s.ItemText,{children:a})]})}function o({className:t,...a}){return e.jsx(s.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:l.cn("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(u.default,{className:"size-4"})})}function i({className:t,...a}){return e.jsx(s.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:l.cn("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(n.default,{className:"size-4"})})}exports.Select=p;exports.SelectContent=g;exports.SelectItem=x;exports.SelectScrollDownButton=i;exports.SelectScrollUpButton=o;exports.SelectTrigger=f;exports.SelectValue=m;
2
2
  //# sourceMappingURL=index.cjs13.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("react"),S=require("./index.cjs10.js"),c=require("./index.cjs36.js"),F=require("./index.cjs14.js"),p=require("./index.cjs9.js"),R=require("./index.cjs4.js"),V=require("./index.cjs37.js"),$=require("./index.cjs38.js"),A=require("./index.cjs20.js"),E=require("react-hook-form"),N=require("./index.cjs39.js"),k=require("./index.cjs40.js"),w=A.AddFormSchema.pick({constraints:!0,property:!0});function B({open:f,onOpenChange:h,onSubmit:g,property:i,propertyKey:y}){const r=E.useForm({resolver:N.zodResolver(w),defaultValues:{property:i}}),l=r.watch("constraints"),{getConstraintDefinitionsForType:C,getRendererForConstraint:j,validateConstraintValue:v}=R.useConstraints(),D=e=>{const{constraints:n}=e,a={...n?.reduce((s,o)=>({...s,[o.name]:o.value}),{})};g([y,a]),r.reset()},q=(e,n)=>{const a=p.a(l),s=a?.[e];if(!s){r.setError(`constraints.${e}`,{message:"The constraint was not found",type:"constraint_not_found"});return}const o=v(s.name,n);if(o.status==="error"){let u=o.message;o.code==="invalid"&&(u=`${u}: ${o.error?.map(b=>b.message).join(", ")}`),r.setError(`constraints.${e}`,{type:o.code,message:u});return}s.value=n,r.setValue("constraints",a),r.clearErrors(`constraints.${e}`)},x=e=>{if(!l)return;const a=p.a(l).filter(s=>s.name!==e);r.setValue("constraints",a)},d=m.useMemo(()=>C(typeof i?.type=="string"?i.type:""),[i.type]);return m.useEffect(()=>{const e=[];for(const n of d)n.name in i&&e.push({name:n.name,value:i[n.name]});r.setValue("constraints",e)},[d]),t.jsx(c.Dialog,{open:f,onOpenChange:h,children:t.jsxs(c.DialogContent,{children:[t.jsxs(c.DialogHeader,{children:[t.jsx(c.DialogTitle,{children:"Edit"}),t.jsx(c.DialogDescription,{children:"Constraints and other properties"})]}),t.jsx(k.Form,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(D),className:"space-y-4","data-testid":"edit-property-form",children:[d.length?t.jsxs("div",{className:"space-y-2",children:[t.jsx(F.Label,{children:"Constraints"}),t.jsx(V.default,{addedConstraints:l??[],availableDefinitions:d,onAdd:e=>{r.setValue("constraints",e)}}),t.jsx($.Separator,{}),l?.map((e,n)=>{const a=j(e.name);if(!a)return null;const s=r.formState.errors.constraints?.[n];let o;return s&&(o={code:s?.type??"INVALID",message:s.message??"An error occurred"}),t.jsx(a,{constraintName:e.name,value:e.value,onConstraintChange:u=>{q(n,u)},onRemoveConstraint:()=>{x(e.name)},error:o},e.name)})]}):null,t.jsx(c.DialogFooter,{children:t.jsx(S.Button,{type:"submit",children:"Save"})})]})})]})})}exports.EditPropertyDialog=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("react"),S=require("./index.cjs10.js"),c=require("./index.cjs40.js"),F=require("./index.cjs14.js"),p=require("./index.cjs9.js"),R=require("./index.cjs4.js"),V=require("./index.cjs41.js"),$=require("./index.cjs42.js"),A=require("./index.cjs20.js"),E=require("react-hook-form"),N=require("./index.cjs43.js"),k=require("./index.cjs44.js"),w=A.AddFormSchema.pick({constraints:!0,property:!0});function B({open:f,onOpenChange:h,onSubmit:g,property:i,propertyKey:y}){const r=E.useForm({resolver:N.zodResolver(w),defaultValues:{property:i}}),l=r.watch("constraints"),{getConstraintDefinitionsForType:C,getRendererForConstraint:j,validateConstraintValue:v}=R.useConstraints(),D=e=>{const{constraints:n}=e,a={...n?.reduce((s,o)=>({...s,[o.name]:o.value}),{})};g([y,a]),r.reset()},q=(e,n)=>{const a=p.a(l),s=a?.[e];if(!s){r.setError(`constraints.${e}`,{message:"The constraint was not found",type:"constraint_not_found"});return}const o=v(s.name,n);if(o.status==="error"){let u=o.message;o.code==="invalid"&&(u=`${u}: ${o.error?.map(b=>b.message).join(", ")}`),r.setError(`constraints.${e}`,{type:o.code,message:u});return}s.value=n,r.setValue("constraints",a),r.clearErrors(`constraints.${e}`)},x=e=>{if(!l)return;const a=p.a(l).filter(s=>s.name!==e);r.setValue("constraints",a)},d=m.useMemo(()=>C(typeof i?.type=="string"?i.type:""),[i.type]);return m.useEffect(()=>{const e=[];for(const n of d)n.name in i&&e.push({name:n.name,value:i[n.name]});r.setValue("constraints",e)},[d]),t.jsx(c.Dialog,{open:f,onOpenChange:h,children:t.jsxs(c.DialogContent,{children:[t.jsxs(c.DialogHeader,{children:[t.jsx(c.DialogTitle,{children:"Edit"}),t.jsx(c.DialogDescription,{children:"Constraints and other properties"})]}),t.jsx(k.Form,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(D),className:"space-y-4","data-testid":"edit-property-form",children:[d.length?t.jsxs("div",{className:"space-y-2",children:[t.jsx(F.Label,{children:"Constraints"}),t.jsx(V.default,{addedConstraints:l??[],availableDefinitions:d,onAdd:e=>{r.setValue("constraints",e)}}),t.jsx($.Separator,{}),l?.map((e,n)=>{const a=j(e.name);if(!a)return null;const s=r.formState.errors.constraints?.[n];let o;return s&&(o={code:s?.type??"INVALID",message:s.message??"An error occurred"}),t.jsx(a,{constraintName:e.name,value:e.value,onConstraintChange:u=>{q(n,u)},onRemoveConstraint:()=>{x(e.name)},error:o},e.name)})]}):null,t.jsx(c.DialogFooter,{children:t.jsx(S.Button,{type:"submit",children:"Save"})})]})})]})})}exports.EditPropertyDialog=B;
2
2
  //# sourceMappingURL=index.cjs15.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),m=require("react"),f=require("./index.cjs9.js"),d=m.createContext(void 0),q={$schema:"http://json-schema.org/draft-07/schema#",type:"object",title:"title",description:"",properties:{},required:[]};function S({children:l,initialSchema:p}){const[n,a]=m.useState(p??q),[u,c]=m.useState([]);return y.jsx(d.Provider,{value:{schema:n,setSchema:a,path:u,setPath:c},children:l})}function b(){const l=m.useContext(d);if(l===void 0)throw new Error("useSchema must be used within a SchemaProvider");const{path:p,schema:n,setSchema:a}=l,u=(t,e)=>{let r=t,i=null,o=null;for(const s of e)r.type==="array"&&r.items&&!Array.isArray(r.items)&&typeof r.items=="object"&&r.items.type==="object"&&typeof r.items.properties?.[s]=="object"?(o=r.items,i=r.items.properties[s],r=r.items):r.type==="object"&&r.properties&&!Array.isArray(r.properties)&&typeof r.properties[s]=="object"&&(o=r,i=r.properties[s],r=r.properties[s]);return{propertySchema:i,parentSchema:o}},c=t=>{const{propertySchema:e}=u(t??n,p);return e?e.type==="array"?e.items:e:t??n};return{...l,getCurrentSchema:c,getCurrentProperty:()=>{const{propertySchema:t}=u(n,p);return t},handlePropertyChange:(t,e)=>{const r=f.a(n),i=c(r);typeof e=="object"&&"isRequired"in e&&(i.type==="object"&&(i.required||(i.required=[]),e.isRequired?i.required.includes(t)||i.required.push(t):i.required=i.required.filter(s=>s!==t)),delete e.isRequired);let o=!1;if(i.type==="object"&&i.properties){const s=i.properties[t];typeof s!="boolean"&&s&&typeof e!="boolean"&&(e.type&&e.type!==s.type?e={title:s.title,description:s.description,default:s.default,...e}:e.enum?(delete e.type,delete e.items,delete e.properties,e={title:s.title,description:s.description,...e}):e={...s,...e},i.properties[t]=e),o=!0}if(a(r),o)return{status:"success",property:i.properties[t]}},handleAddProperty:(t,e,r)=>{const i=f.a(n),o=c(i);return o.type!=="object"&&(o.type="object"),o.properties||(o.properties={}),o.properties[t]?{status:"error",code:"key-exists",message:`Property with key ${t} already exists`}:(e.enum&&(delete e.type,delete e.items,delete e.properties),o.properties[t]=e,r&&(o.required||(o.required=[]),o.required.includes(t)||o.required.push(t)),a(i),{status:"success",property:o.properties[t]})},handleKeyChange:(t,e)=>{const r=f.a(n),i=c(r);if(i.properties?.[t]){const o=Object.entries(i.properties).map(([s,h])=>[s===t?e:s,h]);i.properties=Object.fromEntries(o)}i.required?.includes(t)&&(i.required=i.required.map(o=>o===t?e:o)),a(r)},navigateToCorrectNesting:u,handleDeleteProperty:t=>{const e=f.a(n),r=c(e);r.type==="object"&&r.required&&(r.required=r.required.filter(i=>i!==t)),r.type==="object"&&r.properties&&delete r.properties[t],a(e)},isPropertyRequired:t=>{if(p.length){const{propertySchema:e}=u(n,p);return e?.type==="array"&&e.items&&typeof e.items!="boolean"&&!Array.isArray(e.items)&&e.items?.type==="object"?!!e.items?.required?.includes(t):!!e?.required?.includes(t)}return!!n?.required?.includes(t)}}}exports.SchemaContext=d;exports.SchemaProvider=S;exports.useSchema=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),m=require("react"),f=require("./index.cjs9.js"),d=m.createContext(void 0),q={$schema:"http://json-schema.org/draft-07/schema#",type:"object",title:"title",description:"",properties:{},required:[]};function S({children:l,initialSchema:p}){const[n,u]=m.useState(p??q),[a,c]=m.useState([]);return y.jsx(d.Provider,{value:{schema:n,setSchema:u,path:a,setPath:c},children:l})}function b(){const l=m.useContext(d);if(l===void 0)throw new Error("useSchema must be used within a SchemaProvider");const{path:p,schema:n,setSchema:u}=l,a=(t,e)=>{let r=t,i=null,o=null;for(const s of e)r.type==="array"&&r.items&&!Array.isArray(r.items)&&typeof r.items=="object"&&r.items.type==="object"&&typeof r.items.properties?.[s]=="object"?(o=r.items,i=r.items.properties[s],r=r.items):r.type==="object"&&r.properties&&!Array.isArray(r.properties)&&typeof r.properties[s]=="object"&&(o=r,i=r.properties[s],r=r.properties[s]);return{propertySchema:i,parentSchema:o}},c=t=>{const{propertySchema:e}=a(t??n,p);return e?e.type==="array"?e.items:e:t??n};return{...l,getCurrentSchema:c,getCurrentProperty:()=>{const{propertySchema:t}=a(n,p);return t},handlePropertyChange:(t,e)=>{const r=f.a(n),i=c(r);typeof e=="object"&&"isRequired"in e&&(i.type==="object"&&(i.required||(i.required=[]),e.isRequired?i.required.includes(t)||i.required.push(t):i.required=i.required.filter(s=>s!==t)),delete e.isRequired);let o=!1;if(i.type==="object"&&i.properties){const s=i.properties[t];typeof s!="boolean"&&s&&typeof e!="boolean"&&(e.type&&e.type!==s.type?e={title:s.title,description:s.description,default:s.default,...e}:e.enum?(delete e.type,delete e.items,delete e.properties,e={title:s.title,description:s.description,...e}):e={...s,...e},i.properties[t]=e),o=!0}if(u(r),o)return{status:"success",property:i.properties[t]}},handleAddProperty:(t,e,r)=>{const i=f.a(n),o=c(i);return o.type!=="object"&&(o.type="object"),o.properties||(o.properties={}),o.properties[t]?{status:"error",code:"key-exists",message:`Property with key ${t} already exists`}:(e.enum&&(delete e.type,delete e.items,delete e.properties),o.properties[t]=e,r&&(o.required||(o.required=[]),o.required.includes(t)||o.required.push(t)),u(i),{status:"success",property:o.properties[t]})},handleKeyChange:(t,e)=>{const r=f.a(n),i=c(r);if(i.properties?.[t]){const o=Object.entries(i.properties).map(([s,h])=>[s===t?e:s,h]);i.properties=Object.fromEntries(o)}i.required?.includes(t)&&(i.required=i.required.map(o=>o===t?e:o)),u(r)},navigateToCorrectNesting:a,handleDeleteProperty:t=>{const e=f.a(n),r=c(e);r.type==="object"&&r.required&&(r.required=r.required.filter(i=>i!==t)),r.type==="object"&&r.properties&&delete r.properties[t],u(e)},isPropertyRequired:t=>{if(p.length){const{propertySchema:e}=a(n,p);return e?.type==="array"&&e.items&&typeof e.items!="boolean"&&!Array.isArray(e.items)&&e.items?.type==="object"?!!e.items?.required?.includes(t):!!e?.required?.includes(t)}return!!n?.required?.includes(t)},getValue:()=>n}}exports.SchemaContext=d;exports.SchemaProvider=S;exports.useSchema=b;
2
2
  //# sourceMappingURL=index.cjs2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs2.js","sources":["../src/packages/builder/context.tsx"],"sourcesContent":["import { createContext, useContext, useState } from \"react\";\n\nimport type { PropsWithChildren, SetStateAction } from \"react\";\nimport type { JSONSchema7, JSONSchema7Definition } from \"json-schema\";\nimport { clone } from \"remeda\";\nimport type { OperationError } from \"./shared-types\";\n\ninterface ContextState<T extends JSONSchema7> {\n schema: T;\n setSchema: React.Dispatch<T>;\n path: string[];\n setPath: React.Dispatch<SetStateAction<string[]>>;\n}\n\nexport const SchemaContext = createContext<\n ContextState<JSONSchema7> | undefined\n>(undefined);\n\nconst defaultSchema: JSONSchema7 = {\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"object\",\n title: \"title\",\n description: \"\",\n properties: {},\n required: [],\n};\n\nfunction SchemaProvider({\n children,\n initialSchema,\n}: PropsWithChildren<{ initialSchema?: JSONSchema7 }>) {\n const [schema, setSchema] = useState<JSONSchema7>(\n initialSchema ?? defaultSchema,\n );\n\n /**\n * Path represents the path to a nested property in the schema.\n * It should only contain property keys.\n * An empty path means the current schema is the root schema since\n * the path only represents nested properties.\n */\n const [path, setPath] = useState<string[]>([]);\n\n // NOTE: you *might* need to memoize your values\n // Learn more in http://kcd.im/optimize-context\n\n return (\n <SchemaContext.Provider value={{ schema, setSchema, path, setPath }}>\n {children}\n </SchemaContext.Provider>\n );\n}\n\nexport type PropertyAddError = OperationError & {\n status: \"error\";\n};\n\nexport interface PropertyAddSuccess {\n status: \"success\";\n property: JSONSchema7;\n}\n\nexport interface PropertyChangeSuccess {\n status: \"success\";\n property: JSONSchema7Definition;\n}\n\nfunction useSchema() {\n const context = useContext(SchemaContext);\n\n if (context === undefined) {\n throw new Error(\"useSchema must be used within a SchemaProvider\");\n }\n\n const { path, schema, setSchema } = context;\n\n /**\n * Navigates to the correct property schema of the latest key in the provided path.\n *\n * It will traverse both \"properties\" and \"items\" to find the correct property schema.\n *\n * It will only return a property schema if the provided path is valid i.e. it\n * correctly follows the schema's nesting structure.\n *\n * It will only return a parent schema if the provided path is valid i.e. it\n * correctly follows the schema's nesting structure.\n */\n const navigateToCorrectNesting = (\n providedSchema: JSONSchema7,\n providedPath: string[],\n ) => {\n let current = providedSchema;\n let propertySchema: JSONSchema7 | null = null;\n // Should be the schema of type \"object\" containing the property in its properties key\n let parentSchema: JSONSchema7 | null = null;\n\n for (const p of providedPath) {\n if (\n current.type === \"array\" &&\n current.items &&\n !Array.isArray(current.items) &&\n typeof current.items === \"object\" &&\n current.items.type === \"object\" &&\n typeof current.items.properties?.[p] === \"object\"\n ) {\n parentSchema = current.items;\n propertySchema = current.items.properties[p];\n current = current.items;\n } else if (\n current.type === \"object\" &&\n current.properties &&\n !Array.isArray(current.properties) &&\n typeof current.properties[p] === \"object\"\n ) {\n parentSchema = current;\n propertySchema = current.properties[p];\n current = current.properties[p];\n }\n }\n\n return { propertySchema, parentSchema };\n };\n\n /**\n * Gets the current schema of the latest key in the path.\n * If path is empty, it will return the root schema.\n *\n * It should always return the \"object\" schema of the current path.\n */\n const getCurrentSchema = (initialSchema?: JSONSchema7) => {\n // Gets the correct object schema if under nesting\n // Otherwise, return the root schema\n const { propertySchema } = navigateToCorrectNesting(\n initialSchema ?? schema,\n path,\n );\n\n if (propertySchema) {\n if (propertySchema.type === \"array\") {\n return propertySchema.items as JSONSchema7;\n }\n\n return propertySchema;\n }\n\n return initialSchema ?? schema;\n };\n\n /**\n * Gets the correct property schema of the latest key in the path.\n * If no path is provided, it will return null.\n */\n const getCurrentProperty = () => {\n const { propertySchema } = navigateToCorrectNesting(schema, path);\n\n return propertySchema;\n };\n\n /**\n * Change the key of a property in the schema. It expects\n * the find the key at the current path.\n */\n const handleKeyChange = (key: string, newKey: string) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to change\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n if (current.properties?.[key]) {\n //Important: maintain order as to not confuse users\n const newProperties = Object.entries(current.properties).map(\n ([k, val]) => {\n return [k === key ? newKey : k, val];\n },\n );\n\n current.properties = Object.fromEntries(\n newProperties,\n ) as JSONSchema7[\"properties\"];\n }\n\n if (current.required?.includes(key)) {\n current.required = current.required.map((item) =>\n item === key ? newKey : item,\n );\n }\n\n setSchema(newSchema);\n };\n\n const handlePropertyChange = (\n key: string,\n updates: Partial<JSONSchema7Definition> & { isRequired?: boolean },\n ): PropertyChangeSuccess | undefined => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to change\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Handle required field updates\n if (typeof updates === \"object\" && \"isRequired\" in updates) {\n if (current.type === \"object\") {\n if (!current.required) {\n current.required = [];\n }\n if (updates.isRequired) {\n if (!current.required.includes(key)) {\n current.required.push(key);\n }\n } else {\n current.required = current.required.filter((item) => item !== key);\n }\n }\n delete updates.isRequired;\n }\n\n let isUpdated = false;\n\n // Update the property\n if (current.type === \"object\" && current.properties) {\n const originalProperty = current.properties[key];\n // Ensure the property exists and is not a boolean\n if (typeof originalProperty !== \"boolean\" && originalProperty) {\n if (typeof updates !== \"boolean\") {\n //if updates changes the type of the property,\n //only the title, description, and default properties should remain\n //from the original property\n if (updates.type && updates.type !== originalProperty.type) {\n updates = {\n title: originalProperty.title,\n description: originalProperty.description,\n default: originalProperty.default,\n ...updates,\n };\n } else if (updates.enum) {\n //if the property is an enum, only the title and description should remain\n //from the original property\n delete updates.type;\n delete updates.items;\n delete updates.properties;\n updates = {\n title: originalProperty.title,\n description: originalProperty.description,\n ...updates,\n };\n } else {\n updates = { ...originalProperty, ...updates };\n }\n\n current.properties[key] = updates;\n }\n }\n isUpdated = true;\n }\n\n setSchema(newSchema);\n\n if (isUpdated) {\n return { status: \"success\", property: current.properties![key]! };\n }\n };\n\n /**\n * Adds a sibling property to the current schema.\n */\n const handleAddProperty = (\n key: string,\n propertyToAdd: JSONSchema7,\n isRequired: boolean,\n ) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to add\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Ensure the current schema has a properties object\n if (current.type !== \"object\") {\n current.type = \"object\";\n }\n if (!current.properties) {\n current.properties = {};\n }\n\n //Ensure there's no existing property with the same key\n if (current.properties[key]) {\n return {\n status: \"error\",\n code: \"key-exists\" as const,\n message: `Property with key ${key} already exists`,\n } satisfies PropertyAddError;\n }\n\n if (propertyToAdd.enum) {\n //ensure that only the enum property is present\n delete propertyToAdd.type;\n delete propertyToAdd.items;\n delete propertyToAdd.properties;\n }\n\n // Add the new property\n current.properties[key] = propertyToAdd;\n\n // Handle required field\n if (isRequired) {\n if (!current.required) {\n current.required = [];\n }\n if (!current.required.includes(key)) {\n current.required.push(key);\n }\n }\n\n setSchema(newSchema);\n\n return {\n status: \"success\" as const,\n property: current.properties[key],\n } satisfies PropertyAddSuccess;\n };\n\n const handleDeleteProperty = (key: string) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to delete\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Handle required field updates\n if (current.type === \"object\") {\n if (current.required) {\n current.required = current.required.filter((item) => item !== key);\n }\n }\n\n // Delete the property\n if (current.type === \"object\" && current.properties) {\n delete current.properties[key];\n }\n\n setSchema(newSchema);\n };\n\n // const handleDuplicateProperty = (key: string) => {\n // const currentProperties = getCurrentSchema().properties;\n // if (!currentProperties || typeof currentProperties[key] === \"boolean\") {\n // return;\n // }\n\n // const propertyToDuplicate = currentProperties[key]!;\n // const newKey = `${key}_copy`;\n // const newProperty = clone(propertyToDuplicate);\n\n // // Add the duplicated property\n // const result = handleAddProperty(\n // newKey,\n // newProperty,\n // isPropertyRequired(key),\n // );\n\n // // Notify if needed\n // if (result.status === \"error\") {\n // props.onPropertyAddError?.(result);\n // } else {\n // props.onPropertyAddSuccess?.(result);\n // }\n // };\n\n const isPropertyRequired = (key: string) => {\n if (path.length) {\n const { propertySchema } = navigateToCorrectNesting(schema, path);\n\n if (\n propertySchema?.type === \"array\" &&\n propertySchema.items &&\n typeof propertySchema.items !== \"boolean\" &&\n !Array.isArray(propertySchema.items) &&\n propertySchema.items?.type === \"object\"\n ) {\n return Boolean(propertySchema.items?.required?.includes(key));\n } else {\n return Boolean(propertySchema?.required?.includes(key));\n }\n }\n\n return Boolean(schema?.required?.includes(key));\n };\n\n return {\n ...context,\n getCurrentSchema,\n getCurrentProperty,\n handlePropertyChange,\n handleAddProperty,\n handleKeyChange,\n navigateToCorrectNesting,\n handleDeleteProperty,\n isPropertyRequired,\n };\n}\n\nexport { SchemaProvider, useSchema };\n"],"names":["SchemaContext","createContext","defaultSchema","SchemaProvider","children","initialSchema","schema","setSchema","useState","path","setPath","jsx","useSchema","context","useContext","navigateToCorrectNesting","providedSchema","providedPath","current","propertySchema","parentSchema","p","getCurrentSchema","key","updates","newSchema","clone","item","isUpdated","originalProperty","propertyToAdd","isRequired","newKey","newProperties","k","val"],"mappings":"qKAcaA,EAAgBC,gBAE3B,MAAS,EAELC,EAA6B,CACjC,QAAS,0CACT,KAAM,SACN,MAAO,QACP,YAAa,GACb,WAAY,CAAC,EACb,SAAU,CAAA,CACZ,EAEA,SAASC,EAAe,CACtB,SAAAC,EACA,cAAAC,CACF,EAAuD,CAC/C,KAAA,CAACC,EAAQC,CAAS,EAAIC,EAAA,SAC1BH,GAAiBH,CACnB,EAQM,CAACO,EAAMC,CAAO,EAAIF,EAAAA,SAAmB,CAAA,CAAE,EAM3C,OAAAG,MAACX,EAAc,SAAd,CAAuB,MAAO,CAAE,OAAAM,EAAQ,UAAAC,EAAW,KAAAE,EAAM,QAAAC,CAAQ,EAC/D,SAAAN,CACH,CAAA,CAEJ,CAgBA,SAASQ,GAAY,CACb,MAAAC,EAAUC,aAAWd,CAAa,EAExC,GAAIa,IAAY,OACR,MAAA,IAAI,MAAM,gDAAgD,EAGlE,KAAM,CAAE,KAAAJ,EAAM,OAAAH,EAAQ,UAAAC,CAAc,EAAAM,EAa9BE,EAA2B,CAC/BC,EACAC,IACG,CACH,IAAIC,EAAUF,EACVG,EAAqC,KAErCC,EAAmC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S,IAAmB,CACjD,MAAAP,EAAYC,IAAMpB,CAAM,EAGxBY,EAAuBI,EAAiBG,CAAS,EAEnD,GAAAP,EAAQ,aAAaK,CAAG,EAAG,CAE7B,MAAMU,EAAgB,OAAO,QAAQf,EAAQ,UAAU,EAAE,IACvD,CAAC,CAACgB,EAAGC,CAAG,IACC,CAACD,IAAMX,EAAMS,EAASE,EAAGC,CAAG,CAEvC,EAEAjB,EAAQ,WAAa,OAAO,YAC1Be,CACF,CAAA,CAGEf,EAAQ,UAAU,SAASK,CAAG,IACxBL,EAAA,SAAWA,EAAQ,SAAS,IAAKS,GACvCA,IAASJ,EAAMS,EAASL,CAC1B,GAGFpB,EAAUkB,CAAS,CACrB,EA6ME,yBAAAV,EACA,qBA1E4BQ,GAAgB,CACtC,MAAAE,EAAYC,IAAMpB,CAAM,EAGxBY,EAAuBI,EAAiBG,CAAS,EAGnDP,EAAQ,OAAS,UACfA,EAAQ,WACVA,EAAQ,SAAWA,EAAQ,SAAS,OAAQS,GAASA,IAASJ,CAAG,GAKjEL,EAAQ,OAAS,UAAYA,EAAQ,YAChC,OAAAA,EAAQ,WAAWK,CAAG,EAG/BhB,EAAUkB,CAAS,CACrB,EAwDE,mBA7B0BF,GAAgB,CAC1C,GAAId,EAAK,OAAQ,CACf,KAAM,CAAE,eAAAU,CAAmB,EAAAJ,EAAyBT,EAAQG,CAAI,EAEhE,OACEU,GAAgB,OAAS,SACzBA,EAAe,OACf,OAAOA,EAAe,OAAU,WAChC,CAAC,MAAM,QAAQA,EAAe,KAAK,GACnCA,EAAe,OAAO,OAAS,SAExB,EAAQA,EAAe,OAAO,UAAU,SAASI,CAAG,EAEpD,EAAQJ,GAAgB,UAAU,SAASI,CAAG,CACvD,CAGF,MAAO,EAAQjB,GAAQ,UAAU,SAASiB,CAAG,CAC/C,CAYA,CACF"}
1
+ {"version":3,"file":"index.cjs2.js","sources":["../src/packages/builder/context.tsx"],"sourcesContent":["import { createContext, useContext, useState } from \"react\";\n\nimport type { PropsWithChildren, SetStateAction } from \"react\";\nimport type { JSONSchema7, JSONSchema7Definition } from \"json-schema\";\nimport { clone } from \"remeda\";\nimport type { OperationError } from \"./shared-types\";\n\ninterface ContextState<T extends JSONSchema7> {\n schema: T;\n setSchema: React.Dispatch<T>;\n path: string[];\n setPath: React.Dispatch<SetStateAction<string[]>>;\n}\n\nexport const SchemaContext = createContext<\n ContextState<JSONSchema7> | undefined\n>(undefined);\n\nconst defaultSchema: JSONSchema7 = {\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"object\",\n title: \"title\",\n description: \"\",\n properties: {},\n required: [],\n};\n\nfunction SchemaProvider({\n children,\n initialSchema,\n}: PropsWithChildren<{ initialSchema?: JSONSchema7 }>) {\n const [schema, setSchema] = useState<JSONSchema7>(\n initialSchema ?? defaultSchema,\n );\n\n /**\n * Path represents the path to a nested property in the schema.\n * It should only contain property keys.\n * An empty path means the current schema is the root schema since\n * the path only represents nested properties.\n */\n const [path, setPath] = useState<string[]>([]);\n\n // NOTE: you *might* need to memoize your values\n // Learn more in http://kcd.im/optimize-context\n\n return (\n <SchemaContext.Provider value={{ schema, setSchema, path, setPath }}>\n {children}\n </SchemaContext.Provider>\n );\n}\n\nexport type PropertyAddError = OperationError & {\n status: \"error\";\n};\n\nexport interface PropertyAddSuccess {\n status: \"success\";\n property: JSONSchema7;\n}\n\nexport interface PropertyChangeSuccess {\n status: \"success\";\n property: JSONSchema7Definition;\n}\n\nfunction useSchema() {\n const context = useContext(SchemaContext);\n\n if (context === undefined) {\n throw new Error(\"useSchema must be used within a SchemaProvider\");\n }\n\n const { path, schema, setSchema } = context;\n\n /**\n * Navigates to the correct property schema of the latest key in the provided path.\n *\n * It will traverse both \"properties\" and \"items\" to find the correct property schema.\n *\n * It will only return a property schema if the provided path is valid i.e. it\n * correctly follows the schema's nesting structure.\n *\n * It will only return a parent schema if the provided path is valid i.e. it\n * correctly follows the schema's nesting structure.\n */\n const navigateToCorrectNesting = (\n providedSchema: JSONSchema7,\n providedPath: string[],\n ) => {\n let current = providedSchema;\n let propertySchema: JSONSchema7 | null = null;\n // Should be the schema of type \"object\" containing the property in its properties key\n let parentSchema: JSONSchema7 | null = null;\n\n for (const p of providedPath) {\n if (\n current.type === \"array\" &&\n current.items &&\n !Array.isArray(current.items) &&\n typeof current.items === \"object\" &&\n current.items.type === \"object\" &&\n typeof current.items.properties?.[p] === \"object\"\n ) {\n parentSchema = current.items;\n propertySchema = current.items.properties[p];\n current = current.items;\n } else if (\n current.type === \"object\" &&\n current.properties &&\n !Array.isArray(current.properties) &&\n typeof current.properties[p] === \"object\"\n ) {\n parentSchema = current;\n propertySchema = current.properties[p];\n current = current.properties[p];\n }\n }\n\n return { propertySchema, parentSchema };\n };\n\n /**\n * Gets the current schema of the latest key in the path.\n * If path is empty, it will return the root schema.\n *\n * It should always return the \"object\" schema of the current path.\n */\n const getCurrentSchema = (initialSchema?: JSONSchema7) => {\n // Gets the correct object schema if under nesting\n // Otherwise, return the root schema\n const { propertySchema } = navigateToCorrectNesting(\n initialSchema ?? schema,\n path,\n );\n\n if (propertySchema) {\n if (propertySchema.type === \"array\") {\n return propertySchema.items as JSONSchema7;\n }\n\n return propertySchema;\n }\n\n return initialSchema ?? schema;\n };\n\n /**\n * Gets the correct property schema of the latest key in the path.\n * If no path is provided, it will return null.\n */\n const getCurrentProperty = () => {\n const { propertySchema } = navigateToCorrectNesting(schema, path);\n\n return propertySchema;\n };\n\n /**\n * Change the key of a property in the schema. It expects\n * the find the key at the current path.\n */\n const handleKeyChange = (key: string, newKey: string) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to change\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n if (current.properties?.[key]) {\n //Important: maintain order as to not confuse users\n const newProperties = Object.entries(current.properties).map(\n ([k, val]) => {\n return [k === key ? newKey : k, val];\n },\n );\n\n current.properties = Object.fromEntries(\n newProperties,\n ) as JSONSchema7[\"properties\"];\n }\n\n if (current.required?.includes(key)) {\n current.required = current.required.map((item) =>\n item === key ? newKey : item,\n );\n }\n\n setSchema(newSchema);\n };\n\n const handlePropertyChange = (\n key: string,\n updates: Partial<JSONSchema7Definition> & { isRequired?: boolean },\n ): PropertyChangeSuccess | undefined => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to change\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Handle required field updates\n if (typeof updates === \"object\" && \"isRequired\" in updates) {\n if (current.type === \"object\") {\n if (!current.required) {\n current.required = [];\n }\n if (updates.isRequired) {\n if (!current.required.includes(key)) {\n current.required.push(key);\n }\n } else {\n current.required = current.required.filter((item) => item !== key);\n }\n }\n delete updates.isRequired;\n }\n\n let isUpdated = false;\n\n // Update the property\n if (current.type === \"object\" && current.properties) {\n const originalProperty = current.properties[key];\n // Ensure the property exists and is not a boolean\n if (typeof originalProperty !== \"boolean\" && originalProperty) {\n if (typeof updates !== \"boolean\") {\n //if updates changes the type of the property,\n //only the title, description, and default properties should remain\n //from the original property\n if (updates.type && updates.type !== originalProperty.type) {\n updates = {\n title: originalProperty.title,\n description: originalProperty.description,\n default: originalProperty.default,\n ...updates,\n };\n } else if (updates.enum) {\n //if the property is an enum, only the title and description should remain\n //from the original property\n delete updates.type;\n delete updates.items;\n delete updates.properties;\n updates = {\n title: originalProperty.title,\n description: originalProperty.description,\n ...updates,\n };\n } else {\n updates = { ...originalProperty, ...updates };\n }\n\n current.properties[key] = updates;\n }\n }\n isUpdated = true;\n }\n\n setSchema(newSchema);\n\n if (isUpdated) {\n return { status: \"success\", property: current.properties![key]! };\n }\n };\n\n /**\n * Adds a sibling property to the current schema.\n */\n const handleAddProperty = (\n key: string,\n propertyToAdd: JSONSchema7,\n isRequired: boolean,\n ) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to add\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Ensure the current schema has a properties object\n if (current.type !== \"object\") {\n current.type = \"object\";\n }\n if (!current.properties) {\n current.properties = {};\n }\n\n //Ensure there's no existing property with the same key\n if (current.properties[key]) {\n return {\n status: \"error\",\n code: \"key-exists\" as const,\n message: `Property with key ${key} already exists`,\n } satisfies PropertyAddError;\n }\n\n if (propertyToAdd.enum) {\n //ensure that only the enum property is present\n delete propertyToAdd.type;\n delete propertyToAdd.items;\n delete propertyToAdd.properties;\n }\n\n // Add the new property\n current.properties[key] = propertyToAdd;\n\n // Handle required field\n if (isRequired) {\n if (!current.required) {\n current.required = [];\n }\n if (!current.required.includes(key)) {\n current.required.push(key);\n }\n }\n\n setSchema(newSchema);\n\n return {\n status: \"success\" as const,\n property: current.properties[key],\n } satisfies PropertyAddSuccess;\n };\n\n const handleDeleteProperty = (key: string) => {\n const newSchema = clone(schema);\n\n // The current schema containing the property to delete\n const current: JSONSchema7 = getCurrentSchema(newSchema);\n\n // Handle required field updates\n if (current.type === \"object\") {\n if (current.required) {\n current.required = current.required.filter((item) => item !== key);\n }\n }\n\n // Delete the property\n if (current.type === \"object\" && current.properties) {\n delete current.properties[key];\n }\n\n setSchema(newSchema);\n };\n\n // const handleDuplicateProperty = (key: string) => {\n // const currentProperties = getCurrentSchema().properties;\n // if (!currentProperties || typeof currentProperties[key] === \"boolean\") {\n // return;\n // }\n\n // const propertyToDuplicate = currentProperties[key]!;\n // const newKey = `${key}_copy`;\n // const newProperty = clone(propertyToDuplicate);\n\n // // Add the duplicated property\n // const result = handleAddProperty(\n // newKey,\n // newProperty,\n // isPropertyRequired(key),\n // );\n\n // // Notify if needed\n // if (result.status === \"error\") {\n // props.onPropertyAddError?.(result);\n // } else {\n // props.onPropertyAddSuccess?.(result);\n // }\n // };\n\n const isPropertyRequired = (key: string) => {\n if (path.length) {\n const { propertySchema } = navigateToCorrectNesting(schema, path);\n\n if (\n propertySchema?.type === \"array\" &&\n propertySchema.items &&\n typeof propertySchema.items !== \"boolean\" &&\n !Array.isArray(propertySchema.items) &&\n propertySchema.items?.type === \"object\"\n ) {\n return Boolean(propertySchema.items?.required?.includes(key));\n } else {\n return Boolean(propertySchema?.required?.includes(key));\n }\n }\n\n return Boolean(schema?.required?.includes(key));\n };\n\n /**\n * Programatically get the current schema value\n */\n const getValue = () => {\n return schema;\n };\n\n return {\n ...context,\n getCurrentSchema,\n getCurrentProperty,\n handlePropertyChange,\n handleAddProperty,\n handleKeyChange,\n navigateToCorrectNesting,\n handleDeleteProperty,\n isPropertyRequired,\n getValue,\n };\n}\n\nexport { SchemaProvider, useSchema };\n"],"names":["SchemaContext","createContext","defaultSchema","SchemaProvider","children","initialSchema","schema","setSchema","useState","path","setPath","jsx","useSchema","context","useContext","navigateToCorrectNesting","providedSchema","providedPath","current","propertySchema","parentSchema","p","getCurrentSchema","key","updates","newSchema","clone","item","isUpdated","originalProperty","propertyToAdd","isRequired","newKey","newProperties","k","val"],"mappings":"qKAcaA,EAAgBC,gBAE3B,MAAS,EAELC,EAA6B,CACjC,QAAS,0CACT,KAAM,SACN,MAAO,QACP,YAAa,GACb,WAAY,CAAC,EACb,SAAU,CAAA,CACZ,EAEA,SAASC,EAAe,CACtB,SAAAC,EACA,cAAAC,CACF,EAAuD,CAC/C,KAAA,CAACC,EAAQC,CAAS,EAAIC,EAAA,SAC1BH,GAAiBH,CACnB,EAQM,CAACO,EAAMC,CAAO,EAAIF,EAAAA,SAAmB,CAAA,CAAE,EAM3C,OAAAG,MAACX,EAAc,SAAd,CAAuB,MAAO,CAAE,OAAAM,EAAQ,UAAAC,EAAW,KAAAE,EAAM,QAAAC,CAAQ,EAC/D,SAAAN,CACH,CAAA,CAEJ,CAgBA,SAASQ,GAAY,CACb,MAAAC,EAAUC,aAAWd,CAAa,EAExC,GAAIa,IAAY,OACR,MAAA,IAAI,MAAM,gDAAgD,EAGlE,KAAM,CAAE,KAAAJ,EAAM,OAAAH,EAAQ,UAAAC,CAAc,EAAAM,EAa9BE,EAA2B,CAC/BC,EACAC,IACG,CACH,IAAIC,EAAUF,EACVG,EAAqC,KAErCC,EAAmC,KAEvC,UAAWC,KAAKJ,EAEZC,EAAQ,OAAS,SACjBA,EAAQ,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EAAiBG,CAAS,EAEnD,GAAAP,EAAQ,aAAaK,CAAG,EAAG,CAE7B,MAAMU,EAAgB,OAAO,QAAQf,EAAQ,UAAU,EAAE,IACvD,CAAC,CAACgB,EAAGC,CAAG,IACC,CAACD,IAAMX,EAAMS,EAASE,EAAGC,CAAG,CAEvC,EAEAjB,EAAQ,WAAa,OAAO,YAC1Be,CACF,CAAA,CAGEf,EAAQ,UAAU,SAASK,CAAG,IACxBL,EAAA,SAAWA,EAAQ,SAAS,IAAKS,GACvCA,IAASJ,EAAMS,EAASL,CAC1B,GAGFpB,EAAUkB,CAAS,CACrB,EAoNE,yBAAAV,EACA,qBAjF4BQ,GAAgB,CACtC,MAAAE,EAAYC,IAAMpB,CAAM,EAGxBY,EAAuBI,EAAiBG,CAAS,EAGnDP,EAAQ,OAAS,UACfA,EAAQ,WACVA,EAAQ,SAAWA,EAAQ,SAAS,OAAQS,GAASA,IAASJ,CAAG,GAKjEL,EAAQ,OAAS,UAAYA,EAAQ,YAChC,OAAAA,EAAQ,WAAWK,CAAG,EAG/BhB,EAAUkB,CAAS,CACrB,EA+DE,mBApC0BF,GAAgB,CAC1C,GAAId,EAAK,OAAQ,CACf,KAAM,CAAE,eAAAU,CAAmB,EAAAJ,EAAyBT,EAAQG,CAAI,EAEhE,OACEU,GAAgB,OAAS,SACzBA,EAAe,OACf,OAAOA,EAAe,OAAU,WAChC,CAAC,MAAM,QAAQA,EAAe,KAAK,GACnCA,EAAe,OAAO,OAAS,SAExB,EAAQA,EAAe,OAAO,UAAU,SAASI,CAAG,EAEpD,EAAQJ,GAAgB,UAAU,SAASI,CAAG,CACvD,CAGF,MAAO,EAAQjB,GAAQ,UAAU,SAASiB,CAAG,CAC/C,EAmBE,SAde,IACRjB,CAcT,CACF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./index.cjs10.js"),R=require("./index.cjs39.js"),m=require("./index.cjs36.js"),E=require("./index.cjs27.js"),L=require("./index.cjs14.js"),a=require("./index.cjs13.js"),k=require("./index.cjs12.js"),v=require("./index.cjs19.js"),h=require("./index.cjs9.js"),w=require("./index.cjs41.js"),M=require("./index.cjs4.js"),P=require("./index.cjs37.js"),$=require("./index.cjs38.js"),o=require("zod"),B=require("react-hook-form"),t=require("./index.cjs40.js"),d=o.z.enum(["string","number","integer","boolean","object","array","null"]),b=o.z.object({key:o.z.string().trim().min(1,{message:"Key must be at least 1 character long"}),property:o.z.object({title:o.z.string().trim().min(1,{message:"Title must be at least 1 character long"}),type:d.or(o.z.array(d)),description:o.z.string().optional(),enum:o.z.array(o.z.string().or(o.z.number()).or(o.z.null()).or(o.z.boolean()).or(o.z.record(o.z.string(),o.z.any()))).optional(),items:o.z.object({type:d.or(o.z.array(d))}).or(o.z.array(o.z.object({type:d.or(o.z.array(d))}).or(o.z.boolean()))).or(o.z.boolean()).optional()}),required:o.z.boolean().default(!1),constraints:o.z.array(o.z.custom(()=>({name:o.z.string().trim().min(1),value:o.z.any()}))).optional()});function _({open:F,onOpenChange:C,onSubmit:S}){const n=B.useForm({resolver:R.zodResolver(b),defaultValues:{key:"",property:{title:""}}}),p=n.watch("constraints"),y=n.watch("property"),z=n.watch("property.enum"),I=n.watch("property.type"),{getConstraintDefinitionsForType:f,getRendererForConstraint:q,validateConstraintValue:D}=M.useConstraints(),A=r=>{const{key:s,property:l,required:c,constraints:i}=r,u={...l,...i?.reduce((j,g)=>({...j,[g.name]:g.value}),{})};S(s,u,c),n.reset()},V=(r,s)=>{const l=h.a(p),c=l?.[r];if(!c){n.setError(`constraints.${r}`,{message:"The constraint was not found",type:"constraint_not_found"});return}const i=D(c.name,s);if(i.status==="error"){let u=i.message;i.code==="invalid"&&(u=`${u}: ${i.error?.map(j=>j.message).join(", ")}`),n.setError(`constraints.${r}`,{type:i.code,message:u});return}c.value=s,n.setValue("constraints",l),n.clearErrors(`constraints.${r}`)},T=r=>{if(!p)return;const l=h.a(p).filter(c=>c.name!==r);n.setValue("constraints",l)},x=f(typeof y?.type=="string"?y.type:"");return e.jsx(m.Dialog,{open:F,onOpenChange:C,children:e.jsxs(m.DialogContent,{"data-testid":"add-property-dialog",children:[e.jsxs(m.DialogHeader,{children:[e.jsx(m.DialogTitle,{children:"Add"}),e.jsx(m.DialogDescription,{children:"Required property values and constraints"})]}),e.jsx(t.Form,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(A),className:"space-y-4","data-testid":"add-property-form",children:[e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"key",render:({field:r})=>{const{onChange:s,...l}=r;return e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Property Key"}),e.jsx(t.FormControl,{children:e.jsx(v.DebouncedInput,{...l,onDebounce:c=>s(c)})}),e.jsx(t.FormMessage,{})]})}})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.title",render:({field:r})=>{const{onChange:s,...l}=r;return e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Property Title"}),e.jsx(t.FormControl,{children:e.jsx(v.DebouncedInput,{...l,onDebounce:c=>s(c)})}),e.jsx(t.FormMessage,{})]})}})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.type",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Type"}),e.jsx(t.FormControl,{children:e.jsxs(a.Select,{value:Array.isArray(r.value)?void 0:r.value,onValueChange:s=>{s==="enum"?n.setValue("property.enum",[]):n.setValue("property.enum",void 0),r.value==="array"&&s!=="array"&&(n.clearErrors("property.items"),n.setValue("property.items",void 0)),r.onChange(s)},children:[e.jsx(a.SelectTrigger,{className:"w-full","aria-label":"Select type",children:e.jsx(a.SelectValue,{})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"string",children:"string"}),e.jsx(a.SelectItem,{value:"number",children:"number"}),e.jsx(a.SelectItem,{value:"integer",children:"integer"}),e.jsx(a.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(a.SelectItem,{value:"object",children:"object"}),e.jsx(a.SelectItem,{value:"array",children:"array"}),e.jsx(a.SelectItem,{value:"null",children:"null"})]})]})}),e.jsx(t.FormMessage,{})]})})}),I==="array"&&e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.items.type",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Items of type"}),e.jsx(t.FormControl,{children:e.jsxs(a.Select,{value:Array.isArray(r.value)?void 0:r.value,onValueChange:s=>{n.clearErrors("property.items.type"),n.setValue("property.items.type",s)},children:[e.jsx(a.SelectTrigger,{className:"w-full","aria-label":"Select items of type",children:e.jsx(a.SelectValue,{placeholder:"Select item type"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"string",children:"string"}),e.jsx(a.SelectItem,{value:"number",children:"number"}),e.jsx(a.SelectItem,{value:"integer",children:"integer"}),e.jsx(a.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(a.SelectItem,{value:"object",children:"object"}),e.jsx(a.SelectItem,{value:"array",children:"array"}),e.jsx(a.SelectItem,{value:"null",children:"null"})]})]})}),e.jsx(t.FormMessage,{})]})})}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(t.FormField,{control:n.control,name:"required",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormControl,{children:e.jsx(k.Switch,{checked:r.value,onCheckedChange:s=>r.onChange(s)})}),e.jsx(t.FormLabel,{children:"Required"}),e.jsx(t.FormMessage,{})]})})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.description",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Description"}),e.jsx(t.FormControl,{children:e.jsx(E.Input,{...r})}),e.jsx(t.FormMessage,{})]})})}),z?e.jsx(t.FormField,{control:n.control,name:"property.enum",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Enum"}),e.jsx(t.FormControl,{children:e.jsx(w.default,{values:r.value?.filter(s=>typeof s=="string")??[],onAddValue:s=>{const l=[];r.value&&l.push(...r.value),l.push(s),r.onChange(l)},onRemoveValue:s=>{const l=h.a(r.value??[]);l.splice(s,1),r.onChange(l)}})}),e.jsx(t.FormMessage,{})]})}):null,x.length?e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Constraints"}),e.jsx(P.default,{addedConstraints:p??[],availableDefinitions:x,onAdd:r=>{n.setValue("constraints",r)}}),e.jsx($.Separator,{}),p?.map((r,s)=>{const l=q(r.name);if(!l)return null;const c=n.formState.errors.constraints?.[s];let i;return c&&(i={code:c?.type??"INVALID",message:c.message??"An error occurred"}),e.jsx(l,{constraintName:r.name,value:r.value,onConstraintChange:u=>{V(s,u)},onRemoveConstraint:()=>{T(r.name)},error:i},r.name)})]}):null,e.jsx(m.DialogFooter,{children:e.jsx(N.Button,{type:"submit",children:"Add Property"})})]})})]})})}exports.AddFormSchema=b;exports.AddPropertyDialog=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./index.cjs10.js"),R=require("./index.cjs43.js"),m=require("./index.cjs40.js"),E=require("./index.cjs27.js"),L=require("./index.cjs14.js"),a=require("./index.cjs13.js"),k=require("./index.cjs12.js"),v=require("./index.cjs19.js"),h=require("./index.cjs9.js"),w=require("./index.cjs45.js"),M=require("./index.cjs4.js"),P=require("./index.cjs41.js"),$=require("./index.cjs42.js"),o=require("zod"),B=require("react-hook-form"),t=require("./index.cjs44.js"),d=o.z.enum(["string","number","integer","boolean","object","array","null"]),b=o.z.object({key:o.z.string().trim().min(1,{message:"Key must be at least 1 character long"}),property:o.z.object({title:o.z.string().trim().min(1,{message:"Title must be at least 1 character long"}),type:d.or(o.z.array(d)),description:o.z.string().optional(),enum:o.z.array(o.z.string().or(o.z.number()).or(o.z.null()).or(o.z.boolean()).or(o.z.record(o.z.string(),o.z.any()))).optional(),items:o.z.object({type:d.or(o.z.array(d))}).or(o.z.array(o.z.object({type:d.or(o.z.array(d))}).or(o.z.boolean()))).or(o.z.boolean()).optional()}),required:o.z.boolean().default(!1),constraints:o.z.array(o.z.custom(()=>({name:o.z.string().trim().min(1),value:o.z.any()}))).optional()});function _({open:F,onOpenChange:C,onSubmit:S}){const n=B.useForm({resolver:R.zodResolver(b),defaultValues:{key:"",property:{title:""}}}),p=n.watch("constraints"),y=n.watch("property"),z=n.watch("property.enum"),I=n.watch("property.type"),{getConstraintDefinitionsForType:f,getRendererForConstraint:q,validateConstraintValue:D}=M.useConstraints(),A=r=>{const{key:s,property:l,required:c,constraints:i}=r,u={...l,...i?.reduce((j,g)=>({...j,[g.name]:g.value}),{})};S(s,u,c),n.reset()},V=(r,s)=>{const l=h.a(p),c=l?.[r];if(!c){n.setError(`constraints.${r}`,{message:"The constraint was not found",type:"constraint_not_found"});return}const i=D(c.name,s);if(i.status==="error"){let u=i.message;i.code==="invalid"&&(u=`${u}: ${i.error?.map(j=>j.message).join(", ")}`),n.setError(`constraints.${r}`,{type:i.code,message:u});return}c.value=s,n.setValue("constraints",l),n.clearErrors(`constraints.${r}`)},T=r=>{if(!p)return;const l=h.a(p).filter(c=>c.name!==r);n.setValue("constraints",l)},x=f(typeof y?.type=="string"?y.type:"");return e.jsx(m.Dialog,{open:F,onOpenChange:C,children:e.jsxs(m.DialogContent,{"data-testid":"add-property-dialog",children:[e.jsxs(m.DialogHeader,{children:[e.jsx(m.DialogTitle,{children:"Add"}),e.jsx(m.DialogDescription,{children:"Required property values and constraints"})]}),e.jsx(t.Form,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(A),className:"space-y-4","data-testid":"add-property-form",children:[e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"key",render:({field:r})=>{const{onChange:s,...l}=r;return e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Property Key"}),e.jsx(t.FormControl,{children:e.jsx(v.DebouncedInput,{...l,onDebounce:c=>s(c)})}),e.jsx(t.FormMessage,{})]})}})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.title",render:({field:r})=>{const{onChange:s,...l}=r;return e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Property Title"}),e.jsx(t.FormControl,{children:e.jsx(v.DebouncedInput,{...l,onDebounce:c=>s(c)})}),e.jsx(t.FormMessage,{})]})}})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.type",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Type"}),e.jsx(t.FormControl,{children:e.jsxs(a.Select,{value:Array.isArray(r.value)?void 0:r.value,onValueChange:s=>{s==="enum"?n.setValue("property.enum",[]):n.setValue("property.enum",void 0),r.value==="array"&&s!=="array"&&(n.clearErrors("property.items"),n.setValue("property.items",void 0)),r.onChange(s)},children:[e.jsx(a.SelectTrigger,{className:"w-full","aria-label":"Select type",children:e.jsx(a.SelectValue,{})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"string",children:"string"}),e.jsx(a.SelectItem,{value:"number",children:"number"}),e.jsx(a.SelectItem,{value:"integer",children:"integer"}),e.jsx(a.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(a.SelectItem,{value:"object",children:"object"}),e.jsx(a.SelectItem,{value:"array",children:"array"}),e.jsx(a.SelectItem,{value:"null",children:"null"})]})]})}),e.jsx(t.FormMessage,{})]})})}),I==="array"&&e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.items.type",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Items of type"}),e.jsx(t.FormControl,{children:e.jsxs(a.Select,{value:Array.isArray(r.value)?void 0:r.value,onValueChange:s=>{n.clearErrors("property.items.type"),n.setValue("property.items.type",s)},children:[e.jsx(a.SelectTrigger,{className:"w-full","aria-label":"Select items of type",children:e.jsx(a.SelectValue,{placeholder:"Select item type"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"string",children:"string"}),e.jsx(a.SelectItem,{value:"number",children:"number"}),e.jsx(a.SelectItem,{value:"integer",children:"integer"}),e.jsx(a.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(a.SelectItem,{value:"object",children:"object"}),e.jsx(a.SelectItem,{value:"array",children:"array"}),e.jsx(a.SelectItem,{value:"null",children:"null"})]})]})}),e.jsx(t.FormMessage,{})]})})}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(t.FormField,{control:n.control,name:"required",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormControl,{children:e.jsx(k.Switch,{checked:r.value,onCheckedChange:s=>r.onChange(s)})}),e.jsx(t.FormLabel,{children:"Required"}),e.jsx(t.FormMessage,{})]})})}),e.jsx("div",{className:"space-y-2",children:e.jsx(t.FormField,{control:n.control,name:"property.description",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Description"}),e.jsx(t.FormControl,{children:e.jsx(E.Input,{...r})}),e.jsx(t.FormMessage,{})]})})}),z?e.jsx(t.FormField,{control:n.control,name:"property.enum",render:({field:r})=>e.jsxs(t.FormItem,{children:[e.jsx(t.FormLabel,{children:"Enum"}),e.jsx(t.FormControl,{children:e.jsx(w.default,{values:r.value?.filter(s=>typeof s=="string")??[],onAddValue:s=>{const l=[];r.value&&l.push(...r.value),l.push(s),r.onChange(l)},onRemoveValue:s=>{const l=h.a(r.value??[]);l.splice(s,1),r.onChange(l)}})}),e.jsx(t.FormMessage,{})]})}):null,x.length?e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Constraints"}),e.jsx(P.default,{addedConstraints:p??[],availableDefinitions:x,onAdd:r=>{n.setValue("constraints",r)}}),e.jsx($.Separator,{}),p?.map((r,s)=>{const l=q(r.name);if(!l)return null;const c=n.formState.errors.constraints?.[s];let i;return c&&(i={code:c?.type??"INVALID",message:c.message??"An error occurred"}),e.jsx(l,{constraintName:r.name,value:r.value,onConstraintChange:u=>{V(s,u)},onRemoveConstraint:()=>{T(r.name)},error:i},r.name)})]}):null,e.jsx(m.DialogFooter,{children:e.jsx(N.Button,{type:"submit",children:"Add Property"})})]})})]})})}exports.AddFormSchema=b;exports.AddPropertyDialog=_;
2
2
  //# sourceMappingURL=index.cjs20.js.map
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs48.js");/**
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs50.js");/**
2
2
  * @license lucide-react v0.477.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),se=require("./index.cjs2.js"),h=require("./index.cjs10.js"),u=require("./index.cjs11.js"),ae=require("./index.cjs12.js"),l=require("./index.cjs13.js"),F=require("./index.cjs14.js"),U=require("./index.cjs9.js"),Q=require("./index.cjs4.js"),oe=require("./index.cjs15.js"),a=require("./index.cjs16.js"),D=require("./index.cjs17.js"),ce=require("./index.cjs18.js"),de=require("ajv"),P=require("./index.cjs19.js"),ue=require("./index.cjs20.js"),A=require("./index.cjs21.js"),he=require("./index.cjs22.js"),me=require("./index.cjs23.js"),je=require("./index.cjs24.js"),xe=require("./index.cjs25.js"),ge=require("./index.cjs26.js"),be=i=>{const[_,x]=s.useState(!1),[k,p]=s.useState(!1),[H,g]=s.useState(!1),[b,S]=s.useState(),[N,q]=s.useState(),[B,I]=s.useState(),[f,v]=s.useState(null);Q.usePluginSystem(i.plugins??[]);const{getCurrentSchema:E,setPath:m,path:o,schema:w,handleAddProperty:T,handlePropertyChange:c,handleKeyChange:R,handleDeleteProperty:M,setSchema:G,isPropertyRequired:C}=se.useSchema(),{getConstraintDefinitionsForType:J}=Q.useConstraints();s.useEffect(()=>{if(i.initialSchema)try{ce.validateSchema(i.initialSchema),G(U.a(i.initialSchema)),v(null)}catch(t){t instanceof Error?v(t.message):t instanceof de.ValidationError?v(`Schema validation error: ${t.message}`):v("Unknown schema validation error")}},[i.initialSchema]),s.useEffect(()=>{!f&&i.onSchemaChange&&i.onSchemaChange(w)},[w,f,i.onSchemaChange]);const W=E(),z=t=>{m([...o,t])},K=()=>{m(o.slice(0,-1))},X=(t,n)=>{q(t),I(n),p(!0)},V=t=>{S(t),g(!0)},Y=()=>{b&&(M(b),S(void 0)),g(!1)},Z=()=>{S(void 0),g(!1)},$=t=>{const n=E().properties;if(!n||typeof n[t]=="boolean")return;const r=n[t],j=`${t}_copy`,y=U.a(r),d=T(j,y,C(t));d.status==="error"?i.onPropertyAddError?.(d):i.onPropertyAddSuccess?.(d)},ee=(...t)=>{const n=T(...t);n.status==="error"?i.onPropertyAddError?.(n):n.status==="success"&&i.onPropertyAddSuccess?.(n),x(!1)},L=i.propertyComponent,te=(t,n)=>L?e.jsx(L,{property:{key:t,schema:n,isRequired:C(t)},onPropertyChange:c,onKeyChange:R,onDelete:V,onDuplicate:$,onNavigate:n.type==="object"||n.type==="array"&&typeof n.items=="object"&&n.items.type==="object"?z:void 0},t):e.jsxs("div",{className:"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2",children:[e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:t,onDebounce:r=>R(t,r),placeholder:"Property Key","aria-label":`Property key for ${t}`,delay:500})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae.Switch,{checked:C(t),onCheckedChange:r=>c(t,{isRequired:r}),"aria-label":"Required"}),e.jsx(F.Label,{htmlFor:`required-${t}`,children:"Required"})]}),e.jsx("div",{className:"",children:e.jsxs(l.Select,{value:typeof n=="object"&&!Array.isArray(n.type)?n.type:void 0,onValueChange:r=>c(t,{type:r}),"aria-label":"Type",children:[e.jsx(l.SelectTrigger,{className:"w-full","aria-label":"Select type",children:e.jsx(l.SelectValue,{})}),e.jsxs(l.SelectContent,{children:[e.jsx(l.SelectItem,{value:"string",children:"string"}),e.jsx(l.SelectItem,{value:"number",children:"number"}),e.jsx(l.SelectItem,{value:"integer",children:"integer"}),e.jsx(l.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(l.SelectItem,{value:"object",children:"object"}),e.jsx(l.SelectItem,{value:"array",children:"array"}),e.jsx(l.SelectItem,{value:"null",children:"null"}),e.jsx(l.SelectItem,{value:"enum",children:"enum"})]})]})}),e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:typeof n=="object"?n.title:void 0,onDebounce:r=>c(t,{title:r}),placeholder:"Title"})}),e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:typeof n=="object"?n.description:void 0,onDebounce:r=>c(t,{description:r}),placeholder:"Description"})}),e.jsxs("div",{className:"order-last md:order-none flex gap-2",children:[e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>V(t),"aria-label":"Delete",className:"block!",children:e.jsx(me.default,{size:16,className:"text-destructive"})}),e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>$(t),"aria-label":"Duplicate",className:"block!",children:e.jsx(je.default,{size:16})}),re(t,n),O(t,n)]}),ne(t,n)]},t),ne=(t,n)=>{if(typeof n!="object"||n.type!=="array")return null;const r=n.items,j=!Array.isArray(r)&&typeof r=="object"&&typeof r.type=="string"?r?.type:"string";return e.jsxs("div",{className:"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md",children:[e.jsx(F.Label,{children:"Items of type:"}),e.jsxs(l.Select,{value:j,onValueChange:y=>{const d={...typeof r=="object"?r:{},type:y};y==="object"&&(d.properties=d.properties??{}),c(t,{items:d})},children:[e.jsx(l.SelectTrigger,{className:"w-[200px]","aria-label":"Select items of type",children:e.jsx(l.SelectValue,{})}),e.jsxs(l.SelectContent,{children:[e.jsx(l.SelectItem,{value:"string",children:"string"}),e.jsx(l.SelectItem,{value:"number",children:"number"}),e.jsx(l.SelectItem,{value:"integer",children:"integer"}),e.jsx(l.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(l.SelectItem,{value:"object",children:"object"}),e.jsx(l.SelectItem,{value:"array",children:"array"}),e.jsx(l.SelectItem,{value:"null",children:"null"})]})]}),O(t,r)]})},re=(t,n)=>{if(typeof n!="object")return null;const r=J(typeof n.type=="string"?n.type:""),j=Array.isArray(n?.enum);return r.length||j?e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>X(t,n),"aria-label":"Edit constraints",children:e.jsx(xe.default,{size:16})}):null},O=(t,n)=>!Array.isArray(n)&&typeof n=="object"&&n?.type==="object"?e.jsxs(h.Button,{variant:"outline",size:"sm",onClick:()=>z(t),"aria-label":"Navigate",children:[e.jsx("span",{className:"sr-only",children:"Navigate"}),e.jsx(ge.default,{size:16})]}):null,le=()=>{const t=i.navigationComponent;return t?e.jsx(t,{currentPath:o,onNavigateUp:K,onNavigateTo:m,isRootPath:o.length===0}):e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(h.Button,{variant:"outline",size:"sm",onClick:K,disabled:o.length===0,className:A.cn(i.backButtonClassName),children:"Back"}),e.jsx(u.Breadcrumb,{children:e.jsxs(u.BreadcrumbList,{children:[e.jsx(u.BreadcrumbItem,{children:e.jsx(u.BreadcrumbLink,{href:"#",onClick:()=>m([]),children:"Root"})}),o.map((n,r)=>e.jsxs(s.Fragment,{children:[e.jsx(u.BreadcrumbSeparator,{}),e.jsx(u.BreadcrumbItem,{children:e.jsx(u.BreadcrumbLink,{href:"#",onClick:()=>m(o.slice(0,r+1)),children:n})})]},`path-${r}`))]})})]})},ie=()=>{const t=i.addPropertyButtonComponent;return t?e.jsx(t,{onClick:()=>x(!0)}):e.jsxs(h.Button,{className:A.cn("self-center",i.addPropertyButtonClassName),onClick:()=>{x(!0)},children:[e.jsx(he.default,{className:"h-4 w-4 mr-2"}),"Add Property"]})};return e.jsxs("div",{children:[f&&e.jsxs(D.Alert,{variant:"destructive",children:[e.jsx(D.AlertTitle,{children:"Schema Error"}),e.jsx(D.AlertDescription,{children:f})]}),le(),e.jsx("div",{className:A.cn("mt-6 overflow-x-hidden",i.propertiesListClassName),children:Object.entries(W.properties??{}).map(([t,n])=>typeof n=="boolean"?null:te(t,n))}),ie(),e.jsx(ue.AddPropertyDialog,{open:_,onOpenChange:x,onSubmit:ee}),N&&B&&e.jsx(oe.EditPropertyDialog,{propertyKey:N,property:B,open:k,onOpenChange:p,onSubmit:t=>{c(...t),q(void 0),I(void 0),p(!1)}}),e.jsx(a.AlertDialog,{open:H,onOpenChange:g,children:e.jsxs(a.AlertDialogContent,{children:[e.jsxs(a.AlertDialogHeader,{children:[e.jsx(a.AlertDialogTitle,{children:"Are you sure?"}),e.jsxs(a.AlertDialogDescription,{children:["This action cannot be undone. This will permanently delete the property",b?` "${b}"`:""," from the schema."]})]}),e.jsxs(a.AlertDialogFooter,{children:[e.jsx(a.AlertDialogCancel,{onClick:Z,children:"Cancel"}),e.jsx(a.AlertDialogAction,{onClick:Y,children:"Delete"})]})]})})]})};exports.SchemaBuilder=be;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),se=require("./index.cjs2.js"),h=require("./index.cjs10.js"),u=require("./index.cjs11.js"),ae=require("./index.cjs12.js"),l=require("./index.cjs13.js"),F=require("./index.cjs14.js"),U=require("./index.cjs9.js"),Q=require("./index.cjs4.js"),oe=require("./index.cjs15.js"),a=require("./index.cjs16.js"),D=require("./index.cjs17.js"),ce=require("./index.cjs18.js"),de=require("ajv"),P=require("./index.cjs19.js"),ue=require("./index.cjs20.js"),A=require("./index.cjs21.js"),he=require("./index.cjs22.js"),me=require("./index.cjs23.js"),je=require("./index.cjs24.js"),xe=require("./index.cjs25.js"),ge=require("./index.cjs26.js"),be=i=>{const[_,x]=s.useState(!1),[k,p]=s.useState(!1),[H,g]=s.useState(!1),[b,S]=s.useState(),[N,q]=s.useState(),[B,I]=s.useState(),[f,v]=s.useState(null);Q.usePluginSystem(i.plugins??[]);const{getCurrentSchema:E,setPath:m,path:o,schema:w,handleAddProperty:T,handlePropertyChange:c,handleKeyChange:R,handleDeleteProperty:M,setSchema:G,isPropertyRequired:C}=se.useSchema(),{getConstraintDefinitionsForType:J}=Q.useConstraints();s.useEffect(()=>{if(i.initialSchema)try{ce.validateSchema(i.initialSchema),G(U.a(i.initialSchema)),v(null)}catch(t){t instanceof Error?v(t.message):t instanceof de.ValidationError?v(`Schema validation error: ${t.message}`):v("Unknown schema validation error")}},[i.initialSchema]),s.useEffect(()=>{!f&&i.onSchemaChange&&i.onSchemaChange(w)},[w,f,i.onSchemaChange]);const W=E(),z=t=>{m([...o,t])},K=()=>{m(o.slice(0,-1))},X=(t,n)=>{q(t),I(n),p(!0)},V=t=>{S(t),g(!0)},Y=()=>{b&&(M(b),S(void 0)),g(!1)},Z=()=>{S(void 0),g(!1)},$=t=>{const n=E().properties;if(!n||typeof n[t]=="boolean")return;const r=n[t],j=`${t}_copy`,y=U.a(r),d=T(j,y,C(t));d.status==="error"?i.onPropertyAddError?.(d):i.onPropertyAddSuccess?.(d)},ee=(...t)=>{const n=T(...t);n.status==="error"?i.onPropertyAddError?.(n):n.status==="success"&&i.onPropertyAddSuccess?.(n),x(!1)},L=i.propertyComponent,te=(t,n)=>L?e.jsx(L,{property:{key:t,schema:n,isRequired:C(t)},onPropertyChange:c,onKeyChange:R,onDelete:V,onDuplicate:$,onNavigate:n.type==="object"||n.type==="array"&&typeof n.items=="object"&&n.items.type==="object"?z:void 0},t):e.jsxs("div",{className:"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2",children:[e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:t,onDebounce:r=>R(t,r),placeholder:"Property Key","aria-label":`Property key for ${t}`,delay:500})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae.Switch,{checked:C(t),onCheckedChange:r=>c(t,{isRequired:r}),"aria-label":"Required"}),e.jsx(F.Label,{htmlFor:`required-${t}`,children:"Required"})]}),e.jsx("div",{className:"",children:e.jsxs(l.Select,{value:typeof n=="object"&&!Array.isArray(n.type)?n.type:void 0,onValueChange:r=>c(t,{type:r}),"aria-label":"Type",children:[e.jsx(l.SelectTrigger,{className:"w-full","aria-label":"Select type",children:e.jsx(l.SelectValue,{})}),e.jsxs(l.SelectContent,{children:[e.jsx(l.SelectItem,{value:"string",children:"string"}),e.jsx(l.SelectItem,{value:"number",children:"number"}),e.jsx(l.SelectItem,{value:"integer",children:"integer"}),e.jsx(l.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(l.SelectItem,{value:"object",children:"object"}),e.jsx(l.SelectItem,{value:"array",children:"array"}),e.jsx(l.SelectItem,{value:"null",children:"null"}),e.jsx(l.SelectItem,{value:"enum",children:"enum"})]})]})}),e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:typeof n=="object"?n.title:void 0,onDebounce:r=>c(t,{title:r}),placeholder:"Title"})}),e.jsx("div",{className:"",children:e.jsx(P.DebouncedInput,{value:typeof n=="object"?n.description:void 0,onDebounce:r=>c(t,{description:r}),placeholder:"Description"})}),e.jsxs("div",{className:"order-last md:order-none flex gap-2",children:[e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>V(t),"aria-label":"Delete",className:"block!",children:e.jsx(me.default,{size:16,className:"text-destructive"})}),e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>$(t),"aria-label":"Duplicate",className:"block!",children:e.jsx(je.default,{size:16})}),re(t,n),O(t,n)]}),ne(t,n)]},t),ne=(t,n)=>{if(typeof n!="object"||n.type!=="array")return null;const r=n.items,j=!Array.isArray(r)&&typeof r=="object"&&typeof r.type=="string"?r?.type:"string";return e.jsxs("div",{className:"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md",children:[e.jsx(F.Label,{children:"Items of type:"}),e.jsxs(l.Select,{value:j,onValueChange:y=>{const d={...typeof r=="object"?r:{},type:y};y==="object"&&(d.properties=d.properties??{}),c(t,{items:d})},children:[e.jsx(l.SelectTrigger,{className:"w-[200px]","aria-label":"Select items of type",children:e.jsx(l.SelectValue,{})}),e.jsxs(l.SelectContent,{children:[e.jsx(l.SelectItem,{value:"string",children:"string"}),e.jsx(l.SelectItem,{value:"number",children:"number"}),e.jsx(l.SelectItem,{value:"integer",children:"integer"}),e.jsx(l.SelectItem,{value:"boolean",children:"boolean"}),e.jsx(l.SelectItem,{value:"object",children:"object"}),e.jsx(l.SelectItem,{value:"array",children:"array"}),e.jsx(l.SelectItem,{value:"null",children:"null"})]})]}),O(t,r)]})},re=(t,n)=>{if(typeof n!="object")return null;const r=J(typeof n.type=="string"?n.type:""),j=Array.isArray(n?.enum);return r.length||j?e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>X(t,n),"aria-label":"Edit constraints",children:e.jsx(xe.default,{size:16})}):null},O=(t,n)=>!Array.isArray(n)&&typeof n=="object"&&n?.type==="object"?e.jsxs(h.Button,{variant:"outline",size:"sm",onClick:()=>z(t),"aria-label":"Navigate",children:[e.jsx("span",{className:"sr-only",children:"Navigate"}),e.jsx(ge.default,{size:16})]}):null,le=()=>{const t=i.navigationComponent;return t?e.jsx(t,{currentPath:o,onNavigateUp:K,onNavigateTo:m,isRootPath:o.length===0}):e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(h.Button,{variant:"outline",size:"sm",onClick:K,disabled:o.length===0,className:A.cn(i.backButtonClassName),children:"Back"}),e.jsx(u.Breadcrumb,{children:e.jsxs(u.BreadcrumbList,{children:[e.jsx(u.BreadcrumbItem,{children:e.jsx(u.BreadcrumbLink,{href:"#",onClick:()=>m([]),children:"Root"})}),o.map((n,r)=>e.jsxs(s.Fragment,{children:[e.jsx(u.BreadcrumbSeparator,{}),e.jsx(u.BreadcrumbItem,{children:e.jsx(u.BreadcrumbLink,{href:"#",onClick:()=>m(o.slice(0,r+1)),children:n})})]},`path-${r}`))]})})]})},ie=()=>{const t=i.addPropertyButtonComponent;return t?e.jsx(t,{onClick:()=>x(!0)}):e.jsxs(h.Button,{type:"button",className:A.cn("self-center",i.addPropertyButtonClassName),onClick:()=>{x(!0)},children:[e.jsx(he.default,{className:"h-4 w-4 mr-2"}),"Add Property"]})};return e.jsxs("div",{children:[f&&e.jsxs(D.Alert,{variant:"destructive",children:[e.jsx(D.AlertTitle,{children:"Schema Error"}),e.jsx(D.AlertDescription,{children:f})]}),le(),e.jsx("div",{className:A.cn("mt-6 overflow-x-hidden",i.propertiesListClassName),children:Object.entries(W.properties??{}).map(([t,n])=>typeof n=="boolean"?null:te(t,n))}),ie(),e.jsx(ue.AddPropertyDialog,{open:_,onOpenChange:x,onSubmit:ee}),N&&B&&e.jsx(oe.EditPropertyDialog,{propertyKey:N,property:B,open:k,onOpenChange:p,onSubmit:t=>{c(...t),q(void 0),I(void 0),p(!1)}}),e.jsx(a.AlertDialog,{open:H,onOpenChange:g,children:e.jsxs(a.AlertDialogContent,{children:[e.jsxs(a.AlertDialogHeader,{children:[e.jsx(a.AlertDialogTitle,{children:"Are you sure?"}),e.jsxs(a.AlertDialogDescription,{children:["This action cannot be undone. This will permanently delete the property",b?` "${b}"`:""," from the schema."]})]}),e.jsxs(a.AlertDialogFooter,{children:[e.jsx(a.AlertDialogCancel,{onClick:Z,children:"Cancel"}),e.jsx(a.AlertDialogAction,{onClick:Y,children:"Delete"})]})]})})]})};exports.SchemaBuilder=be;
2
2
  //# sourceMappingURL=index.cjs3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs3.js","sources":["../src/packages/builder/schema-builder.tsx"],"sourcesContent":["import { useEffect, useState, Fragment } from \"react\";\nimport { PropertyAddError, PropertyAddSuccess, useSchema } from \"./context\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Bolt, ChevronRight, Copy, Plus, Trash2 } from \"lucide-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { Label } from \"@/components/ui/label\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { clone } from \"remeda\";\nimport {\n BaseJSONSchemaPlugin,\n useConstraints,\n usePluginSystem,\n} from \"@/packages/constraints/context\";\nimport { EditPropertyDialog } from \"./edit-dialog\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { validateSchema } from \"./utils\";\nimport Ajv from \"ajv\";\nimport { DebouncedInput } from \"@/components/depounced-input\";\nimport { AddPropertyDialog, type AddPropertyDialogProps } from \"./add-dialog\";\nimport { cn } from \"@/lib/utils\";\n\n// PropertyComponent type definition for custom property components\nexport interface PropertyComponentProps {\n property: {\n key: string;\n schema: JSONSchema7;\n isRequired: boolean;\n };\n onPropertyChange: (key: string, changes: Partial<JSONSchema7>) => void;\n onKeyChange: (oldKey: string, newKey: string) => void;\n onDelete: (key: string) => void;\n onDuplicate?: (key: string) => void;\n onNavigate?: (key: string) => void;\n}\n\n// NavigationProps for custom navigation component\nexport interface NavigationProps {\n currentPath: string[];\n onNavigateUp: () => void;\n onNavigateTo: (newPath: string[]) => void;\n isRootPath: boolean;\n}\n\n// AddPropertyButtonProps for custom add property button\nexport interface AddPropertyButtonProps {\n onClick: () => void;\n}\n\ninterface SchemaBuilderProps {\n /** The schema to edit */\n initialSchema?: JSONSchema7;\n /** Constraint plugins to use */\n plugins?: BaseJSONSchemaPlugin[];\n /** Custom component to render properties */\n propertyComponent?: React.ComponentType<PropertyComponentProps>;\n /** Called when the schema changes */\n onSchemaChange?: (schema: JSONSchema7) => void;\n /** Called when a property is successfully added */\n onPropertyAddSuccess?: (props: PropertyAddSuccess) => void;\n /** Called when there's an error adding a property */\n onPropertyAddError?: (props: PropertyAddError) => void;\n /** Called when there's an error changing a property */\n onPropertyChangeError?: (prop: Error) => void;\n /** Called when a property is successfully changed */\n onPropertyChangeSuccess?: () => void;\n /** Class name for the navigation bar back button */\n backButtonClassName?: string;\n /** Class name for the properties list container */\n propertiesListClassName?: string;\n /** Class name for the add property button */\n addPropertyButtonClassName?: string;\n /** Custom navigation component */\n navigationComponent?: React.ComponentType<NavigationProps>;\n /** Custom add property button component */\n addPropertyButtonComponent?: React.ComponentType<AddPropertyButtonProps>;\n}\n\nexport const SchemaBuilder = (props: SchemaBuilderProps) => {\n // State\n const [showPropertyDialog, setShowPropertyDialog] = useState(false);\n const [showEditDialog, setShowEditDialog] = useState(false);\n const [showDeleteDialog, setShowDeleteDialog] = useState(false);\n const [deleteKey, setDeleteKey] = useState<string | undefined>();\n const [editingKey, setEditingKey] = useState<string | undefined>();\n const [editingProperty, setEditingProperty] = useState<\n JSONSchema7 | undefined\n >();\n const [schemaValidationError, setSchemaValidationError] = useState<\n string | null\n >(null);\n\n // Initialize the plugin system\n usePluginSystem(props.plugins ?? []);\n\n // Get schema context\n const {\n getCurrentSchema,\n setPath,\n path,\n schema,\n handleAddProperty,\n handlePropertyChange,\n handleKeyChange,\n handleDeleteProperty,\n setSchema,\n isPropertyRequired,\n } = useSchema();\n\n // Get constraints context\n const { getConstraintDefinitionsForType } = useConstraints();\n\n // Set schema from props\n useEffect(() => {\n if (props.initialSchema) {\n try {\n // Validate the schema before setting it\n validateSchema(props.initialSchema);\n setSchema(clone(props.initialSchema));\n setSchemaValidationError(null);\n } catch (error) {\n if (error instanceof Error) {\n setSchemaValidationError(error.message);\n } else if (error instanceof Ajv.ValidationError) {\n setSchemaValidationError(`Schema validation error: ${error.message}`);\n } else {\n setSchemaValidationError(\"Unknown schema validation error\");\n }\n }\n }\n }, [props.initialSchema]);\n\n // Notify schema changes\n useEffect(() => {\n if (!schemaValidationError && props.onSchemaChange) {\n props.onSchemaChange(schema);\n }\n }, [schema, schemaValidationError, props.onSchemaChange]);\n\n const currentSchema = getCurrentSchema();\n\n // Navigation handlers\n const handleNavigateToProperty = (name: string) => {\n setPath([...path, name]);\n };\n\n const handleNavigateUp = () => {\n setPath(path.slice(0, -1));\n };\n\n // Property management handlers\n const handleEditProperty = (key: string, property: JSONSchema7) => {\n setEditingKey(key);\n setEditingProperty(property);\n setShowEditDialog(true);\n };\n\n const handleInitiateDelete = (key: string) => {\n setDeleteKey(key);\n setShowDeleteDialog(true);\n };\n\n const handleConfirmDelete = () => {\n if (deleteKey) {\n handleDeleteProperty(deleteKey);\n setDeleteKey(undefined);\n }\n setShowDeleteDialog(false);\n };\n\n const handleCancelDelete = () => {\n setDeleteKey(undefined);\n setShowDeleteDialog(false);\n };\n\n const handleDuplicateProperty = (key: string) => {\n const currentProperties = getCurrentSchema().properties;\n if (!currentProperties || typeof currentProperties[key] === \"boolean\") {\n return;\n }\n\n const propertyToDuplicate = currentProperties[key]!;\n const newKey = `${key}_copy`;\n const newProperty = clone(propertyToDuplicate);\n\n // Add the duplicated property\n const result = handleAddProperty(\n newKey,\n newProperty,\n isPropertyRequired(key),\n );\n\n // Notify if needed\n if (result.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else {\n props.onPropertyAddSuccess?.(result);\n }\n };\n\n const onAddProperty: AddPropertyDialogProps[\"onSubmit\"] = (...vals) => {\n const result = handleAddProperty(...vals);\n\n if (result.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else if (result.status === \"success\") {\n props.onPropertyAddSuccess?.(result);\n }\n setShowPropertyDialog(false);\n };\n\n // Custom property component or default renderer\n const PropertyComponent = props.propertyComponent;\n\n const renderProperty = (key: string, property: JSONSchema7) => {\n if (PropertyComponent) {\n return (\n <PropertyComponent\n key={key}\n property={{\n key,\n schema: property,\n isRequired: isPropertyRequired(key),\n }}\n onPropertyChange={handlePropertyChange}\n onKeyChange={handleKeyChange}\n onDelete={handleInitiateDelete}\n onDuplicate={handleDuplicateProperty}\n onNavigate={\n property.type === \"object\" ||\n (property.type === \"array\" &&\n typeof property.items === \"object\" &&\n (property.items as JSONSchema7).type === \"object\")\n ? handleNavigateToProperty\n : undefined\n }\n />\n );\n }\n\n // Default property renderer\n return (\n <div\n key={key}\n className=\"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2\"\n >\n <div className=\"\">\n <DebouncedInput\n value={key}\n onDebounce={(newVal) => handleKeyChange(key, newVal)}\n placeholder=\"Property Key\"\n aria-label={`Property key for ${key}`}\n delay={500}\n />\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Switch\n checked={isPropertyRequired(key)}\n onCheckedChange={(checked) =>\n handlePropertyChange(key, { isRequired: checked })\n }\n aria-label=\"Required\"\n />\n <Label htmlFor={`required-${key}`}>Required</Label>\n </div>\n\n <div className=\"\">\n <Select\n value={\n typeof property === \"object\" && !Array.isArray(property.type)\n ? property.type\n : undefined\n }\n onValueChange={(value) =>\n handlePropertyChange(key, {\n type: value as JSONSchema7[\"type\"],\n })\n }\n aria-label=\"Type\"\n >\n <SelectTrigger className=\"w-full\" aria-label=\"Select type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n <SelectItem value={\"enum\"}>enum</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={typeof property === \"object\" ? property.title : undefined}\n onDebounce={(newVal) =>\n handlePropertyChange(key, { title: newVal })\n }\n placeholder=\"Title\"\n />\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={\n typeof property === \"object\" ? property.description : undefined\n }\n onDebounce={(newVal) =>\n handlePropertyChange(key, { description: newVal })\n }\n placeholder=\"Description\"\n />\n </div>\n\n <div className=\"order-last md:order-none flex gap-2\">\n {/* Delete button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleInitiateDelete(key)}\n aria-label=\"Delete\"\n className=\"block!\"\n >\n <Trash2 size={16} className=\"text-destructive\" />\n </Button>\n\n {/* Duplicate button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleDuplicateProperty(key)}\n aria-label=\"Duplicate\"\n className=\"block!\"\n >\n <Copy size={16} />\n </Button>\n\n {/* Edit button if applicable */}\n {renderEditButton(key, property)}\n\n {/* Navigate button for objects/array items */}\n {renderNavigateButton(key, property)}\n </div>\n\n {/* Render array items configuration if needed */}\n {renderArrayItemsConfig(key, property)}\n </div>\n );\n };\n\n // Helper to render array items configuration\n const renderArrayItemsConfig = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\" || property.type !== \"array\") {\n return null;\n }\n\n const items = property.items;\n const itemType =\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n typeof items.type === \"string\"\n ? items?.type\n : \"string\";\n\n return (\n <div className=\"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md\">\n <Label>Items of type:</Label>\n <Select\n value={itemType as string}\n onValueChange={(value) => {\n const newItems: JSONSchema7 = {\n ...(typeof items === \"object\" ? items : {}),\n type: value as JSONSchema7[\"type\"],\n };\n\n if (value === \"object\") {\n // Initialize empty properties for object type\n newItems.properties = newItems.properties ?? {};\n }\n\n handlePropertyChange(key, { items: newItems });\n }}\n >\n <SelectTrigger\n className=\"w-[200px]\"\n aria-label=\"Select items of type\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n </SelectContent>\n </Select>\n\n {/* Configure object button for array items of type object */}\n {renderNavigateButton(key, items)}\n </div>\n );\n };\n\n // Helper to render the edit constraint button when needed\n const renderEditButton = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\") return null;\n\n // Check for constraints\n const availableConstraints = getConstraintDefinitionsForType(\n typeof property.type === \"string\" ? property.type : \"\",\n );\n\n // Check for enum\n const hasEnum = Array.isArray(property?.enum);\n\n if (availableConstraints.length || hasEnum) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleEditProperty(key, property)}\n aria-label=\"Edit constraints\"\n >\n <Bolt size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n const renderNavigateButton = (key: string, items: JSONSchema7[\"items\"]) => {\n if (\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n items?.type === \"object\"\n ) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleNavigateToProperty(key)}\n aria-label=\"Navigate\"\n >\n <span className=\"sr-only\">Navigate</span>\n <ChevronRight size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n // Render navigation component\n const renderNavigation = () => {\n const NavigationComponent = props.navigationComponent;\n\n if (NavigationComponent) {\n return (\n <NavigationComponent\n currentPath={path}\n onNavigateUp={handleNavigateUp}\n onNavigateTo={setPath}\n isRootPath={path.length === 0}\n />\n );\n }\n\n return (\n <div className=\"flex items-center space-x-4\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleNavigateUp}\n disabled={path.length === 0}\n className={cn(props.backButtonClassName)}\n >\n Back\n </Button>\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#\" onClick={() => setPath([])}>\n Root\n </BreadcrumbLink>\n </BreadcrumbItem>\n {path.map((item, index) => (\n <Fragment key={`path-${index}`}>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbLink\n href=\"#\"\n onClick={() => setPath(path.slice(0, index + 1))}\n >\n {item}\n </BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n ))}\n </BreadcrumbList>\n </Breadcrumb>\n </div>\n );\n };\n\n // Render add property button\n const renderAddPropertyButton = () => {\n const AddPropertyButtonComponent = props.addPropertyButtonComponent;\n\n if (AddPropertyButtonComponent) {\n return (\n <AddPropertyButtonComponent\n onClick={() => setShowPropertyDialog(true)}\n />\n );\n }\n\n return (\n <Button\n className={cn(\"self-center\", props.addPropertyButtonClassName)}\n onClick={() => {\n setShowPropertyDialog(true);\n }}\n >\n <Plus className=\"h-4 w-4 mr-2\" />\n Add Property\n </Button>\n );\n };\n\n return (\n <div>\n {/* Schema validation error */}\n {schemaValidationError && (\n <Alert variant=\"destructive\">\n <AlertTitle>Schema Error</AlertTitle>\n <AlertDescription>{schemaValidationError}</AlertDescription>\n </Alert>\n )}\n\n {/* Navigation bar */}\n {renderNavigation()}\n\n {/* Properties list */}\n <div\n className={cn(\"mt-6 overflow-x-hidden\", props.propertiesListClassName)}\n >\n {Object.entries(currentSchema.properties ?? {}).map(\n ([key, property]) => {\n if (typeof property === \"boolean\") {\n // We don't support editing boolean properties\n return null;\n }\n\n return renderProperty(key, property);\n },\n )}\n </div>\n\n {/* Add property button */}\n {renderAddPropertyButton()}\n\n {/* Add property dialog */}\n <AddPropertyDialog\n open={showPropertyDialog}\n onOpenChange={setShowPropertyDialog}\n onSubmit={onAddProperty}\n />\n\n {/* Edit property dialog */}\n {editingKey && editingProperty && (\n <EditPropertyDialog\n propertyKey={editingKey}\n property={editingProperty}\n open={showEditDialog}\n onOpenChange={setShowEditDialog}\n onSubmit={(params) => {\n handlePropertyChange(...params);\n setEditingKey(undefined);\n setEditingProperty(undefined);\n setShowEditDialog(false);\n }}\n />\n )}\n\n {/* Delete confirmation dialog */}\n <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Are you sure?</AlertDialogTitle>\n <AlertDialogDescription>\n This action cannot be undone. This will permanently delete the\n property\n {deleteKey ? ` \"${deleteKey}\"` : \"\"} from the schema.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel onClick={handleCancelDelete}>\n Cancel\n </AlertDialogCancel>\n <AlertDialogAction onClick={handleConfirmDelete}>\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"names":["SchemaBuilder","props","showPropertyDialog","setShowPropertyDialog","useState","showEditDialog","setShowEditDialog","showDeleteDialog","setShowDeleteDialog","deleteKey","setDeleteKey","editingKey","setEditingKey","editingProperty","setEditingProperty","schemaValidationError","setSchemaValidationError","usePluginSystem","getCurrentSchema","setPath","path","schema","handleAddProperty","handlePropertyChange","handleKeyChange","handleDeleteProperty","setSchema","isPropertyRequired","useSchema","getConstraintDefinitionsForType","useConstraints","useEffect","validateSchema","clone","error","Ajv","currentSchema","handleNavigateToProperty","name","handleNavigateUp","handleEditProperty","key","property","handleInitiateDelete","handleConfirmDelete","handleCancelDelete","handleDuplicateProperty","currentProperties","propertyToDuplicate","newKey","newProperty","result","onAddProperty","vals","PropertyComponent","renderProperty","jsx","jsxs","DebouncedInput","newVal","Switch","checked","Label","Select","value","SelectTrigger","SelectValue","SelectContent","SelectItem","Button","Trash2","Copy","renderEditButton","renderNavigateButton","renderArrayItemsConfig","items","itemType","newItems","availableConstraints","hasEnum","Bolt","ChevronRight","renderNavigation","NavigationComponent","cn","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","item","index","Fragment","BreadcrumbSeparator","renderAddPropertyButton","AddPropertyButtonComponent","Plus","Alert","AlertTitle","AlertDescription","AddPropertyDialog","EditPropertyDialog","params","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction"],"mappings":"yvBAqGaA,GAAiBC,GAA8B,CAE1D,KAAM,CAACC,EAAoBC,CAAqB,EAAIC,EAAAA,SAAS,EAAK,EAC5D,CAACC,EAAgBC,CAAiB,EAAIF,EAAAA,SAAS,EAAK,EACpD,CAACG,EAAkBC,CAAmB,EAAIJ,EAAAA,SAAS,EAAK,EACxD,CAACK,EAAWC,CAAY,EAAIN,WAA6B,EACzD,CAACO,EAAYC,CAAa,EAAIR,WAA6B,EAC3D,CAACS,EAAiBC,CAAkB,EAAIV,WAE5C,EACI,CAACW,EAAuBC,CAAwB,EAAIZ,EAAAA,SAExD,IAAI,EAGUa,kBAAAhB,EAAM,SAAW,EAAE,EAG7B,KAAA,CACJ,iBAAAiB,EACA,QAAAC,EACA,KAAAC,EACA,OAAAC,EACA,kBAAAC,EACA,qBAAAC,EACA,gBAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,mBAAAC,GACEC,aAAU,EAGR,CAAE,gCAAAC,CAAgC,EAAIC,iBAAe,EAG3DC,EAAAA,UAAU,IAAM,CACd,GAAI9B,EAAM,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AAA,SAAA,CAAA9C,OAAC+C,EAAAA,kBACC,CAAA,SAAA,CAAAhD,EAAAA,IAACiD,oBAAiB,SAAa,eAAA,CAAA,SAC9BC,EAAAA,uBAAuB,CAAA,SAAA,CAAA,0EAGrBjG,EAAY,KAAKA,CAAS,IAAM,GAAG,mBAAA,CACtC,CAAA,CAAA,EACF,SACCkG,EAAAA,kBACC,CAAA,SAAA,CAACnD,EAAA,IAAAoD,EAAA,kBAAA,CAAkB,QAAS/D,EAAoB,SAEhD,SAAA,EACCW,EAAA,IAAAqD,EAAA,kBAAA,CAAkB,QAASjE,EAAqB,SAEjD,QAAA,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,CACF,CAAA,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"index.cjs3.js","sources":["../src/packages/builder/schema-builder.tsx"],"sourcesContent":["import { useEffect, useState, Fragment } from \"react\";\nimport { PropertyAddError, PropertyAddSuccess, useSchema } from \"./context\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Bolt, ChevronRight, Copy, Plus, Trash2 } from \"lucide-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { Label } from \"@/components/ui/label\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { clone } from \"remeda\";\nimport {\n BaseJSONSchemaPlugin,\n useConstraints,\n usePluginSystem,\n} from \"@/packages/constraints/context\";\nimport { EditPropertyDialog } from \"./edit-dialog\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { validateSchema } from \"./utils\";\nimport Ajv from \"ajv\";\nimport { DebouncedInput } from \"@/components/depounced-input\";\nimport { AddPropertyDialog, type AddPropertyDialogProps } from \"./add-dialog\";\nimport { cn } from \"@/lib/utils\";\n\n// PropertyComponent type definition for custom property components\nexport interface PropertyComponentProps {\n property: {\n key: string;\n schema: JSONSchema7;\n isRequired: boolean;\n };\n onPropertyChange: (key: string, changes: Partial<JSONSchema7>) => void;\n onKeyChange: (oldKey: string, newKey: string) => void;\n onDelete: (key: string) => void;\n onDuplicate?: (key: string) => void;\n onNavigate?: (key: string) => void;\n}\n\n// NavigationProps for custom navigation component\nexport interface NavigationProps {\n currentPath: string[];\n onNavigateUp: () => void;\n onNavigateTo: (newPath: string[]) => void;\n isRootPath: boolean;\n}\n\n// AddPropertyButtonProps for custom add property button\nexport interface AddPropertyButtonProps {\n onClick: () => void;\n}\n\ninterface SchemaBuilderProps {\n /** The schema to edit */\n initialSchema?: JSONSchema7;\n /** Constraint plugins to use */\n plugins?: BaseJSONSchemaPlugin[];\n /** Custom component to render properties */\n propertyComponent?: React.ComponentType<PropertyComponentProps>;\n /** Called when the schema changes */\n onSchemaChange?: (schema: JSONSchema7) => void;\n /** Called when a property is successfully added */\n onPropertyAddSuccess?: (props: PropertyAddSuccess) => void;\n /** Called when there's an error adding a property */\n onPropertyAddError?: (props: PropertyAddError) => void;\n /** Called when there's an error changing a property */\n onPropertyChangeError?: (prop: Error) => void;\n /** Called when a property is successfully changed */\n onPropertyChangeSuccess?: () => void;\n /** Class name for the navigation bar back button */\n backButtonClassName?: string;\n /** Class name for the properties list container */\n propertiesListClassName?: string;\n /** Class name for the add property button */\n addPropertyButtonClassName?: string;\n /** Custom navigation component */\n navigationComponent?: React.ComponentType<NavigationProps>;\n /** Custom add property button component */\n addPropertyButtonComponent?: React.ComponentType<AddPropertyButtonProps>;\n}\n\nexport const SchemaBuilder = (props: SchemaBuilderProps) => {\n // State\n const [showPropertyDialog, setShowPropertyDialog] = useState(false);\n const [showEditDialog, setShowEditDialog] = useState(false);\n const [showDeleteDialog, setShowDeleteDialog] = useState(false);\n const [deleteKey, setDeleteKey] = useState<string | undefined>();\n const [editingKey, setEditingKey] = useState<string | undefined>();\n const [editingProperty, setEditingProperty] = useState<\n JSONSchema7 | undefined\n >();\n const [schemaValidationError, setSchemaValidationError] = useState<\n string | null\n >(null);\n\n // Initialize the plugin system\n usePluginSystem(props.plugins ?? []);\n\n // Get schema context\n const {\n getCurrentSchema,\n setPath,\n path,\n schema,\n handleAddProperty,\n handlePropertyChange,\n handleKeyChange,\n handleDeleteProperty,\n setSchema,\n isPropertyRequired,\n } = useSchema();\n\n // Get constraints context\n const { getConstraintDefinitionsForType } = useConstraints();\n\n // Set schema from props\n useEffect(() => {\n if (props.initialSchema) {\n try {\n // Validate the schema before setting it\n validateSchema(props.initialSchema);\n setSchema(clone(props.initialSchema));\n setSchemaValidationError(null);\n } catch (error) {\n if (error instanceof Error) {\n setSchemaValidationError(error.message);\n } else if (error instanceof Ajv.ValidationError) {\n setSchemaValidationError(`Schema validation error: ${error.message}`);\n } else {\n setSchemaValidationError(\"Unknown schema validation error\");\n }\n }\n }\n }, [props.initialSchema]);\n\n // Notify schema changes\n useEffect(() => {\n if (!schemaValidationError && props.onSchemaChange) {\n props.onSchemaChange(schema);\n }\n }, [schema, schemaValidationError, props.onSchemaChange]);\n\n const currentSchema = getCurrentSchema();\n\n // Navigation handlers\n const handleNavigateToProperty = (name: string) => {\n setPath([...path, name]);\n };\n\n const handleNavigateUp = () => {\n setPath(path.slice(0, -1));\n };\n\n // Property management handlers\n const handleEditProperty = (key: string, property: JSONSchema7) => {\n setEditingKey(key);\n setEditingProperty(property);\n setShowEditDialog(true);\n };\n\n const handleInitiateDelete = (key: string) => {\n setDeleteKey(key);\n setShowDeleteDialog(true);\n };\n\n const handleConfirmDelete = () => {\n if (deleteKey) {\n handleDeleteProperty(deleteKey);\n setDeleteKey(undefined);\n }\n setShowDeleteDialog(false);\n };\n\n const handleCancelDelete = () => {\n setDeleteKey(undefined);\n setShowDeleteDialog(false);\n };\n\n const handleDuplicateProperty = (key: string) => {\n const currentProperties = getCurrentSchema().properties;\n if (!currentProperties || typeof currentProperties[key] === \"boolean\") {\n return;\n }\n\n const propertyToDuplicate = currentProperties[key]!;\n const newKey = `${key}_copy`;\n const newProperty = clone(propertyToDuplicate);\n\n // Add the duplicated property\n const result = handleAddProperty(\n newKey,\n newProperty,\n isPropertyRequired(key),\n );\n\n // Notify if needed\n if (result.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else {\n props.onPropertyAddSuccess?.(result);\n }\n };\n\n const onAddProperty: AddPropertyDialogProps[\"onSubmit\"] = (...vals) => {\n const result = handleAddProperty(...vals);\n\n if (result.status === \"error\") {\n props.onPropertyAddError?.(result);\n } else if (result.status === \"success\") {\n props.onPropertyAddSuccess?.(result);\n }\n setShowPropertyDialog(false);\n };\n\n // Custom property component or default renderer\n const PropertyComponent = props.propertyComponent;\n\n const renderProperty = (key: string, property: JSONSchema7) => {\n if (PropertyComponent) {\n return (\n <PropertyComponent\n key={key}\n property={{\n key,\n schema: property,\n isRequired: isPropertyRequired(key),\n }}\n onPropertyChange={handlePropertyChange}\n onKeyChange={handleKeyChange}\n onDelete={handleInitiateDelete}\n onDuplicate={handleDuplicateProperty}\n onNavigate={\n property.type === \"object\" ||\n (property.type === \"array\" &&\n typeof property.items === \"object\" &&\n (property.items as JSONSchema7).type === \"object\")\n ? handleNavigateToProperty\n : undefined\n }\n />\n );\n }\n\n // Default property renderer\n return (\n <div\n key={key}\n className=\"flex flex-col md:grid grid-cols-(--my-autofit-grid) gap-4 md:items-center border p-2 rounded-md mb-2\"\n >\n <div className=\"\">\n <DebouncedInput\n value={key}\n onDebounce={(newVal) => handleKeyChange(key, newVal)}\n placeholder=\"Property Key\"\n aria-label={`Property key for ${key}`}\n delay={500}\n />\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Switch\n checked={isPropertyRequired(key)}\n onCheckedChange={(checked) =>\n handlePropertyChange(key, { isRequired: checked })\n }\n aria-label=\"Required\"\n />\n <Label htmlFor={`required-${key}`}>Required</Label>\n </div>\n\n <div className=\"\">\n <Select\n value={\n typeof property === \"object\" && !Array.isArray(property.type)\n ? property.type\n : undefined\n }\n onValueChange={(value) =>\n handlePropertyChange(key, {\n type: value as JSONSchema7[\"type\"],\n })\n }\n aria-label=\"Type\"\n >\n <SelectTrigger className=\"w-full\" aria-label=\"Select type\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n <SelectItem value={\"enum\"}>enum</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={typeof property === \"object\" ? property.title : undefined}\n onDebounce={(newVal) =>\n handlePropertyChange(key, { title: newVal })\n }\n placeholder=\"Title\"\n />\n </div>\n\n <div className=\"\">\n <DebouncedInput\n value={\n typeof property === \"object\" ? property.description : undefined\n }\n onDebounce={(newVal) =>\n handlePropertyChange(key, { description: newVal })\n }\n placeholder=\"Description\"\n />\n </div>\n\n <div className=\"order-last md:order-none flex gap-2\">\n {/* Delete button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleInitiateDelete(key)}\n aria-label=\"Delete\"\n className=\"block!\"\n >\n <Trash2 size={16} className=\"text-destructive\" />\n </Button>\n\n {/* Duplicate button */}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleDuplicateProperty(key)}\n aria-label=\"Duplicate\"\n className=\"block!\"\n >\n <Copy size={16} />\n </Button>\n\n {/* Edit button if applicable */}\n {renderEditButton(key, property)}\n\n {/* Navigate button for objects/array items */}\n {renderNavigateButton(key, property)}\n </div>\n\n {/* Render array items configuration if needed */}\n {renderArrayItemsConfig(key, property)}\n </div>\n );\n };\n\n // Helper to render array items configuration\n const renderArrayItemsConfig = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\" || property.type !== \"array\") {\n return null;\n }\n\n const items = property.items;\n const itemType =\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n typeof items.type === \"string\"\n ? items?.type\n : \"string\";\n\n return (\n <div className=\"col-span-full flex items-center gap-4 pl-8 mt-2 bg-gray-50 p-2 rounded-md\">\n <Label>Items of type:</Label>\n <Select\n value={itemType as string}\n onValueChange={(value) => {\n const newItems: JSONSchema7 = {\n ...(typeof items === \"object\" ? items : {}),\n type: value as JSONSchema7[\"type\"],\n };\n\n if (value === \"object\") {\n // Initialize empty properties for object type\n newItems.properties = newItems.properties ?? {};\n }\n\n handlePropertyChange(key, { items: newItems });\n }}\n >\n <SelectTrigger\n className=\"w-[200px]\"\n aria-label=\"Select items of type\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={\"string\" satisfies JSONSchema7[\"type\"]}>\n string\n </SelectItem>\n <SelectItem value={\"number\" satisfies JSONSchema7[\"type\"]}>\n number\n </SelectItem>\n <SelectItem value={\"integer\" satisfies JSONSchema7[\"type\"]}>\n integer\n </SelectItem>\n <SelectItem value={\"boolean\" satisfies JSONSchema7[\"type\"]}>\n boolean\n </SelectItem>\n <SelectItem value={\"object\" satisfies JSONSchema7[\"type\"]}>\n object\n </SelectItem>\n <SelectItem value={\"array\" satisfies JSONSchema7[\"type\"]}>\n array\n </SelectItem>\n <SelectItem value={\"null\" satisfies JSONSchema7[\"type\"]}>\n null\n </SelectItem>\n </SelectContent>\n </Select>\n\n {/* Configure object button for array items of type object */}\n {renderNavigateButton(key, items)}\n </div>\n );\n };\n\n // Helper to render the edit constraint button when needed\n const renderEditButton = (key: string, property: JSONSchema7) => {\n if (typeof property !== \"object\") return null;\n\n // Check for constraints\n const availableConstraints = getConstraintDefinitionsForType(\n typeof property.type === \"string\" ? property.type : \"\",\n );\n\n // Check for enum\n const hasEnum = Array.isArray(property?.enum);\n\n if (availableConstraints.length || hasEnum) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleEditProperty(key, property)}\n aria-label=\"Edit constraints\"\n >\n <Bolt size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n const renderNavigateButton = (key: string, items: JSONSchema7[\"items\"]) => {\n if (\n !Array.isArray(items) &&\n typeof items === \"object\" &&\n items?.type === \"object\"\n ) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => handleNavigateToProperty(key)}\n aria-label=\"Navigate\"\n >\n <span className=\"sr-only\">Navigate</span>\n <ChevronRight size={16} />\n </Button>\n );\n }\n\n return null;\n };\n\n // Render navigation component\n const renderNavigation = () => {\n const NavigationComponent = props.navigationComponent;\n\n if (NavigationComponent) {\n return (\n <NavigationComponent\n currentPath={path}\n onNavigateUp={handleNavigateUp}\n onNavigateTo={setPath}\n isRootPath={path.length === 0}\n />\n );\n }\n\n return (\n <div className=\"flex items-center space-x-4\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleNavigateUp}\n disabled={path.length === 0}\n className={cn(props.backButtonClassName)}\n >\n Back\n </Button>\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#\" onClick={() => setPath([])}>\n Root\n </BreadcrumbLink>\n </BreadcrumbItem>\n {path.map((item, index) => (\n <Fragment key={`path-${index}`}>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbLink\n href=\"#\"\n onClick={() => setPath(path.slice(0, index + 1))}\n >\n {item}\n </BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n ))}\n </BreadcrumbList>\n </Breadcrumb>\n </div>\n );\n };\n\n // Render add property button\n const renderAddPropertyButton = () => {\n const AddPropertyButtonComponent = props.addPropertyButtonComponent;\n\n if (AddPropertyButtonComponent) {\n return (\n <AddPropertyButtonComponent\n onClick={() => setShowPropertyDialog(true)}\n />\n );\n }\n\n return (\n <Button\n type=\"button\"\n className={cn(\"self-center\", props.addPropertyButtonClassName)}\n onClick={() => {\n setShowPropertyDialog(true);\n }}\n >\n <Plus className=\"h-4 w-4 mr-2\" />\n Add Property\n </Button>\n );\n };\n\n return (\n <div>\n {/* Schema validation error */}\n {schemaValidationError && (\n <Alert variant=\"destructive\">\n <AlertTitle>Schema Error</AlertTitle>\n <AlertDescription>{schemaValidationError}</AlertDescription>\n </Alert>\n )}\n\n {/* Navigation bar */}\n {renderNavigation()}\n\n {/* Properties list */}\n <div\n className={cn(\"mt-6 overflow-x-hidden\", props.propertiesListClassName)}\n >\n {Object.entries(currentSchema.properties ?? {}).map(\n ([key, property]) => {\n if (typeof property === \"boolean\") {\n // We don't support editing boolean properties\n return null;\n }\n\n return renderProperty(key, property);\n },\n )}\n </div>\n\n {/* Add property button */}\n {renderAddPropertyButton()}\n\n {/* Add property dialog */}\n <AddPropertyDialog\n open={showPropertyDialog}\n onOpenChange={setShowPropertyDialog}\n onSubmit={onAddProperty}\n />\n\n {/* Edit property dialog */}\n {editingKey && editingProperty && (\n <EditPropertyDialog\n propertyKey={editingKey}\n property={editingProperty}\n open={showEditDialog}\n onOpenChange={setShowEditDialog}\n onSubmit={(params) => {\n handlePropertyChange(...params);\n setEditingKey(undefined);\n setEditingProperty(undefined);\n setShowEditDialog(false);\n }}\n />\n )}\n\n {/* Delete confirmation dialog */}\n <AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Are you sure?</AlertDialogTitle>\n <AlertDialogDescription>\n This action cannot be undone. This will permanently delete the\n property\n {deleteKey ? ` \"${deleteKey}\"` : \"\"} from the schema.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel onClick={handleCancelDelete}>\n Cancel\n </AlertDialogCancel>\n <AlertDialogAction onClick={handleConfirmDelete}>\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"names":["SchemaBuilder","props","showPropertyDialog","setShowPropertyDialog","useState","showEditDialog","setShowEditDialog","showDeleteDialog","setShowDeleteDialog","deleteKey","setDeleteKey","editingKey","setEditingKey","editingProperty","setEditingProperty","schemaValidationError","setSchemaValidationError","usePluginSystem","getCurrentSchema","setPath","path","schema","handleAddProperty","handlePropertyChange","handleKeyChange","handleDeleteProperty","setSchema","isPropertyRequired","useSchema","getConstraintDefinitionsForType","useConstraints","useEffect","validateSchema","clone","error","Ajv","currentSchema","handleNavigateToProperty","name","handleNavigateUp","handleEditProperty","key","property","handleInitiateDelete","handleConfirmDelete","handleCancelDelete","handleDuplicateProperty","currentProperties","propertyToDuplicate","newKey","newProperty","result","onAddProperty","vals","PropertyComponent","renderProperty","jsx","jsxs","DebouncedInput","newVal","Switch","checked","Label","Select","value","SelectTrigger","SelectValue","SelectContent","SelectItem","Button","Trash2","Copy","renderEditButton","renderNavigateButton","renderArrayItemsConfig","items","itemType","newItems","availableConstraints","hasEnum","Bolt","ChevronRight","renderNavigation","NavigationComponent","cn","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","item","index","Fragment","BreadcrumbSeparator","renderAddPropertyButton","AddPropertyButtonComponent","Plus","Alert","AlertTitle","AlertDescription","AddPropertyDialog","EditPropertyDialog","params","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction"],"mappings":"yvBAqGaA,GAAiBC,GAA8B,CAE1D,KAAM,CAACC,EAAoBC,C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UAAW4B,EAAA,GAAG,yBAA0BnF,EAAM,uBAAuB,EAEpE,gBAAO,QAAQmC,EAAc,YAAc,CAAE,CAAA,EAAE,IAC9C,CAAC,CAACK,EAAKC,CAAQ,IACT,OAAOA,GAAa,UAEf,KAGFa,GAAed,EAAKC,CAAQ,CACrC,CACF,CACF,EAGCmD,GAAwB,EAGzBrC,EAAA,IAAC2C,GAAA,kBAAA,CACC,KAAMjG,EACN,aAAcC,EACd,SAAUiD,EAAA,CACZ,EAGCzC,GAAcE,GACb2C,EAAA,IAAC4C,GAAA,mBAAA,CACC,YAAazF,EACb,SAAUE,EACV,KAAMR,EACN,aAAcC,EACd,SAAW+F,GAAW,CACpB9E,EAAqB,GAAG8E,CAAM,EAC9BzF,EAAc,MAAS,EACvBE,EAAmB,MAAS,EAC5BR,EAAkB,EAAK,CAAA,CACzB,CACF,QAIDgG,EAAY,YAAA,CAAA,KAAM/F,EAAkB,aAAcC,EACjD,gBAAC+F,EACC,mBAAA,CAAA,SAAA,CAAA9C,OAAC+C,EAAAA,kBACC,CAAA,SAAA,CAAAhD,EAAAA,IAACiD,oBAAiB,SAAa,eAAA,CAAA,SAC9BC,EAAAA,uBAAuB,CAAA,SAAA,CAAA,0EAGrBjG,EAAY,KAAKA,CAAS,IAAM,GAAG,mBAAA,CACtC,CAAA,CAAA,EACF,SACCkG,EAAAA,kBACC,CAAA,SAAA,CAACnD,EAAA,IAAAoD,EAAA,kBAAA,CAAkB,QAAS/D,EAAoB,SAEhD,SAAA,EACCW,EAAA,IAAAqD,EAAA,kBAAA,CAAkB,QAASjE,EAAqB,SAEjD,QAAA,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,CACF,CAAA,CAAA,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("./index.cjs62.js"),i=require("react/jsx-runtime");function c(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const l=c(n);var s="Label",o=l.forwardRef((t,r)=>i.jsx(u.Primitive.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));o.displayName=s;var f=o;exports.Label=o;exports.Root=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("./index.cjs68.js"),i=require("react/jsx-runtime");function c(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const l=c(n);var s="Label",o=l.forwardRef((t,r)=>i.jsx(u.Primitive.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));o.displayName=s;var f=o;exports.Label=o;exports.Root=f;
2
2
  //# sourceMappingURL=index.cjs30.js.map