@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,26 +1,16 @@
1
- var a = {
2
- left: 0,
3
- top: 0,
4
- right: 0,
5
- gap: 0
6
- }, e = function(t) {
7
- return parseInt(t || "", 10) || 0;
8
- }, o = function(t) {
9
- var n = window.getComputedStyle(document.body), i = n[t === "padding" ? "paddingLeft" : "marginLeft"], r = n[t === "padding" ? "paddingTop" : "marginTop"], d = n[t === "padding" ? "paddingRight" : "marginRight"];
10
- return [e(i), e(r), e(d)];
11
- }, f = function(t) {
12
- if (t === void 0 && (t = "margin"), typeof window > "u")
13
- return a;
14
- var n = o(t), i = document.documentElement.clientWidth, r = window.innerWidth;
15
- return {
16
- left: n[0],
17
- top: n[1],
18
- right: n[2],
19
- gap: Math.max(0, r - i + n[2] - n[0])
1
+ import * as o from "react";
2
+ import { stylesheetSingleton as r } from "./index.es101.js";
3
+ var i = function() {
4
+ var t = r();
5
+ return function(e, n) {
6
+ o.useEffect(function() {
7
+ return t.add(e), function() {
8
+ t.remove();
9
+ };
10
+ }, [e && n]);
20
11
  };
21
12
  };
22
13
  export {
23
- f as getGapWidth,
24
- a as zeroGap
14
+ i as styleHookSingleton
25
15
  };
26
16
  //# sourceMappingURL=index.es100.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es100.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":"AAAU,IAACA,IAAU;AAAA,EACjB,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AACT,GACIC,IAAQ,SAAUC,GAAG;AAAE,SAAO,SAASA,KAAK,IAAI,EAAE,KAAK;AAAI,GAC3DC,IAAY,SAAUC,GAAS;AAC/B,MAAIC,IAAK,OAAO,iBAAiB,SAAS,IAAI,GAC1CC,IAAOD,EAAGD,MAAY,YAAY,gBAAgB,YAAY,GAC9DG,IAAMF,EAAGD,MAAY,YAAY,eAAe,WAAW,GAC3DI,IAAQH,EAAGD,MAAY,YAAY,iBAAiB,aAAa;AACrE,SAAO,CAACH,EAAMK,CAAI,GAAGL,EAAMM,CAAG,GAAGN,EAAMO,CAAK,CAAC;AACjD,GACWC,IAAc,SAAUL,GAAS;AAExC,MADIA,MAAY,WAAUA,IAAU,WAChC,OAAO,SAAW;AAClB,WAAOJ;AAEX,MAAIU,IAAUP,EAAUC,CAAO,GAC3BO,IAAgB,SAAS,gBAAgB,aACzCC,IAAc,OAAO;AACzB,SAAO;AAAA,IACH,MAAMF,EAAQ,CAAC;AAAA,IACf,KAAKA,EAAQ,CAAC;AAAA,IACd,OAAOA,EAAQ,CAAC;AAAA,IAChB,KAAK,KAAK,IAAI,GAAGE,IAAcD,IAAgBD,EAAQ,CAAC,IAAIA,EAAQ,CAAC,CAAC;AAAA,EACzE;AACL;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es100.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":";;AAWU,IAACA,IAAqB,WAAY;AACxC,MAAIC,IAAQC,EAAqB;AACjC,SAAO,SAAUC,GAAQC,GAAW;AAChC,IAAAC,EAAM,UAAU,WAAY;AACxB,aAAAJ,EAAM,IAAIE,CAAM,GACT,WAAY;AACf,QAAAF,EAAM,OAAQ;AAAA,MACjB;AAAA,IACb,GAAW,CAACE,KAAUC,CAAS,CAAC;AAAA,EAC3B;AACL;","x_google_ignoreList":[0]}
@@ -1,16 +1,31 @@
1
- import * as o from "react";
2
- import { stylesheetSingleton as r } from "./index.es102.js";
3
- var i = function() {
4
- var t = r();
5
- return function(e, n) {
6
- o.useEffect(function() {
7
- return t.add(e), function() {
8
- t.remove();
9
- };
10
- }, [e && n]);
1
+ import { getNonce as o } from "./index.es102.js";
2
+ function r() {
3
+ if (!document)
4
+ return null;
5
+ var t = document.createElement("style");
6
+ t.type = "text/css";
7
+ var e = o();
8
+ return e && t.setAttribute("nonce", e), t;
9
+ }
10
+ function l(t, e) {
11
+ t.styleSheet ? t.styleSheet.cssText = e : t.appendChild(document.createTextNode(e));
12
+ }
13
+ function a(t) {
14
+ var e = document.head || document.getElementsByTagName("head")[0];
15
+ e.appendChild(t);
16
+ }
17
+ var c = function() {
18
+ var t = 0, e = null;
19
+ return {
20
+ add: function(n) {
21
+ t == 0 && (e = r()) && (l(e, n), a(e)), t++;
22
+ },
23
+ remove: function() {
24
+ t--, !t && e && (e.parentNode && e.parentNode.removeChild(e), e = null);
25
+ }
11
26
  };
12
27
  };
13
28
  export {
14
- i as styleHookSingleton
29
+ c as stylesheetSingleton
15
30
  };
16
31
  //# sourceMappingURL=index.es101.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es101.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":";;AAWU,IAACA,IAAqB,WAAY;AACxC,MAAIC,IAAQC,EAAqB;AACjC,SAAO,SAAUC,GAAQC,GAAW;AAChC,IAAAC,EAAM,UAAU,WAAY;AACxB,aAAAJ,EAAM,IAAIE,CAAM,GACT,WAAY;AACf,QAAAF,EAAM,OAAQ;AAAA,MACjB;AAAA,IACb,GAAW,CAACE,KAAUC,CAAS,CAAC;AAAA,EAC3B;AACL;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es101.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":";AACA,SAASA,IAAe;AACpB,MAAI,CAAC;AACD,WAAO;AACX,MAAIC,IAAM,SAAS,cAAc,OAAO;AACxC,EAAAA,EAAI,OAAO;AACX,MAAIC,IAAQC,EAAU;AACtB,SAAID,KACAD,EAAI,aAAa,SAASC,CAAK,GAE5BD;AACX;AACA,SAASG,EAAaH,GAAKI,GAAK;AAE5B,EAAIJ,EAAI,aAEJA,EAAI,WAAW,UAAUI,IAGzBJ,EAAI,YAAY,SAAS,eAAeI,CAAG,CAAC;AAEpD;AACA,SAASC,EAAeL,GAAK;AACzB,MAAIM,IAAO,SAAS,QAAQ,SAAS,qBAAqB,MAAM,EAAE,CAAC;AACnE,EAAAA,EAAK,YAAYN,CAAG;AACxB;AACU,IAACO,IAAsB,WAAY;AACzC,MAAIC,IAAU,GACVC,IAAa;AACjB,SAAO;AAAA,IACH,KAAK,SAAUC,GAAO;AAClB,MAAIF,KAAW,MACNC,IAAaV,SACdI,EAAaM,GAAYC,CAAK,GAC9BL,EAAeI,CAAU,IAGjCD;AAAA,IACH;AAAA,IACD,QAAQ,WAAY;AAChB,MAAAA,KACI,CAACA,KAAWC,MACZA,EAAW,cAAcA,EAAW,WAAW,YAAYA,CAAU,GACrEA,IAAa;AAAA,IAEpB;AAAA,EACJ;AACL;","x_google_ignoreList":[0]}
@@ -1,31 +1,8 @@
1
- import { getNonce as o } from "./index.es103.js";
2
- function r() {
3
- if (!document)
4
- return null;
5
- var t = document.createElement("style");
6
- t.type = "text/css";
7
- var e = o();
8
- return e && t.setAttribute("nonce", e), t;
9
- }
10
- function l(t, e) {
11
- t.styleSheet ? t.styleSheet.cssText = e : t.appendChild(document.createTextNode(e));
12
- }
13
- function a(t) {
14
- var e = document.head || document.getElementsByTagName("head")[0];
15
- e.appendChild(t);
16
- }
17
- var c = function() {
18
- var t = 0, e = null;
19
- return {
20
- add: function(n) {
21
- t == 0 && (e = r()) && (l(e, n), a(e)), t++;
22
- },
23
- remove: function() {
24
- t--, !t && e && (e.parentNode && e.parentNode.removeChild(e), e = null);
25
- }
26
- };
1
+ var e = function() {
2
+ if (typeof __webpack_nonce__ < "u")
3
+ return __webpack_nonce__;
27
4
  };
28
5
  export {
29
- c as stylesheetSingleton
6
+ e as getNonce
30
7
  };
31
8
  //# sourceMappingURL=index.es102.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es102.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":";AACA,SAASA,IAAe;AACpB,MAAI,CAAC;AACD,WAAO;AACX,MAAIC,IAAM,SAAS,cAAc,OAAO;AACxC,EAAAA,EAAI,OAAO;AACX,MAAIC,IAAQC,EAAU;AACtB,SAAID,KACAD,EAAI,aAAa,SAASC,CAAK,GAE5BD;AACX;AACA,SAASG,EAAaH,GAAKI,GAAK;AAE5B,EAAIJ,EAAI,aAEJA,EAAI,WAAW,UAAUI,IAGzBJ,EAAI,YAAY,SAAS,eAAeI,CAAG,CAAC;AAEpD;AACA,SAASC,EAAeL,GAAK;AACzB,MAAIM,IAAO,SAAS,QAAQ,SAAS,qBAAqB,MAAM,EAAE,CAAC;AACnE,EAAAA,EAAK,YAAYN,CAAG;AACxB;AACU,IAACO,IAAsB,WAAY;AACzC,MAAIC,IAAU,GACVC,IAAa;AACjB,SAAO;AAAA,IACH,KAAK,SAAUC,GAAO;AAClB,MAAIF,KAAW,MACNC,IAAaV,SACdI,EAAaM,GAAYC,CAAK,GAC9BL,EAAeI,CAAU,IAGjCD;AAAA,IACH;AAAA,IACD,QAAQ,WAAY;AAChB,MAAAA,KACI,CAACA,KAAWC,MACZA,EAAW,cAAcA,EAAW,WAAW,YAAYA,CAAU,GACrEA,IAAa;AAAA,IAEpB;AAAA,EACJ;AACL;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es102.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":"AAIU,IAACA,IAAW,WAAY;AAI9B,MAAI,OAAO,oBAAsB;AAC7B,WAAO;AAGf;","x_google_ignoreList":[0]}
@@ -1,8 +1,26 @@
1
- var e = function() {
2
- if (typeof __webpack_nonce__ < "u")
3
- return __webpack_nonce__;
1
+ var a = {
2
+ left: 0,
3
+ top: 0,
4
+ right: 0,
5
+ gap: 0
6
+ }, e = function(t) {
7
+ return parseInt(t || "", 10) || 0;
8
+ }, o = function(t) {
9
+ var n = window.getComputedStyle(document.body), i = n[t === "padding" ? "paddingLeft" : "marginLeft"], r = n[t === "padding" ? "paddingTop" : "marginTop"], d = n[t === "padding" ? "paddingRight" : "marginRight"];
10
+ return [e(i), e(r), e(d)];
11
+ }, f = function(t) {
12
+ if (t === void 0 && (t = "margin"), typeof window > "u")
13
+ return a;
14
+ var n = o(t), i = document.documentElement.clientWidth, r = window.innerWidth;
15
+ return {
16
+ left: n[0],
17
+ top: n[1],
18
+ right: n[2],
19
+ gap: Math.max(0, r - i + n[2] - n[0])
20
+ };
4
21
  };
5
22
  export {
6
- e as getNonce
23
+ f as getGapWidth,
24
+ a as zeroGap
7
25
  };
8
26
  //# sourceMappingURL=index.es103.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es103.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":"AAIU,IAACA,IAAW,WAAY;AAI9B,MAAI,OAAO,oBAAsB;AAC7B,WAAO;AAGf;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es103.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":"AAAU,IAACA,IAAU;AAAA,EACjB,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AACT,GACIC,IAAQ,SAAUC,GAAG;AAAE,SAAO,SAASA,KAAK,IAAI,EAAE,KAAK;AAAI,GAC3DC,IAAY,SAAUC,GAAS;AAC/B,MAAIC,IAAK,OAAO,iBAAiB,SAAS,IAAI,GAC1CC,IAAOD,EAAGD,MAAY,YAAY,gBAAgB,YAAY,GAC9DG,IAAMF,EAAGD,MAAY,YAAY,eAAe,WAAW,GAC3DI,IAAQH,EAAGD,MAAY,YAAY,iBAAiB,aAAa;AACrE,SAAO,CAACH,EAAMK,CAAI,GAAGL,EAAMM,CAAG,GAAGN,EAAMO,CAAK,CAAC;AACjD,GACWC,IAAc,SAAUL,GAAS;AAExC,MADIA,MAAY,WAAUA,IAAU,WAChC,OAAO,SAAW;AAClB,WAAOJ;AAEX,MAAIU,IAAUP,EAAUC,CAAO,GAC3BO,IAAgB,SAAS,gBAAgB,aACzCC,IAAc,OAAO;AACzB,SAAO;AAAA,IACH,MAAMF,EAAQ,CAAC;AAAA,IACf,KAAKA,EAAQ,CAAC;AAAA,IACd,OAAOA,EAAQ,CAAC;AAAA,IAChB,KAAK,KAAK,IAAI,GAAGE,IAAcD,IAAgBD,EAAQ,CAAC,IAAIA,EAAQ,CAAC,CAAC;AAAA,EACzE;AACL;","x_google_ignoreList":[0]}
@@ -1,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { Root as n, Thumb as i } from "./index.es35.js";
2
+ import { Root as n, Thumb as i } from "./index.es39.js";
3
3
  import { cn as e } from "./index.es21.js";
4
4
  function l({
5
5
  className: r,
@@ -1,9 +1,9 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { Root as i, Trigger as d, Icon as c, Value as u, Portal as m, Content as p, Viewport as f, Item as g, ItemIndicator as v, ItemText as h, ScrollUpButton as x, ScrollDownButton as b } from "./index.es42.js";
2
+ import { Root as i, Trigger as d, Icon as c, Value as u, Portal as m, Content as p, Viewport as f, Item as g, ItemIndicator as v, ItemText as h, ScrollUpButton as x, ScrollDownButton as b } from "./index.es35.js";
3
3
  import { cn as r } from "./index.es21.js";
4
- import n from "./index.es43.js";
5
- import w from "./index.es44.js";
6
- import y from "./index.es45.js";
4
+ import n from "./index.es36.js";
5
+ import w from "./index.es37.js";
6
+ import y from "./index.es38.js";
7
7
  function B({
8
8
  ...t
9
9
  }) {
@@ -1,16 +1,16 @@
1
1
  import { jsx as s, jsxs as u } from "react/jsx-runtime";
2
2
  import { useMemo as R, useEffect as V } from "react";
3
3
  import { Button as A } from "./index.es10.js";
4
- import { Dialog as $, DialogContent as N, DialogHeader as j, DialogTitle as w, DialogDescription as E, DialogFooter as I } from "./index.es36.js";
4
+ import { Dialog as $, DialogContent as N, DialogHeader as j, DialogTitle as w, DialogDescription as E, DialogFooter as I } from "./index.es40.js";
5
5
  import { Label as L } from "./index.es14.js";
6
6
  import { a as d } from "./index.es9.js";
7
7
  import { useConstraints as _ } from "./index.es4.js";
8
- import k from "./index.es37.js";
9
- import { Separator as z } from "./index.es38.js";
8
+ import k from "./index.es41.js";
9
+ import { Separator as z } from "./index.es42.js";
10
10
  import { AddFormSchema as B } from "./index.es20.js";
11
11
  import { useForm as H } from "react-hook-form";
12
- import { zodResolver as M } from "./index.es39.js";
13
- import { Form as O } from "./index.es40.js";
12
+ import { zodResolver as M } from "./index.es43.js";
13
+ import { Form as O } from "./index.es44.js";
14
14
  const P = B.pick({
15
15
  constraints: !0,
16
16
  property: !0
package/dist/index.es2.js CHANGED
@@ -9,40 +9,40 @@ const d = q(void 0), j = {
9
9
  properties: {},
10
10
  required: []
11
11
  };
12
- function B({
12
+ function D({
13
13
  children: l,
14
- initialSchema: c
14
+ initialSchema: p
15
15
  }) {
16
16
  const [n, a] = m(
17
- c ?? j
18
- ), [u, p] = m([]);
19
- return /* @__PURE__ */ y(d.Provider, { value: { schema: n, setSchema: a, path: u, setPath: p }, children: l });
17
+ p ?? j
18
+ ), [u, c] = m([]);
19
+ return /* @__PURE__ */ y(d.Provider, { value: { schema: n, setSchema: a, path: u, setPath: c }, children: l });
20
20
  }
21
- function D() {
21
+ function E() {
22
22
  const l = b(d);
23
23
  if (l === void 0)
24
24
  throw new Error("useSchema must be used within a SchemaProvider");
25
- const { path: c, schema: n, setSchema: a } = l, u = (t, e) => {
25
+ const { path: p, schema: n, setSchema: a } = l, u = (t, e) => {
26
26
  let r = t, i = null, o = null;
27
27
  for (const s of e)
28
28
  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]);
29
29
  return { propertySchema: i, parentSchema: o };
30
- }, p = (t) => {
30
+ }, c = (t) => {
31
31
  const { propertySchema: e } = u(
32
32
  t ?? n,
33
- c
33
+ p
34
34
  );
35
35
  return e ? e.type === "array" ? e.items : e : t ?? n;
36
36
  };
37
37
  return {
38
38
  ...l,
39
- getCurrentSchema: p,
39
+ getCurrentSchema: c,
40
40
  getCurrentProperty: () => {
41
- const { propertySchema: t } = u(n, c);
41
+ const { propertySchema: t } = u(n, p);
42
42
  return t;
43
43
  },
44
44
  handlePropertyChange: (t, e) => {
45
- const r = f(n), i = p(r);
45
+ const r = f(n), i = c(r);
46
46
  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);
47
47
  let o = !1;
48
48
  if (i.type === "object" && i.properties) {
@@ -62,7 +62,7 @@ function D() {
62
62
  return { status: "success", property: i.properties[t] };
63
63
  },
64
64
  handleAddProperty: (t, e, r) => {
65
- const i = f(n), o = p(i);
65
+ const i = f(n), o = c(i);
66
66
  return o.type !== "object" && (o.type = "object"), o.properties || (o.properties = {}), o.properties[t] ? {
67
67
  status: "error",
68
68
  code: "key-exists",
@@ -73,7 +73,7 @@ function D() {
73
73
  });
74
74
  },
75
75
  handleKeyChange: (t, e) => {
76
- const r = f(n), i = p(r);
76
+ const r = f(n), i = c(r);
77
77
  if (i.properties?.[t]) {
78
78
  const o = Object.entries(i.properties).map(
79
79
  ([s, h]) => [s === t ? e : s, h]
@@ -88,21 +88,22 @@ function D() {
88
88
  },
89
89
  navigateToCorrectNesting: u,
90
90
  handleDeleteProperty: (t) => {
91
- const e = f(n), r = p(e);
91
+ const e = f(n), r = c(e);
92
92
  r.type === "object" && r.required && (r.required = r.required.filter((i) => i !== t)), r.type === "object" && r.properties && delete r.properties[t], a(e);
93
93
  },
94
94
  isPropertyRequired: (t) => {
95
- if (c.length) {
96
- const { propertySchema: e } = u(n, c);
95
+ if (p.length) {
96
+ const { propertySchema: e } = u(n, p);
97
97
  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);
98
98
  }
99
99
  return !!n?.required?.includes(t);
100
- }
100
+ },
101
+ getValue: () => n
101
102
  };
102
103
  }
103
104
  export {
104
105
  d as SchemaContext,
105
- B as SchemaProvider,
106
- D as useSchema
106
+ D as SchemaProvider,
107
+ E as useSchema
107
108
  };
108
109
  //# sourceMappingURL=index.es2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es2.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":";;;AAca,MAAAA,IAAgBC,EAE3B,MAAS,GAELC,IAA6B;AAAA,EACjC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,EACb,YAAY,CAAC;AAAA,EACb,UAAU,CAAA;AACZ;AAEA,SAASC,EAAe;AAAA,EACtB,UAAAC;AAAA,EACA,eAAAC;AACF,GAAuD;AAC/C,QAAA,CAACC,GAAQC,CAAS,IAAIC;AAAA,IAC1BH,KAAiBH;AAAA,EACnB,GAQM,CAACO,GAAMC,CAAO,IAAIF,EAAmB,CAAA,CAAE;AAM3C,SAAA,gBAAAG,EAACX,EAAc,UAAd,EAAuB,OAAO,EAAE,QAAAM,GAAQ,WAAAC,GAAW,MAAAE,GAAM,SAAAC,EAAQ,GAC/D,UAAAN,EACH,CAAA;AAEJ;AAgBA,SAASQ,IAAY;AACb,QAAAC,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WK,CAAG,GAG/BhB,EAAUkB,CAAS;AAAA,IACrB;AAAA,IAwDE,oBA7ByB,CAACF,MAAgB;AAC1C,UAAId,EAAK,QAAQ;AACf,cAAM,EAAE,gBAAAU,EAAmB,IAAAJ,EAAyBT,GAAQG,CAAI;AAEhE,eACEU,GAAgB,SAAS,WACzBA,EAAe,SACf,OAAOA,EAAe,SAAU,aAChC,CAAC,MAAM,QAAQA,EAAe,KAAK,KACnCA,EAAe,OAAO,SAAS,WAExB,EAAQA,EAAe,OAAO,UAAU,SAASI,CAAG,IAEpD,EAAQJ,GAAgB,UAAU,SAASI,CAAG;AAAA,MACvD;AAGF,aAAO,EAAQjB,GAAQ,UAAU,SAASiB,CAAG;AAAA,IAC/C;AAAA,EAYA;AACF;"}
1
+ {"version":3,"file":"index.es2.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":";;;AAca,MAAAA,IAAgBC,EAE3B,MAAS,GAELC,IAA6B;AAAA,EACjC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,EACb,YAAY,CAAC;AAAA,EACb,UAAU,CAAA;AACZ;AAEA,SAASC,EAAe;AAAA,EACt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IAASL;AAAA,MAC1B,IAGFpB,EAAUkB,CAAS;AAAA,IACrB;AAAA,IAoNE,0BAAAV;AAAA,IACA,sBAjF2B,CAACQ,MAAgB;AACtC,YAAAE,IAAYC,EAAMpB,CAAM,GAGxBY,IAAuBI,EAAiBG,CAAS;AAGnD,MAAAP,EAAQ,SAAS,YACfA,EAAQ,aACVA,EAAQ,WAAWA,EAAQ,SAAS,OAAO,CAACS,MAASA,MAASJ,CAAG,IAKjEL,EAAQ,SAAS,YAAYA,EAAQ,cAChC,OAAAA,EAAQ,WAAWK,CAAG,GAG/BhB,EAAUkB,CAAS;AAAA,IACrB;AAAA,IA+DE,oBApCyB,CAACF,MAAgB;AAC1C,UAAId,EAAK,QAAQ;AACf,cAAM,EAAE,gBAAAU,EAAmB,IAAAJ,EAAyBT,GAAQG,CAAI;AAEhE,eACEU,GAAgB,SAAS,WACzBA,EAAe,SACf,OAAOA,EAAe,SAAU,aAChC,CAAC,MAAM,QAAQA,EAAe,KAAK,KACnCA,EAAe,OAAO,SAAS,WAExB,EAAQA,EAAe,OAAO,UAAU,SAASI,CAAG,IAEpD,EAAQJ,GAAgB,UAAU,SAASI,CAAG;AAAA,MACvD;AAGF,aAAO,EAAQjB,GAAQ,UAAU,SAASiB,CAAG;AAAA,IAC/C;AAAA,IAmBE,UAde,MACRjB;AAAA,EAcT;AACF;"}
@@ -1,20 +1,20 @@
1
1
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
2
  import { Button as x } from "./index.es10.js";
3
- import { zodResolver as K } from "./index.es39.js";
4
- import { Dialog as M, DialogContent as _, DialogHeader as B, DialogTitle as H, DialogDescription as J, DialogFooter as G } from "./index.es36.js";
3
+ import { zodResolver as K } from "./index.es43.js";
4
+ import { Dialog as M, DialogContent as _, DialogHeader as B, DialogTitle as H, DialogDescription as J, DialogFooter as G } from "./index.es40.js";
5
5
  import { Input as O } from "./index.es27.js";
6
6
  import { Label as Q } from "./index.es14.js";
7
7
  import { Select as A, SelectTrigger as j, SelectValue as F, SelectContent as N, SelectItem as s } from "./index.es13.js";
8
8
  import { Switch as U } from "./index.es12.js";
9
9
  import { DebouncedInput as V } from "./index.es19.js";
10
10
  import { a as f } from "./index.es9.js";
11
- import W from "./index.es41.js";
11
+ import W from "./index.es45.js";
12
12
  import { useConstraints as X } from "./index.es4.js";
13
- import Y from "./index.es37.js";
14
- import { Separator as Z } from "./index.es38.js";
13
+ import Y from "./index.es41.js";
14
+ import { Separator as Z } from "./index.es42.js";
15
15
  import { z as t } from "zod";
16
16
  import { useForm as ee } from "react-hook-form";
17
- import { Form as re, FormField as u, FormItem as d, FormLabel as p, FormControl as h, FormMessage as y } from "./index.es40.js";
17
+ import { Form as re, FormField as u, FormItem as d, FormLabel as p, FormControl as h, FormMessage as y } from "./index.es44.js";
18
18
  const g = t.enum([
19
19
  "string",
20
20
  "number",
@@ -1,4 +1,4 @@
1
- import e from "./index.es48.js";
1
+ import e from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import e from "./index.es48.js";
1
+ import e from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import e from "./index.es48.js";
1
+ import e from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import c from "./index.es48.js";
1
+ import c from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import o from "./index.es48.js";
1
+ import o from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import e from "./index.es48.js";
1
+ import e from "./index.es50.js";
2
2
  /**
3
3
  * @license lucide-react v0.477.0 - ISC
4
4
  *
package/dist/index.es3.js CHANGED
@@ -295,6 +295,7 @@ const lt = (o) => {
295
295
  ) : /* @__PURE__ */ i(
296
296
  m,
297
297
  {
298
+ type: "button",
298
299
  className: A("self-center", o.addPropertyButtonClassName),
299
300
  onClick: () => {
300
301
  f(!0);