@chobantonov/jsonforms-react-renderer-common 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (624) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +79 -2
  3. package/lib/cells/CellSummary.cjs.js +2 -0
  4. package/lib/cells/CellSummary.cjs.js.map +1 -0
  5. package/lib/cells/CellSummary.d.ts +14 -0
  6. package/lib/cells/CellSummary.esm.js +29 -0
  7. package/lib/cells/CellSummary.esm.js.map +1 -0
  8. package/lib/cells/cellMode.cjs.js +2 -0
  9. package/lib/cells/cellMode.cjs.js.map +1 -0
  10. package/lib/cells/cellMode.d.ts +14 -0
  11. package/lib/cells/cellMode.esm.js +6 -0
  12. package/lib/cells/cellMode.esm.js.map +1 -0
  13. package/lib/cells/compositeActions.cjs.js +2 -0
  14. package/lib/cells/compositeActions.cjs.js.map +1 -0
  15. package/lib/cells/compositeActions.d.ts +7 -0
  16. package/lib/cells/compositeActions.esm.js +14 -0
  17. package/lib/cells/compositeActions.esm.js.map +1 -0
  18. package/lib/cells/compositeCellTester.cjs.js +2 -0
  19. package/lib/cells/compositeCellTester.cjs.js.map +1 -0
  20. package/lib/cells/compositeCellTester.d.ts +2 -0
  21. package/lib/cells/compositeCellTester.esm.js +12 -0
  22. package/lib/cells/compositeCellTester.esm.js.map +1 -0
  23. package/lib/cells/compositeSummary.cjs.js +2 -0
  24. package/lib/cells/compositeSummary.cjs.js.map +1 -0
  25. package/lib/cells/compositeSummary.d.ts +10 -0
  26. package/lib/cells/compositeSummary.esm.js +44 -0
  27. package/lib/cells/compositeSummary.esm.js.map +1 -0
  28. package/lib/cells/useCompositeCellPresentation.cjs.js +2 -0
  29. package/lib/cells/useCompositeCellPresentation.cjs.js.map +1 -0
  30. package/lib/cells/useCompositeCellPresentation.d.ts +7 -0
  31. package/lib/cells/useCompositeCellPresentation.esm.js +18 -0
  32. package/lib/cells/useCompositeCellPresentation.esm.js.map +1 -0
  33. package/lib/cells/useCompositeDraft.cjs.js +2 -0
  34. package/lib/cells/useCompositeDraft.cjs.js.map +1 -0
  35. package/lib/cells/useCompositeDraft.d.ts +52 -0
  36. package/lib/cells/useCompositeDraft.esm.js +95 -0
  37. package/lib/cells/useCompositeDraft.esm.js.map +1 -0
  38. package/lib/collections/CollectionErrorNavigation.cjs.js +2 -0
  39. package/lib/collections/CollectionErrorNavigation.cjs.js.map +1 -0
  40. package/lib/collections/CollectionErrorNavigation.d.ts +12 -0
  41. package/lib/collections/CollectionErrorNavigation.esm.js +68 -0
  42. package/lib/collections/CollectionErrorNavigation.esm.js.map +1 -0
  43. package/lib/collections/arrayChoices.cjs.js +2 -0
  44. package/lib/collections/arrayChoices.cjs.js.map +1 -0
  45. package/lib/collections/arrayChoices.d.ts +85 -0
  46. package/lib/collections/arrayChoices.esm.js +54 -0
  47. package/lib/collections/arrayChoices.esm.js.map +1 -0
  48. package/lib/collections/collectionPagination.cjs.js +2 -0
  49. package/lib/collections/collectionPagination.cjs.js.map +1 -0
  50. package/lib/collections/collectionPagination.d.ts +22 -0
  51. package/lib/collections/collectionPagination.esm.js +51 -0
  52. package/lib/collections/collectionPagination.esm.js.map +1 -0
  53. package/lib/collections/columnResize.cjs.js +2 -0
  54. package/lib/collections/columnResize.cjs.js.map +1 -0
  55. package/lib/collections/columnResize.d.ts +16 -0
  56. package/lib/collections/columnResize.esm.js +85 -0
  57. package/lib/collections/columnResize.esm.js.map +1 -0
  58. package/lib/collections/rowDetail.cjs.js +2 -0
  59. package/lib/collections/rowDetail.cjs.js.map +1 -0
  60. package/lib/collections/rowDetail.d.ts +34 -0
  61. package/lib/collections/rowDetail.esm.js +106 -0
  62. package/lib/collections/rowDetail.esm.js.map +1 -0
  63. package/lib/collections/tableColumns.cjs.js +2 -0
  64. package/lib/collections/tableColumns.cjs.js.map +1 -0
  65. package/lib/collections/tableColumns.d.ts +13 -0
  66. package/lib/collections/tableColumns.esm.js +16 -0
  67. package/lib/collections/tableColumns.esm.js.map +1 -0
  68. package/lib/collections/useArrayPanelState.cjs.js +2 -0
  69. package/lib/collections/useArrayPanelState.cjs.js.map +1 -0
  70. package/lib/collections/useArrayPanelState.d.ts +7 -0
  71. package/lib/collections/useArrayPanelState.esm.js +18 -0
  72. package/lib/collections/useArrayPanelState.esm.js.map +1 -0
  73. package/lib/collections/useCollectionDelete.cjs.js +2 -0
  74. package/lib/collections/useCollectionDelete.cjs.js.map +1 -0
  75. package/lib/collections/useCollectionDelete.d.ts +17 -0
  76. package/lib/collections/useCollectionDelete.esm.js +38 -0
  77. package/lib/collections/useCollectionDelete.esm.js.map +1 -0
  78. package/lib/collections/useTableSelection.cjs.js +2 -0
  79. package/lib/collections/useTableSelection.cjs.js.map +1 -0
  80. package/lib/collections/useTableSelection.d.ts +11 -0
  81. package/lib/collections/useTableSelection.esm.js +41 -0
  82. package/lib/collections/useTableSelection.esm.js.map +1 -0
  83. package/lib/composition/AllOfRenderer.cjs.js +2 -0
  84. package/lib/composition/AllOfRenderer.cjs.js.map +1 -0
  85. package/lib/composition/AllOfRenderer.d.ts +5 -0
  86. package/lib/composition/AllOfRenderer.esm.js +33 -0
  87. package/lib/composition/AllOfRenderer.esm.js.map +1 -0
  88. package/lib/composition/CombinatorBranch.cjs.js +2 -0
  89. package/lib/composition/CombinatorBranch.cjs.js.map +1 -0
  90. package/lib/composition/CombinatorBranch.d.ts +17 -0
  91. package/lib/composition/CombinatorBranch.esm.js +54 -0
  92. package/lib/composition/CombinatorBranch.esm.js.map +1 -0
  93. package/lib/composition/CombinatorProperties.cjs.js +2 -0
  94. package/lib/composition/CombinatorProperties.cjs.js.map +1 -0
  95. package/lib/composition/CombinatorProperties.d.ts +12 -0
  96. package/lib/composition/CombinatorProperties.esm.js +20 -0
  97. package/lib/composition/CombinatorProperties.esm.js.map +1 -0
  98. package/lib/composition/ScalarCompositionControl.cjs.js +2 -0
  99. package/lib/composition/ScalarCompositionControl.cjs.js.map +1 -0
  100. package/lib/composition/ScalarCompositionControl.d.ts +6 -0
  101. package/lib/composition/ScalarCompositionControl.esm.js +22 -0
  102. package/lib/composition/ScalarCompositionControl.esm.js.map +1 -0
  103. package/lib/composition/choiceCards.cjs.js +2 -0
  104. package/lib/composition/choiceCards.cjs.js.map +1 -0
  105. package/lib/composition/choiceCards.d.ts +36 -0
  106. package/lib/composition/choiceCards.esm.js +162 -0
  107. package/lib/composition/choiceCards.esm.js.map +1 -0
  108. package/lib/composition/combinators.cjs.js +2 -0
  109. package/lib/composition/combinators.cjs.js.map +1 -0
  110. package/lib/composition/combinators.d.ts +40 -0
  111. package/lib/composition/combinators.esm.js +26 -0
  112. package/lib/composition/combinators.esm.js.map +1 -0
  113. package/lib/composition/discriminatorBranch.cjs.js +2 -0
  114. package/lib/composition/discriminatorBranch.cjs.js.map +1 -0
  115. package/lib/composition/discriminatorBranch.d.ts +6 -0
  116. package/lib/composition/discriminatorBranch.esm.js +41 -0
  117. package/lib/composition/discriminatorBranch.esm.js.map +1 -0
  118. package/lib/composition/scalarComposition.cjs.js +2 -0
  119. package/lib/composition/scalarComposition.cjs.js.map +1 -0
  120. package/lib/composition/scalarComposition.d.ts +27 -0
  121. package/lib/composition/scalarComposition.esm.js +76 -0
  122. package/lib/composition/scalarComposition.esm.js.map +1 -0
  123. package/lib/composition/useCombinatorSelection.cjs.js +2 -0
  124. package/lib/composition/useCombinatorSelection.cjs.js.map +1 -0
  125. package/lib/composition/useCombinatorSelection.d.ts +6 -0
  126. package/lib/composition/useCombinatorSelection.esm.js +22 -0
  127. package/lib/composition/useCombinatorSelection.esm.js.map +1 -0
  128. package/lib/composition/useScalarComposition.cjs.js +2 -0
  129. package/lib/composition/useScalarComposition.cjs.js.map +1 -0
  130. package/lib/composition/useScalarComposition.d.ts +18 -0
  131. package/lib/composition/useScalarComposition.esm.js +24 -0
  132. package/lib/composition/useScalarComposition.esm.js.map +1 -0
  133. package/lib/controls/FileArrayInput.cjs.js +2 -0
  134. package/lib/controls/FileArrayInput.cjs.js.map +1 -0
  135. package/lib/controls/FileArrayInput.d.ts +19 -0
  136. package/lib/controls/FileArrayInput.esm.js +232 -0
  137. package/lib/controls/FileArrayInput.esm.js.map +1 -0
  138. package/lib/controls/controlHelp.cjs.js +2 -0
  139. package/lib/controls/controlHelp.cjs.js.map +1 -0
  140. package/lib/controls/controlHelp.d.ts +15 -0
  141. package/lib/controls/controlHelp.esm.js +9 -0
  142. package/lib/controls/controlHelp.esm.js.map +1 -0
  143. package/lib/controls/inputAdornments.cjs.js +2 -0
  144. package/lib/controls/inputAdornments.cjs.js.map +1 -0
  145. package/lib/controls/inputAdornments.d.ts +32 -0
  146. package/lib/controls/inputAdornments.esm.js +192 -0
  147. package/lib/controls/inputAdornments.esm.js.map +1 -0
  148. package/lib/controls/numeric.cjs.js +2 -0
  149. package/lib/controls/numeric.cjs.js.map +1 -0
  150. package/lib/controls/numeric.d.ts +36 -0
  151. package/lib/controls/numeric.esm.js +9 -0
  152. package/lib/controls/numeric.esm.js.map +1 -0
  153. package/lib/controls/useClearAffordance.cjs.js +2 -0
  154. package/lib/controls/useClearAffordance.cjs.js.map +1 -0
  155. package/lib/controls/useClearAffordance.d.ts +15 -0
  156. package/lib/controls/useClearAffordance.esm.js +17 -0
  157. package/lib/controls/useClearAffordance.esm.js.map +1 -0
  158. package/lib/controls/useDebouncedChange.cjs.js +2 -0
  159. package/lib/controls/useDebouncedChange.cjs.js.map +1 -0
  160. package/lib/controls/useDebouncedChange.d.ts +37 -0
  161. package/lib/controls/useDebouncedChange.esm.js +40 -0
  162. package/lib/controls/useDebouncedChange.esm.js.map +1 -0
  163. package/lib/controls/useFocus.cjs.js +2 -0
  164. package/lib/controls/useFocus.cjs.js.map +1 -0
  165. package/lib/controls/useFocus.d.ts +1 -0
  166. package/lib/controls/useFocus.esm.js +13 -0
  167. package/lib/controls/useFocus.esm.js.map +1 -0
  168. package/lib/core/configNamespaces.cjs.js +2 -0
  169. package/lib/core/configNamespaces.cjs.js.map +1 -0
  170. package/lib/core/configNamespaces.d.ts +32 -0
  171. package/lib/core/configNamespaces.esm.js +15 -0
  172. package/lib/core/configNamespaces.esm.js.map +1 -0
  173. package/lib/core/dataPointer.cjs.js +2 -0
  174. package/lib/core/dataPointer.cjs.js.map +1 -0
  175. package/lib/core/dataPointer.d.ts +1 -0
  176. package/lib/core/dataPointer.esm.js +5 -0
  177. package/lib/core/dataPointer.esm.js.map +1 -0
  178. package/lib/core/detailUiSchema.cjs.js +2 -0
  179. package/lib/core/detailUiSchema.cjs.js.map +1 -0
  180. package/lib/core/detailUiSchema.d.ts +7 -0
  181. package/lib/core/detailUiSchema.esm.js +23 -0
  182. package/lib/core/detailUiSchema.esm.js.map +1 -0
  183. package/lib/core/plainRecord.cjs.js +2 -0
  184. package/lib/core/plainRecord.cjs.js.map +1 -0
  185. package/lib/core/plainRecord.d.ts +1 -0
  186. package/lib/core/plainRecord.esm.js +5 -0
  187. package/lib/core/plainRecord.esm.js.map +1 -0
  188. package/lib/core/uiSchemaCycle.cjs.js +2 -0
  189. package/lib/core/uiSchemaCycle.cjs.js.map +1 -0
  190. package/lib/core/uiSchemaCycle.d.ts +18 -0
  191. package/lib/core/uiSchemaCycle.esm.js +27 -0
  192. package/lib/core/uiSchemaCycle.esm.js.map +1 -0
  193. package/lib/dynamic/DynamicUiProvider.cjs.js +4 -0
  194. package/lib/dynamic/DynamicUiProvider.cjs.js.map +1 -0
  195. package/lib/dynamic/DynamicUiProvider.d.ts +35 -0
  196. package/lib/dynamic/DynamicUiProvider.esm.js +182 -0
  197. package/lib/dynamic/DynamicUiProvider.esm.js.map +1 -0
  198. package/lib/dynamic/dynamicCel.cjs.js +2 -0
  199. package/lib/dynamic/dynamicCel.cjs.js.map +1 -0
  200. package/lib/dynamic/dynamicCel.d.ts +1 -0
  201. package/lib/dynamic/dynamicCel.esm.js +43 -0
  202. package/lib/dynamic/dynamicCel.esm.js.map +1 -0
  203. package/lib/dynamic/dynamicConfig.cjs.js +2 -0
  204. package/lib/dynamic/dynamicConfig.cjs.js.map +1 -0
  205. package/lib/dynamic/dynamicConfig.d.ts +7 -0
  206. package/lib/dynamic/dynamicConfig.esm.js +13 -0
  207. package/lib/dynamic/dynamicConfig.esm.js.map +1 -0
  208. package/lib/dynamic/dynamicRuntime.cjs.js +2 -0
  209. package/lib/dynamic/dynamicRuntime.cjs.js.map +1 -0
  210. package/lib/dynamic/dynamicRuntime.d.ts +4 -0
  211. package/lib/dynamic/dynamicRuntime.esm.js +16 -0
  212. package/lib/dynamic/dynamicRuntime.esm.js.map +1 -0
  213. package/lib/dynamic/dynamicScope.cjs.js +2 -0
  214. package/lib/dynamic/dynamicScope.cjs.js.map +1 -0
  215. package/lib/dynamic/dynamicScope.d.ts +2 -0
  216. package/lib/dynamic/dynamicScope.esm.js +17 -0
  217. package/lib/dynamic/dynamicScope.esm.js.map +1 -0
  218. package/lib/dynamic/dynamicTree.cjs.js +2 -0
  219. package/lib/dynamic/dynamicTree.cjs.js.map +1 -0
  220. package/lib/dynamic/dynamicTree.d.ts +12 -0
  221. package/lib/dynamic/dynamicTree.esm.js +57 -0
  222. package/lib/dynamic/dynamicTree.esm.js.map +1 -0
  223. package/lib/dynamic/dynamicUi.cjs.js +2 -0
  224. package/lib/dynamic/dynamicUi.cjs.js.map +1 -0
  225. package/lib/dynamic/dynamicUi.d.ts +39 -0
  226. package/lib/dynamic/dynamicUi.esm.js +397 -0
  227. package/lib/dynamic/dynamicUi.esm.js.map +1 -0
  228. package/lib/formats/colorFormat.cjs.js +2 -0
  229. package/lib/formats/colorFormat.cjs.js.map +1 -0
  230. package/lib/formats/colorFormat.d.ts +127 -0
  231. package/lib/formats/colorFormat.esm.js +139 -0
  232. package/lib/formats/colorFormat.esm.js.map +1 -0
  233. package/lib/formats/dateValues.cjs.js +2 -0
  234. package/lib/formats/dateValues.cjs.js.map +1 -0
  235. package/lib/formats/dateValues.d.ts +3 -0
  236. package/lib/formats/dateValues.esm.js +21 -0
  237. package/lib/formats/dateValues.esm.js.map +1 -0
  238. package/lib/formats/duration.cjs.js +2 -0
  239. package/lib/formats/duration.cjs.js.map +1 -0
  240. package/lib/formats/duration.d.ts +13 -0
  241. package/lib/formats/duration.esm.js +28 -0
  242. package/lib/formats/duration.esm.js.map +1 -0
  243. package/lib/formats/maskControls.cjs.js +2 -0
  244. package/lib/formats/maskControls.cjs.js.map +1 -0
  245. package/lib/formats/maskControls.d.ts +32 -0
  246. package/lib/formats/maskControls.esm.js +16 -0
  247. package/lib/formats/maskControls.esm.js.map +1 -0
  248. package/lib/formats/maskFormat.cjs.js +2 -0
  249. package/lib/formats/maskFormat.cjs.js.map +1 -0
  250. package/lib/formats/maskFormat.d.ts +198 -0
  251. package/lib/formats/maskFormat.esm.js +79 -0
  252. package/lib/formats/maskFormat.esm.js.map +1 -0
  253. package/lib/formats/temporalBounds.cjs.js +2 -0
  254. package/lib/formats/temporalBounds.cjs.js.map +1 -0
  255. package/lib/formats/temporalBounds.d.ts +82 -0
  256. package/lib/formats/temporalBounds.esm.js +76 -0
  257. package/lib/formats/temporalBounds.esm.js.map +1 -0
  258. package/lib/formats/temporalFormats.cjs.js +2 -0
  259. package/lib/formats/temporalFormats.cjs.js.map +1 -0
  260. package/lib/formats/temporalFormats.d.ts +62 -0
  261. package/lib/formats/temporalFormats.esm.js +18 -0
  262. package/lib/formats/temporalFormats.esm.js.map +1 -0
  263. package/lib/formats/useMaskedInput.cjs.js +2 -0
  264. package/lib/formats/useMaskedInput.cjs.js.map +1 -0
  265. package/lib/formats/useMaskedInput.d.ts +11 -0
  266. package/lib/formats/useMaskedInput.esm.js +80 -0
  267. package/lib/formats/useMaskedInput.esm.js.map +1 -0
  268. package/lib/index.cjs.js +1 -0
  269. package/lib/index.d.ts +42 -0
  270. package/lib/index.esm.js +44 -0
  271. package/lib/interaction/confirmation.cjs.js +2 -0
  272. package/lib/interaction/confirmation.cjs.js.map +1 -0
  273. package/lib/interaction/confirmation.d.ts +112 -0
  274. package/lib/interaction/confirmation.esm.js +18 -0
  275. package/lib/interaction/confirmation.esm.js.map +1 -0
  276. package/lib/interaction/createDeleteConfirmation.cjs.js +2 -0
  277. package/lib/interaction/createDeleteConfirmation.cjs.js.map +1 -0
  278. package/lib/interaction/createDeleteConfirmation.d.ts +10 -0
  279. package/lib/interaction/createDeleteConfirmation.esm.js +17 -0
  280. package/lib/interaction/createDeleteConfirmation.esm.js.map +1 -0
  281. package/lib/interaction/detailDialog.cjs.js +2 -0
  282. package/lib/interaction/detailDialog.cjs.js.map +1 -0
  283. package/lib/interaction/detailDialog.d.ts +30 -0
  284. package/lib/interaction/detailDialog.esm.js +89 -0
  285. package/lib/interaction/detailDialog.esm.js.map +1 -0
  286. package/lib/interaction/pendingChanges.cjs.js +2 -0
  287. package/lib/interaction/pendingChanges.cjs.js.map +1 -0
  288. package/lib/interaction/pendingChanges.d.ts +19 -0
  289. package/lib/interaction/pendingChanges.esm.js +17 -0
  290. package/lib/interaction/pendingChanges.esm.js.map +1 -0
  291. package/lib/interaction/useConfirmationState.cjs.js +2 -0
  292. package/lib/interaction/useConfirmationState.cjs.js.map +1 -0
  293. package/lib/interaction/useConfirmationState.d.ts +11 -0
  294. package/lib/interaction/useConfirmationState.esm.js +39 -0
  295. package/lib/interaction/useConfirmationState.esm.js.map +1 -0
  296. package/lib/interaction/visuallyHidden.cjs.js +2 -0
  297. package/lib/interaction/visuallyHidden.cjs.js.map +1 -0
  298. package/lib/interaction/visuallyHidden.d.ts +9 -0
  299. package/lib/interaction/visuallyHidden.esm.js +14 -0
  300. package/lib/interaction/visuallyHidden.esm.js.map +1 -0
  301. package/lib/layout/categoryState.cjs.js +2 -0
  302. package/lib/layout/categoryState.cjs.js.map +1 -0
  303. package/lib/layout/categoryState.d.ts +66 -0
  304. package/lib/layout/categoryState.esm.js +42 -0
  305. package/lib/layout/categoryState.esm.js.map +1 -0
  306. package/lib/layout/groupState.cjs.js +2 -0
  307. package/lib/layout/groupState.cjs.js.map +1 -0
  308. package/lib/layout/groupState.d.ts +34 -0
  309. package/lib/layout/groupState.esm.js +63 -0
  310. package/lib/layout/groupState.esm.js.map +1 -0
  311. package/lib/layout/layoutContext.cjs.js +2 -0
  312. package/lib/layout/layoutContext.cjs.js.map +1 -0
  313. package/lib/layout/layoutContext.d.ts +16 -0
  314. package/lib/layout/layoutContext.esm.js +26 -0
  315. package/lib/layout/layoutContext.esm.js.map +1 -0
  316. package/lib/layout/layoutSizing.cjs.js +2 -0
  317. package/lib/layout/layoutSizing.cjs.js.map +1 -0
  318. package/lib/layout/layoutSizing.d.ts +104 -0
  319. package/lib/layout/layoutSizing.esm.js +69 -0
  320. package/lib/layout/layoutSizing.esm.js.map +1 -0
  321. package/lib/locale/bg.cjs.js +2 -0
  322. package/lib/locale/bg.cjs.js.map +1 -0
  323. package/lib/locale/bg.d.ts +279 -0
  324. package/lib/locale/bg.esm.js +271 -0
  325. package/lib/locale/bg.esm.js.map +1 -0
  326. package/lib/locale/calendar.cjs.js +2 -0
  327. package/lib/locale/calendar.cjs.js.map +1 -0
  328. package/lib/locale/calendar.d.ts +23 -0
  329. package/lib/locale/calendar.esm.js +57 -0
  330. package/lib/locale/calendar.esm.js.map +1 -0
  331. package/lib/locale/en.cjs.js +2 -0
  332. package/lib/locale/en.cjs.js.map +1 -0
  333. package/lib/locale/en.d.ts +275 -0
  334. package/lib/locale/en.esm.js +271 -0
  335. package/lib/locale/en.esm.js.map +1 -0
  336. package/lib/locale/index.cjs.js +1 -0
  337. package/lib/locale/index.d.ts +3 -0
  338. package/lib/locale/index.esm.js +3 -0
  339. package/lib/locale/intl.cjs.js +2 -0
  340. package/lib/locale/intl.cjs.js.map +1 -0
  341. package/lib/locale/intl.d.ts +2 -0
  342. package/lib/locale/intl.esm.js +11 -0
  343. package/lib/locale/intl.esm.js.map +1 -0
  344. package/lib/locale/rendererLocale.cjs.js +2 -0
  345. package/lib/locale/rendererLocale.cjs.js.map +1 -0
  346. package/lib/locale/rendererLocale.d.ts +40 -0
  347. package/lib/locale/rendererLocale.esm.js +24 -0
  348. package/lib/locale/rendererLocale.esm.js.map +1 -0
  349. package/lib/locale/translate.cjs.js +2 -0
  350. package/lib/locale/translate.cjs.js.map +1 -0
  351. package/lib/locale/translate.d.ts +43 -0
  352. package/lib/locale/translate.esm.js +25 -0
  353. package/lib/locale/translate.esm.js.map +1 -0
  354. package/lib/mixed/MixedDetailControl.cjs.js +2 -0
  355. package/lib/mixed/MixedDetailControl.cjs.js.map +1 -0
  356. package/lib/mixed/MixedDetailControl.d.ts +20 -0
  357. package/lib/mixed/MixedDetailControl.esm.js +73 -0
  358. package/lib/mixed/MixedDetailControl.esm.js.map +1 -0
  359. package/lib/mixed/RecursiveTreeRenderer.cjs.js +2 -0
  360. package/lib/mixed/RecursiveTreeRenderer.cjs.js.map +1 -0
  361. package/lib/mixed/RecursiveTreeRenderer.d.ts +35 -0
  362. package/lib/mixed/RecursiveTreeRenderer.esm.js +206 -0
  363. package/lib/mixed/RecursiveTreeRenderer.esm.js.map +1 -0
  364. package/lib/mixed/createMixedTypeChangeHandler.cjs.js +2 -0
  365. package/lib/mixed/createMixedTypeChangeHandler.cjs.js.map +1 -0
  366. package/lib/mixed/createMixedTypeChangeHandler.d.ts +16 -0
  367. package/lib/mixed/createMixedTypeChangeHandler.esm.js +34 -0
  368. package/lib/mixed/createMixedTypeChangeHandler.esm.js.map +1 -0
  369. package/lib/mixed/mixedComposition.cjs.js +2 -0
  370. package/lib/mixed/mixedComposition.cjs.js.map +1 -0
  371. package/lib/mixed/mixedComposition.d.ts +7 -0
  372. package/lib/mixed/mixedComposition.esm.js +37 -0
  373. package/lib/mixed/mixedComposition.esm.js.map +1 -0
  374. package/lib/mixed/mixedNodeEditor.cjs.js +2 -0
  375. package/lib/mixed/mixedNodeEditor.cjs.js.map +1 -0
  376. package/lib/mixed/mixedNodeEditor.d.ts +12 -0
  377. package/lib/mixed/mixedNodeEditor.esm.js +20 -0
  378. package/lib/mixed/mixedNodeEditor.esm.js.map +1 -0
  379. package/lib/mixed/mixedScalar.cjs.js +2 -0
  380. package/lib/mixed/mixedScalar.cjs.js.map +1 -0
  381. package/lib/mixed/mixedScalar.d.ts +4 -0
  382. package/lib/mixed/mixedScalar.esm.js +6 -0
  383. package/lib/mixed/mixedScalar.esm.js.map +1 -0
  384. package/lib/mixed/mixedSchema.cjs.js +2 -0
  385. package/lib/mixed/mixedSchema.cjs.js.map +1 -0
  386. package/lib/mixed/mixedSchema.d.ts +22 -0
  387. package/lib/mixed/mixedSchema.esm.js +88 -0
  388. package/lib/mixed/mixedSchema.esm.js.map +1 -0
  389. package/lib/mixed/mixedTree.cjs.js +2 -0
  390. package/lib/mixed/mixedTree.cjs.js.map +1 -0
  391. package/lib/mixed/mixedTree.d.ts +19 -0
  392. package/lib/mixed/mixedTree.esm.js +78 -0
  393. package/lib/mixed/mixedTree.esm.js.map +1 -0
  394. package/lib/mixed/mixedTreeActions.cjs.js +2 -0
  395. package/lib/mixed/mixedTreeActions.cjs.js.map +1 -0
  396. package/lib/mixed/mixedTreeActions.d.ts +6 -0
  397. package/lib/mixed/mixedTreeActions.esm.js +17 -0
  398. package/lib/mixed/mixedTreeActions.esm.js.map +1 -0
  399. package/lib/mixed/recursiveTree.cjs.js +2 -0
  400. package/lib/mixed/recursiveTree.cjs.js.map +1 -0
  401. package/lib/mixed/recursiveTree.d.ts +9 -0
  402. package/lib/mixed/recursiveTree.esm.js +49 -0
  403. package/lib/mixed/recursiveTree.esm.js.map +1 -0
  404. package/lib/mixed/useMixedNavigation.cjs.js +2 -0
  405. package/lib/mixed/useMixedNavigation.cjs.js.map +1 -0
  406. package/lib/mixed/useMixedNavigation.d.ts +6 -0
  407. package/lib/mixed/useMixedNavigation.esm.js +21 -0
  408. package/lib/mixed/useMixedNavigation.esm.js.map +1 -0
  409. package/lib/mixed/useMixedRenderer.cjs.js +2 -0
  410. package/lib/mixed/useMixedRenderer.cjs.js.map +1 -0
  411. package/lib/mixed/useMixedRenderer.d.ts +61 -0
  412. package/lib/mixed/useMixedRenderer.esm.js +185 -0
  413. package/lib/mixed/useMixedRenderer.esm.js.map +1 -0
  414. package/lib/mixed/useMixedType.cjs.js +2 -0
  415. package/lib/mixed/useMixedType.cjs.js.map +1 -0
  416. package/lib/mixed/useMixedType.d.ts +6 -0
  417. package/lib/mixed/useMixedType.esm.js +23 -0
  418. package/lib/mixed/useMixedType.esm.js.map +1 -0
  419. package/lib/objects/IsolatedPropertyEditor.cjs.js +2 -0
  420. package/lib/objects/IsolatedPropertyEditor.cjs.js.map +1 -0
  421. package/lib/objects/IsolatedPropertyEditor.d.ts +35 -0
  422. package/lib/objects/IsolatedPropertyEditor.esm.js +27 -0
  423. package/lib/objects/IsolatedPropertyEditor.esm.js.map +1 -0
  424. package/lib/objects/ObjectDetail.cjs.js +2 -0
  425. package/lib/objects/ObjectDetail.cjs.js.map +1 -0
  426. package/lib/objects/ObjectDetail.d.ts +42 -0
  427. package/lib/objects/ObjectDetail.esm.js +103 -0
  428. package/lib/objects/ObjectDetail.esm.js.map +1 -0
  429. package/lib/objects/additionalProperties.cjs.js +2 -0
  430. package/lib/objects/additionalProperties.cjs.js.map +1 -0
  431. package/lib/objects/additionalProperties.d.ts +14 -0
  432. package/lib/objects/additionalProperties.esm.js +41 -0
  433. package/lib/objects/additionalProperties.esm.js.map +1 -0
  434. package/lib/objects/additionalPropertyName.cjs.js +2 -0
  435. package/lib/objects/additionalPropertyName.cjs.js.map +1 -0
  436. package/lib/objects/additionalPropertyName.d.ts +63 -0
  437. package/lib/objects/additionalPropertyName.esm.js +46 -0
  438. package/lib/objects/additionalPropertyName.esm.js.map +1 -0
  439. package/lib/objects/conditionalFields.cjs.js +2 -0
  440. package/lib/objects/conditionalFields.cjs.js.map +1 -0
  441. package/lib/objects/conditionalFields.d.ts +18 -0
  442. package/lib/objects/conditionalFields.esm.js +105 -0
  443. package/lib/objects/conditionalFields.esm.js.map +1 -0
  444. package/lib/objects/dynamicProperties.cjs.js +2 -0
  445. package/lib/objects/dynamicProperties.cjs.js.map +1 -0
  446. package/lib/objects/dynamicProperties.d.ts +10 -0
  447. package/lib/objects/dynamicProperties.esm.js +33 -0
  448. package/lib/objects/dynamicProperties.esm.js.map +1 -0
  449. package/lib/objects/literalPropertySchema.cjs.js +2 -0
  450. package/lib/objects/literalPropertySchema.cjs.js.map +1 -0
  451. package/lib/objects/literalPropertySchema.d.ts +2 -0
  452. package/lib/objects/literalPropertySchema.esm.js +38 -0
  453. package/lib/objects/literalPropertySchema.esm.js.map +1 -0
  454. package/lib/objects/useAdditionalPropertyEntries.cjs.js +2 -0
  455. package/lib/objects/useAdditionalPropertyEntries.cjs.js.map +1 -0
  456. package/lib/objects/useAdditionalPropertyEntries.d.ts +72 -0
  457. package/lib/objects/useAdditionalPropertyEntries.esm.js +71 -0
  458. package/lib/objects/useAdditionalPropertyEntries.esm.js.map +1 -0
  459. package/lib/rolldown-runtime-BocRIvOZ.js +1 -0
  460. package/lib/tuple/TupleControlContent.cjs.js +2 -0
  461. package/lib/tuple/TupleControlContent.cjs.js.map +1 -0
  462. package/lib/tuple/TupleControlContent.d.ts +17 -0
  463. package/lib/tuple/TupleControlContent.esm.js +74 -0
  464. package/lib/tuple/TupleControlContent.esm.js.map +1 -0
  465. package/lib/tuple/TupleField.cjs.js +2 -0
  466. package/lib/tuple/TupleField.cjs.js.map +1 -0
  467. package/lib/tuple/TupleField.d.ts +15 -0
  468. package/lib/tuple/TupleField.esm.js +72 -0
  469. package/lib/tuple/TupleField.esm.js.map +1 -0
  470. package/lib/tuple/tupleSchema.cjs.js +2 -0
  471. package/lib/tuple/tupleSchema.cjs.js.map +1 -0
  472. package/lib/tuple/tupleSchema.d.ts +93 -0
  473. package/lib/tuple/tupleSchema.esm.js +63 -0
  474. package/lib/tuple/tupleSchema.esm.js.map +1 -0
  475. package/lib/tuple/useTupleAdditionalItems.cjs.js +2 -0
  476. package/lib/tuple/useTupleAdditionalItems.cjs.js.map +1 -0
  477. package/lib/tuple/useTupleAdditionalItems.d.ts +45 -0
  478. package/lib/tuple/useTupleAdditionalItems.esm.js +47 -0
  479. package/lib/tuple/useTupleAdditionalItems.esm.js.map +1 -0
  480. package/lib/tuple/useTupleControl.cjs.js +3 -0
  481. package/lib/tuple/useTupleControl.cjs.js.map +1 -0
  482. package/lib/tuple/useTupleControl.d.ts +26 -0
  483. package/lib/tuple/useTupleControl.esm.js +84 -0
  484. package/lib/tuple/useTupleControl.esm.js.map +1 -0
  485. package/lib/tuple/useTupleField.cjs.js +2 -0
  486. package/lib/tuple/useTupleField.cjs.js.map +1 -0
  487. package/lib/tuple/useTupleField.d.ts +38 -0
  488. package/lib/tuple/useTupleField.esm.js +80 -0
  489. package/lib/tuple/useTupleField.esm.js.map +1 -0
  490. package/lib/validation/ItemValidationIndicator.cjs.js +2 -0
  491. package/lib/validation/ItemValidationIndicator.cjs.js.map +1 -0
  492. package/lib/validation/ItemValidationIndicator.d.ts +9 -0
  493. package/lib/validation/ItemValidationIndicator.esm.js +14 -0
  494. package/lib/validation/ItemValidationIndicator.esm.js.map +1 -0
  495. package/lib/validation/errorSummary.cjs.js +9 -0
  496. package/lib/validation/errorSummary.cjs.js.map +1 -0
  497. package/lib/validation/errorSummary.d.ts +44 -0
  498. package/lib/validation/errorSummary.esm.js +194 -0
  499. package/lib/validation/errorSummary.esm.js.map +1 -0
  500. package/lib/validation/preTouchErrors.cjs.js +2 -0
  501. package/lib/validation/preTouchErrors.cjs.js.map +1 -0
  502. package/lib/validation/preTouchErrors.d.ts +77 -0
  503. package/lib/validation/preTouchErrors.esm.js +42 -0
  504. package/lib/validation/preTouchErrors.esm.js.map +1 -0
  505. package/lib/validation/validationIndicator.cjs.js +2 -0
  506. package/lib/validation/validationIndicator.cjs.js.map +1 -0
  507. package/lib/validation/validationIndicator.d.ts +72 -0
  508. package/lib/validation/validationIndicator.esm.js +66 -0
  509. package/lib/validation/validationIndicator.esm.js.map +1 -0
  510. package/lib/webcomponent/element.cjs.js +2 -0
  511. package/lib/webcomponent/element.cjs.js.map +1 -0
  512. package/lib/webcomponent/element.d.ts +48 -0
  513. package/lib/webcomponent/element.esm.js +85 -0
  514. package/lib/webcomponent/element.esm.js.map +1 -0
  515. package/lib/webcomponent/input.cjs.js +2 -0
  516. package/lib/webcomponent/input.cjs.js.map +1 -0
  517. package/lib/webcomponent/input.d.ts +6 -0
  518. package/lib/webcomponent/input.esm.js +25 -0
  519. package/lib/webcomponent/input.esm.js.map +1 -0
  520. package/package.json +86 -3
  521. package/src/cells/CellSummary.tsx +59 -0
  522. package/src/cells/cellMode.tsx +21 -0
  523. package/src/cells/compositeActions.ts +21 -0
  524. package/src/cells/compositeCellTester.ts +15 -0
  525. package/src/cells/compositeSummary.ts +149 -0
  526. package/src/cells/useCompositeCellPresentation.ts +37 -0
  527. package/src/cells/useCompositeDraft.ts +199 -0
  528. package/src/collections/CollectionErrorNavigation.tsx +123 -0
  529. package/src/collections/arrayChoices.ts +235 -0
  530. package/src/collections/collectionPagination.ts +95 -0
  531. package/src/collections/columnResize.tsx +151 -0
  532. package/src/collections/rowDetail.tsx +208 -0
  533. package/src/collections/tableColumns.ts +39 -0
  534. package/src/collections/useArrayPanelState.ts +25 -0
  535. package/src/collections/useCollectionDelete.ts +62 -0
  536. package/src/collections/useTableSelection.ts +77 -0
  537. package/src/composition/AllOfRenderer.tsx +79 -0
  538. package/src/composition/CombinatorBranch.tsx +93 -0
  539. package/src/composition/CombinatorProperties.tsx +56 -0
  540. package/src/composition/ScalarCompositionControl.tsx +34 -0
  541. package/src/composition/choiceCards.tsx +389 -0
  542. package/src/composition/combinators.ts +131 -0
  543. package/src/composition/discriminatorBranch.ts +82 -0
  544. package/src/composition/scalarComposition.ts +193 -0
  545. package/src/composition/useCombinatorSelection.ts +53 -0
  546. package/src/composition/useScalarComposition.ts +67 -0
  547. package/src/controls/FileArrayInput.tsx +407 -0
  548. package/src/controls/controlHelp.ts +28 -0
  549. package/src/controls/inputAdornments.tsx +337 -0
  550. package/src/controls/numeric.ts +43 -0
  551. package/src/controls/useClearAffordance.ts +22 -0
  552. package/src/controls/useDebouncedChange.ts +138 -0
  553. package/src/controls/useFocus.ts +32 -0
  554. package/src/core/configNamespaces.ts +67 -0
  555. package/src/core/dataPointer.ts +8 -0
  556. package/src/core/detailUiSchema.ts +88 -0
  557. package/src/core/plainRecord.ts +8 -0
  558. package/src/core/uiSchemaCycle.tsx +122 -0
  559. package/src/dynamic/DynamicUiProvider.tsx +414 -0
  560. package/src/dynamic/dynamicCel.ts +68 -0
  561. package/src/dynamic/dynamicConfig.ts +26 -0
  562. package/src/dynamic/dynamicRuntime.ts +25 -0
  563. package/src/dynamic/dynamicScope.ts +22 -0
  564. package/src/dynamic/dynamicTree.ts +128 -0
  565. package/src/dynamic/dynamicUi.ts +711 -0
  566. package/src/formats/colorFormat.ts +390 -0
  567. package/src/formats/dateValues.ts +45 -0
  568. package/src/formats/duration.ts +60 -0
  569. package/src/formats/maskControls.ts +88 -0
  570. package/src/formats/maskFormat.ts +375 -0
  571. package/src/formats/temporalBounds.ts +219 -0
  572. package/src/formats/temporalFormats.ts +128 -0
  573. package/src/formats/useMaskedInput.ts +194 -0
  574. package/src/index.ts +42 -0
  575. package/src/interaction/confirmation.ts +211 -0
  576. package/src/interaction/createDeleteConfirmation.ts +23 -0
  577. package/src/interaction/detailDialog.ts +138 -0
  578. package/src/interaction/pendingChanges.tsx +55 -0
  579. package/src/interaction/useConfirmationState.ts +55 -0
  580. package/src/interaction/visuallyHidden.ts +19 -0
  581. package/src/layout/categoryState.ts +189 -0
  582. package/src/layout/groupState.ts +201 -0
  583. package/src/layout/layoutContext.tsx +49 -0
  584. package/src/layout/layoutSizing.ts +369 -0
  585. package/src/locale/bg.ts +309 -0
  586. package/src/locale/calendar.ts +57 -0
  587. package/src/locale/en.ts +375 -0
  588. package/src/locale/index.ts +5 -0
  589. package/src/locale/intl.ts +10 -0
  590. package/src/locale/rendererLocale.ts +74 -0
  591. package/src/locale/translate.ts +98 -0
  592. package/src/mixed/MixedDetailControl.tsx +182 -0
  593. package/src/mixed/RecursiveTreeRenderer.tsx +388 -0
  594. package/src/mixed/createMixedTypeChangeHandler.ts +77 -0
  595. package/src/mixed/mixedComposition.ts +76 -0
  596. package/src/mixed/mixedNodeEditor.ts +47 -0
  597. package/src/mixed/mixedScalar.ts +7 -0
  598. package/src/mixed/mixedSchema.ts +283 -0
  599. package/src/mixed/mixedTree.ts +199 -0
  600. package/src/mixed/mixedTreeActions.ts +60 -0
  601. package/src/mixed/recursiveTree.ts +105 -0
  602. package/src/mixed/useMixedNavigation.ts +36 -0
  603. package/src/mixed/useMixedRenderer.ts +300 -0
  604. package/src/mixed/useMixedType.ts +45 -0
  605. package/src/objects/IsolatedPropertyEditor.tsx +86 -0
  606. package/src/objects/ObjectDetail.tsx +232 -0
  607. package/src/objects/additionalProperties.ts +151 -0
  608. package/src/objects/additionalPropertyName.ts +185 -0
  609. package/src/objects/conditionalFields.ts +173 -0
  610. package/src/objects/dynamicProperties.tsx +68 -0
  611. package/src/objects/literalPropertySchema.ts +100 -0
  612. package/src/objects/useAdditionalPropertyEntries.ts +204 -0
  613. package/src/tuple/TupleControlContent.tsx +152 -0
  614. package/src/tuple/TupleField.tsx +150 -0
  615. package/src/tuple/tupleSchema.ts +245 -0
  616. package/src/tuple/useTupleAdditionalItems.ts +131 -0
  617. package/src/tuple/useTupleControl.tsx +173 -0
  618. package/src/tuple/useTupleField.ts +164 -0
  619. package/src/validation/ItemValidationIndicator.tsx +21 -0
  620. package/src/validation/errorSummary.tsx +489 -0
  621. package/src/validation/preTouchErrors.ts +185 -0
  622. package/src/validation/validationIndicator.ts +202 -0
  623. package/src/webcomponent/element.ts +107 -0
  624. package/src/webcomponent/input.ts +56 -0
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./mixedSchema.cjs.js");let t=require("@jsonforms/core");var n=(t,n,r)=>{let i=t.path.length>0&&t.type!==`array`&&t.type!==`object`&&t.type!==`null`,a=e.ANY_TYPES.includes(t.type)?e.schemaForType(t.schema,t.type,r):t.schema,o=[n,...t.path].filter(e=>e!==``).join(`.`),s=e.getSchemaTypes(t.schema);return{isNestedPrimitive:i,nodeSchema:a,nodePath:o,nodeTypes:s,nodeType:t.type&&s.includes(t.type)?t.type:t.type===`integer`&&s.includes(`number`)?`number`:null}},r=(n,r,i,a,o)=>{if(!r)return;let s=e.schemaForType(n.schema,r,a);o(i,(0,t.createDefaultValue)(s,a))};exports.changeMixedNodeType=r,exports.resolveMixedNodeEditor=n;
2
+ //# sourceMappingURL=mixedNodeEditor.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedNodeEditor.cjs.js","names":["ANY_TYPES","schemaForType","getSchemaTypes","createDefaultValue","require_mixed_mixedSchema","_jsonforms_core","resolveMixedNodeEditor","isNestedPrimitive","node","nodeSchema","rootSchema","nodePath","path","segment","nodeTypes","changeMixedNodeType","nextType","nextSchema","handleChange"],"sources":["../../src/mixed/mixedNodeEditor.ts"],"sourcesContent":["import { createDefaultValue, type JsonSchema } from '@jsonforms/core';\nimport {\n ANY_TYPES,\n getSchemaTypes,\n schemaForType,\n type JsonDataType,\n} from './mixedSchema';\nimport type { MixedTreeNode } from './mixedTree';\n\n/** The editor at a selected mixed-tree node, independent of selector widgets. */\nexport const resolveMixedNodeEditor = (\n node: MixedTreeNode,\n path: string,\n rootSchema: JsonSchema,\n) => {\n const isNestedPrimitive =\n node.path.length > 0 &&\n node.type !== 'array' &&\n node.type !== 'object' &&\n node.type !== 'null';\n const nodeSchema = ANY_TYPES.includes(node.type as JsonDataType)\n ? schemaForType(node.schema, node.type as JsonDataType, rootSchema)\n : node.schema;\n const nodePath = [path, ...node.path]\n .filter((segment) => segment !== '')\n .join('.');\n const nodeTypes = getSchemaTypes(node.schema);\n const nodeType =\n node.type && nodeTypes.includes(node.type as JsonDataType)\n ? node.type\n : node.type === 'integer' && nodeTypes.includes('number')\n ? 'number'\n : null;\n return { isNestedPrimitive, nodeSchema, nodePath, nodeTypes, nodeType };\n};\n\nexport const changeMixedNodeType = (\n node: MixedTreeNode,\n nextType: JsonDataType | undefined,\n nodePath: string,\n rootSchema: JsonSchema,\n handleChange: (path: string, value: unknown) => void,\n) => {\n if (!nextType) return;\n const nextSchema = schemaForType(node.schema, nextType, rootSchema);\n handleChange(nodePath, createDefaultValue(nextSchema, rootSchema));\n};\n"],"mappings":"A,4IAUA,IAAaM,GACX,EACA,EACA,IACG,CACH,IAAMC,EACJC,EAAK,KAAK,OAAS,GACnBA,EAAK,OAAS,SACdA,EAAK,OAAS,UACdA,EAAK,OAAS,OACVC,EAAaT,EAAAA,UAAU,SAASQ,EAAK,IAAoB,EAC3DP,EAAAA,cAAcO,EAAK,OAAQA,EAAK,KAAsBE,CAAU,EAChEF,EAAK,OACHG,EAAW,CAACC,EAAM,GAAGJ,EAAK,IAAI,CAAC,CAClC,OAAQ,GAAYK,IAAY,EAAE,CAAC,CACnC,KAAK,GAAG,EACLC,EAAYZ,EAAAA,eAAeM,EAAK,MAAM,EAO5C,MAAO,CAAE,oBAAmB,aAAY,WAAU,YAAW,SAL3DA,EAAK,MAAQM,EAAU,SAASN,EAAK,IAAoB,EACrDA,EAAK,KACLA,EAAK,OAAS,WAAaM,EAAU,SAAS,QAAQ,EACpD,SACA,IAC8D,CACxE,EAEaC,GACX,EACA,EACA,EACA,EACA,IACG,CACH,GAAI,CAACC,EAAU,OACf,IAAMC,EAAahB,EAAAA,cAAcO,EAAK,OAAQQ,EAAUN,CAAU,EAClEQ,EAAaP,GAAA,EAAUR,EAAAA,mBAAAA,CAAmBc,EAAYP,CAAU,CAAC,CACnE,E"}
@@ -0,0 +1,12 @@
1
+ import { type JsonSchema } from '@jsonforms/core';
2
+ import { type JsonDataType } from './mixedSchema';
3
+ import type { MixedTreeNode } from './mixedTree';
4
+ /** The editor at a selected mixed-tree node, independent of selector widgets. */
5
+ export declare const resolveMixedNodeEditor: (node: MixedTreeNode, path: string, rootSchema: JsonSchema) => {
6
+ isNestedPrimitive: boolean;
7
+ nodeSchema: JsonSchema;
8
+ nodePath: string;
9
+ nodeTypes: JsonDataType[];
10
+ nodeType: string | null;
11
+ };
12
+ export declare const changeMixedNodeType: (node: MixedTreeNode, nextType: JsonDataType | undefined, nodePath: string, rootSchema: JsonSchema, handleChange: (path: string, value: unknown) => void) => void;
@@ -0,0 +1,20 @@
1
+ import { ANY_TYPES as e, getSchemaTypes as t, schemaForType as n } from "./mixedSchema.esm.js";
2
+ import { createDefaultValue as r } from "@jsonforms/core";
3
+ // src/mixed/mixedNodeEditor.ts
4
+ var i = (r, i, a) => {
5
+ let o = r.path.length > 0 && r.type !== "array" && r.type !== "object" && r.type !== "null", s = e.includes(r.type) ? n(r.schema, r.type, a) : r.schema, c = [i, ...r.path].filter((e) => e !== "").join("."), l = t(r.schema);
6
+ return {
7
+ isNestedPrimitive: o,
8
+ nodeSchema: s,
9
+ nodePath: c,
10
+ nodeTypes: l,
11
+ nodeType: r.type && l.includes(r.type) ? r.type : r.type === "integer" && l.includes("number") ? "number" : null
12
+ };
13
+ }, a = (e, t, i, a, o) => {
14
+ if (!t) return;
15
+ let s = n(e.schema, t, a);
16
+ o(i, r(s, a));
17
+ };
18
+ export { a as changeMixedNodeType, i as resolveMixedNodeEditor };
19
+
20
+ //# sourceMappingURL=mixedNodeEditor.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedNodeEditor.esm.js","names":["resolveMixedNodeEditor","isNestedPrimitive","node","nodeSchema","ANY_TYPES","schemaForType","rootSchema","nodePath","path","segment","nodeTypes","getSchemaTypes","changeMixedNodeType","nextType","nextSchema","createDefaultValue"],"sources":["../../src/mixed/mixedNodeEditor.ts"],"sourcesContent":["import { createDefaultValue, type JsonSchema } from '@jsonforms/core';\nimport {\n ANY_TYPES,\n getSchemaTypes,\n schemaForType,\n type JsonDataType,\n} from './mixedSchema';\nimport type { MixedTreeNode } from './mixedTree';\n\n/** The editor at a selected mixed-tree node, independent of selector widgets. */\nexport const resolveMixedNodeEditor = (\n node: MixedTreeNode,\n path: string,\n rootSchema: JsonSchema,\n) => {\n const isNestedPrimitive =\n node.path.length > 0 &&\n node.type !== 'array' &&\n node.type !== 'object' &&\n node.type !== 'null';\n const nodeSchema = ANY_TYPES.includes(node.type as JsonDataType)\n ? schemaForType(node.schema, node.type as JsonDataType, rootSchema)\n : node.schema;\n const nodePath = [path, ...node.path]\n .filter((segment) => segment !== '')\n .join('.');\n const nodeTypes = getSchemaTypes(node.schema);\n const nodeType =\n node.type && nodeTypes.includes(node.type as JsonDataType)\n ? node.type\n : node.type === 'integer' && nodeTypes.includes('number')\n ? 'number'\n : null;\n return { isNestedPrimitive, nodeSchema, nodePath, nodeTypes, nodeType };\n};\n\nexport const changeMixedNodeType = (\n node: MixedTreeNode,\n nextType: JsonDataType | undefined,\n nodePath: string,\n rootSchema: JsonSchema,\n handleChange: (path: string, value: unknown) => void,\n) => {\n if (!nextType) return;\n const nextSchema = schemaForType(node.schema, nextType, rootSchema);\n handleChange(nodePath, createDefaultValue(nextSchema, rootSchema));\n};\n"],"mappings":";;;AAUA,IAAaA,KACX,GACA,GACA,MACG;CACH,IAAMC,IACJC,EAAK,KAAK,SAAS,KACnBA,EAAK,SAAS,WACdA,EAAK,SAAS,YACdA,EAAK,SAAS,QACVC,IAAaC,EAAU,SAASF,EAAK,IAAoB,IAC3DG,EAAcH,EAAK,QAAQA,EAAK,MAAsBI,CAAU,IAChEJ,EAAK,QACHK,IAAW,CAACC,GAAM,GAAGN,EAAK,IAAI,CAAC,CAClC,QAAQ,MAAYO,MAAY,EAAE,CAAC,CACnC,KAAK,GAAG,GACLC,IAAYC,EAAeT,EAAK,MAAM;CAO5C,OAAO;EAAE;EAAmB;EAAY;EAAU;EAAW,UAL3DA,EAAK,QAAQQ,EAAU,SAASR,EAAK,IAAoB,IACrDA,EAAK,OACLA,EAAK,SAAS,aAAaQ,EAAU,SAAS,QAAQ,IACpD,WACA;CAC8D;AACxE,GAEaE,KACX,GACA,GACA,GACA,GACA,MACG;CACH,IAAI,CAACC,GAAU;CACf,IAAMC,IAAaT,EAAcH,EAAK,QAAQW,GAAUP,CAAU;CAClE,EAAaC,GAAUQ,EAAmBD,GAAYR,CAAU,CAAC;AACnE"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react");var t=(0,e.createContext)(void 0),n=n=>(0,e.useContext)(t)===n;exports.MixedScalarContext=t,exports.useMixedScalar=n;
2
+ //# sourceMappingURL=mixedScalar.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedScalar.cjs.js","names":["createContext","useContext","react","MixedScalarContext","useMixedScalar","path"],"sources":["../../src/mixed/mixedScalar.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n/** Only the scalar owned by a mixed type selector retains its empty value.\n * Ordinary optional fields keep their existing clear-to-absent behavior. */\nexport const MixedScalarContext = createContext<string | undefined>(undefined);\nexport const useMixedScalar = (path: string) =>\n useContext(MixedScalarContext) === path;\n"],"mappings":"A,0FAIA,IAAaG,GAAA,EAAqBH,EAAAA,cAAAA,CAAkC,IAAA,EAAS,EAChEI,EAAkB,IAAA,EAC7BH,EAAAA,WAAAA,CAAWE,CAAkB,IAAME,E"}
@@ -0,0 +1,4 @@
1
+ /** Only the scalar owned by a mixed type selector retains its empty value.
2
+ * Ordinary optional fields keep their existing clear-to-absent behavior. */
3
+ export declare const MixedScalarContext: import("react").Context<string | undefined>;
4
+ export declare const useMixedScalar: (path: string) => boolean;
@@ -0,0 +1,6 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ // src/mixed/mixedScalar.ts
3
+ var n = e(void 0), r = (e) => t(n) === e;
4
+ export { n as MixedScalarContext, r as useMixedScalar };
5
+
6
+ //# sourceMappingURL=mixedScalar.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedScalar.esm.js","names":["MixedScalarContext","createContext","useMixedScalar","useContext","path"],"sources":["../../src/mixed/mixedScalar.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n/** Only the scalar owned by a mixed type selector retains its empty value.\n * Ordinary optional fields keep their existing clear-to-absent behavior. */\nexport const MixedScalarContext = createContext<string | undefined>(undefined);\nexport const useMixedScalar = (path: string) =>\n useContext(MixedScalarContext) === path;\n"],"mappings":";;AAIA,IAAaA,IAAqBC,EAAkC,KAAA,CAAS,GAChEC,KAAkB,MAC7BC,EAAWH,CAAkB,MAAMI"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("./mixedComposition.cjs.js");let n=require("@jsonforms/core"),r=require("lodash/get");r=e.t(r);var i=[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`],a=[`items`,`maxItems`,`minItems`,`uniqueItems`],o=[`additionalProperties`,`dependencies`,`dependentRequired`,`dependentSchemas`,`maxProperties`,`minProperties`,`patternProperties`,`properties`,`propertyNames`,`required`],s=[`contentEncoding`,`contentMediaType`,`format`,`maxLength`,`minLength`,`pattern`],c=[`exclusiveMaximum`,`exclusiveMinimum`,`maximum`,`minimum`,`multipleOf`],l=(e,t)=>t.forEach(t=>delete e[t]),u=e=>typeof e==`string`?`string`:typeof e==`number`?Number.isInteger(e)?`integer`:`number`:typeof e==`boolean`?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e==`object`?`object`:null,d=e=>typeof e==`object`?typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type:i:i;function f(e,t){t!==`array`&&l(e,a),t!==`object`&&l(e,o),t!==`string`&&l(e,s),t!==`integer`&&t!==`number`&&l(e,c)}function p(e,t){return typeof e==`object`&&!Array.isArray(e)&&typeof e.$ref==`string`?(0,n.resolveSchema)(t,e.$ref,t)??e:e}var m=(e,n,r)=>{let a=t.narrowMixedComposition(e,n),o={...typeof a==`object`?a:{},...a===!1?{not:{}}:{},type:typeof a==`object`?a.type??n:n};if(f(o,n),o.default!==void 0){let e=u(o.default);e===n||n===`number`&&e===`integer`||delete o.default}if(n===`object`)o.additionalProperties=o.additionalProperties??!0;else if(n===`array`){let e=p(o.items,r);o.items=e===void 0?{type:i}:e}return o},h=(e,t)=>{if(!t)return!1;let n=t.lastIndexOf(`.`),i=n<0?e:(0,r.default)(e,t.slice(0,n).split(`.`));return Array.isArray(i)},g=(e,t,r)=>{let i=e==null?void 0:e.scope;if(!i)return t;try{return(0,n.resolveSchema)(t,i,(r==null?void 0:r.rootSchema)??t)??t}catch{return t}},_=(e,t,r)=>{if(t&&typeof t==`boolean`)return!0;if(!t||typeof t!=`object`)return!1;let i=g(e,t,r);return typeof i==`boolean`?!!i:Array.isArray(i.type)?i.type.length>1:i.allOf||i.anyOf||i.oneOf||i.properties||i.patternProperties||i.additionalProperties!==void 0?!1:!!(i.type===void 0&&(0,n.isControl)(e))},v=e=>{let t=e==null?void 0:e.elements;return(e.type===`VerticalLayout`||e.type===`Group`)&&Array.isArray(t)&&t.length===1&&t[0].scope===`#`&&t[0].type===`Control`},y=e=>(t,r,i)=>e(t,r,i)&&((0,n.isControl)(t)||v(t)),b=y(_),x=(0,n.rankWith)(20,b);exports.ANY_TYPES=i,exports.getJsonDataType=u,exports.getSchemaTypes=d,exports.isArrayElementPath=h,exports.isDefaultGeneratedUiSchema=v,exports.isMixedControl=b,exports.isMixedSchema=_,exports.mixedControlFor=y,exports.mixedControlTester=x,exports.removeInapplicableKeywords=f,exports.resolveMixedArrayItems=p,exports.schemaForType=m;
2
+ //# sourceMappingURL=mixedSchema.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedSchema.cjs.js","names":["resolveSchema","narrowMixedComposition","get","isControl","rankWith","require_rolldown_runtime","require_mixed_mixedComposition","_jsonforms_core","lodash_get","ANY_TYPES","ARRAY_KEYWORDS","OBJECT_KEYWORDS","STRING_KEYWORDS","NUMBER_KEYWORDS","removeKeywords","keywords","schema","keyword","getJsonDataType","value","getSchemaTypes","removeInapplicableKeywords","type","nextSchema","resolveMixedArrayItems","items","rootSchema","schemaForType","narrowed","defaultType","isArrayElementPath","path","separator","parent","data","resolveScopedSchema","scope","uischema","context","isMixedSchema","rawSchema","isDefaultGeneratedUiSchema","elements","mixedControlFor","matchesSchema","isMixedControl","mixedControlTester"],"sources":["../../src/mixed/mixedSchema.ts"],"sourcesContent":["import {\n JsonSchema,\n JsonSchema7,\n UISchemaElement,\n Scopable,\n TesterContext,\n isControl,\n resolveSchema,\n rankWith,\n RankedTester,\n} from '@jsonforms/core';\nimport get from 'lodash/get';\nimport { narrowMixedComposition } from './mixedComposition';\nexport type JsonDataType =\n | 'array'\n | 'boolean'\n | 'integer'\n | 'null'\n | 'number'\n | 'object'\n | 'string';\n\nexport const ANY_TYPES: JsonDataType[] = [\n 'array',\n 'boolean',\n 'integer',\n 'null',\n 'number',\n 'object',\n 'string',\n];\n\nconst ARRAY_KEYWORDS = [\n 'items',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n] as const;\nconst OBJECT_KEYWORDS = [\n 'additionalProperties',\n 'dependencies',\n 'dependentRequired',\n 'dependentSchemas',\n 'maxProperties',\n 'minProperties',\n 'patternProperties',\n 'properties',\n 'propertyNames',\n 'required',\n] as const;\nconst STRING_KEYWORDS = [\n 'contentEncoding',\n 'contentMediaType',\n 'format',\n 'maxLength',\n 'minLength',\n 'pattern',\n] as const;\nconst NUMBER_KEYWORDS = [\n 'exclusiveMaximum',\n 'exclusiveMinimum',\n 'maximum',\n 'minimum',\n 'multipleOf',\n] as const;\n\nconst removeKeywords = (schema: JsonSchema7, keywords: readonly string[]) =>\n keywords.forEach(\n (keyword) => delete (schema as Record<string, unknown>)[keyword],\n );\n\nexport const getJsonDataType = (value: any): JsonDataType | null => {\n if (typeof value === 'string') {\n return 'string';\n }\n if (typeof value === 'number') {\n return Number.isInteger(value) ? 'integer' : 'number';\n }\n if (typeof value === 'boolean') {\n return 'boolean';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n if (value === null) {\n return 'null';\n }\n if (typeof value === 'object') {\n return 'object';\n }\n\n return null;\n};\n\nexport const getSchemaTypes = (schema: JsonSchema): JsonDataType[] => {\n if (typeof schema !== 'object') {\n return ANY_TYPES;\n }\n\n if (typeof schema.type === 'string') {\n return [schema.type as JsonDataType];\n }\n\n if (Array.isArray(schema.type)) {\n return schema.type as JsonDataType[];\n }\n\n return ANY_TYPES;\n};\n\nexport function removeInapplicableKeywords(\n nextSchema: JsonSchema7,\n type: JsonDataType,\n) {\n if (type !== 'array') removeKeywords(nextSchema, ARRAY_KEYWORDS);\n if (type !== 'object') removeKeywords(nextSchema, OBJECT_KEYWORDS);\n if (type !== 'string') removeKeywords(nextSchema, STRING_KEYWORDS);\n if (type !== 'integer' && type !== 'number') {\n removeKeywords(nextSchema, NUMBER_KEYWORDS);\n }\n}\n\nexport function resolveMixedArrayItems(\n items: JsonSchema7['items'],\n rootSchema: JsonSchema,\n) {\n return typeof items === 'object' &&\n !Array.isArray(items) &&\n typeof items.$ref === 'string'\n ? (resolveSchema(rootSchema, items.$ref, rootSchema) ?? items)\n : items;\n}\n\nexport const schemaForType = (\n schema: JsonSchema,\n type: JsonDataType,\n rootSchema: JsonSchema,\n): JsonSchema => {\n const narrowed = narrowMixedComposition(schema, type);\n const nextSchema: JsonSchema7 = {\n ...(typeof narrowed === 'object' ? (narrowed as JsonSchema7) : {}),\n ...(narrowed === (false as unknown) ? { not: {} } : {}),\n type: typeof narrowed === 'object' ? (narrowed.type ?? type) : type,\n };\n removeInapplicableKeywords(nextSchema, type);\n if (nextSchema.default !== undefined) {\n const defaultType = getJsonDataType(nextSchema.default);\n const compatibleDefault =\n defaultType === type || (type === 'number' && defaultType === 'integer');\n if (!compatibleDefault) delete nextSchema.default;\n }\n\n if (type === 'object') {\n nextSchema.additionalProperties = nextSchema.additionalProperties ?? true;\n } else if (type === 'array') {\n const items = resolveMixedArrayItems(nextSchema.items, rootSchema);\n nextSchema.items =\n items !== undefined\n ? (items as JsonSchema7 | JsonSchema7[])\n : { type: ANY_TYPES as JsonSchema7['type'] };\n }\n\n return nextSchema;\n};\n\n/**\n * Whether the value at `path` is an element of an array.\n *\n * Read from the data rather than from the schema, because it is the data's\n * shape that decides what unsetting the path will do: core deletes an array\n * element in place and leaves a hole, whatever the schema says the container\n * ought to be.\n */\nexport const isArrayElementPath = (data: unknown, path: string): boolean => {\n if (!path) {\n return false;\n }\n const separator = path.lastIndexOf('.');\n const parent =\n separator < 0 ? data : get(data, path.slice(0, separator).split('.'));\n return Array.isArray(parent);\n};\n\n/**\n * The schema this control actually edits.\n *\n * A tester is handed the schema of the dispatch it sits in, which at the top of\n * a form is the **root** - so a Control scoped at `#/properties/setting` is\n * asked about the whole document, not about `setting`. The specification is\n * explicit that selection is on \"a Control with a **resolved** schema whose\n * type is an array of permitted JSON types\", so the scope is resolved first.\n *\n * Without this, a declared property with a union type never matched: the root\n * carries `properties`, which the checks below reject, and the field fell\n * through to the plain text control. A `[\"string\", \"number\"]` property became a\n * text box, and a number typed into it was stored as a string.\n */\nconst resolveScopedSchema = (\n uischema: UISchemaElement & Scopable,\n schema: JsonSchema,\n context: TesterContext,\n): JsonSchema => {\n const scope = uischema?.scope;\n if (!scope) {\n return schema;\n }\n try {\n return (\n (resolveSchema(schema, scope, context?.rootSchema ?? schema) as\n | JsonSchema\n | undefined) ?? schema\n );\n } catch {\n // An unresolvable scope is not this tester's problem to report.\n return schema;\n }\n};\n\nexport const isMixedSchema = (\n uischema: UISchemaElement & Scopable,\n rawSchema: JsonSchema,\n context: TesterContext,\n) => {\n if (rawSchema && typeof rawSchema === 'boolean') {\n return true;\n }\n\n if (!rawSchema || typeof rawSchema !== 'object') {\n return false;\n }\n\n const schema = resolveScopedSchema(uischema, rawSchema, context);\n\n if (typeof schema === 'boolean') {\n return Boolean(schema);\n }\n\n if (Array.isArray(schema.type)) {\n return schema.type.length > 1;\n }\n\n if (\n schema.allOf ||\n schema.anyOf ||\n schema.oneOf ||\n schema.properties ||\n schema.patternProperties ||\n schema.additionalProperties !== undefined\n ) {\n return false;\n }\n\n // An unconstrained schema: the specification admits it to this renderer, and\n // nothing else would know what editor to offer.\n if (schema.type === undefined && isControl(uischema)) {\n return true;\n }\n\n return false;\n};\n\nexport const isDefaultGeneratedUiSchema = (\n uischema: UISchemaElement,\n): boolean => {\n const elements = (uischema as any)?.elements;\n return (\n (uischema.type === 'VerticalLayout' || uischema.type === 'Group') &&\n Array.isArray(elements) &&\n elements.length === 1 &&\n elements[0].scope === '#' &&\n elements[0].type === 'Control'\n );\n};\n\nexport const mixedControlFor =\n (matchesSchema: typeof isMixedSchema) =>\n (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) =>\n matchesSchema(uischema as UISchemaElement & Scopable, schema, context) &&\n (isControl(uischema) || isDefaultGeneratedUiSchema(uischema));\n\nexport const isMixedControl = mixedControlFor(isMixedSchema);\n\nexport const mixedControlTester: RankedTester = rankWith(20, isMixedControl);\n"],"mappings":"A,+NAsBA,IAAaS,EAA4B,CACvC,QACA,UACA,UACA,OACA,SACA,SACA,QACF,EAEMC,EAAiB,CACrB,QACA,WACA,WACA,aACF,EACMC,EAAkB,CACtB,uBACA,eACA,oBACA,mBACA,gBACA,gBACA,oBACA,aACA,gBACA,UACF,EACMC,EAAkB,CACtB,kBACA,mBACA,SACA,YACA,YACA,SACF,EACMC,EAAkB,CACtB,mBACA,mBACA,UACA,UACA,YACF,EAEMC,GAAkB,EAAqB,IAC3CC,EAAS,QACN,GAAY,OAAQC,EAAmCC,EAC1D,EAEWC,EAAmB,GAC1B,OAAOC,GAAU,SACZ,SAEL,OAAOA,GAAU,SACZ,OAAO,UAAUA,CAAK,EAAI,UAAY,SAE3C,OAAOA,GAAU,UACZ,UAEL,MAAM,QAAQA,CAAK,EACd,QAELA,IAAU,KACL,OAEL,OAAOA,GAAU,SACZ,SAGF,KAGIC,EAAkB,GACzB,OAAOJ,GAAW,SAIlB,OAAOA,EAAO,MAAS,SAClB,CAACA,EAAO,IAAoB,EAGjC,MAAM,QAAQA,EAAO,IAAI,EACpBA,EAAO,KAG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,EAAmC1C,EAAAA,SAAAA,CAAS,GAAIyC,CAAc,E"}
@@ -0,0 +1,22 @@
1
+ import { JsonSchema, JsonSchema7, UISchemaElement, Scopable, TesterContext, RankedTester } from '@jsonforms/core';
2
+ export type JsonDataType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
3
+ export declare const ANY_TYPES: JsonDataType[];
4
+ export declare const getJsonDataType: (value: any) => JsonDataType | null;
5
+ export declare const getSchemaTypes: (schema: JsonSchema) => JsonDataType[];
6
+ export declare function removeInapplicableKeywords(nextSchema: JsonSchema7, type: JsonDataType): void;
7
+ export declare function resolveMixedArrayItems(items: JsonSchema7['items'], rootSchema: JsonSchema): JsonSchema | JsonSchema7[] | undefined;
8
+ export declare const schemaForType: (schema: JsonSchema, type: JsonDataType, rootSchema: JsonSchema) => JsonSchema;
9
+ /**
10
+ * Whether the value at `path` is an element of an array.
11
+ *
12
+ * Read from the data rather than from the schema, because it is the data's
13
+ * shape that decides what unsetting the path will do: core deletes an array
14
+ * element in place and leaves a hole, whatever the schema says the container
15
+ * ought to be.
16
+ */
17
+ export declare const isArrayElementPath: (data: unknown, path: string) => boolean;
18
+ export declare const isMixedSchema: (uischema: UISchemaElement & Scopable, rawSchema: JsonSchema, context: TesterContext) => boolean;
19
+ export declare const isDefaultGeneratedUiSchema: (uischema: UISchemaElement) => boolean;
20
+ export declare const mixedControlFor: (matchesSchema: typeof isMixedSchema) => (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
21
+ export declare const isMixedControl: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
22
+ export declare const mixedControlTester: RankedTester;
@@ -0,0 +1,88 @@
1
+ import { narrowMixedComposition as e } from "./mixedComposition.esm.js";
2
+ import { isControl as t, rankWith as n, resolveSchema as r } from "@jsonforms/core";
3
+ import i from "lodash/get";
4
+ // src/mixed/mixedSchema.ts
5
+ var a = [
6
+ "array",
7
+ "boolean",
8
+ "integer",
9
+ "null",
10
+ "number",
11
+ "object",
12
+ "string"
13
+ ], o = [
14
+ "items",
15
+ "maxItems",
16
+ "minItems",
17
+ "uniqueItems"
18
+ ], s = [
19
+ "additionalProperties",
20
+ "dependencies",
21
+ "dependentRequired",
22
+ "dependentSchemas",
23
+ "maxProperties",
24
+ "minProperties",
25
+ "patternProperties",
26
+ "properties",
27
+ "propertyNames",
28
+ "required"
29
+ ], c = [
30
+ "contentEncoding",
31
+ "contentMediaType",
32
+ "format",
33
+ "maxLength",
34
+ "minLength",
35
+ "pattern"
36
+ ], l = [
37
+ "exclusiveMaximum",
38
+ "exclusiveMinimum",
39
+ "maximum",
40
+ "minimum",
41
+ "multipleOf"
42
+ ], u = (e, t) => t.forEach((t) => delete e[t]), d = (e) => typeof e == "string" ? "string" : typeof e == "number" ? Number.isInteger(e) ? "integer" : "number" : typeof e == "boolean" ? "boolean" : Array.isArray(e) ? "array" : e === null ? "null" : typeof e == "object" ? "object" : null, f = (e) => typeof e == "object" ? typeof e.type == "string" ? [e.type] : Array.isArray(e.type) ? e.type : a : a;
43
+ function p(e, t) {
44
+ t !== "array" && u(e, o), t !== "object" && u(e, s), t !== "string" && u(e, c), t !== "integer" && t !== "number" && u(e, l);
45
+ }
46
+ function m(e, t) {
47
+ return typeof e == "object" && !Array.isArray(e) && typeof e.$ref == "string" ? r(t, e.$ref, t) ?? e : e;
48
+ }
49
+ var h = (t, n, r) => {
50
+ let i = e(t, n), o = {
51
+ ...typeof i == "object" ? i : {},
52
+ ...i === !1 ? { not: {} } : {},
53
+ type: typeof i == "object" ? i.type ?? n : n
54
+ };
55
+ if (p(o, n), o.default !== void 0) {
56
+ let e = d(o.default);
57
+ e === n || n === "number" && e === "integer" || delete o.default;
58
+ }
59
+ if (n === "object") o.additionalProperties = o.additionalProperties ?? !0;
60
+ else if (n === "array") {
61
+ let e = m(o.items, r);
62
+ o.items = e === void 0 ? { type: a } : e;
63
+ }
64
+ return o;
65
+ }, g = (e, t) => {
66
+ if (!t) return !1;
67
+ let n = t.lastIndexOf("."), r = n < 0 ? e : i(e, t.slice(0, n).split("."));
68
+ return Array.isArray(r);
69
+ }, _ = (e, t, n) => {
70
+ let i = e == null ? void 0 : e.scope;
71
+ if (!i) return t;
72
+ try {
73
+ return r(t, i, (n == null ? void 0 : n.rootSchema) ?? t) ?? t;
74
+ } catch {
75
+ return t;
76
+ }
77
+ }, v = (e, n, r) => {
78
+ if (n && typeof n == "boolean") return !0;
79
+ if (!n || typeof n != "object") return !1;
80
+ let i = _(e, n, r);
81
+ return typeof i == "boolean" ? !!i : Array.isArray(i.type) ? i.type.length > 1 : i.allOf || i.anyOf || i.oneOf || i.properties || i.patternProperties || i.additionalProperties !== void 0 ? !1 : !!(i.type === void 0 && t(e));
82
+ }, y = (e) => {
83
+ let t = e == null ? void 0 : e.elements;
84
+ return (e.type === "VerticalLayout" || e.type === "Group") && Array.isArray(t) && t.length === 1 && t[0].scope === "#" && t[0].type === "Control";
85
+ }, b = (e) => (n, r, i) => e(n, r, i) && (t(n) || y(n)), x = b(v), S = n(20, x);
86
+ export { a as ANY_TYPES, d as getJsonDataType, f as getSchemaTypes, g as isArrayElementPath, y as isDefaultGeneratedUiSchema, x as isMixedControl, v as isMixedSchema, b as mixedControlFor, S as mixedControlTester, p as removeInapplicableKeywords, m as resolveMixedArrayItems, h as schemaForType };
87
+
88
+ //# sourceMappingURL=mixedSchema.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedSchema.esm.js","names":["get","ANY_TYPES","ARRAY_KEYWORDS","OBJECT_KEYWORDS","STRING_KEYWORDS","NUMBER_KEYWORDS","removeKeywords","keywords","schema","keyword","getJsonDataType","value","getSchemaTypes","removeInapplicableKeywords","type","nextSchema","resolveMixedArrayItems","items","resolveSchema","rootSchema","schemaForType","narrowed","narrowMixedComposition","defaultType","isArrayElementPath","path","separator","parent","data","resolveScopedSchema","scope","uischema","context","isMixedSchema","rawSchema","isControl","isDefaultGeneratedUiSchema","elements","mixedControlFor","matchesSchema","isMixedControl","mixedControlTester","rankWith"],"sources":["../../src/mixed/mixedSchema.ts"],"sourcesContent":["import {\n JsonSchema,\n JsonSchema7,\n UISchemaElement,\n Scopable,\n TesterContext,\n isControl,\n resolveSchema,\n rankWith,\n RankedTester,\n} from '@jsonforms/core';\nimport get from 'lodash/get';\nimport { narrowMixedComposition } from './mixedComposition';\nexport type JsonDataType =\n | 'array'\n | 'boolean'\n | 'integer'\n | 'null'\n | 'number'\n | 'object'\n | 'string';\n\nexport const ANY_TYPES: JsonDataType[] = [\n 'array',\n 'boolean',\n 'integer',\n 'null',\n 'number',\n 'object',\n 'string',\n];\n\nconst ARRAY_KEYWORDS = [\n 'items',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n] as const;\nconst OBJECT_KEYWORDS = [\n 'additionalProperties',\n 'dependencies',\n 'dependentRequired',\n 'dependentSchemas',\n 'maxProperties',\n 'minProperties',\n 'patternProperties',\n 'properties',\n 'propertyNames',\n 'required',\n] as const;\nconst STRING_KEYWORDS = [\n 'contentEncoding',\n 'contentMediaType',\n 'format',\n 'maxLength',\n 'minLength',\n 'pattern',\n] as const;\nconst NUMBER_KEYWORDS = [\n 'exclusiveMaximum',\n 'exclusiveMinimum',\n 'maximum',\n 'minimum',\n 'multipleOf',\n] as const;\n\nconst removeKeywords = (schema: JsonSchema7, keywords: readonly string[]) =>\n keywords.forEach(\n (keyword) => delete (schema as Record<string, unknown>)[keyword],\n );\n\nexport const getJsonDataType = (value: any): JsonDataType | null => {\n if (typeof value === 'string') {\n return 'string';\n }\n if (typeof value === 'number') {\n return Number.isInteger(value) ? 'integer' : 'number';\n }\n if (typeof value === 'boolean') {\n return 'boolean';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n if (value === null) {\n return 'null';\n }\n if (typeof value === 'object') {\n return 'object';\n }\n\n return null;\n};\n\nexport const getSchemaTypes = (schema: JsonSchema): JsonDataType[] => {\n if (typeof schema !== 'object') {\n return ANY_TYPES;\n }\n\n if (typeof schema.type === 'string') {\n return [schema.type as JsonDataType];\n }\n\n if (Array.isArray(schema.type)) {\n return schema.type as JsonDataType[];\n }\n\n return ANY_TYPES;\n};\n\nexport function removeInapplicableKeywords(\n nextSchema: JsonSchema7,\n type: JsonDataType,\n) {\n if (type !== 'array') removeKeywords(nextSchema, ARRAY_KEYWORDS);\n if (type !== 'object') removeKeywords(nextSchema, OBJECT_KEYWORDS);\n if (type !== 'string') removeKeywords(nextSchema, STRING_KEYWORDS);\n if (type !== 'integer' && type !== 'number') {\n removeKeywords(nextSchema, NUMBER_KEYWORDS);\n }\n}\n\nexport function resolveMixedArrayItems(\n items: JsonSchema7['items'],\n rootSchema: JsonSchema,\n) {\n return typeof items === 'object' &&\n !Array.isArray(items) &&\n typeof items.$ref === 'string'\n ? (resolveSchema(rootSchema, items.$ref, rootSchema) ?? items)\n : items;\n}\n\nexport const schemaForType = (\n schema: JsonSchema,\n type: JsonDataType,\n rootSchema: JsonSchema,\n): JsonSchema => {\n const narrowed = narrowMixedComposition(schema, type);\n const nextSchema: JsonSchema7 = {\n ...(typeof narrowed === 'object' ? (narrowed as JsonSchema7) : {}),\n ...(narrowed === (false as unknown) ? { not: {} } : {}),\n type: typeof narrowed === 'object' ? (narrowed.type ?? type) : type,\n };\n removeInapplicableKeywords(nextSchema, type);\n if (nextSchema.default !== undefined) {\n const defaultType = getJsonDataType(nextSchema.default);\n const compatibleDefault =\n defaultType === type || (type === 'number' && defaultType === 'integer');\n if (!compatibleDefault) delete nextSchema.default;\n }\n\n if (type === 'object') {\n nextSchema.additionalProperties = nextSchema.additionalProperties ?? true;\n } else if (type === 'array') {\n const items = resolveMixedArrayItems(nextSchema.items, rootSchema);\n nextSchema.items =\n items !== undefined\n ? (items as JsonSchema7 | JsonSchema7[])\n : { type: ANY_TYPES as JsonSchema7['type'] };\n }\n\n return nextSchema;\n};\n\n/**\n * Whether the value at `path` is an element of an array.\n *\n * Read from the data rather than from the schema, because it is the data's\n * shape that decides what unsetting the path will do: core deletes an array\n * element in place and leaves a hole, whatever the schema says the container\n * ought to be.\n */\nexport const isArrayElementPath = (data: unknown, path: string): boolean => {\n if (!path) {\n return false;\n }\n const separator = path.lastIndexOf('.');\n const parent =\n separator < 0 ? data : get(data, path.slice(0, separator).split('.'));\n return Array.isArray(parent);\n};\n\n/**\n * The schema this control actually edits.\n *\n * A tester is handed the schema of the dispatch it sits in, which at the top of\n * a form is the **root** - so a Control scoped at `#/properties/setting` is\n * asked about the whole document, not about `setting`. The specification is\n * explicit that selection is on \"a Control with a **resolved** schema whose\n * type is an array of permitted JSON types\", so the scope is resolved first.\n *\n * Without this, a declared property with a union type never matched: the root\n * carries `properties`, which the checks below reject, and the field fell\n * through to the plain text control. A `[\"string\", \"number\"]` property became a\n * text box, and a number typed into it was stored as a string.\n */\nconst resolveScopedSchema = (\n uischema: UISchemaElement & Scopable,\n schema: JsonSchema,\n context: TesterContext,\n): JsonSchema => {\n const scope = uischema?.scope;\n if (!scope) {\n return schema;\n }\n try {\n return (\n (resolveSchema(schema, scope, context?.rootSchema ?? schema) as\n | JsonSchema\n | undefined) ?? schema\n );\n } catch {\n // An unresolvable scope is not this tester's problem to report.\n return schema;\n }\n};\n\nexport const isMixedSchema = (\n uischema: UISchemaElement & Scopable,\n rawSchema: JsonSchema,\n context: TesterContext,\n) => {\n if (rawSchema && typeof rawSchema === 'boolean') {\n return true;\n }\n\n if (!rawSchema || typeof rawSchema !== 'object') {\n return false;\n }\n\n const schema = resolveScopedSchema(uischema, rawSchema, context);\n\n if (typeof schema === 'boolean') {\n return Boolean(schema);\n }\n\n if (Array.isArray(schema.type)) {\n return schema.type.length > 1;\n }\n\n if (\n schema.allOf ||\n schema.anyOf ||\n schema.oneOf ||\n schema.properties ||\n schema.patternProperties ||\n schema.additionalProperties !== undefined\n ) {\n return false;\n }\n\n // An unconstrained schema: the specification admits it to this renderer, and\n // nothing else would know what editor to offer.\n if (schema.type === undefined && isControl(uischema)) {\n return true;\n }\n\n return false;\n};\n\nexport const isDefaultGeneratedUiSchema = (\n uischema: UISchemaElement,\n): boolean => {\n const elements = (uischema as any)?.elements;\n return (\n (uischema.type === 'VerticalLayout' || uischema.type === 'Group') &&\n Array.isArray(elements) &&\n elements.length === 1 &&\n elements[0].scope === '#' &&\n elements[0].type === 'Control'\n );\n};\n\nexport const mixedControlFor =\n (matchesSchema: typeof isMixedSchema) =>\n (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) =>\n matchesSchema(uischema as UISchemaElement & Scopable, schema, context) &&\n (isControl(uischema) || isDefaultGeneratedUiSchema(uischema));\n\nexport const isMixedControl = mixedControlFor(isMixedSchema);\n\nexport const mixedControlTester: RankedTester = rankWith(20, isMixedControl);\n"],"mappings":";;;;AAsBA,IAAaC,IAA4B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAiB;CACrB;CACA;CACA;CACA;AACF,GACMC,IAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACMC,IAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;AACF,GACMC,IAAkB;CACtB;CACA;CACA;CACA;CACA;AACF,GAEMC,KAAkB,GAAqB,MAC3CC,EAAS,SACN,MAAY,OAAQC,EAAmCC,EAC1D,GAEWC,KAAmB,MAC1B,OAAOC,KAAU,WACZ,WAEL,OAAOA,KAAU,WACZ,OAAO,UAAUA,CAAK,IAAI,YAAY,WAE3C,OAAOA,KAAU,YACZ,YAEL,MAAM,QAAQA,CAAK,IACd,UAELA,MAAU,OACL,SAEL,OAAOA,KAAU,WACZ,WAGF,MAGIC,KAAkB,MACzB,OAAOJ,KAAW,WAIlB,OAAOA,EAAO,QAAS,WAClB,CAACA,EAAO,IAAoB,IAGjC,MAAM,QAAQA,EAAO,IAAI,IACpBA,EAAO,OAGTP,IAXEA;AAcX,SAAgBY,EACd,GACA,GACA;CAIA,AAHIC,MAAS,WAASR,EAAeS,GAAYb,CAAc,GAC3DY,MAAS,YAAUR,EAAeS,GAAYZ,CAAe,GAC7D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A,EAAU;CACxB,IAAI,CAACD,GACH,OAAOtB;CAET,IAAI;EACF,OACGU,EAAcV,GAAQsB,IAAAE,KAAA,OAAA,KAAA,IAAOA,EAAS,eAAcxB,CAAM,KAEzCA;CAEtB,QAAQ;EAEN,OAAOA;CACT;AACF,GAEayB,KACX,GACA,GACA,MACG;CACH,IAAIC,KAAa,OAAOA,KAAc,WACpC,OAAO;CAGT,IAAI,CAACA,KAAa,OAAOA,KAAc,UACrC,OAAO;CAGT,IAAM1B,IAASqB,EAAoBE,GAAUG,GAAWF,CAAO;CA2B/D,OAzBI,OAAOxB,KAAW,YACb,EAAQA,IAGb,MAAM,QAAQA,EAAO,IAAI,IACpBA,EAAO,KAAK,SAAS,IAI5BA,EAAO,SACPA,EAAO,SACPA,EAAO,SACPA,EAAO,cACPA,EAAO,qBACPA,EAAO,yBAAyB,KAAA,IAEzB,KAKT,GAAIA,EAAO,SAAS,KAAA,KAAa2B,EAAUJ,CAAQ;AAKrD,GAEaK,KACX,MACY;CACZ,IAAMC,IAAAN,KAAA,OAAA,KAAA,IAAYA,EAAkB;CACpC,QACGA,EAAS,SAAS,oBAAoBA,EAAS,SAAS,YACzD,MAAM,QAAQM,CAAQ,KACtBA,EAAS,WAAW,KACpBA,EAAS,EAAE,CAAC,UAAU,OACtBA,EAAS,EAAE,CAAC,SAAS;AAEzB,GAEaC,KACV,OACA,GAA2B,GAAoB,MAC9CC,EAAcR,GAAwCvB,GAAQwB,CAAO,MACpEG,EAAUJ,CAAQ,KAAKK,EAA2BL,CAAQ,IAElDS,IAAiBF,EAAgBL,CAAa,GAE9CQ,IAAmCC,EAAS,IAAIF,CAAc"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@jsonforms/core");var t=e=>e.length?JSON.stringify(e):`$`,n=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e==`number`?Number.isInteger(e)?`integer`:`number`:e===void 0?null:typeof e,r=(t,n,r)=>{var i;let a=t=>typeof t==`object`&&t.$ref?(0,e.resolveSchema)(r,t.$ref,r)??t:t,o=typeof t==`object`&&t.$ref?(0,e.resolveSchema)(r,t.$ref,r)??t:t;if(typeof o!=`object`)return{dynamic:!1,schema:{}};if(typeof n==`number`){let e=o.items;return{dynamic:!1,schema:a(Array.isArray(e)?e[n]??{}:e??{})}}if((i=o.properties)!=null&&i[n])return{dynamic:!1,schema:a(o.properties[n])};let s=Object.entries(o.patternProperties??{}).filter(([e])=>{try{return new RegExp(e).test(n)}catch{return!1}}).map(([,e])=>a(e));return s.length>1?{dynamic:!0,schema:{allOf:s}}:s.length===1?{dynamic:!0,schema:s[0]}:{dynamic:!0,schema:o.additionalProperties===!1?{}:a(o.additionalProperties??{})}},i=(e,t,a,o=`Value`,s=[],c=!1)=>({children:(Array.isArray(e)?e.map((e,t)=>[t,e]):e&&typeof e==`object`?Object.entries(e):[]).map(([e,n])=>{let o=r(t,e,a);return i(n,o.schema,a,typeof e==`number`?`Item ${e}`:e,[...s,e],o.dynamic)}),data:e,dynamic:c,label:o,path:s,schema:t,type:n(e)}),a=(e,n)=>{if(t(e.path)===t(n))return e;for(let t of e.children){let e=a(t,n);if(e)return e}},o=e=>e.path.length===0&&!e.named?e.type===`array`?`[]`:e.type===`object`?`{}`:e.label:e.label,s=(e,t,n)=>{if(t.length===0)return n(e);let[r,...i]=t;if(Array.isArray(e)&&typeof r==`number`){let t=[...e];return t[r]=s(t[r],i,n),t}if(e&&typeof e==`object`&&typeof r==`string`){let t={...e};return t[r]=s(t[r],i,n),t}return e},c=(e,t)=>{if(t.length===0)return e;let n=t.slice(0,-1),r=t[t.length-1];return s(e,n,e=>Array.isArray(e)&&typeof r==`number`?e.filter((e,t)=>t!==r):e&&typeof e==`object`&&typeof r==`string`?Object.fromEntries(Object.entries(e).filter(([e])=>e!==r)):e)},l=(e,t,n)=>{if(t.length===0)return e;let r=t.slice(0,-1),i=t[t.length-1];return typeof i==`string`?s(e,r,e=>!e||typeof e!=`object`||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e===i?n:e,t]))):e};exports.buildMixedTree=i,exports.deleteMixedTreeNode=c,exports.findMixedTreeNode=a,exports.mixedDataType=n,exports.mixedPathKey=t,exports.mixedTreeLabel=o,exports.renameMixedTreeNode=l;
2
+ //# sourceMappingURL=mixedTree.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedTree.cjs.js","names":["resolveSchema","_jsonforms_core","mixedPathKey","path","mixedDataType","value","childSchema","_resolved$properties","resolveChild","candidate","rootSchema","resolved","schema","key","items","matches","pattern","buildMixedTree","data","index","findMixedTreeNode","node","child","result","mixedTreeLabel","updateMixedParent","parentPath","update","segment","remaining","next","deleteMixedTreeNode","parent","renameMixedTreeNode","nextName"],"sources":["../../src/mixed/mixedTree.ts"],"sourcesContent":["import { JsonSchema, resolveSchema } from '@jsonforms/core';\n\nexport type MixedTreePath = Array<string | number>;\n\nexport interface MixedTreeNode {\n named?: boolean;\n children: MixedTreeNode[];\n data: unknown;\n dynamic: boolean;\n label: string;\n path: MixedTreePath;\n schema: JsonSchema;\n type: string | null;\n}\n\nexport const mixedPathKey = (path: MixedTreePath) =>\n path.length ? JSON.stringify(path) : '$';\n\nexport const mixedDataType = (value: unknown): string | null => {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (typeof value === 'number')\n return Number.isInteger(value) ? 'integer' : 'number';\n return value === undefined ? null : typeof value;\n};\n\nconst childSchema = (\n schema: JsonSchema,\n key: string | number,\n rootSchema: JsonSchema,\n): { dynamic: boolean; schema: JsonSchema } => {\n const resolveChild = (candidate: JsonSchema): JsonSchema =>\n typeof candidate === 'object' && candidate.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n const resolved =\n typeof schema === 'object' && schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n if (typeof resolved !== 'object') return { dynamic: false, schema: {} };\n if (typeof key === 'number') {\n const items = resolved.items;\n return {\n dynamic: false,\n schema: resolveChild(\n Array.isArray(items)\n ? (items[key] ?? {})\n : ((items as JsonSchema | undefined) ?? {}),\n ),\n };\n }\n if (resolved.properties?.[key]) {\n return {\n dynamic: false,\n schema: resolveChild(resolved.properties[key]),\n };\n }\n const matches = Object.entries(resolved.patternProperties ?? {})\n .filter(([pattern]) => {\n try {\n return new RegExp(pattern).test(key);\n } catch {\n return false;\n }\n })\n .map(([, value]) => resolveChild(value));\n if (matches.length > 1) {\n return { dynamic: true, schema: { allOf: matches } as JsonSchema };\n }\n if (matches.length === 1) {\n return { dynamic: true, schema: matches[0] };\n }\n return {\n dynamic: true,\n schema:\n resolved.additionalProperties === false\n ? {}\n : resolveChild(\n (resolved.additionalProperties as JsonSchema | undefined) ?? {},\n ),\n };\n};\n\nexport const buildMixedTree = (\n data: unknown,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n label = 'Value',\n path: MixedTreePath = [],\n dynamic = false,\n): MixedTreeNode => {\n const entries: Array<[string | number, unknown]> = Array.isArray(data)\n ? data.map((value, index) => [index, value])\n : data && typeof data === 'object'\n ? Object.entries(data)\n : [];\n return {\n children: entries.map(([key, value]) => {\n const resolved = childSchema(schema, key, rootSchema);\n return buildMixedTree(\n value,\n resolved.schema,\n rootSchema,\n typeof key === 'number' ? `Item ${key}` : key,\n [...path, key],\n resolved.dynamic,\n );\n }),\n data,\n dynamic,\n label,\n path,\n schema,\n type: mixedDataType(data),\n };\n};\n\nexport const findMixedTreeNode = (\n node: MixedTreeNode,\n path: MixedTreePath,\n): MixedTreeNode | undefined => {\n if (mixedPathKey(node.path) === mixedPathKey(path)) return node;\n for (const child of node.children) {\n const result = findMixedTreeNode(child, path);\n if (result) return result;\n }\n return undefined;\n};\n\nexport const mixedTreeLabel = (node: MixedTreeNode) =>\n node.path.length === 0 && !node.named\n ? node.type === 'array'\n ? '[]'\n : node.type === 'object'\n ? '{}'\n : node.label\n : node.label;\n\nconst updateMixedParent = (\n data: unknown,\n parentPath: MixedTreePath,\n update: (parent: unknown) => unknown,\n): unknown => {\n if (parentPath.length === 0) return update(data);\n const [segment, ...remaining] = parentPath;\n if (Array.isArray(data) && typeof segment === 'number') {\n const next = [...data];\n next[segment] = updateMixedParent(next[segment], remaining, update);\n return next;\n }\n if (data && typeof data === 'object' && typeof segment === 'string') {\n const next = { ...(data as Record<string, unknown>) };\n next[segment] = updateMixedParent(next[segment], remaining, update);\n return next;\n }\n return data;\n};\n\nexport const deleteMixedTreeNode = (\n data: unknown,\n path: MixedTreePath,\n): unknown => {\n if (path.length === 0) return data;\n const parentPath = path.slice(0, -1);\n const segment = path[path.length - 1];\n return updateMixedParent(data, parentPath, (parent) => {\n if (Array.isArray(parent) && typeof segment === 'number') {\n return parent.filter((_, index) => index !== segment);\n }\n if (parent && typeof parent === 'object' && typeof segment === 'string') {\n return Object.fromEntries(\n Object.entries(parent).filter(([key]) => key !== segment),\n );\n }\n return parent;\n });\n};\n\nexport const renameMixedTreeNode = (\n data: unknown,\n path: MixedTreePath,\n nextName: string,\n): unknown => {\n if (path.length === 0) return data;\n const parentPath = path.slice(0, -1);\n const segment = path[path.length - 1];\n if (typeof segment !== 'string') return data;\n return updateMixedParent(data, parentPath, (parent) => {\n if (!parent || typeof parent !== 'object' || Array.isArray(parent)) {\n return parent;\n }\n return Object.fromEntries(\n Object.entries(parent).map(([key, value]) => [\n key === segment ? nextName : key,\n value,\n ]),\n );\n });\n};\n"],"mappings":"A,oGAeA,IAAaE,EAAgB,GAC3BC,EAAK,OAAS,KAAK,UAAUA,CAAI,EAAI,IAE1BC,EAAiB,GACxBC,IAAU,KAAa,OACvB,MAAM,QAAQA,CAAK,EAAU,QAC7B,OAAOA,GAAU,SACZ,OAAO,UAAUA,CAAK,EAAI,UAAY,SACxCA,IAAU,IAAA,GAAY,KAAO,OAAOA,EAGvCC,GACJ,EACA,EACA,IAC6C,C,MAC7C,IAAME,EAAgB,GACpB,OAAOC,GAAc,UAAYA,EAAU,M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9B,IAAMQ,EAAavB,EAAK,MAAM,EAAG,EAAE,EAC7ByB,EAAUzB,EAAKA,EAAK,OAAS,GACnC,OAAOsB,EAAkBP,EAAMQ,EAAa,GACtC,MAAM,QAAQM,CAAM,GAAK,OAAOJ,GAAY,SACvCI,EAAO,QAAQ,EAAG,IAAUb,IAAUS,CAAO,EAElDI,GAAU,OAAOA,GAAW,UAAY,OAAOJ,GAAY,SACtD,OAAO,YACZ,OAAO,QAAQI,CAAM,CAAC,CAAC,QAAQ,CAACnB,KAASA,IAAQe,CAAO,CAC1D,EAEKI,CACR,CACH,EAEaC,GACX,EACA,EACA,IACY,CACZ,GAAI9B,EAAK,SAAW,EAAG,OAAOe,EAC9B,IAAMQ,EAAavB,EAAK,MAAM,EAAG,EAAE,EAC7ByB,EAAUzB,EAAKA,EAAK,OAAS,GAEnC,OADI,OAAOyB,GAAY,SAChBH,EAAkBP,EAAMQ,EAAa,GACtC,CAACM,GAAU,OAAOA,GAAW,UAAY,MAAM,QAAQA,CAAM,EACxDA,EAEF,OAAO,YACZ,OAAO,QAAQA,CAAM,CAAC,CAAC,KAAK,CAACnB,EAAKR,KAAW,CAC3CQ,IAAQe,EAAUM,EAAWrB,EAC7BR,CACF,CAAC,CACH,CACD,EAXuCa,CAY1C,E"}
@@ -0,0 +1,19 @@
1
+ import { JsonSchema } from '@jsonforms/core';
2
+ export type MixedTreePath = Array<string | number>;
3
+ export interface MixedTreeNode {
4
+ named?: boolean;
5
+ children: MixedTreeNode[];
6
+ data: unknown;
7
+ dynamic: boolean;
8
+ label: string;
9
+ path: MixedTreePath;
10
+ schema: JsonSchema;
11
+ type: string | null;
12
+ }
13
+ export declare const mixedPathKey: (path: MixedTreePath) => string;
14
+ export declare const mixedDataType: (value: unknown) => string | null;
15
+ export declare const buildMixedTree: (data: unknown, schema: JsonSchema, rootSchema: JsonSchema, label?: string, path?: MixedTreePath, dynamic?: boolean) => MixedTreeNode;
16
+ export declare const findMixedTreeNode: (node: MixedTreeNode, path: MixedTreePath) => MixedTreeNode | undefined;
17
+ export declare const mixedTreeLabel: (node: MixedTreeNode) => string;
18
+ export declare const deleteMixedTreeNode: (data: unknown, path: MixedTreePath) => unknown;
19
+ export declare const renameMixedTreeNode: (data: unknown, path: MixedTreePath, nextName: string) => unknown;
@@ -0,0 +1,78 @@
1
+ import { resolveSchema as e } from "@jsonforms/core";
2
+ // src/mixed/mixedTree.ts
3
+ var t = (e) => e.length ? JSON.stringify(e) : "$", n = (e) => e === null ? "null" : Array.isArray(e) ? "array" : typeof e == "number" ? Number.isInteger(e) ? "integer" : "number" : e === void 0 ? null : typeof e, r = (t, n, r) => {
4
+ var i;
5
+ let a = (t) => typeof t == "object" && t.$ref ? e(r, t.$ref, r) ?? t : t, o = typeof t == "object" && t.$ref ? e(r, t.$ref, r) ?? t : t;
6
+ if (typeof o != "object") return {
7
+ dynamic: !1,
8
+ schema: {}
9
+ };
10
+ if (typeof n == "number") {
11
+ let e = o.items;
12
+ return {
13
+ dynamic: !1,
14
+ schema: a(Array.isArray(e) ? e[n] ?? {} : e ?? {})
15
+ };
16
+ }
17
+ if ((i = o.properties) != null && i[n]) return {
18
+ dynamic: !1,
19
+ schema: a(o.properties[n])
20
+ };
21
+ let s = Object.entries(o.patternProperties ?? {}).filter(([e]) => {
22
+ try {
23
+ return new RegExp(e).test(n);
24
+ } catch {
25
+ return !1;
26
+ }
27
+ }).map(([, e]) => a(e));
28
+ return s.length > 1 ? {
29
+ dynamic: !0,
30
+ schema: { allOf: s }
31
+ } : s.length === 1 ? {
32
+ dynamic: !0,
33
+ schema: s[0]
34
+ } : {
35
+ dynamic: !0,
36
+ schema: o.additionalProperties === !1 ? {} : a(o.additionalProperties ?? {})
37
+ };
38
+ }, i = (e, t, a, o = "Value", s = [], c = !1) => ({
39
+ children: (Array.isArray(e) ? e.map((e, t) => [t, e]) : e && typeof e == "object" ? Object.entries(e) : []).map(([e, n]) => {
40
+ let o = r(t, e, a);
41
+ return i(n, o.schema, a, typeof e == "number" ? `Item ${e}` : e, [...s, e], o.dynamic);
42
+ }),
43
+ data: e,
44
+ dynamic: c,
45
+ label: o,
46
+ path: s,
47
+ schema: t,
48
+ type: n(e)
49
+ }), a = (e, n) => {
50
+ if (t(e.path) === t(n)) return e;
51
+ for (let t of e.children) {
52
+ let e = a(t, n);
53
+ if (e) return e;
54
+ }
55
+ }, o = (e) => e.path.length === 0 && !e.named ? e.type === "array" ? "[]" : e.type === "object" ? "{}" : e.label : e.label, s = (e, t, n) => {
56
+ if (t.length === 0) return n(e);
57
+ let [r, ...i] = t;
58
+ if (Array.isArray(e) && typeof r == "number") {
59
+ let t = [...e];
60
+ return t[r] = s(t[r], i, n), t;
61
+ }
62
+ if (e && typeof e == "object" && typeof r == "string") {
63
+ let t = { ...e };
64
+ return t[r] = s(t[r], i, n), t;
65
+ }
66
+ return e;
67
+ }, c = (e, t) => {
68
+ if (t.length === 0) return e;
69
+ let n = t.slice(0, -1), r = t[t.length - 1];
70
+ return s(e, n, (e) => Array.isArray(e) && typeof r == "number" ? e.filter((e, t) => t !== r) : e && typeof e == "object" && typeof r == "string" ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== r)) : e);
71
+ }, l = (e, t, n) => {
72
+ if (t.length === 0) return e;
73
+ let r = t.slice(0, -1), i = t[t.length - 1];
74
+ return typeof i == "string" ? s(e, r, (e) => !e || typeof e != "object" || Array.isArray(e) ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e === i ? n : e, t]))) : e;
75
+ };
76
+ export { i as buildMixedTree, c as deleteMixedTreeNode, a as findMixedTreeNode, n as mixedDataType, t as mixedPathKey, o as mixedTreeLabel, l as renameMixedTreeNode };
77
+
78
+ //# sourceMappingURL=mixedTree.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedTree.esm.js","names":["mixedPathKey","path","mixedDataType","value","childSchema","_resolved$properties","resolveChild","candidate","resolveSchema","rootSchema","resolved","schema","key","items","matches","pattern","buildMixedTree","data","index","findMixedTreeNode","node","child","result","mixedTreeLabel","updateMixedParent","parentPath","update","segment","remaining","next","deleteMixedTreeNode","parent","renameMixedTreeNode","nextName"],"sources":["../../src/mixed/mixedTree.ts"],"sourcesContent":["import { JsonSchema, resolveSchema } from '@jsonforms/core';\n\nexport type MixedTreePath = Array<string | number>;\n\nexport interface MixedTreeNode {\n named?: boolean;\n children: MixedTreeNode[];\n data: unknown;\n dynamic: boolean;\n label: string;\n path: MixedTreePath;\n schema: JsonSchema;\n type: string | null;\n}\n\nexport const mixedPathKey = (path: MixedTreePath) =>\n path.length ? JSON.stringify(path) : '$';\n\nexport const mixedDataType = (value: unknown): string | null => {\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'array';\n if (typeof value === 'number')\n return Number.isInteger(value) ? 'integer' : 'number';\n return value === undefined ? null : typeof value;\n};\n\nconst childSchema = (\n schema: JsonSchema,\n key: string | number,\n rootSchema: JsonSchema,\n): { dynamic: boolean; schema: JsonSchema } => {\n const resolveChild = (candidate: JsonSchema): JsonSchema =>\n typeof candidate === 'object' && candidate.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n const resolved =\n typeof schema === 'object' && schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n if (typeof resolved !== 'object') return { dynamic: false, schema: {} };\n if (typeof key === 'number') {\n const items = resolved.items;\n return {\n dynamic: false,\n schema: resolveChild(\n Array.isArray(items)\n ? (items[key] ?? {})\n : ((items as JsonSchema | undefined) ?? {}),\n ),\n };\n }\n if (resolved.properties?.[key]) {\n return {\n dynamic: false,\n schema: resolveChild(resolved.properties[key]),\n };\n }\n const matches = Object.entries(resolved.patternProperties ?? {})\n .filter(([pattern]) => {\n try {\n return new RegExp(pattern).test(key);\n } catch {\n return false;\n }\n })\n .map(([, value]) => resolveChild(value));\n if (matches.length > 1) {\n return { dynamic: true, schema: { allOf: matches } as JsonSchema };\n }\n if (matches.length === 1) {\n return { dynamic: true, schema: matches[0] };\n }\n return {\n dynamic: true,\n schema:\n resolved.additionalProperties === false\n ? {}\n : resolveChild(\n (resolved.additionalProperties as JsonSchema | undefined) ?? {},\n ),\n };\n};\n\nexport const buildMixedTree = (\n data: unknown,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n label = 'Value',\n path: MixedTreePath = [],\n dynamic = false,\n): MixedTreeNode => {\n const entries: Array<[string | number, unknown]> = Array.isArray(data)\n ? data.map((value, index) => [index, value])\n : data && typeof data === 'object'\n ? Object.entries(data)\n : [];\n return {\n children: entries.map(([key, value]) => {\n const resolved = childSchema(schema, key, rootSchema);\n return buildMixedTree(\n value,\n resolved.schema,\n rootSchema,\n typeof key === 'number' ? `Item ${key}` : key,\n [...path, key],\n resolved.dynamic,\n );\n }),\n data,\n dynamic,\n label,\n path,\n schema,\n type: mixedDataType(data),\n };\n};\n\nexport const findMixedTreeNode = (\n node: MixedTreeNode,\n path: MixedTreePath,\n): MixedTreeNode | undefined => {\n if (mixedPathKey(node.path) === mixedPathKey(path)) return node;\n for (const child of node.children) {\n const result = findMixedTreeNode(child, path);\n if (result) return result;\n }\n return undefined;\n};\n\nexport const mixedTreeLabel = (node: MixedTreeNode) =>\n node.path.length === 0 && !node.named\n ? node.type === 'array'\n ? '[]'\n : node.type === 'object'\n ? '{}'\n : node.label\n : node.label;\n\nconst updateMixedParent = (\n data: unknown,\n parentPath: MixedTreePath,\n update: (parent: unknown) => unknown,\n): unknown => {\n if (parentPath.length === 0) return update(data);\n const [segment, ...remaining] = parentPath;\n if (Array.isArray(data) && typeof segment === 'number') {\n const next = [...data];\n next[segment] = updateMixedParent(next[segment], remaining, update);\n return next;\n }\n if (data && typeof data === 'object' && typeof segment === 'string') {\n const next = { ...(data as Record<string, unknown>) };\n next[segment] = updateMixedParent(next[segment], remaining, update);\n return next;\n }\n return data;\n};\n\nexport const deleteMixedTreeNode = (\n data: unknown,\n path: MixedTreePath,\n): unknown => {\n if (path.length === 0) return data;\n const parentPath = path.slice(0, -1);\n const segment = path[path.length - 1];\n return updateMixedParent(data, parentPath, (parent) => {\n if (Array.isArray(parent) && typeof segment === 'number') {\n return parent.filter((_, index) => index !== segment);\n }\n if (parent && typeof parent === 'object' && typeof segment === 'string') {\n return Object.fromEntries(\n Object.entries(parent).filter(([key]) => key !== segment),\n );\n }\n return parent;\n });\n};\n\nexport const renameMixedTreeNode = (\n data: unknown,\n path: MixedTreePath,\n nextName: string,\n): unknown => {\n if (path.length === 0) return data;\n const parentPath = path.slice(0, -1);\n const segment = path[path.length - 1];\n if (typeof segment !== 'string') return data;\n return updateMixedParent(data, parentPath, (parent) => {\n if (!parent || typeof parent !== 'object' || Array.isArray(parent)) {\n return parent;\n }\n return Object.fromEntries(\n Object.entries(parent).map(([key, value]) => [\n key === segment ? nextName : key,\n value,\n ]),\n );\n });\n};\n"],"mappings":";;AAeA,IAAaA,KAAgB,MAC3BC,EAAK,SAAS,KAAK,UAAUA,CAAI,IAAI,KAE1BC,KAAiB,MACxBC,MAAU,OAAa,SACvB,MAAM,QAAQA,CAAK,IAAU,UAC7B,OAAOA,KAAU,WACZ,OAAO,UAAUA,CAAK,IAAI,YAAY,WACxCA,MAAU,KAAA,IAAY,OAAO,OAAOA,GAGvCC,KACJ,GACA,GACA,MAC6C;;CAC7C,IAAME,KAAgB,MACpB,OAAOC,KAAc,YAAYA,EAAU,OACtCC,EAAcC,GAAYF,EAAU,MAAME,CAAU,KAAKF,IAC1DA,GACAG,IACJ,OAAOC,KAAW,YAAYA,EAAO,OAChCH,EAAcC,GAAYE,EAAO,MAAMF,CAAU,KAAKE,IACvDA;CACN,IAAI,OAAOD,KAAa,UAAU,OAAO;EAAE,SAAS;EAAO,QAAQ,CAAC;CAAE;CACtE,IAAI,OAAOE,KAAQ,UAAU;EAC3B,IAAMC,IAAQH,EAAS;EACvB,OAAO;GACL,SAAS;GACT,QAAQJ,EACN,MAAM,QAAQO,CAAK,IACdA,EAAMD,MAAQ,CAAC,IACdC,KAAoC,CAAC,CAC7C;EACF;C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MQ,IAAaxB,EAAK,MAAM,GAAG,EAAE,GAC7B0B,IAAU1B,EAAKA,EAAK,SAAS;CAEnC,OADI,OAAO0B,KAAY,WAChBH,EAAkBP,GAAMQ,IAAa,MACtC,CAACM,KAAU,OAAOA,KAAW,YAAY,MAAM,QAAQA,CAAM,IACxDA,IAEF,OAAO,YACZ,OAAO,QAAQA,CAAM,CAAC,CAAC,KAAK,CAACnB,GAAKT,OAAW,CAC3CS,MAAQe,IAAUM,IAAWrB,GAC7BT,CACF,CAAC,CACH,CACD,IAXuCc;AAY1C"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./mixedSchema.cjs.js"),t=require("./mixedTree.cjs.js");var n=(e,n)=>e?t.findMixedTreeNode(e,n.path.slice(0,-1)):void 0,r=(t,r,i,a,o,s)=>{var c;if(!a||o||r.path.length===0)return!1;let l=n(t,r);if(!l)return!1;if(!s)return!0;let u=e.ANY_TYPES.includes(l.type)?e.schemaForType(l.schema,l.type,i):l.schema;if(Array.isArray(l.data))return u.minItems===void 0||l.data.length>u.minItems;let d=r.path[r.path.length-1];return!l.data||typeof l.data!=`object`||typeof d!=`string`||(c=u.required)!=null&&c.includes(d)?!1:u.minProperties===void 0||Object.keys(l.data).length>u.minProperties},i=(e,t,n)=>!!(t&&!n&&e.dynamic&&typeof e.path[e.path.length-1]==`string`);exports.canDeleteMixedTreeNode=r,exports.canRenameMixedTreeNode=i,exports.mixedParentNode=n;
2
+ //# sourceMappingURL=mixedTreeActions.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedTreeActions.cjs.js","names":["findMixedTreeNode","ANY_TYPES","schemaForType","require_mixed_mixedSchema","require_mixed_mixedTree","mixedParentNode","tree","node","canDeleteMixedTreeNode","_parentSchema$require","enabled","readonly","parent","restrict","parentSchema","rootSchema","key","canRenameMixedTreeNode"],"sources":["../../src/mixed/mixedTreeActions.ts"],"sourcesContent":["import type { JsonSchema, JsonSchema7 } from '@jsonforms/core';\nimport { ANY_TYPES, schemaForType, type JsonDataType } from './mixedSchema';\nimport { findMixedTreeNode, type MixedTreeNode } from './mixedTree';\n\nexport const mixedParentNode = (\n tree: MixedTreeNode | undefined,\n node: MixedTreeNode,\n) => (tree ? findMixedTreeNode(tree, node.path.slice(0, -1)) : undefined);\n\n/** Respect collection bounds, required properties and renderer permissions. */\nexport const canDeleteMixedTreeNode = (\n tree: MixedTreeNode | undefined,\n node: MixedTreeNode,\n rootSchema: JsonSchema,\n enabled: boolean,\n readonly: boolean | undefined,\n restrict: boolean,\n) => {\n if (!enabled || readonly || node.path.length === 0) return false;\n const parent = mixedParentNode(tree, node);\n if (!parent) return false;\n if (!restrict) return true;\n const parentSchema = ANY_TYPES.includes(parent.type as JsonDataType)\n ? (schemaForType(\n parent.schema,\n parent.type as JsonDataType,\n rootSchema,\n ) as JsonSchema7)\n : (parent.schema as JsonSchema7);\n if (Array.isArray(parent.data)) {\n return (\n parentSchema.minItems === undefined ||\n parent.data.length > parentSchema.minItems\n );\n }\n const key = node.path[node.path.length - 1];\n if (\n !parent.data ||\n typeof parent.data !== 'object' ||\n typeof key !== 'string'\n )\n return false;\n if (parentSchema.required?.includes(key)) return false;\n return (\n parentSchema.minProperties === undefined ||\n Object.keys(parent.data).length > parentSchema.minProperties\n );\n};\n\nexport const canRenameMixedTreeNode = (\n node: MixedTreeNode,\n enabled: boolean,\n readonly: boolean | undefined,\n) =>\n Boolean(\n enabled &&\n !readonly &&\n node.dynamic &&\n typeof node.path[node.path.length - 1] === 'string',\n );\n"],"mappings":"A,2IAIA,IAAaK,GACX,EACA,IACIC,EAAON,EAAAA,kBAAkBM,EAAMC,EAAK,KAAK,MAAM,EAAG,EAAE,CAAC,EAAI,IAAA,GAGlDC,GACX,EACA,EACA,EACA,EACA,EACA,IACG,C,MACH,GAAI,CAACE,GAAWC,GAAYJ,EAAK,KAAK,SAAW,EAAG,MAAO,GAC3D,IAAMK,EAASP,EAAgBC,EAAMC,CAAI,EACzC,GAAI,CAACK,EAAQ,MAAO,GACpB,GAAI,CAACC,EAAU,MAAO,GACtB,IAAMC,EAAeb,EAAAA,UAAU,SAASW,EAAO,IAAoB,EAC9DV,EAAAA,cACCU,EAAO,OACPA,EAAO,KACPG,CACF,EACCH,EAAO,OACZ,GAAI,MAAM,QAAQA,EAAO,IAAI,EAC3B,OACEE,EAAa,WAAa,IAAA,IAC1BF,EAAO,KAAK,OAASE,EAAa,SAGtC,IAAME,EAAMT,EAAK,KAAKA,EAAK,KAAK,OAAS,GAQzC,MANE,CAACK,EAAO,MACR,OAAOA,EAAO,MAAS,UACvB,OAAOI,GAAQ,WAGjB,EAAIF,EAAa,WAAA,MAAAL,EAAU,SAASO,CAAG,EAAU,GAE/CF,EAAa,gBAAkB,IAAA,IAC/B,OAAO,KAAKF,EAAO,IAAI,CAAC,CAAC,OAASE,EAAa,aAEnD,EAEaG,GACX,EACA,EACA,IAEA,GACEP,GACA,CAACC,GACDJ,EAAK,SACL,OAAOA,EAAK,KAAKA,EAAK,KAAK,OAAS,IAAO,U"}
@@ -0,0 +1,6 @@
1
+ import type { JsonSchema } from '@jsonforms/core';
2
+ import { type MixedTreeNode } from './mixedTree';
3
+ export declare const mixedParentNode: (tree: MixedTreeNode | undefined, node: MixedTreeNode) => MixedTreeNode | undefined;
4
+ /** Respect collection bounds, required properties and renderer permissions. */
5
+ export declare const canDeleteMixedTreeNode: (tree: MixedTreeNode | undefined, node: MixedTreeNode, rootSchema: JsonSchema, enabled: boolean, readonly: boolean | undefined, restrict: boolean) => boolean;
6
+ export declare const canRenameMixedTreeNode: (node: MixedTreeNode, enabled: boolean, readonly: boolean | undefined) => boolean;
@@ -0,0 +1,17 @@
1
+ import { ANY_TYPES as e, schemaForType as t } from "./mixedSchema.esm.js";
2
+ import { findMixedTreeNode as n } from "./mixedTree.esm.js";
3
+ // src/mixed/mixedTreeActions.ts
4
+ var r = (e, t) => e ? n(e, t.path.slice(0, -1)) : void 0, i = (n, i, a, o, s, c) => {
5
+ var l;
6
+ if (!o || s || i.path.length === 0) return !1;
7
+ let u = r(n, i);
8
+ if (!u) return !1;
9
+ if (!c) return !0;
10
+ let d = e.includes(u.type) ? t(u.schema, u.type, a) : u.schema;
11
+ if (Array.isArray(u.data)) return d.minItems === void 0 || u.data.length > d.minItems;
12
+ let f = i.path[i.path.length - 1];
13
+ return !u.data || typeof u.data != "object" || typeof f != "string" || (l = d.required) != null && l.includes(f) ? !1 : d.minProperties === void 0 || Object.keys(u.data).length > d.minProperties;
14
+ }, a = (e, t, n) => !!(t && !n && e.dynamic && typeof e.path[e.path.length - 1] == "string");
15
+ export { i as canDeleteMixedTreeNode, a as canRenameMixedTreeNode, r as mixedParentNode };
16
+
17
+ //# sourceMappingURL=mixedTreeActions.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixedTreeActions.esm.js","names":["mixedParentNode","tree","findMixedTreeNode","node","canDeleteMixedTreeNode","_parentSchema$require","enabled","readonly","parent","restrict","parentSchema","ANY_TYPES","schemaForType","rootSchema","key","canRenameMixedTreeNode"],"sources":["../../src/mixed/mixedTreeActions.ts"],"sourcesContent":["import type { JsonSchema, JsonSchema7 } from '@jsonforms/core';\nimport { ANY_TYPES, schemaForType, type JsonDataType } from './mixedSchema';\nimport { findMixedTreeNode, type MixedTreeNode } from './mixedTree';\n\nexport const mixedParentNode = (\n tree: MixedTreeNode | undefined,\n node: MixedTreeNode,\n) => (tree ? findMixedTreeNode(tree, node.path.slice(0, -1)) : undefined);\n\n/** Respect collection bounds, required properties and renderer permissions. */\nexport const canDeleteMixedTreeNode = (\n tree: MixedTreeNode | undefined,\n node: MixedTreeNode,\n rootSchema: JsonSchema,\n enabled: boolean,\n readonly: boolean | undefined,\n restrict: boolean,\n) => {\n if (!enabled || readonly || node.path.length === 0) return false;\n const parent = mixedParentNode(tree, node);\n if (!parent) return false;\n if (!restrict) return true;\n const parentSchema = ANY_TYPES.includes(parent.type as JsonDataType)\n ? (schemaForType(\n parent.schema,\n parent.type as JsonDataType,\n rootSchema,\n ) as JsonSchema7)\n : (parent.schema as JsonSchema7);\n if (Array.isArray(parent.data)) {\n return (\n parentSchema.minItems === undefined ||\n parent.data.length > parentSchema.minItems\n );\n }\n const key = node.path[node.path.length - 1];\n if (\n !parent.data ||\n typeof parent.data !== 'object' ||\n typeof key !== 'string'\n )\n return false;\n if (parentSchema.required?.includes(key)) return false;\n return (\n parentSchema.minProperties === undefined ||\n Object.keys(parent.data).length > parentSchema.minProperties\n );\n};\n\nexport const canRenameMixedTreeNode = (\n node: MixedTreeNode,\n enabled: boolean,\n readonly: boolean | undefined,\n) =>\n Boolean(\n enabled &&\n !readonly &&\n node.dynamic &&\n typeof node.path[node.path.length - 1] === 'string',\n );\n"],"mappings":";;;AAIA,IAAaA,KACX,GACA,MACIC,IAAOC,EAAkBD,GAAME,EAAK,KAAK,MAAM,GAAG,EAAE,CAAC,IAAI,KAAA,GAGlDC,KACX,GACA,GACA,GACA,GACA,GACA,MACG;;CACH,IAAI,CAACE,KAAWC,KAAYJ,EAAK,KAAK,WAAW,GAAG,OAAO;CAC3D,IAAMK,IAASR,EAAgBC,GAAME,CAAI;CACzC,IAAI,CAACK,GAAQ,OAAO;CACpB,IAAI,CAACC,GAAU,OAAO;CACtB,IAAMC,IAAeC,EAAU,SAASH,EAAO,IAAoB,IAC9DI,EACCJ,EAAO,QACPA,EAAO,MACPK,CACF,IACCL,EAAO;CACZ,IAAI,MAAM,QAAQA,EAAO,IAAI,GAC3B,OACEE,EAAa,aAAa,KAAA,KAC1BF,EAAO,KAAK,SAASE,EAAa;CAGtC,IAAMI,IAAMX,EAAK,KAAKA,EAAK,KAAK,SAAS;CAQzC,OANE,CAACK,EAAO,QACR,OAAOA,EAAO,QAAS,YACvB,OAAOM,KAAQ,aAGjB,IAAIJ,EAAa,aAAA,QAAAL,EAAU,SAASS,CAAG,IAAU,KAE/CJ,EAAa,kBAAkB,KAAA,KAC/B,OAAO,KAAKF,EAAO,IAAI,CAAC,CAAC,SAASE,EAAa;AAEnD,GAEaK,KACX,GACA,GACA,MAEA,GACET,KACA,CAACC,KACDJ,EAAK,WACL,OAAOA,EAAK,KAAKA,EAAK,KAAK,SAAS,MAAO"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../composition/discriminatorBranch.cjs.js"),t=require("./mixedTree.cjs.js");let n=require("@jsonforms/core");var r=(e,t,i,a,s,c,l=[])=>{var u;let d=t.$ref?(0,n.resolveSchema)(i,t.$ref,i)??t:t,f=(u=o(t,i,e).properties)==null?void 0:u[a],p=f!=null&&f.$ref?(0,n.resolveSchema)(i,f.$ref,i):f,m=Array.isArray(e==null?void 0:e[a])?e[a]:[],h=e==null?void 0:e[s];return{label:typeof h==`string`&&h.trim()?h:c,named:!0,path:l,data:e,schema:d,type:`object`,dynamic:!1,children:m.map((e,t)=>{let n=p==null?void 0:p.items;return r(e,(Array.isArray(n)?n[t]:n)||d,i,a,s,String(t+1),[...l,a,t])})}},i=(e,n,r)=>{let i=e=>e.data===n.data?e:e.children.map(i).find(Boolean),o=i(e);if(o)return o;let s=a(r,n.path),c=a(e,n.path);return n.path.length&&c.children.length<s.children.length?c:t.findMixedTreeNode(e,n.path)??a(e,n.path)},a=(e,n)=>{for(let r=n.length-2;r>=0;r-=2){let i=t.findMixedTreeNode(e,n.slice(0,r));if(i)return i}return e},o=(t,r,i)=>{let a=t.$ref?(0,n.resolveSchema)(r,t.$ref,r)??t:t,o=a;for(let t of[`oneOf`,`anyOf`]){let s=e.discriminatorBranch(a,r,t,i);if(s!==void 0){let e=a[t][s];o=e.$ref?(0,n.resolveSchema)(r,e.$ref,r)??e:e}}return o};exports.buildRecursiveTree=r,exports.recursiveNodeSchema=o,exports.recursiveTreeParent=a,exports.recursiveTreeSelection=i;
2
+ //# sourceMappingURL=recursiveTree.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recursiveTree.cjs.js","names":["resolveSchema","findMixedTreeNode","discriminatorBranch","require_composition_discriminatorBranch","require_mixed_mixedTree","_jsonforms_core","buildRecursiveTree","_branch$properties","resolved","schema","rootSchema","collection","recursiveNodeSchema","data","childrenProperty","arraySchema","children","name","labelProperty","fallback","items","child","index","path","recursiveTreeSelection","identity","node","previous","retained","tree","oldParent","recursiveTreeParent","previousTree","parent","length","branch","keyword","candidate"],"sources":["../../src/mixed/recursiveTree.ts"],"sourcesContent":["import { JsonSchema, resolveSchema } from '@jsonforms/core';\nimport { discriminatorBranch } from '../composition/discriminatorBranch';\nimport { MixedTreeNode, MixedTreePath, findMixedTreeNode } from './mixedTree';\n\n/** Project a recursive collection onto domain nodes, without expanding schemas. */\nexport const buildRecursiveTree = (\n data: any,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n childrenProperty: string,\n labelProperty: string,\n fallback: string,\n path: MixedTreePath = [],\n): MixedTreeNode => {\n const resolved = schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n const branch = recursiveNodeSchema(schema, rootSchema, data);\n const collection = branch.properties?.[childrenProperty];\n const arraySchema = collection?.$ref\n ? resolveSchema(rootSchema, collection.$ref, rootSchema)\n : collection;\n const children = Array.isArray(data?.[childrenProperty])\n ? data[childrenProperty]\n : [];\n const name = data?.[labelProperty];\n return {\n label: typeof name === 'string' && name.trim() ? name : fallback,\n named: true,\n path,\n data,\n schema: resolved,\n type: 'object',\n dynamic: false,\n children: children.map((child: unknown, index: number) => {\n const items = arraySchema?.items;\n const childSchema = Array.isArray(items) ? items[index] : items;\n return buildRecursiveTree(\n child,\n (childSchema || resolved) as JsonSchema,\n rootSchema,\n childrenProperty,\n labelProperty,\n String(index + 1),\n [...path, childrenProperty, index],\n );\n }),\n };\n};\n\n/** After removal, choose the closest remaining ancestor rather than a sibling\n * that happens to occupy the removed item's index. */\nexport const recursiveTreeSelection = (\n tree: MixedTreeNode,\n previous: MixedTreeNode,\n previousTree: MixedTreeNode,\n): MixedTreeNode => {\n const identity = (node: MixedTreeNode): MixedTreeNode | undefined =>\n node.data === previous.data\n ? node\n : node.children.map(identity).find(Boolean);\n const retained = identity(tree);\n if (retained) return retained;\n const oldParent = recursiveTreeParent(previousTree, previous.path);\n const parent = recursiveTreeParent(tree, previous.path);\n if (\n previous.path.length &&\n parent.children.length < oldParent.children.length\n )\n return parent;\n const current = findMixedTreeNode(tree, previous.path);\n // Immutable field edits replace a node, but leave its containing list length intact.\n return current ?? recursiveTreeParent(tree, previous.path);\n};\nexport const recursiveTreeParent = (\n tree: MixedTreeNode,\n path: MixedTreePath,\n): MixedTreeNode => {\n for (let length = path.length - 2; length >= 0; length -= 2) {\n const parent = findMixedTreeNode(tree, path.slice(0, length));\n if (parent) return parent;\n }\n return tree;\n};\n\nexport const recursiveNodeSchema = (\n schema: JsonSchema,\n rootSchema: JsonSchema,\n data: unknown,\n): JsonSchema => {\n const resolved = schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n let branch = resolved;\n for (const keyword of ['oneOf', 'anyOf'] as const) {\n const index = discriminatorBranch(resolved, rootSchema, keyword, data);\n if (index !== undefined) {\n const candidate = resolved[keyword]![index];\n branch = candidate.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n }\n }\n return branch;\n};\n"],"mappings":"A,iMAKA,IAAaM,GACX,EACA,EACA,EACA,EACA,EACA,EACA,EAAsB,CAAC,IACL,C,MAClB,IAAME,EAAWC,EAAO,MAAA,EACnBT,EAAAA,cAAAA,CAAcU,EAAYD,EAAO,KAAMC,CAAU,GAAKD,EACvDA,EAEEE,GAAA,EADSC,EAAoBH,EAAQC,EAAYG,CACpC,CAAA,CAAO,aAAA,KAAA,IAAA,GAAAN,EAAaO,GACjCC,EAAAJ,GAAA,MAAcA,EAAY,MAAA,EAC5BX,EAAAA,cAAAA,CAAcU,EAAYC,EAAW,KAAMD,CAAU,EACrDC,EACEK,EAAW,MAAM,QAAAH,GAAA,KAA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A,cAAAA,CAAcU,EAAYD,EAAO,KAAMC,CAAU,GAAKD,EACvDA,EACA0B,EAAS3B,EACb,IAAK,IAAM4B,IAAW,CAAC,QAAS,OAAO,EAAY,CACjD,IAAMd,EAAQpB,EAAAA,oBAAoBM,EAAUE,EAAY0B,EAASvB,CAAI,EACrE,GAAIS,IAAU,IAAA,GAAW,CACvB,IAAMe,EAAY7B,EAAS4B,EAAQ,CAAEd,GACrC,EAASe,EAAU,MAAA,EACdrC,EAAAA,cAAAA,CAAcU,EAAY2B,EAAU,KAAM3B,CAAU,GAAK2B,EAC1DA,CACN,CACF,CACA,OAAOF,CACT,E"}
@@ -0,0 +1,9 @@
1
+ import { JsonSchema } from '@jsonforms/core';
2
+ import { MixedTreeNode, MixedTreePath } from './mixedTree';
3
+ /** Project a recursive collection onto domain nodes, without expanding schemas. */
4
+ export declare const buildRecursiveTree: (data: any, schema: JsonSchema, rootSchema: JsonSchema, childrenProperty: string, labelProperty: string, fallback: string, path?: MixedTreePath) => MixedTreeNode;
5
+ /** After removal, choose the closest remaining ancestor rather than a sibling
6
+ * that happens to occupy the removed item's index. */
7
+ export declare const recursiveTreeSelection: (tree: MixedTreeNode, previous: MixedTreeNode, previousTree: MixedTreeNode) => MixedTreeNode;
8
+ export declare const recursiveTreeParent: (tree: MixedTreeNode, path: MixedTreePath) => MixedTreeNode;
9
+ export declare const recursiveNodeSchema: (schema: JsonSchema, rootSchema: JsonSchema, data: unknown) => JsonSchema;
@@ -0,0 +1,49 @@
1
+ import { discriminatorBranch as e } from "../composition/discriminatorBranch.esm.js";
2
+ import { findMixedTreeNode as t } from "./mixedTree.esm.js";
3
+ import { resolveSchema as n } from "@jsonforms/core";
4
+ // src/mixed/recursiveTree.ts
5
+ var r = (e, t, i, a, s, c, l = []) => {
6
+ var u;
7
+ let d = t.$ref ? n(i, t.$ref, i) ?? t : t, f = (u = o(t, i, e).properties) == null ? void 0 : u[a], p = f != null && f.$ref ? n(i, f.$ref, i) : f, m = Array.isArray(e == null ? void 0 : e[a]) ? e[a] : [], h = e == null ? void 0 : e[s];
8
+ return {
9
+ label: typeof h == "string" && h.trim() ? h : c,
10
+ named: !0,
11
+ path: l,
12
+ data: e,
13
+ schema: d,
14
+ type: "object",
15
+ dynamic: !1,
16
+ children: m.map((e, t) => {
17
+ let n = p == null ? void 0 : p.items;
18
+ return r(e, (Array.isArray(n) ? n[t] : n) || d, i, a, s, String(t + 1), [
19
+ ...l,
20
+ a,
21
+ t
22
+ ]);
23
+ })
24
+ };
25
+ }, i = (e, n, r) => {
26
+ let i = (e) => e.data === n.data ? e : e.children.map(i).find(Boolean), o = i(e);
27
+ if (o) return o;
28
+ let s = a(r, n.path), c = a(e, n.path);
29
+ return n.path.length && c.children.length < s.children.length ? c : t(e, n.path) ?? a(e, n.path);
30
+ }, a = (e, n) => {
31
+ for (let r = n.length - 2; r >= 0; r -= 2) {
32
+ let i = t(e, n.slice(0, r));
33
+ if (i) return i;
34
+ }
35
+ return e;
36
+ }, o = (t, r, i) => {
37
+ let a = t.$ref ? n(r, t.$ref, r) ?? t : t, o = a;
38
+ for (let t of ["oneOf", "anyOf"]) {
39
+ let s = e(a, r, t, i);
40
+ if (s !== void 0) {
41
+ let e = a[t][s];
42
+ o = e.$ref ? n(r, e.$ref, r) ?? e : e;
43
+ }
44
+ }
45
+ return o;
46
+ };
47
+ export { r as buildRecursiveTree, o as recursiveNodeSchema, a as recursiveTreeParent, i as recursiveTreeSelection };
48
+
49
+ //# sourceMappingURL=recursiveTree.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recursiveTree.esm.js","names":["buildRecursiveTree","_branch$properties","resolved","schema","resolveSchema","rootSchema","collection","recursiveNodeSchema","data","childrenProperty","arraySchema","children","name","labelProperty","fallback","items","child","index","path","recursiveTreeSelection","identity","node","previous","retained","tree","oldParent","recursiveTreeParent","previousTree","parent","findMixedTreeNode","length","branch","keyword","discriminatorBranch","candidate"],"sources":["../../src/mixed/recursiveTree.ts"],"sourcesContent":["import { JsonSchema, resolveSchema } from '@jsonforms/core';\nimport { discriminatorBranch } from '../composition/discriminatorBranch';\nimport { MixedTreeNode, MixedTreePath, findMixedTreeNode } from './mixedTree';\n\n/** Project a recursive collection onto domain nodes, without expanding schemas. */\nexport const buildRecursiveTree = (\n data: any,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n childrenProperty: string,\n labelProperty: string,\n fallback: string,\n path: MixedTreePath = [],\n): MixedTreeNode => {\n const resolved = schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n const branch = recursiveNodeSchema(schema, rootSchema, data);\n const collection = branch.properties?.[childrenProperty];\n const arraySchema = collection?.$ref\n ? resolveSchema(rootSchema, collection.$ref, rootSchema)\n : collection;\n const children = Array.isArray(data?.[childrenProperty])\n ? data[childrenProperty]\n : [];\n const name = data?.[labelProperty];\n return {\n label: typeof name === 'string' && name.trim() ? name : fallback,\n named: true,\n path,\n data,\n schema: resolved,\n type: 'object',\n dynamic: false,\n children: children.map((child: unknown, index: number) => {\n const items = arraySchema?.items;\n const childSchema = Array.isArray(items) ? items[index] : items;\n return buildRecursiveTree(\n child,\n (childSchema || resolved) as JsonSchema,\n rootSchema,\n childrenProperty,\n labelProperty,\n String(index + 1),\n [...path, childrenProperty, index],\n );\n }),\n };\n};\n\n/** After removal, choose the closest remaining ancestor rather than a sibling\n * that happens to occupy the removed item's index. */\nexport const recursiveTreeSelection = (\n tree: MixedTreeNode,\n previous: MixedTreeNode,\n previousTree: MixedTreeNode,\n): MixedTreeNode => {\n const identity = (node: MixedTreeNode): MixedTreeNode | undefined =>\n node.data === previous.data\n ? node\n : node.children.map(identity).find(Boolean);\n const retained = identity(tree);\n if (retained) return retained;\n const oldParent = recursiveTreeParent(previousTree, previous.path);\n const parent = recursiveTreeParent(tree, previous.path);\n if (\n previous.path.length &&\n parent.children.length < oldParent.children.length\n )\n return parent;\n const current = findMixedTreeNode(tree, previous.path);\n // Immutable field edits replace a node, but leave its containing list length intact.\n return current ?? recursiveTreeParent(tree, previous.path);\n};\nexport const recursiveTreeParent = (\n tree: MixedTreeNode,\n path: MixedTreePath,\n): MixedTreeNode => {\n for (let length = path.length - 2; length >= 0; length -= 2) {\n const parent = findMixedTreeNode(tree, path.slice(0, length));\n if (parent) return parent;\n }\n return tree;\n};\n\nexport const recursiveNodeSchema = (\n schema: JsonSchema,\n rootSchema: JsonSchema,\n data: unknown,\n): JsonSchema => {\n const resolved = schema.$ref\n ? (resolveSchema(rootSchema, schema.$ref, rootSchema) ?? schema)\n : schema;\n let branch = resolved;\n for (const keyword of ['oneOf', 'anyOf'] as const) {\n const index = discriminatorBranch(resolved, rootSchema, keyword, data);\n if (index !== undefined) {\n const candidate = resolved[keyword]![index];\n branch = candidate.$ref\n ? (resolveSchema(rootSchema, candidate.$ref, rootSchema) ?? candidate)\n : candidate;\n }\n }\n return branch;\n};\n"],"mappings":";;;;AAKA,IAAaA,KACX,GACA,GACA,GACA,GACA,GACA,GACA,IAAsB,CAAC,MACL;;CAClB,IAAME,IAAWC,EAAO,OACnBC,EAAcC,GAAYF,EAAO,MAAME,CAAU,KAAKF,IACvDA,GAEEG,KAAA,IADSC,EAAoBJ,GAAQE,GAAYG,CACpC,CAAA,CAAO,eAAA,OAAA,KAAA,IAAAP,EAAaQ,IACjCC,IAAAJ,KAAA,QAAcA,EAAY,OAC5BF,EAAcC,GAAYC,EAAW,MAAMD,CAAU,IACrDC,GACEK,IAAW,MAAM,QAAAH,KAAA,OAAA,KAAA,IAAQA,EAAOC,EAAiB,IACnDD,EAAKC,KACL,CAAC,GACCG,IAAAJ,KAAA,OAAA,KAAA,IAAOA,EAAOK;CACpB,OAAO;EACL,OAAO,OAAOD,KAAS,YAAYA,EAAK,KAAK,IAAIA,IAAOE;EACxD,OAAO;EACP;EACA;EACA,QAAQZ;EACR,MAAM;EACN,SAAS;EACT,UAAUS,EAAS,KAAK,GAAgB,MAAkB;GACxD,IAAMI,IAAAL,KAAA,OAAA,KAAA,IA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,OAAOH;AACT"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react");var t=(t,n,r,i)=>(0,e.useMemo)(()=>({selectPath:e=>{if(!n)return;let a=n=>{if([t,...n.path].filter(e=>e!==``).join(`.`)===e)return n;for(let e of n.children){let t=a(e);if(t)return t}},o=a(n);o&&(r(o.path),i(!0))}}),[t,n,i,r]);exports.useMixedNavigation=t;
2
+ //# sourceMappingURL=useMixedNavigation.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMixedNavigation.cjs.js","names":["useMemo","react","useMixedNavigation","tree","findByDataPath","path","node","segment","targetPath","child","found","target","setSelectedPath","setExpanded"],"sources":["../../src/mixed/useMixedNavigation.ts"],"sourcesContent":["import { useMemo, type Dispatch, type SetStateAction } from 'react';\nimport type { MixedTreeNode, MixedTreePath } from './mixedTree';\n\n/** Maps a descendant data path back to its tree node without selecting an unrelated node. */\nexport const useMixedNavigation = (\n path: string,\n tree: MixedTreeNode | undefined,\n setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>,\n setExpanded: (expanded: boolean) => void,\n) =>\n useMemo(\n () => ({\n selectPath: (targetPath: string) => {\n if (!tree) return;\n const findByDataPath = (\n node: MixedTreeNode,\n ): MixedTreeNode | undefined => {\n const nodePath = [path, ...node.path]\n .filter((segment) => segment !== '')\n .join('.');\n if (nodePath === targetPath) return node;\n for (const child of node.children) {\n const found = findByDataPath(child);\n if (found) return found;\n }\n return undefined;\n };\n const target = findByDataPath(tree);\n if (target) {\n setSelectedPath(target.path);\n setExpanded(true);\n }\n },\n }),\n [path, tree, setExpanded, setSelectedPath],\n );\n"],"mappings":"A,0FAIA,IAAaE,GACX,EACA,EACA,EACA,KAAA,EAEAF,EAAAA,QAAAA,MACS,CACL,WAAa,GAAuB,CAClC,GAAI,CAACG,EAAM,OACX,IAAMC,EACJ,GAC8B,CAI9B,GAHiB,CAACC,EAAM,GAAGC,EAAK,IAAI,CAAC,CAClC,OAAQ,GAAYC,IAAY,EAAE,CAAC,CACnC,KAAK,GACJ,IAAaC,EAAY,OAAOF,EACpC,IAAK,IAAMG,KAASH,EAAK,SAAU,CACjC,IAAMI,EAAQN,EAAeK,CAAK,EAClC,GAAIC,EAAO,OAAOA,CACpB,CAEF,EACMC,EAASP,EAAeD,CAAI,EAC9BQ,IACFC,EAAgBD,EAAO,IAAI,EAC3BE,EAAY,EAAI,EAEpB,CACF,GACA,CAACR,EAAMF,EAAMU,EAAaD,CAAe,CAC3C,E"}
@@ -0,0 +1,6 @@
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
+ import type { MixedTreeNode, MixedTreePath } from './mixedTree';
3
+ /** Maps a descendant data path back to its tree node without selecting an unrelated node. */
4
+ export declare const useMixedNavigation: (path: string, tree: MixedTreeNode | undefined, setSelectedPath: Dispatch<SetStateAction<MixedTreePath>>, setExpanded: (expanded: boolean) => void) => {
5
+ selectPath: (targetPath: string) => void;
6
+ };