@vertesia/ui 0.56.0 → 0.58.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 (708) hide show
  1. package/lib/esm/core/components/Avatar.js +31 -0
  2. package/lib/esm/core/components/Avatar.js.map +1 -0
  3. package/lib/esm/core/components/Badge.js +62 -0
  4. package/lib/esm/core/components/Badge.js.map +1 -0
  5. package/lib/esm/core/components/Button.js +32 -0
  6. package/lib/esm/core/components/Button.js.map +1 -0
  7. package/lib/esm/core/components/Center.js +6 -0
  8. package/lib/esm/core/components/Center.js.map +1 -0
  9. package/lib/esm/core/components/ComboBox.js +356 -0
  10. package/lib/esm/core/components/ComboBox.js.map +1 -0
  11. package/lib/esm/core/components/ConfirmModal.js +10 -0
  12. package/lib/esm/core/components/ConfirmModal.js.map +1 -0
  13. package/lib/esm/core/components/DeleteModal.js +28 -0
  14. package/lib/esm/core/components/DeleteModal.js.map +1 -0
  15. package/lib/esm/core/components/Divider.js +6 -0
  16. package/lib/esm/core/components/Divider.js.map +1 -0
  17. package/lib/esm/core/components/Dropdown.js +16 -0
  18. package/lib/esm/core/components/Dropdown.js.map +1 -0
  19. package/lib/esm/core/components/DropdownList.js +9 -0
  20. package/lib/esm/core/components/DropdownList.js.map +1 -0
  21. package/lib/esm/core/components/EmptyCollection.js +7 -0
  22. package/lib/esm/core/components/EmptyCollection.js.map +1 -0
  23. package/lib/esm/core/components/FileUpload.js +119 -0
  24. package/lib/esm/core/components/FileUpload.js.map +1 -0
  25. package/lib/esm/core/components/Input.js +16 -0
  26. package/lib/esm/core/components/Input.js.map +1 -0
  27. package/lib/esm/core/components/InputList.js +42 -0
  28. package/lib/esm/core/components/InputList.js.map +1 -0
  29. package/lib/esm/core/components/Link.js +13 -0
  30. package/lib/esm/core/components/Link.js.map +1 -0
  31. package/lib/esm/core/components/MenuList.js +23 -0
  32. package/lib/esm/core/components/MenuList.js.map +1 -0
  33. package/lib/esm/core/components/MessageBox.js +66 -0
  34. package/lib/esm/core/components/MessageBox.js.map +1 -0
  35. package/lib/esm/core/components/Modal.js +26 -0
  36. package/lib/esm/core/components/Modal.js.map +1 -0
  37. package/lib/esm/core/components/NumberInput.js +43 -0
  38. package/lib/esm/core/components/NumberInput.js.map +1 -0
  39. package/lib/esm/core/components/Portal.js +28 -0
  40. package/lib/esm/core/components/Portal.js.map +1 -0
  41. package/lib/esm/core/components/RadioGroup.js +34 -0
  42. package/lib/esm/core/components/RadioGroup.js.map +1 -0
  43. package/lib/esm/core/components/SelectBox.js +67 -0
  44. package/lib/esm/core/components/SelectBox.js.map +1 -0
  45. package/lib/esm/core/components/SelectList.js +47 -0
  46. package/lib/esm/core/components/SelectList.js.map +1 -0
  47. package/lib/esm/core/components/SelectStack.js +8 -0
  48. package/lib/esm/core/components/SelectStack.js.map +1 -0
  49. package/lib/esm/core/components/SidePanel.js +33 -0
  50. package/lib/esm/core/components/SidePanel.js.map +1 -0
  51. package/lib/esm/core/components/Spinner.js +18 -0
  52. package/lib/esm/core/components/Spinner.js.map +1 -0
  53. package/lib/esm/core/components/Switch.js +12 -0
  54. package/lib/esm/core/components/Switch.js.map +1 -0
  55. package/lib/esm/core/components/Textarea.js +15 -0
  56. package/lib/esm/core/components/Textarea.js.map +1 -0
  57. package/lib/esm/core/components/index.js +34 -0
  58. package/lib/esm/core/components/index.js.map +1 -0
  59. package/lib/esm/core/components/libs/utils.js +6 -0
  60. package/lib/esm/core/components/libs/utils.js.map +1 -0
  61. package/lib/esm/core/components/libs/visuallyHidden.js +16 -0
  62. package/lib/esm/core/components/libs/visuallyHidden.js.map +1 -0
  63. package/lib/esm/core/components/popup/Popup.js +60 -0
  64. package/lib/esm/core/components/popup/Popup.js.map +1 -0
  65. package/lib/esm/core/components/popup/PopupController.js +149 -0
  66. package/lib/esm/core/components/popup/PopupController.js.map +1 -0
  67. package/lib/esm/core/components/popup/index.js +4 -0
  68. package/lib/esm/core/components/popup/index.js.map +1 -0
  69. package/lib/esm/core/components/popup/position.js +221 -0
  70. package/lib/esm/core/components/popup/position.js.map +1 -0
  71. package/lib/esm/core/components/popup/utils.js +74 -0
  72. package/lib/esm/core/components/popup/utils.js.map +1 -0
  73. package/lib/esm/core/components/shadcn/breadcrumb.js +30 -0
  74. package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -0
  75. package/lib/esm/core/components/shadcn/button.js +45 -0
  76. package/lib/esm/core/components/shadcn/button.js.map +1 -0
  77. package/lib/esm/core/components/shadcn/calendar.js +46 -0
  78. package/lib/esm/core/components/shadcn/calendar.js.map +1 -0
  79. package/lib/esm/core/components/shadcn/card.js +17 -0
  80. package/lib/esm/core/components/shadcn/card.js.map +1 -0
  81. package/lib/esm/core/components/shadcn/checkbox.js +10 -0
  82. package/lib/esm/core/components/shadcn/checkbox.js.map +1 -0
  83. package/lib/esm/core/components/shadcn/command.js +30 -0
  84. package/lib/esm/core/components/shadcn/command.js.map +1 -0
  85. package/lib/esm/core/components/shadcn/dialog.js +61 -0
  86. package/lib/esm/core/components/shadcn/dialog.js.map +1 -0
  87. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js +23 -0
  88. package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js.map +1 -0
  89. package/lib/esm/core/components/shadcn/filters/comboBox.js +82 -0
  90. package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -0
  91. package/lib/esm/core/components/shadcn/filters/dateFilter.js +31 -0
  92. package/lib/esm/core/components/shadcn/filters/dateFilter.js.map +1 -0
  93. package/lib/esm/core/components/shadcn/filters/filterBar.js +140 -0
  94. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -0
  95. package/lib/esm/core/components/shadcn/filters/filters.js +42 -0
  96. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -0
  97. package/lib/esm/core/components/shadcn/filters/index.js +6 -0
  98. package/lib/esm/core/components/shadcn/filters/index.js.map +1 -0
  99. package/lib/esm/core/components/shadcn/filters/selectFilter.js +58 -0
  100. package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +1 -0
  101. package/lib/esm/core/components/shadcn/filters/textFilter.js +20 -0
  102. package/lib/esm/core/components/shadcn/filters/textFilter.js.map +1 -0
  103. package/lib/esm/core/components/shadcn/filters/types.js +10 -0
  104. package/lib/esm/core/components/shadcn/filters/types.js.map +1 -0
  105. package/lib/esm/core/components/shadcn/heading.js +17 -0
  106. package/lib/esm/core/components/shadcn/heading.js.map +1 -0
  107. package/lib/esm/core/components/shadcn/index.js +22 -0
  108. package/lib/esm/core/components/shadcn/index.js.map +1 -0
  109. package/lib/esm/core/components/shadcn/input.js +38 -0
  110. package/lib/esm/core/components/shadcn/input.js.map +1 -0
  111. package/lib/esm/core/components/shadcn/label.js +11 -0
  112. package/lib/esm/core/components/shadcn/label.js.map +1 -0
  113. package/lib/esm/core/components/shadcn/popover.js +50 -0
  114. package/lib/esm/core/components/shadcn/popover.js.map +1 -0
  115. package/lib/esm/core/components/shadcn/selectBox.js +62 -0
  116. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -0
  117. package/lib/esm/core/components/shadcn/separator.js +8 -0
  118. package/lib/esm/core/components/shadcn/separator.js.map +1 -0
  119. package/lib/esm/core/components/shadcn/tabs.js +77 -0
  120. package/lib/esm/core/components/shadcn/tabs.js.map +1 -0
  121. package/lib/esm/core/components/shadcn/text.js +30 -0
  122. package/lib/esm/core/components/shadcn/text.js.map +1 -0
  123. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js +38 -0
  124. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js.map +1 -0
  125. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js +13 -0
  126. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -0
  127. package/lib/esm/core/components/shadcn/tooltip.js +14 -0
  128. package/lib/esm/core/components/shadcn/tooltip.js.map +1 -0
  129. package/lib/esm/core/components/styles.js +10 -0
  130. package/lib/esm/core/components/styles.js.map +1 -0
  131. package/lib/esm/core/components/table/index.js +20 -0
  132. package/lib/esm/core/components/table/index.js.map +1 -0
  133. package/lib/esm/core/components/tabs/Tabs.js +78 -0
  134. package/lib/esm/core/components/tabs/Tabs.js.map +1 -0
  135. package/lib/esm/core/components/tabs/TabsContext.js +7 -0
  136. package/lib/esm/core/components/tabs/TabsContext.js.map +1 -0
  137. package/lib/esm/core/components/tabs/index.js +3 -0
  138. package/lib/esm/core/components/tabs/index.js.map +1 -0
  139. package/lib/esm/core/components/toast/NotificationPanel.js +37 -0
  140. package/lib/esm/core/components/toast/NotificationPanel.js.map +1 -0
  141. package/lib/esm/core/components/toast/ToastContext.js +7 -0
  142. package/lib/esm/core/components/toast/ToastContext.js.map +1 -0
  143. package/lib/esm/core/components/toast/ToastProps.js +2 -0
  144. package/lib/esm/core/components/toast/ToastProps.js.map +1 -0
  145. package/lib/esm/core/components/toast/ToastProvider.js +13 -0
  146. package/lib/esm/core/components/toast/ToastProvider.js.map +1 -0
  147. package/lib/esm/core/components/toast/index.js +3 -0
  148. package/lib/esm/core/components/toast/index.js.map +1 -0
  149. package/lib/esm/core/hooks/CompositeState.js +118 -0
  150. package/lib/esm/core/hooks/CompositeState.js.map +1 -0
  151. package/lib/esm/core/hooks/SharedState.js +64 -0
  152. package/lib/esm/core/hooks/SharedState.js.map +1 -0
  153. package/lib/esm/core/hooks/index.js +14 -0
  154. package/lib/esm/core/hooks/index.js.map +1 -0
  155. package/lib/esm/core/hooks/useClickOutside.js +29 -0
  156. package/lib/esm/core/hooks/useClickOutside.js.map +1 -0
  157. package/lib/esm/core/hooks/useCopyToClipboard.js +23 -0
  158. package/lib/esm/core/hooks/useCopyToClipboard.js.map +1 -0
  159. package/lib/esm/core/hooks/useDarkMode.js +11 -0
  160. package/lib/esm/core/hooks/useDarkMode.js.map +1 -0
  161. package/lib/esm/core/hooks/useDebounce.js +14 -0
  162. package/lib/esm/core/hooks/useDebounce.js.map +1 -0
  163. package/lib/esm/core/hooks/useEventSource.js +31 -0
  164. package/lib/esm/core/hooks/useEventSource.js.map +1 -0
  165. package/lib/esm/core/hooks/useFetch.js +40 -0
  166. package/lib/esm/core/hooks/useFetch.js.map +1 -0
  167. package/lib/esm/core/hooks/useFlag.js +13 -0
  168. package/lib/esm/core/hooks/useFlag.js.map +1 -0
  169. package/lib/esm/core/hooks/useIntersectionObserver.js +34 -0
  170. package/lib/esm/core/hooks/useIntersectionObserver.js.map +1 -0
  171. package/lib/esm/core/hooks/useIsFistRendering.js +14 -0
  172. package/lib/esm/core/hooks/useIsFistRendering.js.map +1 -0
  173. package/lib/esm/core/hooks/useSafeLayoutEffect.js +4 -0
  174. package/lib/esm/core/hooks/useSafeLayoutEffect.js.map +1 -0
  175. package/lib/esm/core/hooks/useSharedValue.js +21 -0
  176. package/lib/esm/core/hooks/useSharedValue.js.map +1 -0
  177. package/lib/esm/core/index.js +3 -0
  178. package/lib/esm/core/index.js.map +1 -0
  179. package/lib/esm/env/index.js +69 -0
  180. package/lib/esm/env/index.js.map +1 -0
  181. package/lib/esm/features/activity-doc/ActivityDoc.js +71 -0
  182. package/lib/esm/features/activity-doc/ActivityDoc.js.map +1 -0
  183. package/lib/esm/features/activity-doc/index.js +2 -0
  184. package/lib/esm/features/activity-doc/index.js.map +1 -0
  185. package/lib/esm/features/index.js +2 -2
  186. package/lib/esm/features/index.js.map +1 -1
  187. package/lib/esm/features/permissions/SecureButton.js +13 -0
  188. package/lib/esm/features/permissions/SecureButton.js.map +1 -0
  189. package/lib/esm/features/permissions/SecureSidebarItem.js +14 -0
  190. package/lib/esm/features/permissions/SecureSidebarItem.js.map +1 -0
  191. package/lib/esm/features/permissions/UserPermissionsProvider.js +86 -0
  192. package/lib/esm/features/permissions/UserPermissionsProvider.js.map +1 -0
  193. package/lib/esm/features/permissions/helpers.js +12 -0
  194. package/lib/esm/features/permissions/helpers.js.map +1 -0
  195. package/lib/esm/features/permissions/index.js +5 -0
  196. package/lib/esm/features/permissions/index.js.map +1 -0
  197. package/lib/esm/layout/AppLayout.js +46 -0
  198. package/lib/esm/layout/AppLayout.js.map +1 -0
  199. package/lib/esm/layout/FullHeightLayout.js +20 -0
  200. package/lib/esm/layout/FullHeightLayout.js.map +1 -0
  201. package/lib/esm/layout/Navbar.js +40 -0
  202. package/lib/esm/layout/Navbar.js.map +1 -0
  203. package/lib/esm/layout/Sidebar.js +35 -0
  204. package/lib/esm/layout/Sidebar.js.map +1 -0
  205. package/lib/esm/layout/SidebarContext.js +10 -0
  206. package/lib/esm/layout/SidebarContext.js.map +1 -0
  207. package/lib/esm/layout/TitleBar.js +5 -0
  208. package/lib/esm/layout/TitleBar.js.map +1 -0
  209. package/lib/esm/layout/index.js +7 -0
  210. package/lib/esm/layout/index.js.map +1 -0
  211. package/lib/esm/router/FixLinks.js +23 -0
  212. package/lib/esm/router/FixLinks.js.map +1 -0
  213. package/lib/esm/router/HistoryNavigator.js +149 -0
  214. package/lib/esm/router/HistoryNavigator.js.map +1 -0
  215. package/lib/esm/router/Nav.js +26 -0
  216. package/lib/esm/router/Nav.js.map +1 -0
  217. package/lib/esm/router/NestedNavigationContext.js +19 -0
  218. package/lib/esm/router/NestedNavigationContext.js.map +1 -0
  219. package/lib/esm/router/NestedRouterProvider.js +44 -0
  220. package/lib/esm/router/NestedRouterProvider.js.map +1 -0
  221. package/lib/esm/router/PathMatcher.js +159 -0
  222. package/lib/esm/router/PathMatcher.js.map +1 -0
  223. package/lib/esm/router/PathWithParams.js +34 -0
  224. package/lib/esm/router/PathWithParams.js.map +1 -0
  225. package/lib/esm/router/Route404.js +18 -0
  226. package/lib/esm/router/Route404.js.map +1 -0
  227. package/lib/esm/router/RouteComponent.js +32 -0
  228. package/lib/esm/router/RouteComponent.js.map +1 -0
  229. package/lib/esm/router/Router.js +161 -0
  230. package/lib/esm/router/Router.js.map +1 -0
  231. package/lib/esm/router/RouterProvider.js +41 -0
  232. package/lib/esm/router/RouterProvider.js.map +1 -0
  233. package/lib/esm/router/index.js +10 -5
  234. package/lib/esm/router/index.js.map +1 -1
  235. package/lib/esm/router/path.js +137 -0
  236. package/lib/esm/router/path.js.map +1 -0
  237. package/lib/esm/session/TypeRegistry.js +24 -0
  238. package/lib/esm/session/TypeRegistry.js.map +1 -0
  239. package/lib/esm/session/UserSession.js +191 -0
  240. package/lib/esm/session/UserSession.js.map +1 -0
  241. package/lib/esm/session/UserSessionProvider.js +161 -0
  242. package/lib/esm/session/UserSessionProvider.js.map +1 -0
  243. package/lib/esm/session/auth/composable.js +162 -0
  244. package/lib/esm/session/auth/composable.js.map +1 -0
  245. package/lib/esm/session/auth/firebase.js +151 -0
  246. package/lib/esm/session/auth/firebase.js.map +1 -0
  247. package/lib/esm/session/auth/useAuthState.js +49 -0
  248. package/lib/esm/session/auth/useAuthState.js.map +1 -0
  249. package/lib/esm/session/index.js +6 -2
  250. package/lib/esm/session/index.js.map +1 -1
  251. package/lib/esm/session/useUXTracking.js +29 -0
  252. package/lib/esm/session/useUXTracking.js.map +1 -0
  253. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +103 -0
  254. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -0
  255. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js +33 -0
  256. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js.map +1 -0
  257. package/lib/esm/widgets/codemirror/index.js +2 -0
  258. package/lib/esm/widgets/codemirror/index.js.map +1 -0
  259. package/lib/esm/widgets/form/Form.js +102 -0
  260. package/lib/esm/widgets/form/Form.js.map +1 -0
  261. package/lib/esm/widgets/form/FormContext.js +29 -0
  262. package/lib/esm/widgets/form/FormContext.js.map +1 -0
  263. package/lib/esm/widgets/form/ManagedObject.js +283 -0
  264. package/lib/esm/widgets/form/ManagedObject.js.map +1 -0
  265. package/lib/esm/widgets/form/fields.js +11 -0
  266. package/lib/esm/widgets/form/fields.js.map +1 -0
  267. package/lib/esm/widgets/form/index.js +7 -0
  268. package/lib/esm/widgets/form/index.js.map +1 -0
  269. package/lib/esm/widgets/form/inputs.js +36 -0
  270. package/lib/esm/widgets/form/inputs.js.map +1 -0
  271. package/lib/esm/widgets/form/schema.js +191 -0
  272. package/lib/esm/widgets/form/schema.js.map +1 -0
  273. package/lib/esm/widgets/index.js +6 -0
  274. package/lib/esm/widgets/index.js.map +1 -0
  275. package/lib/esm/widgets/json-view/JSONCode.js +157 -0
  276. package/lib/esm/widgets/json-view/JSONCode.js.map +1 -0
  277. package/lib/esm/widgets/json-view/JSONDisplay.js +10 -0
  278. package/lib/esm/widgets/json-view/JSONDisplay.js.map +1 -0
  279. package/lib/esm/widgets/json-view/JSONView.js +106 -0
  280. package/lib/esm/widgets/json-view/JSONView.js.map +1 -0
  281. package/lib/esm/widgets/json-view/index.js +4 -0
  282. package/lib/esm/widgets/json-view/index.js.map +1 -0
  283. package/lib/esm/widgets/json-view/types.js +2 -0
  284. package/lib/esm/widgets/json-view/types.js.map +1 -0
  285. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js +50 -0
  286. package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js.map +1 -0
  287. package/lib/esm/widgets/schema-editor/ManagedSchema.js +303 -0
  288. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -0
  289. package/lib/esm/widgets/schema-editor/editor/Editable.js +111 -0
  290. package/lib/esm/widgets/schema-editor/editor/Editable.js.map +1 -0
  291. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js +8 -0
  292. package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -0
  293. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +81 -0
  294. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +1 -0
  295. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js +7 -0
  296. package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js.map +1 -0
  297. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js +9 -0
  298. package/lib/esm/widgets/schema-editor/editor/SchemaContext.js.map +1 -0
  299. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +84 -0
  300. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -0
  301. package/lib/esm/widgets/schema-editor/index.js +8 -0
  302. package/lib/esm/widgets/schema-editor/index.js.map +1 -0
  303. package/lib/esm/widgets/schema-editor/json-schema4-utils.js +188 -0
  304. package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -0
  305. package/lib/esm/widgets/schema-editor/type-signature.js +30 -0
  306. package/lib/esm/widgets/schema-editor/type-signature.js.map +1 -0
  307. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js +11 -0
  308. package/lib/esm/widgets/xml-viewer/components/Attributes/index.js.map +1 -0
  309. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js +8 -0
  310. package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js.map +1 -0
  311. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js +11 -0
  312. package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js.map +1 -0
  313. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js +11 -0
  314. package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js.map +1 -0
  315. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js +9 -0
  316. package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js.map +1 -0
  317. package/lib/esm/widgets/xml-viewer/components/Elements/index.js +36 -0
  318. package/lib/esm/widgets/xml-viewer/components/Elements/index.js.map +1 -0
  319. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js +5 -0
  320. package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js.map +1 -0
  321. package/lib/esm/widgets/xml-viewer/components/Tag/index.js +13 -0
  322. package/lib/esm/widgets/xml-viewer/components/Tag/index.js.map +1 -0
  323. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js +13 -0
  324. package/lib/esm/widgets/xml-viewer/components/TextElement/index.js.map +1 -0
  325. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +30 -0
  326. package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +1 -0
  327. package/lib/esm/widgets/xml-viewer/components/types.js +2 -0
  328. package/lib/esm/widgets/xml-viewer/components/types.js.map +1 -0
  329. package/lib/esm/widgets/xml-viewer/constants/index.js +17 -0
  330. package/lib/esm/widgets/xml-viewer/constants/index.js.map +1 -0
  331. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js +10 -0
  332. package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js.map +1 -0
  333. package/lib/esm/widgets/xml-viewer/helpers/index.js +40 -0
  334. package/lib/esm/widgets/xml-viewer/helpers/index.js.map +1 -0
  335. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js +22 -0
  336. package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js.map +1 -0
  337. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js +31 -0
  338. package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js.map +1 -0
  339. package/lib/esm/widgets/xml-viewer/index.js +3 -0
  340. package/lib/esm/widgets/xml-viewer/index.js.map +1 -0
  341. package/lib/esm/widgets/xml-viewer/types/index.js +2 -0
  342. package/lib/esm/widgets/xml-viewer/types/index.js.map +1 -0
  343. package/lib/tsconfig.tsbuildinfo +1 -1
  344. package/lib/types/core/components/Avatar.d.ts +15 -0
  345. package/lib/types/core/components/Badge.d.ts +20 -0
  346. package/lib/types/core/components/Button.d.ts +13 -0
  347. package/lib/types/core/components/Center.d.ts +7 -0
  348. package/lib/types/core/components/ComboBox.d.ts +123 -0
  349. package/lib/types/core/components/ConfirmModal.d.ts +10 -0
  350. package/lib/types/core/components/DeleteModal.d.ts +10 -0
  351. package/lib/types/core/components/Divider.d.ts +5 -0
  352. package/lib/types/core/components/Dropdown.d.ts +14 -0
  353. package/lib/types/core/components/DropdownList.d.ts +12 -0
  354. package/lib/types/core/components/EmptyCollection.d.ts +8 -0
  355. package/lib/types/core/components/FileUpload.d.ts +28 -0
  356. package/lib/types/core/components/Input.d.ts +8 -0
  357. package/lib/types/core/components/InputList.d.ts +10 -0
  358. package/lib/types/core/components/Link.d.ts +6 -0
  359. package/lib/types/core/components/MenuList.d.ts +13 -0
  360. package/lib/types/core/components/MessageBox.d.ts +35 -0
  361. package/lib/types/core/components/Modal.d.ts +29 -0
  362. package/lib/types/core/components/NumberInput.d.ts +15 -0
  363. package/lib/types/core/components/Portal.d.ts +5 -0
  364. package/lib/types/core/components/RadioGroup.d.ts +25 -0
  365. package/lib/types/core/components/SelectBox.d.ts +35 -0
  366. package/lib/types/core/components/SelectList.d.ts +17 -0
  367. package/lib/types/core/components/SelectStack.d.ts +12 -0
  368. package/lib/types/core/components/SidePanel.d.ts +8 -0
  369. package/lib/types/core/components/Spinner.d.ts +6 -0
  370. package/lib/types/core/components/Switch.d.ts +9 -0
  371. package/lib/types/core/components/Textarea.d.ts +7 -0
  372. package/lib/types/core/components/index.d.ts +37 -0
  373. package/lib/types/core/components/libs/utils.d.ts +2 -0
  374. package/lib/types/core/components/libs/visuallyHidden.d.ts +6 -0
  375. package/lib/types/core/components/popup/Popup.d.ts +25 -0
  376. package/lib/types/core/components/popup/PopupController.d.ts +40 -0
  377. package/lib/types/core/components/popup/index.d.ts +3 -0
  378. package/lib/types/core/components/popup/position.d.ts +58 -0
  379. package/lib/types/core/components/popup/utils.d.ts +29 -0
  380. package/lib/types/core/components/shadcn/breadcrumb.d.ts +13 -0
  381. package/lib/types/core/components/shadcn/button.d.ts +15 -0
  382. package/lib/types/core/components/shadcn/calendar.d.ts +10 -0
  383. package/lib/types/core/components/shadcn/card.d.ts +8 -0
  384. package/lib/types/core/components/shadcn/checkbox.d.ts +4 -0
  385. package/lib/types/core/components/shadcn/command.d.ts +80 -0
  386. package/lib/types/core/components/shadcn/dialog.d.ts +34 -0
  387. package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts +6 -0
  388. package/lib/types/core/components/shadcn/filters/comboBox.d.ts +17 -0
  389. package/lib/types/core/components/shadcn/filters/dateFilter.d.ts +14 -0
  390. package/lib/types/core/components/shadcn/filters/filterBar.d.ts +9 -0
  391. package/lib/types/core/components/shadcn/filters/filters.d.ts +9 -0
  392. package/lib/types/core/components/shadcn/filters/index.d.ts +5 -0
  393. package/lib/types/core/components/shadcn/filters/selectFilter.d.ts +11 -0
  394. package/lib/types/core/components/shadcn/filters/textFilter.d.ts +12 -0
  395. package/lib/types/core/components/shadcn/filters/types.d.ts +26 -0
  396. package/lib/types/core/components/shadcn/heading.d.ts +5 -0
  397. package/lib/types/core/components/shadcn/index.d.ts +21 -0
  398. package/lib/types/core/components/shadcn/input.d.ts +16 -0
  399. package/lib/types/core/components/shadcn/label.d.ts +7 -0
  400. package/lib/types/core/components/shadcn/popover.d.ts +16 -0
  401. package/lib/types/core/components/shadcn/selectBox.d.ts +21 -0
  402. package/lib/types/core/components/shadcn/separator.d.ts +4 -0
  403. package/lib/types/core/components/shadcn/tabs.d.ts +26 -0
  404. package/lib/types/core/components/shadcn/text.d.ts +10 -0
  405. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts +13 -0
  406. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts +9 -0
  407. package/lib/types/core/components/shadcn/tooltip.d.ts +19 -0
  408. package/lib/types/core/components/styles.d.ts +6 -0
  409. package/lib/types/core/components/table/index.d.ts +13 -0
  410. package/lib/types/core/components/tabs/Tabs.d.ts +24 -0
  411. package/lib/types/core/components/tabs/TabsContext.d.ts +16 -0
  412. package/lib/types/core/components/tabs/index.d.ts +2 -0
  413. package/lib/types/core/components/toast/NotificationPanel.d.ts +7 -0
  414. package/lib/types/core/components/toast/ToastContext.d.ts +5 -0
  415. package/lib/types/core/components/toast/ToastProps.d.ts +6 -0
  416. package/lib/types/core/components/toast/ToastProvider.d.ts +5 -0
  417. package/lib/types/core/components/toast/index.d.ts +2 -0
  418. package/lib/types/core/hooks/CompositeState.d.ts +27 -0
  419. package/lib/types/core/hooks/SharedState.d.ts +9 -0
  420. package/lib/types/core/hooks/index.d.ts +13 -0
  421. package/lib/types/core/hooks/useClickOutside.d.ts +7 -0
  422. package/lib/types/core/hooks/useCopyToClipboard.d.ts +4 -0
  423. package/lib/types/core/hooks/useDarkMode.d.ts +1 -0
  424. package/lib/types/core/hooks/useDebounce.d.ts +1 -0
  425. package/lib/types/core/hooks/useEventSource.d.ts +1 -0
  426. package/lib/types/core/hooks/useFetch.d.ts +23 -0
  427. package/lib/types/core/hooks/useFlag.d.ts +8 -0
  428. package/lib/types/core/hooks/useIntersectionObserver.d.ts +13 -0
  429. package/lib/types/core/hooks/useIsFistRendering.d.ts +1 -0
  430. package/lib/types/core/hooks/useSafeLayoutEffect.d.ts +3 -0
  431. package/lib/types/core/hooks/useSharedValue.d.ts +11 -0
  432. package/lib/types/core/index.d.ts +2 -0
  433. package/lib/types/env/index.d.ts +70 -0
  434. package/lib/types/features/activity-doc/ActivityDoc.d.ts +13 -0
  435. package/lib/types/features/activity-doc/index.d.ts +1 -0
  436. package/lib/types/features/index.d.ts +2 -0
  437. package/lib/types/features/permissions/SecureButton.d.ts +7 -0
  438. package/lib/types/features/permissions/SecureSidebarItem.d.ts +7 -0
  439. package/lib/types/features/permissions/UserPermissionsProvider.d.ts +19 -0
  440. package/lib/types/features/permissions/helpers.d.ts +4 -0
  441. package/lib/types/features/permissions/index.d.ts +4 -0
  442. package/lib/types/layout/AppLayout.d.ts +12 -0
  443. package/lib/types/layout/FullHeightLayout.d.ts +26 -0
  444. package/lib/types/layout/Navbar.d.ts +32 -0
  445. package/lib/types/layout/Sidebar.d.ts +29 -0
  446. package/lib/types/layout/SidebarContext.d.ts +8 -0
  447. package/lib/types/layout/TitleBar.d.ts +5 -0
  448. package/lib/types/layout/index.d.ts +6 -0
  449. package/lib/types/router/FixLinks.d.ts +6 -0
  450. package/lib/types/router/HistoryNavigator.d.ts +55 -0
  451. package/lib/types/router/Nav.d.ts +28 -0
  452. package/lib/types/router/NestedNavigationContext.d.ts +8 -0
  453. package/lib/types/router/NestedRouterProvider.d.ts +13 -0
  454. package/lib/types/router/PathMatcher.d.ts +35 -0
  455. package/lib/types/router/PathWithParams.d.ts +8 -0
  456. package/lib/types/router/Route404.d.ts +3 -0
  457. package/lib/types/router/RouteComponent.d.ts +5 -0
  458. package/lib/types/router/Router.d.ts +73 -0
  459. package/lib/types/router/RouterProvider.d.ts +14 -0
  460. package/lib/types/router/index.d.ts +10 -4
  461. package/lib/types/router/path.d.ts +7 -0
  462. package/lib/types/session/TypeRegistry.d.ts +9 -0
  463. package/lib/types/session/UserSession.d.ts +39 -0
  464. package/lib/types/session/UserSessionProvider.d.ts +6 -0
  465. package/lib/types/session/auth/composable.d.ts +25 -0
  466. package/lib/types/session/auth/firebase.d.ts +9 -0
  467. package/lib/types/session/auth/useAuthState.d.ts +9 -0
  468. package/lib/types/session/index.d.ts +6 -0
  469. package/lib/types/session/useUXTracking.d.ts +5 -0
  470. package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts +22 -0
  471. package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts +14 -0
  472. package/lib/types/widgets/codemirror/index.d.ts +1 -0
  473. package/lib/types/widgets/form/Form.d.ts +20 -0
  474. package/lib/types/widgets/form/FormContext.d.ts +16 -0
  475. package/lib/types/widgets/form/ManagedObject.d.ts +81 -0
  476. package/lib/types/widgets/form/fields.d.ts +15 -0
  477. package/lib/types/widgets/form/index.d.ts +6 -0
  478. package/lib/types/widgets/form/inputs.d.ts +7 -0
  479. package/lib/types/widgets/form/schema.d.ts +45 -0
  480. package/lib/types/widgets/index.d.ts +5 -0
  481. package/lib/types/widgets/json-view/JSONCode.d.ts +21 -0
  482. package/lib/types/widgets/json-view/JSONDisplay.d.ts +7 -0
  483. package/lib/types/widgets/json-view/JSONView.d.ts +6 -0
  484. package/lib/types/widgets/json-view/index.d.ts +4 -0
  485. package/lib/types/widgets/json-view/types.d.ts +7 -0
  486. package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts +9 -0
  487. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +74 -0
  488. package/lib/types/widgets/schema-editor/editor/Editable.d.ts +39 -0
  489. package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +7 -0
  490. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts +4 -0
  491. package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts +3 -0
  492. package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts +2 -0
  493. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts +8 -0
  494. package/lib/types/widgets/schema-editor/index.d.ts +7 -0
  495. package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts +15 -0
  496. package/lib/types/widgets/schema-editor/type-signature.d.ts +18 -0
  497. package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts +5 -0
  498. package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts +7 -0
  499. package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts +4 -0
  500. package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts +8 -0
  501. package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts +7 -0
  502. package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts +7 -0
  503. package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts +1 -0
  504. package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts +12 -0
  505. package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts +7 -0
  506. package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts +2 -0
  507. package/lib/types/widgets/xml-viewer/components/types.d.ts +103 -0
  508. package/lib/types/widgets/xml-viewer/constants/index.d.ts +16 -0
  509. package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts +3 -0
  510. package/lib/types/widgets/xml-viewer/helpers/index.d.ts +12 -0
  511. package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts +14 -0
  512. package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts +9 -0
  513. package/lib/types/widgets/xml-viewer/index.d.ts +2 -0
  514. package/lib/types/widgets/xml-viewer/types/index.d.ts +15 -0
  515. package/lib/vertesia-ui-core.js +2 -0
  516. package/lib/vertesia-ui-core.js.map +1 -0
  517. package/lib/vertesia-ui-env.js +2 -0
  518. package/lib/vertesia-ui-env.js.map +1 -0
  519. package/lib/vertesia-ui-features.js +1 -1
  520. package/lib/vertesia-ui-features.js.map +1 -1
  521. package/lib/vertesia-ui-layout.js +2 -0
  522. package/lib/vertesia-ui-layout.js.map +1 -0
  523. package/lib/vertesia-ui-router.js +1 -1
  524. package/lib/vertesia-ui-router.js.map +1 -1
  525. package/lib/vertesia-ui-session.js +1 -1
  526. package/lib/vertesia-ui-session.js.map +1 -1
  527. package/lib/vertesia-ui-widgets.js +2 -0
  528. package/lib/vertesia-ui-widgets.js.map +1 -0
  529. package/package.json +80 -19
  530. package/src/code/index.ts +1 -1
  531. package/src/core/components/Avatar.tsx +67 -0
  532. package/src/core/components/Badge.tsx +114 -0
  533. package/src/core/components/Button.tsx +63 -0
  534. package/src/core/components/Center.tsx +12 -0
  535. package/src/core/components/ComboBox.tsx +488 -0
  536. package/src/core/components/ConfirmModal.tsx +51 -0
  537. package/src/core/components/DeleteModal.tsx +45 -0
  538. package/src/core/components/Divider.tsx +11 -0
  539. package/src/core/components/Dropdown.tsx +63 -0
  540. package/src/core/components/DropdownList.tsx +72 -0
  541. package/src/core/components/EmptyCollection.tsx +39 -0
  542. package/src/core/components/FileUpload.tsx +196 -0
  543. package/src/core/components/Input.tsx +43 -0
  544. package/src/core/components/InputList.tsx +75 -0
  545. package/src/core/components/Link.tsx +16 -0
  546. package/src/core/components/MenuList.tsx +44 -0
  547. package/src/core/components/MessageBox.tsx +96 -0
  548. package/src/core/components/Modal.tsx +144 -0
  549. package/src/core/components/NumberInput.tsx +64 -0
  550. package/src/core/components/Portal.tsx +33 -0
  551. package/src/core/components/RadioGroup.tsx +100 -0
  552. package/src/core/components/SelectBox.tsx +188 -0
  553. package/src/core/components/SelectList.tsx +85 -0
  554. package/src/core/components/SelectStack.tsx +63 -0
  555. package/src/core/components/SidePanel.tsx +104 -0
  556. package/src/core/components/Spinner.tsx +33 -0
  557. package/src/core/components/Switch.tsx +29 -0
  558. package/src/core/components/Textarea.tsx +25 -0
  559. package/src/core/components/index.ts +39 -0
  560. package/src/core/components/libs/utils.tsx +6 -0
  561. package/src/core/components/libs/visuallyHidden.tsx +25 -0
  562. package/src/core/components/popup/Popup.tsx +94 -0
  563. package/src/core/components/popup/PopupController.ts +182 -0
  564. package/src/core/components/popup/index.ts +3 -0
  565. package/src/core/components/popup/position.ts +277 -0
  566. package/src/core/components/popup/utils.ts +82 -0
  567. package/src/core/components/shadcn/breadcrumb.tsx +174 -0
  568. package/src/core/components/shadcn/button.tsx +95 -0
  569. package/src/core/components/shadcn/calendar.tsx +87 -0
  570. package/src/core/components/shadcn/card.tsx +76 -0
  571. package/src/core/components/shadcn/checkbox.tsx +30 -0
  572. package/src/core/components/shadcn/command.tsx +155 -0
  573. package/src/core/components/shadcn/dialog.tsx +230 -0
  574. package/src/core/components/shadcn/filters/animateChangeInHeight.tsx +41 -0
  575. package/src/core/components/shadcn/filters/comboBox.tsx +251 -0
  576. package/src/core/components/shadcn/filters/dateFilter.tsx +65 -0
  577. package/src/core/components/shadcn/filters/filterBar.tsx +262 -0
  578. package/src/core/components/shadcn/filters/filters.tsx +110 -0
  579. package/src/core/components/shadcn/filters/index.ts +5 -0
  580. package/src/core/components/shadcn/filters/selectFilter.tsx +91 -0
  581. package/src/core/components/shadcn/filters/textFilter.tsx +59 -0
  582. package/src/core/components/shadcn/filters/types.ts +29 -0
  583. package/src/core/components/shadcn/heading.tsx +23 -0
  584. package/src/core/components/shadcn/index.ts +22 -0
  585. package/src/core/components/shadcn/input.tsx +89 -0
  586. package/src/core/components/shadcn/label.tsx +31 -0
  587. package/src/core/components/shadcn/popover.tsx +115 -0
  588. package/src/core/components/shadcn/selectBox.tsx +186 -0
  589. package/src/core/components/shadcn/separator.tsx +29 -0
  590. package/src/core/components/shadcn/tabs.tsx +218 -0
  591. package/src/core/components/shadcn/text.tsx +33 -0
  592. package/src/core/components/shadcn/theme/ThemeProvider.tsx +73 -0
  593. package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +35 -0
  594. package/src/core/components/shadcn/tooltip.tsx +57 -0
  595. package/src/core/components/styles.ts +11 -0
  596. package/src/core/components/table/index.tsx +49 -0
  597. package/src/core/components/tabs/Tabs.tsx +132 -0
  598. package/src/core/components/tabs/TabsContext.ts +25 -0
  599. package/src/core/components/tabs/index.ts +2 -0
  600. package/src/core/components/toast/NotificationPanel.tsx +91 -0
  601. package/src/core/components/toast/ToastContext.ts +12 -0
  602. package/src/core/components/toast/ToastProps.ts +6 -0
  603. package/src/core/components/toast/ToastProvider.tsx +26 -0
  604. package/src/core/components/toast/index.ts +2 -0
  605. package/src/core/hooks/CompositeState.tsx +142 -0
  606. package/src/core/hooks/SharedState.tsx +69 -0
  607. package/src/core/hooks/index.ts +13 -0
  608. package/src/core/hooks/useClickOutside.tsx +29 -0
  609. package/src/core/hooks/useCopyToClipboard.tsx +28 -0
  610. package/src/core/hooks/useDarkMode.ts +11 -0
  611. package/src/core/hooks/useDebounce.tsx +15 -0
  612. package/src/core/hooks/useEventSource.ts +35 -0
  613. package/src/core/hooks/useFetch.ts +51 -0
  614. package/src/core/hooks/useFlag.tsx +13 -0
  615. package/src/core/hooks/useIntersectionObserver.tsx +40 -0
  616. package/src/core/hooks/useIsFistRendering.ts +17 -0
  617. package/src/core/hooks/useSafeLayoutEffect.ts +5 -0
  618. package/src/core/hooks/useSharedValue.ts +22 -0
  619. package/src/core/index.ts +2 -0
  620. package/src/env/index.ts +116 -0
  621. package/src/features/activity-doc/ActivityDoc.tsx +199 -0
  622. package/src/features/activity-doc/index.ts +1 -0
  623. package/src/features/index.ts +2 -1
  624. package/src/features/permissions/SecureButton.tsx +18 -0
  625. package/src/features/permissions/SecureSidebarItem.tsx +19 -0
  626. package/src/features/permissions/UserPermissionsProvider.tsx +102 -0
  627. package/src/features/permissions/helpers.ts +16 -0
  628. package/src/features/permissions/index.ts +4 -0
  629. package/src/layout/AppLayout.tsx +132 -0
  630. package/src/layout/FullHeightLayout.tsx +74 -0
  631. package/src/layout/Navbar.tsx +127 -0
  632. package/src/layout/Sidebar.tsx +129 -0
  633. package/src/layout/SidebarContext.ts +17 -0
  634. package/src/layout/TitleBar.tsx +7 -0
  635. package/src/layout/index.ts +6 -0
  636. package/src/router/FixLinks.tsx +28 -0
  637. package/src/router/HistoryNavigator.ts +178 -0
  638. package/src/router/Nav.tsx +55 -0
  639. package/src/router/NestedNavigationContext.tsx +32 -0
  640. package/src/router/NestedRouterProvider.tsx +64 -0
  641. package/src/router/PathMatcher.ts +166 -0
  642. package/src/router/PathWithParams.ts +34 -0
  643. package/src/router/Route404.tsx +18 -0
  644. package/src/router/RouteComponent.tsx +41 -0
  645. package/src/router/Router.tsx +216 -0
  646. package/src/router/RouterProvider.tsx +55 -0
  647. package/src/router/index.ts +10 -8
  648. package/src/router/path.ts +151 -0
  649. package/src/session/TypeRegistry.ts +27 -0
  650. package/src/session/UserSession.ts +227 -0
  651. package/src/session/UserSessionProvider.tsx +170 -0
  652. package/src/session/auth/composable.ts +190 -0
  653. package/src/session/auth/firebase.ts +160 -0
  654. package/src/session/auth/useAuthState.ts +61 -0
  655. package/src/session/index.ts +6 -1
  656. package/src/session/useUXTracking.tsx +38 -0
  657. package/src/widgets/codemirror/CodeMirrorEditor.tsx +121 -0
  658. package/src/widgets/codemirror/CodemirrorStateSingleton.tsx +39 -0
  659. package/src/widgets/codemirror/index.ts +2 -0
  660. package/src/widgets/form/Form.tsx +194 -0
  661. package/src/widgets/form/FormContext.ts +38 -0
  662. package/src/widgets/form/ManagedObject.ts +332 -0
  663. package/src/widgets/form/fields.tsx +34 -0
  664. package/src/widgets/form/index.ts +6 -0
  665. package/src/widgets/form/inputs.tsx +44 -0
  666. package/src/widgets/form/schema.ts +215 -0
  667. package/src/widgets/index.ts +5 -0
  668. package/src/widgets/json-view/JSONCode.tsx +176 -0
  669. package/src/widgets/json-view/JSONDisplay.tsx +24 -0
  670. package/src/widgets/json-view/JSONView.tsx +183 -0
  671. package/src/widgets/json-view/index.ts +4 -0
  672. package/src/widgets/json-view/types.ts +5 -0
  673. package/src/widgets/schema-editor/JSONSchemaEditorModal.tsx +68 -0
  674. package/src/widgets/schema-editor/ManagedSchema.ts +340 -0
  675. package/src/widgets/schema-editor/editor/Editable.tsx +252 -0
  676. package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +15 -0
  677. package/src/widgets/schema-editor/editor/PropertyEditor.tsx +150 -0
  678. package/src/widgets/schema-editor/editor/PropertyViewer.tsx +15 -0
  679. package/src/widgets/schema-editor/editor/SchemaContext.tsx +9 -0
  680. package/src/widgets/schema-editor/editor/SchemaEditor.test.ts +48 -0
  681. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +161 -0
  682. package/src/widgets/schema-editor/index.ts +7 -0
  683. package/src/widgets/schema-editor/json-schema4-utils.ts +187 -0
  684. package/src/widgets/schema-editor/type-signature.ts +39 -0
  685. package/src/widgets/xml-viewer/components/Attributes/index.tsx +27 -0
  686. package/src/widgets/xml-viewer/components/CDataTag/index.tsx +21 -0
  687. package/src/widgets/xml-viewer/components/CollapseIcon/index.tsx +32 -0
  688. package/src/widgets/xml-viewer/components/CommentTag/index.tsx +30 -0
  689. package/src/widgets/xml-viewer/components/DeclarationTag/index.tsx +23 -0
  690. package/src/widgets/xml-viewer/components/Elements/index.tsx +83 -0
  691. package/src/widgets/xml-viewer/components/InvalidXml/index.tsx +3 -0
  692. package/src/widgets/xml-viewer/components/Tag/index.tsx +47 -0
  693. package/src/widgets/xml-viewer/components/TextElement/index.tsx +28 -0
  694. package/src/widgets/xml-viewer/components/XMLViewer.tsx +53 -0
  695. package/src/widgets/xml-viewer/components/types.ts +104 -0
  696. package/src/widgets/xml-viewer/constants/index.ts +17 -0
  697. package/src/widgets/xml-viewer/context/xml-viewer-context.ts +12 -0
  698. package/src/widgets/xml-viewer/helpers/index.ts +56 -0
  699. package/src/widgets/xml-viewer/hooks/useCollapsible.ts +28 -0
  700. package/src/widgets/xml-viewer/hooks/useXMLViewer.ts +34 -0
  701. package/src/widgets/xml-viewer/index.ts +2 -0
  702. package/src/widgets/xml-viewer/types/index.ts +21 -0
  703. package/lib/esm/components/index.js +0 -3
  704. package/lib/esm/components/index.js.map +0 -1
  705. package/lib/types/components/index.d.ts +0 -0
  706. package/lib/vertesia-ui-components.js +0 -2
  707. package/lib/vertesia-ui-components.js.map +0 -1
  708. package/src/components/index.ts +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js","esm/widgets/json-view/JSONCode.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/codemirror/CodemirrorStateSingleton.js","esm/widgets/codemirror/CodeMirrorEditor.js","esm/widgets/schema-editor/JSONSchemaEditorModal.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/fields.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js"],"sourcesContent":["export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"path\", { d: \"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { isEqual } from 'lodash-es';\nimport { useEffect, useMemo, useState } from 'react';\nimport { defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n const [theme, setTheme] = useState(() => ({ ...defaultTheme, ...customTheme }));\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n useEffect(() => {\n setTheme((currentTheme) => {\n const nextTheme = { ...defaultTheme, ...customTheme };\n return isEqual(nextTheme, currentTheme) ? currentTheme : nextTheme;\n });\n }, [customTheme]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ObjectWalker } from \"@vertesia/json\";\nimport { useEffect, useState } from \"react\";\nconst st_code = \"bg-gray-100 dark:bg-slate-800 whitespace-pre-wrap p-4 rounded-lg font-mono\";\nconst st_punct = \"text-pink-500 dark:text-pink-400\";\nconst st_symbol = \"text-purple-500 dark:text-purple-400\";\nconst st_number = \"text-green-500 dark:text-green-400\";\nconst st_string = \"text-orange-500 dark:text-orange-400\";\nconst st_key = \"text-blue-500 dark:text-blue-400\";\nconst defaultClassMap = {\n code: st_code,\n comma: st_punct,\n assign: st_punct,\n startObject: st_punct,\n endObject: st_punct,\n startArray: st_punct,\n endArray: st_punct,\n boolean: st_symbol,\n null: st_symbol,\n key: st_key,\n index: st_key,\n string: st_string,\n number: st_number,\n};\nclass Block {\n renderer;\n parent;\n key;\n indent;\n result = [];\n constructor(renderer, parent, key, indent) {\n this.renderer = renderer;\n this.parent = parent;\n this.key = key;\n this.indent = indent;\n }\n get classMap() {\n return this.renderer.classMap;\n }\n writeKey(key) {\n const type = typeof key;\n if (type === 'string') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n this.result.push(`<span class=\"${this.classMap.key}\">\"${key}\"</span><span class='${this.classMap.assign}'>: </span>`);\n }\n else if (type === 'number') {\n if (this.result.length > 0) {\n this.result.push(`<span class='${this.classMap.comma}'>,\\n</span>`);\n }\n this.indent && this.result.push(this.indent);\n }\n }\n pushValue(key, value) {\n this.writeKey(key);\n if (value === null) {\n this.result.push(`<span class='${this.classMap.null}'>null</span>`);\n }\n else if (value instanceof Block) {\n this.result.push(value.renderStart() + value.renderValue() + value.renderEnd());\n }\n else {\n let valueClass;\n const type = typeof value;\n if (type === 'string') {\n value = `\"${value}\"`;\n value = value.replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n valueClass = this.classMap.string;\n }\n else if (type === 'number') {\n valueClass = this.classMap.number;\n }\n else if (type === 'boolean') {\n valueClass = this.classMap.boolean;\n }\n this.result.push(`<span class='${valueClass}'>${value}</span>`);\n }\n }\n renderValue() {\n return this.result.join('');\n }\n}\nclass ObjectBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startObject}'>{\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endObject}'>${NL}${this.parent?.indent || ''}}</span>`;\n }\n}\nclass ArrayBlock extends Block {\n constructor(renderer, parent, key, indent) {\n super(renderer, parent, key, indent);\n }\n renderStart() {\n return `<span class='${this.classMap.startArray}'>[\\n</span>`;\n }\n renderEnd() {\n const NL = this.result.length > 0 ? '\\n' : '';\n return `<span class='${this.classMap.endArray}'>${NL}${this.parent?.indent || ''}]</span>`;\n }\n}\nclass JsonRenderer {\n classMap;\n tab;\n stack = [];\n block = new ObjectBlock(this, undefined, '', '');\n constructor(classMap = defaultClassMap, tab = ' ') {\n this.classMap = classMap;\n this.tab = tab;\n }\n onStartObject(key) {\n const nested = new ObjectBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndObject() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onStartIteration(key) {\n const nested = new ArrayBlock(this, this.block, key, this.block.indent + this.tab);\n this.stack.push(this.block);\n this.block = nested;\n }\n onEndIteration() {\n const currentBlock = this.block;\n this.block = this.stack.pop();\n this.block.pushValue(currentBlock.key, currentBlock);\n }\n onValue(key, value) {\n this.block.pushValue(key, value);\n }\n}\nfunction renderJson(json, classMap, className) {\n const renderer = new JsonRenderer(classMap);\n new ObjectWalker().walk(json, renderer);\n const out = renderer.block.renderValue();\n return _jsx(\"div\", { className: className, dangerouslySetInnerHTML: { __html: `<div class='${renderer.classMap.code}' style='overflow-x: scroll'>${out}</div>` } });\n}\nexport function JSONCode({ data, className, classMap }) {\n const [element, setElement] = useState();\n useEffect(() => {\n setElement(renderJson(data, classMap, className));\n }, [data]);\n return element;\n}\n//# sourceMappingURL=JSONCode.js.map","import Ajv from \"ajv\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: { type: 'any' } };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.validator = new Ajv({ strict: false }).compile(this.schema);\n this.load();\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return true;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = { type: 'any' };\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onCHnage only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { EditorState, Text } from '@codemirror/state';\nlet stateInstance = null;\n/**\n * Returns a shared instance of CodeMirror's EditorState.\n * If the instance doesn't exist, it creates one with the given initial content.\n *\n * @param initialDoc - The initial content for the editor, either as a `string` or `Text`.\n * @param extensions - Optional extensions to be applied to the editor.\n * @returns The shared EditorState instance.\n**/\nexport const getSharedEditorState = (initialDoc = \"\", extensions = []) => {\n const doc = typeof initialDoc === \"string\" ? Text.of(initialDoc.split(\"\\n\")) : initialDoc;\n if (!stateInstance) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n else if (stateInstance.doc.toString() !== doc.toString()) {\n stateInstance = EditorState.create({\n doc,\n extensions,\n });\n }\n return stateInstance;\n};\n/**\n * Resets the singleton instance (useful for testing or reinitializing).\n**/\nexport const resetSharedEditorState = () => {\n stateInstance = null;\n};\n//# sourceMappingURL=CodemirrorStateSingleton.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport debounce from 'debounce';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { EditorView } from '@codemirror/view';\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { getSharedEditorState } from './CodemirrorStateSingleton';\nexport class EditorApi {\n editor;\n constructor(editor) {\n this.editor = editor;\n }\n setValue(value) {\n this.editor.dispatch({\n changes: {\n from: 0,\n to: this.editor.state.doc.length,\n insert: value || \"\",\n },\n });\n }\n getValue() {\n return this.editor.state.doc.toString();\n }\n}\nconst customTheme = EditorView.theme({\n \"&\": { fontSize: \"16px\", fontFamily: \"Sans-Serif\" },\n \".cm-content\": { fontFamily: \"inherit\" },\n \".cm-scroller\": { fontFamily: \"inherit\" },\n \".cm-gutters\": { backgroundColor: \"transparent\", color: \"#ddd\" },\n \".cm-focused\": { outline: \"none\" },\n \".cm-cursor\": {\n borderLeft: \"2px solid #000\",\n borderLeftColor: \"#000\",\n animation: \"blink 1.2s step-start infinite\"\n },\n \"@keyframes blink\": { \"50%\": { opacity: 0 } }\n});\nconst baseExtensions = [\n customTheme,\n EditorView.lineWrapping,\n];\nfunction updateListenerExtension(cb) {\n return EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n cb(update);\n }\n });\n}\n;\n/**\n * The className is only used on the first rendering - the editor class will not be updated if the property changes\n**/\nexport function CodeMirrorEditor({ onChange, value, className, editorRef, extensions, debounceTimeout = 0 }) {\n const ref = useRef(null);\n // the onChange property may change so we need to store it in a\n // reference to be able to update it when it changes without\n // re-registering the listener on codemirror since codemirror can only register\n // listeners at creation\n const onChangeRef = useRef(undefined);\n useEffect(() => {\n if (onChange) {\n onChangeRef.current = debounceTimeout > 0\n ? debounce(onChange, debounceTimeout)\n : onChange;\n return () => {\n // WE MUST NOT CANCEL THE DEBOUNCE even if we unset the onChange impl\n // otherwise some updates will never happens\n onChangeRef.current = undefined;\n };\n }\n }, [onChange, debounceTimeout]);\n const component = useMemo(() => _jsx(\"div\", { ref: ref, className: className }), [className]);\n useSafeLayoutEffect(() => {\n if (ref.current) {\n let actualExtensions = [...baseExtensions, updateListenerExtension((update) => {\n onChangeRef.current?.(update);\n })];\n if (Array.isArray(extensions)) {\n actualExtensions = actualExtensions.concat(extensions);\n }\n else if (extensions) {\n actualExtensions.push(extensions);\n }\n const sharedState = getSharedEditorState(value, actualExtensions);\n const editor = new EditorView({\n state: sharedState,\n parent: ref.current,\n });\n const api = new EditorApi(editor);\n if (editorRef) {\n editorRef.current = api;\n }\n return () => {\n editor.destroy();\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }\n }, [component, extensions]);\n return component;\n}\n//# sourceMappingURL=CodeMirrorEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { json } from \"@codemirror/lang-json\";\nimport { CodeMirrorEditor } from \"../codemirror\";\nimport { Button, VModal, VModalBody, VModalFooter, VModalTitle } from \"@vertesia/ui/core\";\nimport { useToast } from \"@vertesia/ui/core\";\nimport { basicSetup } from \"codemirror\";\nimport { useMemo, useRef } from \"react\";\nimport { JSONCode } from '../json-view';\nfunction contentToJSON(content) {\n if (!content)\n return undefined;\n content = content.trim();\n if (!content)\n return undefined;\n return JSON.parse(content);\n}\nfunction jsonToContent(json) {\n if (!json)\n return '';\n return JSON.stringify(json, null, 2);\n}\nconst extensions = [basicSetup, json()];\nexport function JSONSchemaEditorModal({ schema, isOpen, onClose, readonly = false }) {\n const editorRef = useRef(undefined);\n const toast = useToast();\n const value = useMemo(() => {\n return jsonToContent(schema.schema);\n }, [schema]);\n const onSaveChanges = () => {\n if (editorRef.current) {\n const value = editorRef.current.getValue();\n try {\n const newSchema = contentToJSON(value);\n schema.replaceSchema(newSchema);\n onClose();\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid JSON Schema',\n description: err.message,\n duration: 5000\n });\n }\n }\n };\n return (_jsxs(VModal, { onClose: onClose, isOpen: !!isOpen, className: 'min-w-[60vw]', children: [_jsx(VModalTitle, { children: \"JSON Schema Editor\" }), _jsx(VModalBody, { children: !readonly ? _jsx(CodeMirrorEditor, { value: value, extensions: extensions, editorRef: editorRef })\n : _jsx(JSONCode, { data: schema.schema || {} }) }), _jsx(VModalFooter, { children: !readonly ? _jsx(Button, { onClick: onSaveChanges, children: \"Save changes\" }) : null })] }));\n}\n//# sourceMappingURL=JSONSchemaEditorModal.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor || schema.format) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n this.schema.format = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n this.schema.format = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(VSelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(VModal, { isOpen: isOpen, onClose: onClose, children: [_jsx(VModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-gray-400', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { Pencil, Trash2 } from 'lucide-react';\nimport { Styles } from '@vertesia/ui/core';\nimport { useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block sm:text-sm sm:leading-6 rounded-md border-0 py-1.5 px-2 text-gray-900 dark:text-slate-50\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-gray-300 dark:hover:ring-slate-600`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-gray-300 dark:ring-slate-600`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'hidden group-hover:block text-gray-400 hover:text-gray-600 dark:text-gray-600 dark:hover:text-gray-400';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(\"button\", { className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(\"button\", { className: btnStyle, onClick: onEdit, children: _jsx(Pencil, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(\"button\", { className: \"ml-1 py-2 flex items-center text-gray-400 hover:text-indigo-600\", onClick: add, children: [_jsx(Plus, { className: 'size-5' }), _jsx(\"div\", { className: 'ml-2', children: \"Add property\" })] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nclass FormContext {\n object;\n components;\n constructor(object, components = {}) {\n this.object = object;\n this.components = components;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function FormLabel({ htmlFor, required, children }) {\n return (_jsxs(\"label\", { htmlFor: htmlFor, className: \"block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200\", children: [children, required && _jsx(\"sup\", { className: \"text-red-600\", children: \"*\" })] }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { FormContextProvider, useForm } from \"./FormContext.js\";\nimport { FormLabel, FormHelper } from \"./fields.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: {\n object,\n components: components || {}\n }, children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\n// interface FieldSetProps {\n// name: string;\n// children?: ReactNode | ReactNode[];\n// }\n// export function FieldSet({ name, children }: FieldSetProps) {\n// const ctx = useForm();\n// const newCtx = {\n// ...ctx,\n// object: ctx.object.getProperty(name) as ManagedObjectProperty\n// }\n// return (\n// <FormContextProvider value={newCtx}>\n// {children}\n// </FormContextProvider>\n// )\n// }\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n const { value } = event.target;\n object.value = object.schema.isNumber ? parseFloat(value) : value;\n };\n return (_jsxs(\"div\", { className: \"\", children: [_jsxs(\"div\", { className: clsx('flex gap-2', inline ? 'flex-row items-center' : 'flex-col'), children: [!object.isListItem && _jsx(FormLabel, { required: object.schema.isRequired, children: object.title }), _jsx(Component, { object: object, type: inputType, onChange: handleOnChange })] }), object.schema.description && _jsx(FormHelper, { children: object.schema.description })] }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const addItem = () => {\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index) }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'soft', onClick: addItem, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'soft', onClick: onDelete, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map"],"names":["ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","fontFamily","XMLViewerContext","createContext","theme","collapsible","indentSize","useXMLViewerContext","useContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","props","indentation","children","isInline","_jsxs","style","color","_jsx","CollapseIcon","collapsed","position","right","border","padding","background","Caret","fill","transform","transition","attrs","width","height","viewBox","d","useCollapsible","level","initialCollapsedDepth","setCollapsed","useState","isNil","useEffect","buttonProps","onClick","currentCollapsed","role","cursor","CommentTag","Attributes","attributes","Object","entries","map","key","value","DeclarationTag","tagKey","slice","hasBreakLines","elements","includes","getTagProps","element","elementWithoutAttributes","omit","subElements","type","startsWith","getTagType","hasAttributes","keys","length","Tag","hasChildren","_Fragment","TextElement","hasSiblings","text","isText","undefined","split","filter","trim","line","index","Elements","Array","isArray","size","join","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","setTheme","json","valid","useMemo","XMLValidator","validate","Error","parse","e","errorMessage","message","useXMLViewer","context","currentTheme","nextTheme","isEqual","Provider","className","whiteSpace","overflowWrap","st_punct","st_symbol","st_key","defaultClassMap","code","comma","assign","startObject","endObject","startArray","endArray","boolean","null","string","number","Block","renderer","parent","indent","result","constructor","this","classMap","writeKey","push","pushValue","renderStart","renderValue","renderEnd","valueClass","replace","ObjectBlock","super","NL","ArrayBlock","JsonRenderer","tab","stack","block","onStartObject","nested","onEndObject","currentBlock","pop","onStartIteration","onEndIteration","onValue","JSONCode","data","setElement","ObjectWalker","walk","out","dangerouslySetInnerHTML","__html","renderJson","Schema","schema","properties","validator","Ajv","strict","compile","load","forEach","name","loadProperty","hasProperties","title","description","propertySchema","property","ArrayPropertySchema","PropertySchema","errors","addProperty","typeOrSchema","isRequired","items","removeProperty","required","x","getProperty","editor","isMulti","isReadOnly","readOnly","defaultValue","default","enum","values","concat","remove","isBoolean","isString","isNumber","isObject","arraySchema","getArrayElementType","computeTitleFromName","toUpperCase","getInputType","_name","Node","observer","isRoot","root","path","isScalar","isListItem","isList","onChange","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","Symbol","iterator","ManagedObject","_v","add","newItem","ManageObjectEntry","ManagedScalarEntry","item","splice","i","l","String","Date","now","JSONView","PropertyElement","PropertyTitle","BlockElement","clsx","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","itemMediumLength","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","stateInstance","EditorApi","setValue","dispatch","changes","from","to","state","doc","insert","getValue","toString","baseExtensions","EditorView","fontSize","backgroundColor","outline","borderLeft","borderLeftColor","animation","opacity","lineWrapping","CodeMirrorEditor","editorRef","extensions","debounceTimeout","ref","useRef","onChangeRef","current","debounce","component","useSafeLayoutEffect","actualExtensions","cb","update","updateListener","of","docChanged","sharedState","initialDoc","Text","EditorState","create","getSharedEditorState","api","destroy","basicSetup","JSONSchemaEditorModal","isOpen","onClose","readonly","toast","useToast","JSON","stringify","jsonToContent","VModal","VModalTitle","VModalBody","VModalFooter","Button","newSchema","contentToJSON","replaceSchema","err","status","duration","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","format","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","child","findAvailableChildName","prefix","addChild","addRequired","c","updated","newName","newProperties","setPropertyName","indexOf","setRequireProperty","actualType","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","endsWith","substring","object","parseTypeSignature","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","options","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","variant","AlignLeft","EditDescriptionModal","focus","onKeyUp","target","Styles","INPUT_UNSTYLED","display","VSelectBox","onBlur","onKeyDown","popupClass","EditDescriptionModalForm","currentValue","setCurrentValue","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","onDelete","outlineOnHover","editOnClick","placeholder","viewer","skipClickOutside","isEditing","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","Trash2","Pencil","Editor","actualValue","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","stopPropagation","autoSave","clearTimeout","setTimeout","closest","SchemaEditor","prop","renderProperty","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","test","editableProp","Plus","FieldSetContext","FieldSetContextProvider","useFieldSet","ctx","_FormContext","useForm","FormContextProvider","FormLabel","htmlFor","FormHelper","FormError","Input","React","forwardRef","booleanValue","setBooleanValue","INPUT","_onChange","ev","checked","Form","components","onSubmit","evt","preventDefault","GeneratedFormFields","GeneratedForm","ListField","CompositeField","ScalarField","inline","Component","inputType","event","parseFloat","ListItem","list","deleteItem"],"mappings":"27BAAO,MACMA,EAAiB,QACjBC,EAAoB,WACpBC,EAAkB,SAClBC,EAAkB,kBAElBC,EAAe,CACxBC,SAAU,UACVC,UAAW,OACXC,kBAAmB,UACnBC,oBAAqB,UACrBC,eAAgB,OAChBC,aAAc,OACdC,WAAY,UACZC,WAAY,aCPHC,EAAmBC,EALX,CACjBC,MAAOX,EACPY,aAAa,EACbC,WAAY,IAGHC,EAAsB,IAAMC,EAAWN,GCL9CO,EAAS,IAAIC,EAAU,CACzBC,eAAe,EACfC,kBAAkB,EAClBC,oBAAqB,GACrBC,wBAAwB,EACxBC,gBAAiBzB,EACjB0B,cAAezB,EACf0B,eAAe,ICRZ,SAASC,EAASC,GACrB,MAAMC,YAAEA,EAAWC,SAAEA,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OAqCyHvL,EAAK+T,EAAQ,CAAE6E,QAAS,OAAQnX,QAAS6Y,EAAU3a,SAAUK,EAAK0b,EAAQ,CAAEzV,UAAW,gBA7CzQ,IAA4ByW,EAAMnR,CA8ClC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/ui",
3
- "version": "0.56.0",
3
+ "version": "0.58.0",
4
4
  "description": "Vertesia UI components and and hooks",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -18,45 +18,96 @@
18
18
  "hooks"
19
19
  ],
20
20
  "dependencies": {
21
+ "@codemirror/lang-json": "^6.0.1",
22
+ "@codemirror/state": "^6.5.2",
23
+ "@codemirror/view": "^6.36.8",
24
+ "@headlessui/react": "^2.2.2",
25
+ "@radix-ui/react-checkbox": "^1.3.1",
26
+ "@radix-ui/react-dialog": "^1.1.13",
27
+ "@radix-ui/react-label": "^2.1.6",
28
+ "@radix-ui/react-popover": "^1.1.13",
29
+ "@radix-ui/react-separator": "^1.1.6",
30
+ "@radix-ui/react-slot": "^1.2.2",
31
+ "@radix-ui/react-tabs": "^1.1.11",
32
+ "@radix-ui/react-tooltip": "^1.2.6",
33
+ "ajv": "^8.16.0",
34
+ "class-variance-authority": "^0.7.1",
35
+ "clsx": "^2.1.1",
36
+ "cmdk": "^1.1.1",
37
+ "codemirror": "^6.0.1",
38
+ "date-fns": "^4.1.0",
39
+ "debounce": "^2.2.0",
40
+ "fast-xml-parser": "^5.2.3",
41
+ "firebase": "^10.12.2",
42
+ "jwt-decode": "^4.0.0",
43
+ "lodash-es": "^4.17.21",
44
+ "lucide-react": "^0.511.0",
45
+ "motion": "^12.12.1",
21
46
  "react": "^19.1.0",
47
+ "react-day-picker": "^8.10.1",
22
48
  "react-dom": "^19.1.0",
23
- "@vertesia/client": "0.56.0",
24
- "@vertesia/common": "0.56.0"
49
+ "tailwind-merge": "^3.3.0",
50
+ "@vertesia/client": "0.58.0",
51
+ "@vertesia/json": "0.58.0",
52
+ "@vertesia/common": "0.58.0"
25
53
  },
26
54
  "devDependencies": {
55
+ "@eslint/js": "^9.27.0",
27
56
  "@rollup/plugin-commonjs": "^28.0.3",
57
+ "@rollup/plugin-json": "^6.1.0",
28
58
  "@rollup/plugin-node-resolve": "^16.0.1",
29
- "@rollup/plugin-typescript": "^12.1.2",
30
- "@types/react": "^19.1.2",
31
- "@types/react-dom": "^19.1.2",
59
+ "@types/lodash-es": "^4.17.12",
60
+ "@types/node": "^22.15.21",
61
+ "@types/react": "^19.1.0",
62
+ "@types/react-dom": "^19.1.1",
63
+ "eslint": "^9.27.0",
64
+ "eslint-import-resolver-typescript": "^4.3.5",
65
+ "eslint-plugin-import": "^2.31.0",
66
+ "eslint-plugin-react": "^7.37.5",
67
+ "eslint-plugin-react-hooks": "^5.2.0",
68
+ "rimraf": "^6.0.1",
32
69
  "rollup": "^4.40.2",
33
70
  "rollup-plugin-terser": "^7.0.2",
34
- "typescript": "~5.8.3"
71
+ "typescript": "~5.8.3",
72
+ "typescript-eslint": "^8.32.1",
73
+ "vitest": "^3.0.9"
35
74
  },
36
75
  "exports": {
37
76
  "./router": {
38
77
  "types": "./lib/types/router/index.d.ts",
39
- "default": "./lib/router.js"
78
+ "default": "./lib/esm/router/index.js"
79
+ },
80
+ "./env": {
81
+ "types": "./lib/types/env/index.d.ts",
82
+ "default": "./lib/esm/env/index.js"
40
83
  },
41
84
  "./session": {
42
85
  "types": "./lib/types/session/index.d.ts",
43
- "default": "./lib/session.js"
86
+ "default": "./lib/esm/session/index.js"
87
+ },
88
+ "./core": {
89
+ "types": "./lib/types/core/index.d.ts",
90
+ "default": "./lib/esm/core/index.js"
44
91
  },
45
- "./components": {
46
- "types": "./lib/types/components/index.d.ts",
47
- "default": "./lib/components.js"
92
+ "./widgets": {
93
+ "types": "./lib/types/widgets/index.d.ts",
94
+ "default": "./lib/esm/widgets/index.js"
48
95
  },
49
96
  "./code": {
50
97
  "types": "./lib/types/code/index.d.ts",
51
- "default": "./lib/code.js"
98
+ "default": "./lib/esm/code/index.js"
52
99
  },
53
100
  "./form": {
54
101
  "types": "./lib/types/form/index.d.ts",
55
- "default": "./lib/form.js"
102
+ "default": "./lib/esm/form/index.js"
103
+ },
104
+ "./layout": {
105
+ "types": "./lib/types/layout/index.d.ts",
106
+ "default": "./lib/esm/layout/index.js"
56
107
  },
57
108
  "./features": {
58
109
  "types": "./lib/types/features/index.d.ts",
59
- "default": "./lib/features.js"
110
+ "default": "./lib/esm/features/index.js"
60
111
  }
61
112
  },
62
113
  "types": "./lib/index.d.ts",
@@ -65,11 +116,17 @@
65
116
  "router": [
66
117
  "./lib/types/router/index.d.ts"
67
118
  ],
119
+ "env": [
120
+ "./lib/types/env/index.d.ts"
121
+ ],
68
122
  "session": [
69
123
  "./lib/types/session/index.d.ts"
70
124
  ],
71
- "components": [
72
- "./lib/types/components/index.d.ts"
125
+ "core": [
126
+ "./lib/types/core/index.d.ts"
127
+ ],
128
+ "widgets": [
129
+ "./lib/types/widgets/index.d.ts"
73
130
  ],
74
131
  "code": [
75
132
  "./lib/types/code/index.d.ts"
@@ -77,13 +134,17 @@
77
134
  "features": [
78
135
  "./lib/types/features/index.d.ts"
79
136
  ],
137
+ "layout": [
138
+ "./lib/types/layout/index.d.ts"
139
+ ],
80
140
  "form": [
81
141
  "./lib/types/form/index.d.ts"
82
142
  ]
83
143
  }
84
144
  },
85
145
  "scripts": {
86
- "build": "tsc -b && pnpm exec rollup -c",
87
- "lint": "eslint ."
146
+ "build": "pnpm lint && pnpm exec rimraf ./lib && tsc -b && pnpm exec rollup -c",
147
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
148
+ "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix"
88
149
  }
89
150
  }
package/src/code/index.ts CHANGED
@@ -1 +1 @@
1
- // code components impl
1
+ // code components impl
@@ -0,0 +1,67 @@
1
+
2
+ function getRealSize(size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl') {
3
+ switch (size) {
4
+ case 'xs': return 'size-4';
5
+ case 'sm': return 'size-6';
6
+ case 'md': return 'size-8';
7
+ case 'lg': return 'size-10';
8
+ case 'xl': return 'size-12';
9
+ case '2xl': return 'size-14';
10
+ default: throw new Error('Unexpected size: ' + size);
11
+ }
12
+ }
13
+
14
+ interface AvatarProps {
15
+ shape?: "circle" | "rect"
16
+ src?: string
17
+ name?: string
18
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
19
+ color?: string; // the color class
20
+ className?: string
21
+ }
22
+ export function Avatar({ size, src, name, shape = "circle", color = 'bg-gray-500', className }: AvatarProps) {
23
+ const rounded = shape === 'circle' ? 'rounded-full' : 'rounded-md';
24
+ const sizeClass = getRealSize(size || 'md');
25
+
26
+ if (src) {
27
+ return (
28
+ <img
29
+ className={`inline-block ${sizeClass} ${rounded} ${color} ${className}`}
30
+ src={src}
31
+ alt={name || src}
32
+ title={name}
33
+ />
34
+ )
35
+ }
36
+
37
+ if (name) {
38
+ const [first, second] = name.split(' ');
39
+ let text = second ? `${first[0]}${second[0]}` : `${first[0]}${first[1]}`;
40
+ return (
41
+ <span className={`inline-flex ${sizeClass} items-center justify-center ${rounded} ${color} ${className}`} title={name}>
42
+ <span className={`${(size != 'xs') ? 'text-xs' : 'text-[0.6rem]'} font-medium leading-none text-white`}>{text}</span>
43
+ </span>
44
+ )
45
+ }
46
+
47
+ return (
48
+ <span className={`inline-block ${sizeClass} overflow-hidden ${rounded} ${color}`}>
49
+ <svg className="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
50
+ <path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
51
+ </svg>
52
+ </span>
53
+ )
54
+ }
55
+ interface SvgAvatarProps extends Omit<AvatarProps, 'src' | 'name'> {
56
+ children?: React.ReactNode
57
+ className?: string
58
+ }
59
+ export function SvgAvatar({ size, shape = "circle", color = 'bg-gray-500', className, children }: SvgAvatarProps) {
60
+ const rounded = shape === 'circle' ? 'rounded-full' : 'rounded-md';
61
+ const sizeClass = getRealSize(size || 'md');
62
+ return (
63
+ <span className={`inline-block ${sizeClass} overflow-hidden ${rounded} ${color} ${className}`}>
64
+ {children}
65
+ </span>
66
+ )
67
+ }