@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.
- package/lib/esm/core/components/Avatar.js +31 -0
- package/lib/esm/core/components/Avatar.js.map +1 -0
- package/lib/esm/core/components/Badge.js +62 -0
- package/lib/esm/core/components/Badge.js.map +1 -0
- package/lib/esm/core/components/Button.js +32 -0
- package/lib/esm/core/components/Button.js.map +1 -0
- package/lib/esm/core/components/Center.js +6 -0
- package/lib/esm/core/components/Center.js.map +1 -0
- package/lib/esm/core/components/ComboBox.js +356 -0
- package/lib/esm/core/components/ComboBox.js.map +1 -0
- package/lib/esm/core/components/ConfirmModal.js +10 -0
- package/lib/esm/core/components/ConfirmModal.js.map +1 -0
- package/lib/esm/core/components/DeleteModal.js +28 -0
- package/lib/esm/core/components/DeleteModal.js.map +1 -0
- package/lib/esm/core/components/Divider.js +6 -0
- package/lib/esm/core/components/Divider.js.map +1 -0
- package/lib/esm/core/components/Dropdown.js +16 -0
- package/lib/esm/core/components/Dropdown.js.map +1 -0
- package/lib/esm/core/components/DropdownList.js +9 -0
- package/lib/esm/core/components/DropdownList.js.map +1 -0
- package/lib/esm/core/components/EmptyCollection.js +7 -0
- package/lib/esm/core/components/EmptyCollection.js.map +1 -0
- package/lib/esm/core/components/FileUpload.js +119 -0
- package/lib/esm/core/components/FileUpload.js.map +1 -0
- package/lib/esm/core/components/Input.js +16 -0
- package/lib/esm/core/components/Input.js.map +1 -0
- package/lib/esm/core/components/InputList.js +42 -0
- package/lib/esm/core/components/InputList.js.map +1 -0
- package/lib/esm/core/components/Link.js +13 -0
- package/lib/esm/core/components/Link.js.map +1 -0
- package/lib/esm/core/components/MenuList.js +23 -0
- package/lib/esm/core/components/MenuList.js.map +1 -0
- package/lib/esm/core/components/MessageBox.js +66 -0
- package/lib/esm/core/components/MessageBox.js.map +1 -0
- package/lib/esm/core/components/Modal.js +26 -0
- package/lib/esm/core/components/Modal.js.map +1 -0
- package/lib/esm/core/components/NumberInput.js +43 -0
- package/lib/esm/core/components/NumberInput.js.map +1 -0
- package/lib/esm/core/components/Portal.js +28 -0
- package/lib/esm/core/components/Portal.js.map +1 -0
- package/lib/esm/core/components/RadioGroup.js +34 -0
- package/lib/esm/core/components/RadioGroup.js.map +1 -0
- package/lib/esm/core/components/SelectBox.js +67 -0
- package/lib/esm/core/components/SelectBox.js.map +1 -0
- package/lib/esm/core/components/SelectList.js +47 -0
- package/lib/esm/core/components/SelectList.js.map +1 -0
- package/lib/esm/core/components/SelectStack.js +8 -0
- package/lib/esm/core/components/SelectStack.js.map +1 -0
- package/lib/esm/core/components/SidePanel.js +33 -0
- package/lib/esm/core/components/SidePanel.js.map +1 -0
- package/lib/esm/core/components/Spinner.js +18 -0
- package/lib/esm/core/components/Spinner.js.map +1 -0
- package/lib/esm/core/components/Switch.js +12 -0
- package/lib/esm/core/components/Switch.js.map +1 -0
- package/lib/esm/core/components/Textarea.js +15 -0
- package/lib/esm/core/components/Textarea.js.map +1 -0
- package/lib/esm/core/components/index.js +34 -0
- package/lib/esm/core/components/index.js.map +1 -0
- package/lib/esm/core/components/libs/utils.js +6 -0
- package/lib/esm/core/components/libs/utils.js.map +1 -0
- package/lib/esm/core/components/libs/visuallyHidden.js +16 -0
- package/lib/esm/core/components/libs/visuallyHidden.js.map +1 -0
- package/lib/esm/core/components/popup/Popup.js +60 -0
- package/lib/esm/core/components/popup/Popup.js.map +1 -0
- package/lib/esm/core/components/popup/PopupController.js +149 -0
- package/lib/esm/core/components/popup/PopupController.js.map +1 -0
- package/lib/esm/core/components/popup/index.js +4 -0
- package/lib/esm/core/components/popup/index.js.map +1 -0
- package/lib/esm/core/components/popup/position.js +221 -0
- package/lib/esm/core/components/popup/position.js.map +1 -0
- package/lib/esm/core/components/popup/utils.js +74 -0
- package/lib/esm/core/components/popup/utils.js.map +1 -0
- package/lib/esm/core/components/shadcn/breadcrumb.js +30 -0
- package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -0
- package/lib/esm/core/components/shadcn/button.js +45 -0
- package/lib/esm/core/components/shadcn/button.js.map +1 -0
- package/lib/esm/core/components/shadcn/calendar.js +46 -0
- package/lib/esm/core/components/shadcn/calendar.js.map +1 -0
- package/lib/esm/core/components/shadcn/card.js +17 -0
- package/lib/esm/core/components/shadcn/card.js.map +1 -0
- package/lib/esm/core/components/shadcn/checkbox.js +10 -0
- package/lib/esm/core/components/shadcn/checkbox.js.map +1 -0
- package/lib/esm/core/components/shadcn/command.js +30 -0
- package/lib/esm/core/components/shadcn/command.js.map +1 -0
- package/lib/esm/core/components/shadcn/dialog.js +61 -0
- package/lib/esm/core/components/shadcn/dialog.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js +23 -0
- package/lib/esm/core/components/shadcn/filters/animateChangeInHeight.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/comboBox.js +82 -0
- package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/dateFilter.js +31 -0
- package/lib/esm/core/components/shadcn/filters/dateFilter.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/filterBar.js +140 -0
- package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/filters.js +42 -0
- package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/index.js +6 -0
- package/lib/esm/core/components/shadcn/filters/index.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/selectFilter.js +58 -0
- package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/textFilter.js +20 -0
- package/lib/esm/core/components/shadcn/filters/textFilter.js.map +1 -0
- package/lib/esm/core/components/shadcn/filters/types.js +10 -0
- package/lib/esm/core/components/shadcn/filters/types.js.map +1 -0
- package/lib/esm/core/components/shadcn/heading.js +17 -0
- package/lib/esm/core/components/shadcn/heading.js.map +1 -0
- package/lib/esm/core/components/shadcn/index.js +22 -0
- package/lib/esm/core/components/shadcn/index.js.map +1 -0
- package/lib/esm/core/components/shadcn/input.js +38 -0
- package/lib/esm/core/components/shadcn/input.js.map +1 -0
- package/lib/esm/core/components/shadcn/label.js +11 -0
- package/lib/esm/core/components/shadcn/label.js.map +1 -0
- package/lib/esm/core/components/shadcn/popover.js +50 -0
- package/lib/esm/core/components/shadcn/popover.js.map +1 -0
- package/lib/esm/core/components/shadcn/selectBox.js +62 -0
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -0
- package/lib/esm/core/components/shadcn/separator.js +8 -0
- package/lib/esm/core/components/shadcn/separator.js.map +1 -0
- package/lib/esm/core/components/shadcn/tabs.js +77 -0
- package/lib/esm/core/components/shadcn/tabs.js.map +1 -0
- package/lib/esm/core/components/shadcn/text.js +30 -0
- package/lib/esm/core/components/shadcn/text.js.map +1 -0
- package/lib/esm/core/components/shadcn/theme/ThemeProvider.js +38 -0
- package/lib/esm/core/components/shadcn/theme/ThemeProvider.js.map +1 -0
- package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js +13 -0
- package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -0
- package/lib/esm/core/components/shadcn/tooltip.js +14 -0
- package/lib/esm/core/components/shadcn/tooltip.js.map +1 -0
- package/lib/esm/core/components/styles.js +10 -0
- package/lib/esm/core/components/styles.js.map +1 -0
- package/lib/esm/core/components/table/index.js +20 -0
- package/lib/esm/core/components/table/index.js.map +1 -0
- package/lib/esm/core/components/tabs/Tabs.js +78 -0
- package/lib/esm/core/components/tabs/Tabs.js.map +1 -0
- package/lib/esm/core/components/tabs/TabsContext.js +7 -0
- package/lib/esm/core/components/tabs/TabsContext.js.map +1 -0
- package/lib/esm/core/components/tabs/index.js +3 -0
- package/lib/esm/core/components/tabs/index.js.map +1 -0
- package/lib/esm/core/components/toast/NotificationPanel.js +37 -0
- package/lib/esm/core/components/toast/NotificationPanel.js.map +1 -0
- package/lib/esm/core/components/toast/ToastContext.js +7 -0
- package/lib/esm/core/components/toast/ToastContext.js.map +1 -0
- package/lib/esm/core/components/toast/ToastProps.js +2 -0
- package/lib/esm/core/components/toast/ToastProps.js.map +1 -0
- package/lib/esm/core/components/toast/ToastProvider.js +13 -0
- package/lib/esm/core/components/toast/ToastProvider.js.map +1 -0
- package/lib/esm/core/components/toast/index.js +3 -0
- package/lib/esm/core/components/toast/index.js.map +1 -0
- package/lib/esm/core/hooks/CompositeState.js +118 -0
- package/lib/esm/core/hooks/CompositeState.js.map +1 -0
- package/lib/esm/core/hooks/SharedState.js +64 -0
- package/lib/esm/core/hooks/SharedState.js.map +1 -0
- package/lib/esm/core/hooks/index.js +14 -0
- package/lib/esm/core/hooks/index.js.map +1 -0
- package/lib/esm/core/hooks/useClickOutside.js +29 -0
- package/lib/esm/core/hooks/useClickOutside.js.map +1 -0
- package/lib/esm/core/hooks/useCopyToClipboard.js +23 -0
- package/lib/esm/core/hooks/useCopyToClipboard.js.map +1 -0
- package/lib/esm/core/hooks/useDarkMode.js +11 -0
- package/lib/esm/core/hooks/useDarkMode.js.map +1 -0
- package/lib/esm/core/hooks/useDebounce.js +14 -0
- package/lib/esm/core/hooks/useDebounce.js.map +1 -0
- package/lib/esm/core/hooks/useEventSource.js +31 -0
- package/lib/esm/core/hooks/useEventSource.js.map +1 -0
- package/lib/esm/core/hooks/useFetch.js +40 -0
- package/lib/esm/core/hooks/useFetch.js.map +1 -0
- package/lib/esm/core/hooks/useFlag.js +13 -0
- package/lib/esm/core/hooks/useFlag.js.map +1 -0
- package/lib/esm/core/hooks/useIntersectionObserver.js +34 -0
- package/lib/esm/core/hooks/useIntersectionObserver.js.map +1 -0
- package/lib/esm/core/hooks/useIsFistRendering.js +14 -0
- package/lib/esm/core/hooks/useIsFistRendering.js.map +1 -0
- package/lib/esm/core/hooks/useSafeLayoutEffect.js +4 -0
- package/lib/esm/core/hooks/useSafeLayoutEffect.js.map +1 -0
- package/lib/esm/core/hooks/useSharedValue.js +21 -0
- package/lib/esm/core/hooks/useSharedValue.js.map +1 -0
- package/lib/esm/core/index.js +3 -0
- package/lib/esm/core/index.js.map +1 -0
- package/lib/esm/env/index.js +69 -0
- package/lib/esm/env/index.js.map +1 -0
- package/lib/esm/features/activity-doc/ActivityDoc.js +71 -0
- package/lib/esm/features/activity-doc/ActivityDoc.js.map +1 -0
- package/lib/esm/features/activity-doc/index.js +2 -0
- package/lib/esm/features/activity-doc/index.js.map +1 -0
- package/lib/esm/features/index.js +2 -2
- package/lib/esm/features/index.js.map +1 -1
- package/lib/esm/features/permissions/SecureButton.js +13 -0
- package/lib/esm/features/permissions/SecureButton.js.map +1 -0
- package/lib/esm/features/permissions/SecureSidebarItem.js +14 -0
- package/lib/esm/features/permissions/SecureSidebarItem.js.map +1 -0
- package/lib/esm/features/permissions/UserPermissionsProvider.js +86 -0
- package/lib/esm/features/permissions/UserPermissionsProvider.js.map +1 -0
- package/lib/esm/features/permissions/helpers.js +12 -0
- package/lib/esm/features/permissions/helpers.js.map +1 -0
- package/lib/esm/features/permissions/index.js +5 -0
- package/lib/esm/features/permissions/index.js.map +1 -0
- package/lib/esm/layout/AppLayout.js +46 -0
- package/lib/esm/layout/AppLayout.js.map +1 -0
- package/lib/esm/layout/FullHeightLayout.js +20 -0
- package/lib/esm/layout/FullHeightLayout.js.map +1 -0
- package/lib/esm/layout/Navbar.js +40 -0
- package/lib/esm/layout/Navbar.js.map +1 -0
- package/lib/esm/layout/Sidebar.js +35 -0
- package/lib/esm/layout/Sidebar.js.map +1 -0
- package/lib/esm/layout/SidebarContext.js +10 -0
- package/lib/esm/layout/SidebarContext.js.map +1 -0
- package/lib/esm/layout/TitleBar.js +5 -0
- package/lib/esm/layout/TitleBar.js.map +1 -0
- package/lib/esm/layout/index.js +7 -0
- package/lib/esm/layout/index.js.map +1 -0
- package/lib/esm/router/FixLinks.js +23 -0
- package/lib/esm/router/FixLinks.js.map +1 -0
- package/lib/esm/router/HistoryNavigator.js +149 -0
- package/lib/esm/router/HistoryNavigator.js.map +1 -0
- package/lib/esm/router/Nav.js +26 -0
- package/lib/esm/router/Nav.js.map +1 -0
- package/lib/esm/router/NestedNavigationContext.js +19 -0
- package/lib/esm/router/NestedNavigationContext.js.map +1 -0
- package/lib/esm/router/NestedRouterProvider.js +44 -0
- package/lib/esm/router/NestedRouterProvider.js.map +1 -0
- package/lib/esm/router/PathMatcher.js +159 -0
- package/lib/esm/router/PathMatcher.js.map +1 -0
- package/lib/esm/router/PathWithParams.js +34 -0
- package/lib/esm/router/PathWithParams.js.map +1 -0
- package/lib/esm/router/Route404.js +18 -0
- package/lib/esm/router/Route404.js.map +1 -0
- package/lib/esm/router/RouteComponent.js +32 -0
- package/lib/esm/router/RouteComponent.js.map +1 -0
- package/lib/esm/router/Router.js +161 -0
- package/lib/esm/router/Router.js.map +1 -0
- package/lib/esm/router/RouterProvider.js +41 -0
- package/lib/esm/router/RouterProvider.js.map +1 -0
- package/lib/esm/router/index.js +10 -5
- package/lib/esm/router/index.js.map +1 -1
- package/lib/esm/router/path.js +137 -0
- package/lib/esm/router/path.js.map +1 -0
- package/lib/esm/session/TypeRegistry.js +24 -0
- package/lib/esm/session/TypeRegistry.js.map +1 -0
- package/lib/esm/session/UserSession.js +191 -0
- package/lib/esm/session/UserSession.js.map +1 -0
- package/lib/esm/session/UserSessionProvider.js +161 -0
- package/lib/esm/session/UserSessionProvider.js.map +1 -0
- package/lib/esm/session/auth/composable.js +162 -0
- package/lib/esm/session/auth/composable.js.map +1 -0
- package/lib/esm/session/auth/firebase.js +151 -0
- package/lib/esm/session/auth/firebase.js.map +1 -0
- package/lib/esm/session/auth/useAuthState.js +49 -0
- package/lib/esm/session/auth/useAuthState.js.map +1 -0
- package/lib/esm/session/index.js +6 -2
- package/lib/esm/session/index.js.map +1 -1
- package/lib/esm/session/useUXTracking.js +29 -0
- package/lib/esm/session/useUXTracking.js.map +1 -0
- package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +103 -0
- package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -0
- package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js +33 -0
- package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js.map +1 -0
- package/lib/esm/widgets/codemirror/index.js +2 -0
- package/lib/esm/widgets/codemirror/index.js.map +1 -0
- package/lib/esm/widgets/form/Form.js +102 -0
- package/lib/esm/widgets/form/Form.js.map +1 -0
- package/lib/esm/widgets/form/FormContext.js +29 -0
- package/lib/esm/widgets/form/FormContext.js.map +1 -0
- package/lib/esm/widgets/form/ManagedObject.js +283 -0
- package/lib/esm/widgets/form/ManagedObject.js.map +1 -0
- package/lib/esm/widgets/form/fields.js +11 -0
- package/lib/esm/widgets/form/fields.js.map +1 -0
- package/lib/esm/widgets/form/index.js +7 -0
- package/lib/esm/widgets/form/index.js.map +1 -0
- package/lib/esm/widgets/form/inputs.js +36 -0
- package/lib/esm/widgets/form/inputs.js.map +1 -0
- package/lib/esm/widgets/form/schema.js +191 -0
- package/lib/esm/widgets/form/schema.js.map +1 -0
- package/lib/esm/widgets/index.js +6 -0
- package/lib/esm/widgets/index.js.map +1 -0
- package/lib/esm/widgets/json-view/JSONCode.js +157 -0
- package/lib/esm/widgets/json-view/JSONCode.js.map +1 -0
- package/lib/esm/widgets/json-view/JSONDisplay.js +10 -0
- package/lib/esm/widgets/json-view/JSONDisplay.js.map +1 -0
- package/lib/esm/widgets/json-view/JSONView.js +106 -0
- package/lib/esm/widgets/json-view/JSONView.js.map +1 -0
- package/lib/esm/widgets/json-view/index.js +4 -0
- package/lib/esm/widgets/json-view/index.js.map +1 -0
- package/lib/esm/widgets/json-view/types.js +2 -0
- package/lib/esm/widgets/json-view/types.js.map +1 -0
- package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js +50 -0
- package/lib/esm/widgets/schema-editor/JSONSchemaEditorModal.js.map +1 -0
- package/lib/esm/widgets/schema-editor/ManagedSchema.js +303 -0
- package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/Editable.js +111 -0
- package/lib/esm/widgets/schema-editor/editor/Editable.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js +8 -0
- package/lib/esm/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +81 -0
- package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js +7 -0
- package/lib/esm/widgets/schema-editor/editor/PropertyViewer.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/SchemaContext.js +9 -0
- package/lib/esm/widgets/schema-editor/editor/SchemaContext.js.map +1 -0
- package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +84 -0
- package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -0
- package/lib/esm/widgets/schema-editor/index.js +8 -0
- package/lib/esm/widgets/schema-editor/index.js.map +1 -0
- package/lib/esm/widgets/schema-editor/json-schema4-utils.js +188 -0
- package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -0
- package/lib/esm/widgets/schema-editor/type-signature.js +30 -0
- package/lib/esm/widgets/schema-editor/type-signature.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/Attributes/index.js +11 -0
- package/lib/esm/widgets/xml-viewer/components/Attributes/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js +8 -0
- package/lib/esm/widgets/xml-viewer/components/CDataTag/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js +11 -0
- package/lib/esm/widgets/xml-viewer/components/CollapseIcon/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js +11 -0
- package/lib/esm/widgets/xml-viewer/components/CommentTag/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js +9 -0
- package/lib/esm/widgets/xml-viewer/components/DeclarationTag/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/Elements/index.js +36 -0
- package/lib/esm/widgets/xml-viewer/components/Elements/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js +5 -0
- package/lib/esm/widgets/xml-viewer/components/InvalidXml/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/Tag/index.js +13 -0
- package/lib/esm/widgets/xml-viewer/components/Tag/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/TextElement/index.js +13 -0
- package/lib/esm/widgets/xml-viewer/components/TextElement/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/XMLViewer.js +30 -0
- package/lib/esm/widgets/xml-viewer/components/XMLViewer.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/components/types.js +2 -0
- package/lib/esm/widgets/xml-viewer/components/types.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/constants/index.js +17 -0
- package/lib/esm/widgets/xml-viewer/constants/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js +10 -0
- package/lib/esm/widgets/xml-viewer/context/xml-viewer-context.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/helpers/index.js +40 -0
- package/lib/esm/widgets/xml-viewer/helpers/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js +22 -0
- package/lib/esm/widgets/xml-viewer/hooks/useCollapsible.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js +31 -0
- package/lib/esm/widgets/xml-viewer/hooks/useXMLViewer.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/index.js +3 -0
- package/lib/esm/widgets/xml-viewer/index.js.map +1 -0
- package/lib/esm/widgets/xml-viewer/types/index.js +2 -0
- package/lib/esm/widgets/xml-viewer/types/index.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/Avatar.d.ts +15 -0
- package/lib/types/core/components/Badge.d.ts +20 -0
- package/lib/types/core/components/Button.d.ts +13 -0
- package/lib/types/core/components/Center.d.ts +7 -0
- package/lib/types/core/components/ComboBox.d.ts +123 -0
- package/lib/types/core/components/ConfirmModal.d.ts +10 -0
- package/lib/types/core/components/DeleteModal.d.ts +10 -0
- package/lib/types/core/components/Divider.d.ts +5 -0
- package/lib/types/core/components/Dropdown.d.ts +14 -0
- package/lib/types/core/components/DropdownList.d.ts +12 -0
- package/lib/types/core/components/EmptyCollection.d.ts +8 -0
- package/lib/types/core/components/FileUpload.d.ts +28 -0
- package/lib/types/core/components/Input.d.ts +8 -0
- package/lib/types/core/components/InputList.d.ts +10 -0
- package/lib/types/core/components/Link.d.ts +6 -0
- package/lib/types/core/components/MenuList.d.ts +13 -0
- package/lib/types/core/components/MessageBox.d.ts +35 -0
- package/lib/types/core/components/Modal.d.ts +29 -0
- package/lib/types/core/components/NumberInput.d.ts +15 -0
- package/lib/types/core/components/Portal.d.ts +5 -0
- package/lib/types/core/components/RadioGroup.d.ts +25 -0
- package/lib/types/core/components/SelectBox.d.ts +35 -0
- package/lib/types/core/components/SelectList.d.ts +17 -0
- package/lib/types/core/components/SelectStack.d.ts +12 -0
- package/lib/types/core/components/SidePanel.d.ts +8 -0
- package/lib/types/core/components/Spinner.d.ts +6 -0
- package/lib/types/core/components/Switch.d.ts +9 -0
- package/lib/types/core/components/Textarea.d.ts +7 -0
- package/lib/types/core/components/index.d.ts +37 -0
- package/lib/types/core/components/libs/utils.d.ts +2 -0
- package/lib/types/core/components/libs/visuallyHidden.d.ts +6 -0
- package/lib/types/core/components/popup/Popup.d.ts +25 -0
- package/lib/types/core/components/popup/PopupController.d.ts +40 -0
- package/lib/types/core/components/popup/index.d.ts +3 -0
- package/lib/types/core/components/popup/position.d.ts +58 -0
- package/lib/types/core/components/popup/utils.d.ts +29 -0
- package/lib/types/core/components/shadcn/breadcrumb.d.ts +13 -0
- package/lib/types/core/components/shadcn/button.d.ts +15 -0
- package/lib/types/core/components/shadcn/calendar.d.ts +10 -0
- package/lib/types/core/components/shadcn/card.d.ts +8 -0
- package/lib/types/core/components/shadcn/checkbox.d.ts +4 -0
- package/lib/types/core/components/shadcn/command.d.ts +80 -0
- package/lib/types/core/components/shadcn/dialog.d.ts +34 -0
- package/lib/types/core/components/shadcn/filters/animateChangeInHeight.d.ts +6 -0
- package/lib/types/core/components/shadcn/filters/comboBox.d.ts +17 -0
- package/lib/types/core/components/shadcn/filters/dateFilter.d.ts +14 -0
- package/lib/types/core/components/shadcn/filters/filterBar.d.ts +9 -0
- package/lib/types/core/components/shadcn/filters/filters.d.ts +9 -0
- package/lib/types/core/components/shadcn/filters/index.d.ts +5 -0
- package/lib/types/core/components/shadcn/filters/selectFilter.d.ts +11 -0
- package/lib/types/core/components/shadcn/filters/textFilter.d.ts +12 -0
- package/lib/types/core/components/shadcn/filters/types.d.ts +26 -0
- package/lib/types/core/components/shadcn/heading.d.ts +5 -0
- package/lib/types/core/components/shadcn/index.d.ts +21 -0
- package/lib/types/core/components/shadcn/input.d.ts +16 -0
- package/lib/types/core/components/shadcn/label.d.ts +7 -0
- package/lib/types/core/components/shadcn/popover.d.ts +16 -0
- package/lib/types/core/components/shadcn/selectBox.d.ts +21 -0
- package/lib/types/core/components/shadcn/separator.d.ts +4 -0
- package/lib/types/core/components/shadcn/tabs.d.ts +26 -0
- package/lib/types/core/components/shadcn/text.d.ts +10 -0
- package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts +13 -0
- package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts +9 -0
- package/lib/types/core/components/shadcn/tooltip.d.ts +19 -0
- package/lib/types/core/components/styles.d.ts +6 -0
- package/lib/types/core/components/table/index.d.ts +13 -0
- package/lib/types/core/components/tabs/Tabs.d.ts +24 -0
- package/lib/types/core/components/tabs/TabsContext.d.ts +16 -0
- package/lib/types/core/components/tabs/index.d.ts +2 -0
- package/lib/types/core/components/toast/NotificationPanel.d.ts +7 -0
- package/lib/types/core/components/toast/ToastContext.d.ts +5 -0
- package/lib/types/core/components/toast/ToastProps.d.ts +6 -0
- package/lib/types/core/components/toast/ToastProvider.d.ts +5 -0
- package/lib/types/core/components/toast/index.d.ts +2 -0
- package/lib/types/core/hooks/CompositeState.d.ts +27 -0
- package/lib/types/core/hooks/SharedState.d.ts +9 -0
- package/lib/types/core/hooks/index.d.ts +13 -0
- package/lib/types/core/hooks/useClickOutside.d.ts +7 -0
- package/lib/types/core/hooks/useCopyToClipboard.d.ts +4 -0
- package/lib/types/core/hooks/useDarkMode.d.ts +1 -0
- package/lib/types/core/hooks/useDebounce.d.ts +1 -0
- package/lib/types/core/hooks/useEventSource.d.ts +1 -0
- package/lib/types/core/hooks/useFetch.d.ts +23 -0
- package/lib/types/core/hooks/useFlag.d.ts +8 -0
- package/lib/types/core/hooks/useIntersectionObserver.d.ts +13 -0
- package/lib/types/core/hooks/useIsFistRendering.d.ts +1 -0
- package/lib/types/core/hooks/useSafeLayoutEffect.d.ts +3 -0
- package/lib/types/core/hooks/useSharedValue.d.ts +11 -0
- package/lib/types/core/index.d.ts +2 -0
- package/lib/types/env/index.d.ts +70 -0
- package/lib/types/features/activity-doc/ActivityDoc.d.ts +13 -0
- package/lib/types/features/activity-doc/index.d.ts +1 -0
- package/lib/types/features/index.d.ts +2 -0
- package/lib/types/features/permissions/SecureButton.d.ts +7 -0
- package/lib/types/features/permissions/SecureSidebarItem.d.ts +7 -0
- package/lib/types/features/permissions/UserPermissionsProvider.d.ts +19 -0
- package/lib/types/features/permissions/helpers.d.ts +4 -0
- package/lib/types/features/permissions/index.d.ts +4 -0
- package/lib/types/layout/AppLayout.d.ts +12 -0
- package/lib/types/layout/FullHeightLayout.d.ts +26 -0
- package/lib/types/layout/Navbar.d.ts +32 -0
- package/lib/types/layout/Sidebar.d.ts +29 -0
- package/lib/types/layout/SidebarContext.d.ts +8 -0
- package/lib/types/layout/TitleBar.d.ts +5 -0
- package/lib/types/layout/index.d.ts +6 -0
- package/lib/types/router/FixLinks.d.ts +6 -0
- package/lib/types/router/HistoryNavigator.d.ts +55 -0
- package/lib/types/router/Nav.d.ts +28 -0
- package/lib/types/router/NestedNavigationContext.d.ts +8 -0
- package/lib/types/router/NestedRouterProvider.d.ts +13 -0
- package/lib/types/router/PathMatcher.d.ts +35 -0
- package/lib/types/router/PathWithParams.d.ts +8 -0
- package/lib/types/router/Route404.d.ts +3 -0
- package/lib/types/router/RouteComponent.d.ts +5 -0
- package/lib/types/router/Router.d.ts +73 -0
- package/lib/types/router/RouterProvider.d.ts +14 -0
- package/lib/types/router/index.d.ts +10 -4
- package/lib/types/router/path.d.ts +7 -0
- package/lib/types/session/TypeRegistry.d.ts +9 -0
- package/lib/types/session/UserSession.d.ts +39 -0
- package/lib/types/session/UserSessionProvider.d.ts +6 -0
- package/lib/types/session/auth/composable.d.ts +25 -0
- package/lib/types/session/auth/firebase.d.ts +9 -0
- package/lib/types/session/auth/useAuthState.d.ts +9 -0
- package/lib/types/session/index.d.ts +6 -0
- package/lib/types/session/useUXTracking.d.ts +5 -0
- package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts +22 -0
- package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts +14 -0
- package/lib/types/widgets/codemirror/index.d.ts +1 -0
- package/lib/types/widgets/form/Form.d.ts +20 -0
- package/lib/types/widgets/form/FormContext.d.ts +16 -0
- package/lib/types/widgets/form/ManagedObject.d.ts +81 -0
- package/lib/types/widgets/form/fields.d.ts +15 -0
- package/lib/types/widgets/form/index.d.ts +6 -0
- package/lib/types/widgets/form/inputs.d.ts +7 -0
- package/lib/types/widgets/form/schema.d.ts +45 -0
- package/lib/types/widgets/index.d.ts +5 -0
- package/lib/types/widgets/json-view/JSONCode.d.ts +21 -0
- package/lib/types/widgets/json-view/JSONDisplay.d.ts +7 -0
- package/lib/types/widgets/json-view/JSONView.d.ts +6 -0
- package/lib/types/widgets/json-view/index.d.ts +4 -0
- package/lib/types/widgets/json-view/types.d.ts +7 -0
- package/lib/types/widgets/schema-editor/JSONSchemaEditorModal.d.ts +9 -0
- package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +74 -0
- package/lib/types/widgets/schema-editor/editor/Editable.d.ts +39 -0
- package/lib/types/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +7 -0
- package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts +4 -0
- package/lib/types/widgets/schema-editor/editor/PropertyViewer.d.ts +3 -0
- package/lib/types/widgets/schema-editor/editor/SchemaContext.d.ts +2 -0
- package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts +8 -0
- package/lib/types/widgets/schema-editor/index.d.ts +7 -0
- package/lib/types/widgets/schema-editor/json-schema4-utils.d.ts +15 -0
- package/lib/types/widgets/schema-editor/type-signature.d.ts +18 -0
- package/lib/types/widgets/xml-viewer/components/Attributes/index.d.ts +5 -0
- package/lib/types/widgets/xml-viewer/components/CDataTag/index.d.ts +7 -0
- package/lib/types/widgets/xml-viewer/components/CollapseIcon/index.d.ts +4 -0
- package/lib/types/widgets/xml-viewer/components/CommentTag/index.d.ts +8 -0
- package/lib/types/widgets/xml-viewer/components/DeclarationTag/index.d.ts +7 -0
- package/lib/types/widgets/xml-viewer/components/Elements/index.d.ts +7 -0
- package/lib/types/widgets/xml-viewer/components/InvalidXml/index.d.ts +1 -0
- package/lib/types/widgets/xml-viewer/components/Tag/index.d.ts +12 -0
- package/lib/types/widgets/xml-viewer/components/TextElement/index.d.ts +7 -0
- package/lib/types/widgets/xml-viewer/components/XMLViewer.d.ts +2 -0
- package/lib/types/widgets/xml-viewer/components/types.d.ts +103 -0
- package/lib/types/widgets/xml-viewer/constants/index.d.ts +16 -0
- package/lib/types/widgets/xml-viewer/context/xml-viewer-context.d.ts +3 -0
- package/lib/types/widgets/xml-viewer/helpers/index.d.ts +12 -0
- package/lib/types/widgets/xml-viewer/hooks/useCollapsible.d.ts +14 -0
- package/lib/types/widgets/xml-viewer/hooks/useXMLViewer.d.ts +9 -0
- package/lib/types/widgets/xml-viewer/index.d.ts +2 -0
- package/lib/types/widgets/xml-viewer/types/index.d.ts +15 -0
- package/lib/vertesia-ui-core.js +2 -0
- package/lib/vertesia-ui-core.js.map +1 -0
- package/lib/vertesia-ui-env.js +2 -0
- package/lib/vertesia-ui-env.js.map +1 -0
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-layout.js +2 -0
- package/lib/vertesia-ui-layout.js.map +1 -0
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +2 -0
- package/lib/vertesia-ui-widgets.js.map +1 -0
- package/package.json +80 -19
- package/src/code/index.ts +1 -1
- package/src/core/components/Avatar.tsx +67 -0
- package/src/core/components/Badge.tsx +114 -0
- package/src/core/components/Button.tsx +63 -0
- package/src/core/components/Center.tsx +12 -0
- package/src/core/components/ComboBox.tsx +488 -0
- package/src/core/components/ConfirmModal.tsx +51 -0
- package/src/core/components/DeleteModal.tsx +45 -0
- package/src/core/components/Divider.tsx +11 -0
- package/src/core/components/Dropdown.tsx +63 -0
- package/src/core/components/DropdownList.tsx +72 -0
- package/src/core/components/EmptyCollection.tsx +39 -0
- package/src/core/components/FileUpload.tsx +196 -0
- package/src/core/components/Input.tsx +43 -0
- package/src/core/components/InputList.tsx +75 -0
- package/src/core/components/Link.tsx +16 -0
- package/src/core/components/MenuList.tsx +44 -0
- package/src/core/components/MessageBox.tsx +96 -0
- package/src/core/components/Modal.tsx +144 -0
- package/src/core/components/NumberInput.tsx +64 -0
- package/src/core/components/Portal.tsx +33 -0
- package/src/core/components/RadioGroup.tsx +100 -0
- package/src/core/components/SelectBox.tsx +188 -0
- package/src/core/components/SelectList.tsx +85 -0
- package/src/core/components/SelectStack.tsx +63 -0
- package/src/core/components/SidePanel.tsx +104 -0
- package/src/core/components/Spinner.tsx +33 -0
- package/src/core/components/Switch.tsx +29 -0
- package/src/core/components/Textarea.tsx +25 -0
- package/src/core/components/index.ts +39 -0
- package/src/core/components/libs/utils.tsx +6 -0
- package/src/core/components/libs/visuallyHidden.tsx +25 -0
- package/src/core/components/popup/Popup.tsx +94 -0
- package/src/core/components/popup/PopupController.ts +182 -0
- package/src/core/components/popup/index.ts +3 -0
- package/src/core/components/popup/position.ts +277 -0
- package/src/core/components/popup/utils.ts +82 -0
- package/src/core/components/shadcn/breadcrumb.tsx +174 -0
- package/src/core/components/shadcn/button.tsx +95 -0
- package/src/core/components/shadcn/calendar.tsx +87 -0
- package/src/core/components/shadcn/card.tsx +76 -0
- package/src/core/components/shadcn/checkbox.tsx +30 -0
- package/src/core/components/shadcn/command.tsx +155 -0
- package/src/core/components/shadcn/dialog.tsx +230 -0
- package/src/core/components/shadcn/filters/animateChangeInHeight.tsx +41 -0
- package/src/core/components/shadcn/filters/comboBox.tsx +251 -0
- package/src/core/components/shadcn/filters/dateFilter.tsx +65 -0
- package/src/core/components/shadcn/filters/filterBar.tsx +262 -0
- package/src/core/components/shadcn/filters/filters.tsx +110 -0
- package/src/core/components/shadcn/filters/index.ts +5 -0
- package/src/core/components/shadcn/filters/selectFilter.tsx +91 -0
- package/src/core/components/shadcn/filters/textFilter.tsx +59 -0
- package/src/core/components/shadcn/filters/types.ts +29 -0
- package/src/core/components/shadcn/heading.tsx +23 -0
- package/src/core/components/shadcn/index.ts +22 -0
- package/src/core/components/shadcn/input.tsx +89 -0
- package/src/core/components/shadcn/label.tsx +31 -0
- package/src/core/components/shadcn/popover.tsx +115 -0
- package/src/core/components/shadcn/selectBox.tsx +186 -0
- package/src/core/components/shadcn/separator.tsx +29 -0
- package/src/core/components/shadcn/tabs.tsx +218 -0
- package/src/core/components/shadcn/text.tsx +33 -0
- package/src/core/components/shadcn/theme/ThemeProvider.tsx +73 -0
- package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +35 -0
- package/src/core/components/shadcn/tooltip.tsx +57 -0
- package/src/core/components/styles.ts +11 -0
- package/src/core/components/table/index.tsx +49 -0
- package/src/core/components/tabs/Tabs.tsx +132 -0
- package/src/core/components/tabs/TabsContext.ts +25 -0
- package/src/core/components/tabs/index.ts +2 -0
- package/src/core/components/toast/NotificationPanel.tsx +91 -0
- package/src/core/components/toast/ToastContext.ts +12 -0
- package/src/core/components/toast/ToastProps.ts +6 -0
- package/src/core/components/toast/ToastProvider.tsx +26 -0
- package/src/core/components/toast/index.ts +2 -0
- package/src/core/hooks/CompositeState.tsx +142 -0
- package/src/core/hooks/SharedState.tsx +69 -0
- package/src/core/hooks/index.ts +13 -0
- package/src/core/hooks/useClickOutside.tsx +29 -0
- package/src/core/hooks/useCopyToClipboard.tsx +28 -0
- package/src/core/hooks/useDarkMode.ts +11 -0
- package/src/core/hooks/useDebounce.tsx +15 -0
- package/src/core/hooks/useEventSource.ts +35 -0
- package/src/core/hooks/useFetch.ts +51 -0
- package/src/core/hooks/useFlag.tsx +13 -0
- package/src/core/hooks/useIntersectionObserver.tsx +40 -0
- package/src/core/hooks/useIsFistRendering.ts +17 -0
- package/src/core/hooks/useSafeLayoutEffect.ts +5 -0
- package/src/core/hooks/useSharedValue.ts +22 -0
- package/src/core/index.ts +2 -0
- package/src/env/index.ts +116 -0
- package/src/features/activity-doc/ActivityDoc.tsx +199 -0
- package/src/features/activity-doc/index.ts +1 -0
- package/src/features/index.ts +2 -1
- package/src/features/permissions/SecureButton.tsx +18 -0
- package/src/features/permissions/SecureSidebarItem.tsx +19 -0
- package/src/features/permissions/UserPermissionsProvider.tsx +102 -0
- package/src/features/permissions/helpers.ts +16 -0
- package/src/features/permissions/index.ts +4 -0
- package/src/layout/AppLayout.tsx +132 -0
- package/src/layout/FullHeightLayout.tsx +74 -0
- package/src/layout/Navbar.tsx +127 -0
- package/src/layout/Sidebar.tsx +129 -0
- package/src/layout/SidebarContext.ts +17 -0
- package/src/layout/TitleBar.tsx +7 -0
- package/src/layout/index.ts +6 -0
- package/src/router/FixLinks.tsx +28 -0
- package/src/router/HistoryNavigator.ts +178 -0
- package/src/router/Nav.tsx +55 -0
- package/src/router/NestedNavigationContext.tsx +32 -0
- package/src/router/NestedRouterProvider.tsx +64 -0
- package/src/router/PathMatcher.ts +166 -0
- package/src/router/PathWithParams.ts +34 -0
- package/src/router/Route404.tsx +18 -0
- package/src/router/RouteComponent.tsx +41 -0
- package/src/router/Router.tsx +216 -0
- package/src/router/RouterProvider.tsx +55 -0
- package/src/router/index.ts +10 -8
- package/src/router/path.ts +151 -0
- package/src/session/TypeRegistry.ts +27 -0
- package/src/session/UserSession.ts +227 -0
- package/src/session/UserSessionProvider.tsx +170 -0
- package/src/session/auth/composable.ts +190 -0
- package/src/session/auth/firebase.ts +160 -0
- package/src/session/auth/useAuthState.ts +61 -0
- package/src/session/index.ts +6 -1
- package/src/session/useUXTracking.tsx +38 -0
- package/src/widgets/codemirror/CodeMirrorEditor.tsx +121 -0
- package/src/widgets/codemirror/CodemirrorStateSingleton.tsx +39 -0
- package/src/widgets/codemirror/index.ts +2 -0
- package/src/widgets/form/Form.tsx +194 -0
- package/src/widgets/form/FormContext.ts +38 -0
- package/src/widgets/form/ManagedObject.ts +332 -0
- package/src/widgets/form/fields.tsx +34 -0
- package/src/widgets/form/index.ts +6 -0
- package/src/widgets/form/inputs.tsx +44 -0
- package/src/widgets/form/schema.ts +215 -0
- package/src/widgets/index.ts +5 -0
- package/src/widgets/json-view/JSONCode.tsx +176 -0
- package/src/widgets/json-view/JSONDisplay.tsx +24 -0
- package/src/widgets/json-view/JSONView.tsx +183 -0
- package/src/widgets/json-view/index.ts +4 -0
- package/src/widgets/json-view/types.ts +5 -0
- package/src/widgets/schema-editor/JSONSchemaEditorModal.tsx +68 -0
- package/src/widgets/schema-editor/ManagedSchema.ts +340 -0
- package/src/widgets/schema-editor/editor/Editable.tsx +252 -0
- package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +15 -0
- package/src/widgets/schema-editor/editor/PropertyEditor.tsx +150 -0
- package/src/widgets/schema-editor/editor/PropertyViewer.tsx +15 -0
- package/src/widgets/schema-editor/editor/SchemaContext.tsx +9 -0
- package/src/widgets/schema-editor/editor/SchemaEditor.test.ts +48 -0
- package/src/widgets/schema-editor/editor/SchemaEditor.tsx +161 -0
- package/src/widgets/schema-editor/index.ts +7 -0
- package/src/widgets/schema-editor/json-schema4-utils.ts +187 -0
- package/src/widgets/schema-editor/type-signature.ts +39 -0
- package/src/widgets/xml-viewer/components/Attributes/index.tsx +27 -0
- package/src/widgets/xml-viewer/components/CDataTag/index.tsx +21 -0
- package/src/widgets/xml-viewer/components/CollapseIcon/index.tsx +32 -0
- package/src/widgets/xml-viewer/components/CommentTag/index.tsx +30 -0
- package/src/widgets/xml-viewer/components/DeclarationTag/index.tsx +23 -0
- package/src/widgets/xml-viewer/components/Elements/index.tsx +83 -0
- package/src/widgets/xml-viewer/components/InvalidXml/index.tsx +3 -0
- package/src/widgets/xml-viewer/components/Tag/index.tsx +47 -0
- package/src/widgets/xml-viewer/components/TextElement/index.tsx +28 -0
- package/src/widgets/xml-viewer/components/XMLViewer.tsx +53 -0
- package/src/widgets/xml-viewer/components/types.ts +104 -0
- package/src/widgets/xml-viewer/constants/index.ts +17 -0
- package/src/widgets/xml-viewer/context/xml-viewer-context.ts +12 -0
- package/src/widgets/xml-viewer/helpers/index.ts +56 -0
- package/src/widgets/xml-viewer/hooks/useCollapsible.ts +28 -0
- package/src/widgets/xml-viewer/hooks/useXMLViewer.ts +34 -0
- package/src/widgets/xml-viewer/index.ts +2 -0
- package/src/widgets/xml-viewer/types/index.ts +21 -0
- package/lib/esm/components/index.js +0 -3
- package/lib/esm/components/index.js.map +0 -1
- package/lib/types/components/index.d.ts +0 -0
- package/lib/vertesia-ui-components.js +0 -2
- package/lib/vertesia-ui-components.js.map +0 -1
- package/src/components/index.ts +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AlignLeft } from 'lucide-react';
|
|
4
|
+
import { Button, VModal, ModalBody, ModalFooter, VModalTitle, Styles, VSelectBox } from '@vertesia/ui/core';
|
|
5
|
+
|
|
6
|
+
import { TypeNames } from '../type-signature.js';
|
|
7
|
+
import { DataEditorProps } from './Editable.js';
|
|
8
|
+
import { EditableSchemaProperty } from './EditableSchemaProperty.js';
|
|
9
|
+
|
|
10
|
+
function makeTypeOptions() {
|
|
11
|
+
const types: string[] = Object.values(TypeNames)
|
|
12
|
+
const options = [...types]
|
|
13
|
+
for (const type of types) {
|
|
14
|
+
options.push(type + '[]');
|
|
15
|
+
}
|
|
16
|
+
types.sort();
|
|
17
|
+
return options;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TYPE_OPTIONS = makeTypeOptions();
|
|
21
|
+
|
|
22
|
+
export function PropertyEditor({ value, onChange, onCancel, onSave }: DataEditorProps<EditableSchemaProperty>) {
|
|
23
|
+
const [isModalOpen, setModalOpen] = useState(false);
|
|
24
|
+
|
|
25
|
+
if (!value) return null;
|
|
26
|
+
|
|
27
|
+
const onNameChange = (text: string) => {
|
|
28
|
+
onChange({ ...value, name: text })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const onTypeChange = (text: string) => {
|
|
32
|
+
onChange({ ...value, type: text })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const onDescriptionChange = (text?: string) => {
|
|
36
|
+
if (text !== undefined && typeof text === 'string') {
|
|
37
|
+
onChange({ ...value, description: text }, true);
|
|
38
|
+
}
|
|
39
|
+
setModalOpen(false);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="flex items-center">
|
|
44
|
+
<div className="flex-1">
|
|
45
|
+
<PropertyNameEditor value={value.name} onChange={onNameChange} onCancel={onCancel} onSave={onSave} />
|
|
46
|
+
</div>
|
|
47
|
+
<div className="px-1 font-semibold">:</div>
|
|
48
|
+
<div className="flex-1">
|
|
49
|
+
<PropertyTypeEditor value={value.type} onChange={onTypeChange} onCancel={onCancel} onSave={onSave} />
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
<Button variant={"ghost"} size={"xs"} onClick={() => setModalOpen(true)} title="Edit description">
|
|
53
|
+
<AlignLeft className="size-4" />
|
|
54
|
+
</Button>
|
|
55
|
+
<EditDescriptionModal value={value.description} isOpen={isModalOpen} onClose={onDescriptionChange} />
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export function PropertyNameEditor({ value, onChange, onCancel, onSave }: DataEditorProps<string>) {
|
|
64
|
+
const ref = useRef<HTMLInputElement>(null);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
ref.current?.focus();
|
|
68
|
+
}, [])
|
|
69
|
+
|
|
70
|
+
const onKeyUp = (e: React.KeyboardEvent) => {
|
|
71
|
+
switch (e.key) {
|
|
72
|
+
case "Enter":
|
|
73
|
+
onSave?.();
|
|
74
|
+
break;
|
|
75
|
+
case "Escape":
|
|
76
|
+
onCancel?.();
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const _onChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
82
|
+
onChange(e.target.value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<input onKeyUp={onKeyUp} ref={ref} value={value} onChange={_onChange} className={Styles.INPUT_UNSTYLED} style={{ fontSize: "inherit", width: "", display: "inline" }} />
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function PropertyTypeEditor({ value, onChange, onCancel, onSave }: DataEditorProps<string>) {
|
|
91
|
+
const onBlur = () => {
|
|
92
|
+
onSave?.();
|
|
93
|
+
}
|
|
94
|
+
const onKeyDown = (e: React.KeyboardEvent<Element>, isOpen: boolean) => {
|
|
95
|
+
if (!isOpen) {
|
|
96
|
+
if (e.key === 'Enter') {
|
|
97
|
+
onSave?.();
|
|
98
|
+
} else if (e.key === 'Escape') {
|
|
99
|
+
onCancel?.();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return (
|
|
104
|
+
<VSelectBox
|
|
105
|
+
className={Styles.INPUT_UNSTYLED}
|
|
106
|
+
options={TYPE_OPTIONS}
|
|
107
|
+
value={value || ''}
|
|
108
|
+
onBlur={onBlur}
|
|
109
|
+
onChange={onChange}
|
|
110
|
+
onKeyDown={onKeyDown}
|
|
111
|
+
popupClass="schema-type-suggest-popup z-90"
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface EditDescriptionModalProps {
|
|
117
|
+
value: string | undefined;
|
|
118
|
+
isOpen: boolean;
|
|
119
|
+
onClose: (text?: string) => void;
|
|
120
|
+
}
|
|
121
|
+
function EditDescriptionModal({ value, isOpen, onClose }: EditDescriptionModalProps) {
|
|
122
|
+
return (
|
|
123
|
+
<VModal isOpen={isOpen} onClose={onClose}>
|
|
124
|
+
<VModalTitle>Edit description</VModalTitle>
|
|
125
|
+
<EditDescriptionModalForm value={value} onSave={onClose} />
|
|
126
|
+
</VModal>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface EditDescriptionModalFormProps {
|
|
131
|
+
value: string | undefined;
|
|
132
|
+
onSave: (text: string) => void;
|
|
133
|
+
}
|
|
134
|
+
function EditDescriptionModalForm({ value, onSave }: EditDescriptionModalFormProps) {
|
|
135
|
+
const ref = useRef<HTMLTextAreaElement>(null);
|
|
136
|
+
const [currentValue, setCurrentValue] = useState(value || '');
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
ref.current && ref.current.focus();
|
|
139
|
+
}, [ref.current]);
|
|
140
|
+
return (
|
|
141
|
+
<>
|
|
142
|
+
<ModalBody className="h-max">
|
|
143
|
+
<textarea ref={ref} className="dark:bg-gray-800 w-full h-full dark:text-white" value={currentValue} onChange={(e) => setCurrentValue(e.target.value)} />
|
|
144
|
+
</ModalBody>
|
|
145
|
+
<ModalFooter>
|
|
146
|
+
<Button onClick={() => onSave(currentValue)}>Save Changes</Button>
|
|
147
|
+
</ModalFooter>
|
|
148
|
+
</>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataViewerProps } from "./Editable.js";
|
|
2
|
+
import { EditableSchemaProperty } from "./EditableSchemaProperty.js";
|
|
3
|
+
|
|
4
|
+
export function PropertyViewer({ value }: DataViewerProps<EditableSchemaProperty>) {
|
|
5
|
+
if (!value) return null;
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
className='w-full flex items-baseline'>
|
|
9
|
+
<div>
|
|
10
|
+
{value.name || ''}
|
|
11
|
+
</div>
|
|
12
|
+
<div className='ml-2 text-sm text-gray-400'>{value.type || ''}</div>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { ManagedSchema } from "../ManagedSchema.js";
|
|
3
|
+
|
|
4
|
+
export function useSchema(jsonSchema: any) {
|
|
5
|
+
const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: "object", properties: {} }).withChangeListener((schema) => {
|
|
6
|
+
setSchema(schema.clone());
|
|
7
|
+
}));
|
|
8
|
+
return schema;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { validatePropertyName } from './SchemaEditor';
|
|
3
|
+
|
|
4
|
+
describe('validatePropertyName', () => {
|
|
5
|
+
it('should return true for valid property names', () => {
|
|
6
|
+
const validNames = [
|
|
7
|
+
'name',
|
|
8
|
+
'name?',
|
|
9
|
+
'1name',
|
|
10
|
+
'1name?',
|
|
11
|
+
'property1',
|
|
12
|
+
'property1?',
|
|
13
|
+
'valid_name',
|
|
14
|
+
'valid_name?',
|
|
15
|
+
'anotherValidName',
|
|
16
|
+
'anotherValidName?',
|
|
17
|
+
];
|
|
18
|
+
validNames.forEach(name => {
|
|
19
|
+
const err = validatePropertyName(name);
|
|
20
|
+
expect(err).toBeUndefined();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return false for invalid property names', () => {
|
|
25
|
+
const invalidNames = [
|
|
26
|
+
'property-1', // dash (-) is not allowed
|
|
27
|
+
'invalid name', // space ( ) is not allowed
|
|
28
|
+
'anotherInvalidName!', // exclamation mark (!) is not allowed
|
|
29
|
+
'invalid?name', // question mark (?) is not allowed in the middle
|
|
30
|
+
'user.name', // dot (.) is not allowed
|
|
31
|
+
|
|
32
|
+
// special characters are not allowed
|
|
33
|
+
'name$',
|
|
34
|
+
'property@',
|
|
35
|
+
'invalid#name',
|
|
36
|
+
'another%InvalidName',
|
|
37
|
+
];
|
|
38
|
+
invalidNames.forEach(name => {
|
|
39
|
+
const err = validatePropertyName(name);
|
|
40
|
+
expect(err).toBe('Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should return false for empty property name', () => {
|
|
45
|
+
const err = validatePropertyName('')
|
|
46
|
+
expect(err).toBe('Name is required');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ChevronDown, ChevronRight, Plus } from 'lucide-react';
|
|
4
|
+
import { useToast } from '@vertesia/ui/core';
|
|
5
|
+
|
|
6
|
+
import { ManagedSchema, SchemaNode } from '../ManagedSchema.js';
|
|
7
|
+
import { TypeNames } from '../type-signature.js';
|
|
8
|
+
import { Editable } from './Editable.js';
|
|
9
|
+
import { EditableSchemaProperty, getEditableSchemaProperty } from './EditableSchemaProperty.js';
|
|
10
|
+
import { PropertyEditor } from './PropertyEditor.js';
|
|
11
|
+
import { PropertyViewer } from './PropertyViewer.js';
|
|
12
|
+
|
|
13
|
+
// do not exit edit mode when user is clicking inside the type suggestion popup
|
|
14
|
+
function skipClickOutside(e: MouseEvent) {
|
|
15
|
+
const target = e.target as HTMLElement;
|
|
16
|
+
return !!(target.closest && target.closest('.schema-type-suggest-popup'));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
interface SchemaTreeProps {
|
|
20
|
+
schema: ManagedSchema;
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export function SchemaEditor({ schema, readonly = false }: SchemaTreeProps) {
|
|
24
|
+
return (
|
|
25
|
+
<ul className="">
|
|
26
|
+
{
|
|
27
|
+
schema.children.map(prop => {
|
|
28
|
+
return renderProperty(prop, readonly)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
{
|
|
32
|
+
!readonly ? <AddPropertyButton parent={schema.root} /> : null
|
|
33
|
+
}
|
|
34
|
+
</ul>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function renderProperty(node: SchemaNode, readonly: boolean) {
|
|
39
|
+
return (
|
|
40
|
+
node.isParent ?
|
|
41
|
+
<ParentItem key={node.name} property={node} readonly={readonly} />
|
|
42
|
+
:
|
|
43
|
+
<SimpleItem key={node.name} node={node} readonly={readonly} />
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface SimpleItemProps {
|
|
48
|
+
node: SchemaNode;
|
|
49
|
+
readonly: boolean
|
|
50
|
+
}
|
|
51
|
+
function SimpleItem({ node, readonly }: SimpleItemProps) {
|
|
52
|
+
return (
|
|
53
|
+
<li>
|
|
54
|
+
<PropertyTitleBar property={node} readonly={readonly} />
|
|
55
|
+
</li>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface ParentItemProps {
|
|
60
|
+
property: SchemaNode;
|
|
61
|
+
readonly: boolean;
|
|
62
|
+
}
|
|
63
|
+
function ParentItem({ property, readonly }: ParentItemProps) {
|
|
64
|
+
const [isOpen, setOpen] = useState(true);
|
|
65
|
+
const Icon = isOpen ? ChevronDown : ChevronRight;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<li>
|
|
69
|
+
<div className='flex items-center w-full'>
|
|
70
|
+
<button onClick={() => setOpen(!isOpen)}><Icon className="size-4" /></button>
|
|
71
|
+
<div className='flex-1'><PropertyTitleBar property={property} readonly={readonly} /></div>
|
|
72
|
+
</div>
|
|
73
|
+
{
|
|
74
|
+
isOpen &&
|
|
75
|
+
<ul className="ml-4 border-l border-gray-400 border-dashed">
|
|
76
|
+
{
|
|
77
|
+
(property.children || []).map(prop => renderProperty(prop, readonly))
|
|
78
|
+
}
|
|
79
|
+
{
|
|
80
|
+
!readonly ? <AddPropertyButton parent={property} /> : null
|
|
81
|
+
}
|
|
82
|
+
</ul>
|
|
83
|
+
}
|
|
84
|
+
</li>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function validatePropertyName(propertyName: string): string | undefined {
|
|
89
|
+
if (!propertyName) {
|
|
90
|
+
return 'Name is required';
|
|
91
|
+
}
|
|
92
|
+
if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {
|
|
93
|
+
return undefined; // valid
|
|
94
|
+
}
|
|
95
|
+
return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface PropertyTitleBarProps {
|
|
99
|
+
property: SchemaNode;
|
|
100
|
+
readonly: boolean;
|
|
101
|
+
}
|
|
102
|
+
function PropertyTitleBar({ property, readonly }: PropertyTitleBarProps) {
|
|
103
|
+
const toast = useToast();
|
|
104
|
+
|
|
105
|
+
const onChange = (value: EditableSchemaProperty) => {
|
|
106
|
+
try {
|
|
107
|
+
if (value.description && typeof value.description !== 'string') {
|
|
108
|
+
value.description = undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);
|
|
112
|
+
|
|
113
|
+
if (property.update({ ...update, description: value.description })) {
|
|
114
|
+
property.reloadTree();
|
|
115
|
+
}
|
|
116
|
+
} catch (err: any) {
|
|
117
|
+
toast({
|
|
118
|
+
status: 'error',
|
|
119
|
+
title: 'Invalid property declaration',
|
|
120
|
+
description: err.message,
|
|
121
|
+
duration: 9000
|
|
122
|
+
})
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
const isNew = property.resetIsNew();
|
|
128
|
+
const editableProp = getEditableSchemaProperty(property);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Editable value={editableProp} onChange={onChange}
|
|
132
|
+
onDelete={() => {
|
|
133
|
+
property.remove()
|
|
134
|
+
property.reloadTree();
|
|
135
|
+
}}
|
|
136
|
+
editor={PropertyEditor}
|
|
137
|
+
viewer={PropertyViewer}
|
|
138
|
+
outlineOnHover isEditing={isNew}
|
|
139
|
+
skipClickOutside={skipClickOutside}
|
|
140
|
+
readonly={readonly}
|
|
141
|
+
onValidate={(property) => validatePropertyName(property.name)}
|
|
142
|
+
/>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface AddPropertyButtonProps {
|
|
147
|
+
parent: SchemaNode;
|
|
148
|
+
}
|
|
149
|
+
function AddPropertyButton({ parent }: AddPropertyButtonProps) {
|
|
150
|
+
const add = () => {
|
|
151
|
+
const name = parent.findAvailableChildName("new_property_");
|
|
152
|
+
const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);
|
|
153
|
+
child.isNew = true;
|
|
154
|
+
parent.reloadTree();
|
|
155
|
+
}
|
|
156
|
+
return (
|
|
157
|
+
<button className="ml-1 py-2 flex items-center text-gray-400 hover:text-indigo-600" onClick={add}>
|
|
158
|
+
<Plus className='size-5' /><div className='ml-2'>Add property</div>
|
|
159
|
+
</button>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./JSONSchemaEditorModal.js";
|
|
2
|
+
export * from "./ManagedSchema.js";
|
|
3
|
+
export * from "./editor/EditableSchemaProperty.js";
|
|
4
|
+
export * from "./editor/PropertyEditor.js";
|
|
5
|
+
export * from "./editor/PropertyViewer.js";
|
|
6
|
+
export * from "./editor/SchemaContext.js";
|
|
7
|
+
export * from "./editor/SchemaEditor.js";
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { JSONSchema, JSONSchemaTypeName } from "@vertesia/common";
|
|
2
|
+
import { TypeNames, TypeSignature } from "./type-signature.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function setPropertyName(schema: JSONSchema, name: string, newName: string) {
|
|
6
|
+
if (schema.properties) {
|
|
7
|
+
const properties = schema.properties;
|
|
8
|
+
const newProperties = {} as Record<string, JSONSchema>;
|
|
9
|
+
for (const key of Object.keys(properties)) {
|
|
10
|
+
const value = properties[key];
|
|
11
|
+
if (key === name) {
|
|
12
|
+
newProperties[newName] = value;
|
|
13
|
+
} else {
|
|
14
|
+
newProperties[key] = value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
schema.properties = newProperties;
|
|
18
|
+
}
|
|
19
|
+
if (schema.required) {
|
|
20
|
+
schema.required = (schema.required as string[]).map(x => x === name ? newName : x);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function setRequireProperty(schema: JSONSchema, name: string, isRequired: boolean) {
|
|
25
|
+
if (Array.isArray(schema.required)) {
|
|
26
|
+
const index = schema.required.indexOf(name);
|
|
27
|
+
if (isRequired) {
|
|
28
|
+
if (index < 0) {
|
|
29
|
+
schema.required.push(name);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
if (index > -1) {
|
|
33
|
+
schema.required.splice(index, 1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} else if (isRequired) {
|
|
37
|
+
schema.required = [name];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function setPropertyType(schema: JSONSchema, type: TypeSignature) {
|
|
42
|
+
const isAny = type.name === "any";
|
|
43
|
+
let typeObj: JSONSchemaTypeName | JSONSchemaTypeName[] | undefined = isAny ?
|
|
44
|
+
undefined
|
|
45
|
+
: (type.isNullable ?
|
|
46
|
+
[type.name, "null"] as JSONSchemaTypeName[]
|
|
47
|
+
: type.name as JSONSchemaTypeName);
|
|
48
|
+
if (type.isArray) {
|
|
49
|
+
schema.type = "array";
|
|
50
|
+
schema.properties = undefined;
|
|
51
|
+
if (!schema.items || Array.isArray(schema.items)) {
|
|
52
|
+
schema.items = {
|
|
53
|
+
type: typeObj,
|
|
54
|
+
properties: type.isObject ? {} : undefined
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
const items = schema.items as JSONSchema;
|
|
58
|
+
items.type = typeObj;
|
|
59
|
+
if (type.isObject && !items.properties) {
|
|
60
|
+
items.properties = {};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
schema.type = typeObj;
|
|
65
|
+
schema.items = undefined;
|
|
66
|
+
if (type.isObject) {
|
|
67
|
+
if (!schema.properties) {
|
|
68
|
+
schema.properties = {};
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
schema.properties = undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function removeProperty(schema: JSONSchema, name: string) {
|
|
77
|
+
if (schema.properties) {
|
|
78
|
+
delete schema.properties[name];
|
|
79
|
+
if (Array.isArray(schema.required)) {
|
|
80
|
+
schema.required = schema.required.filter(x => x !== name);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create a new property in the schema
|
|
87
|
+
* @param schema
|
|
88
|
+
* @param name
|
|
89
|
+
* @param type
|
|
90
|
+
* @param isRequired
|
|
91
|
+
*/
|
|
92
|
+
export function addProperty(schema: JSONSchema, name: string, type: TypeSignature, isRequired = false) {
|
|
93
|
+
if (schema.type !== "object") {
|
|
94
|
+
throw new Error("Cannot add property to a non-object schema");
|
|
95
|
+
}
|
|
96
|
+
if (!schema.properties) {
|
|
97
|
+
schema.properties = {};
|
|
98
|
+
}
|
|
99
|
+
const newSchema = {} as JSONSchema;
|
|
100
|
+
setPropertyType(newSchema, type);
|
|
101
|
+
schema.properties[name] = newSchema;
|
|
102
|
+
if (isRequired) {
|
|
103
|
+
if (Array.isArray(schema.required)) {
|
|
104
|
+
addRequired(schema.required, name);
|
|
105
|
+
} else {
|
|
106
|
+
schema.required = [name];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return newSchema;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function getTypeSignature(schema: JSONSchema): TypeSignature {
|
|
113
|
+
let isNullable = false, isArray = false;
|
|
114
|
+
let typeName: JSONSchemaTypeName | undefined;
|
|
115
|
+
const type = schema.type;
|
|
116
|
+
if (Array.isArray(type)) {
|
|
117
|
+
for (const t of type) {
|
|
118
|
+
if (t === "null") {
|
|
119
|
+
isNullable = true;
|
|
120
|
+
} else if (!typeName) {
|
|
121
|
+
typeName = t;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
typeName = type;
|
|
126
|
+
}
|
|
127
|
+
if (!typeName) {
|
|
128
|
+
typeName = "any";
|
|
129
|
+
}
|
|
130
|
+
if (typeName === 'array') {
|
|
131
|
+
isArray = true;
|
|
132
|
+
typeName = getItemTypeName(schema.items);
|
|
133
|
+
}
|
|
134
|
+
let displayTypeName: string = typeName;
|
|
135
|
+
switch (schema.editor || schema.format) {
|
|
136
|
+
case 'textarea': {
|
|
137
|
+
displayTypeName = 'text'; break;
|
|
138
|
+
}
|
|
139
|
+
case 'media': {
|
|
140
|
+
displayTypeName = 'media'; break;
|
|
141
|
+
}
|
|
142
|
+
case 'document': {
|
|
143
|
+
displayTypeName = 'document'; break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
isNullable,
|
|
148
|
+
isArray,
|
|
149
|
+
isObject: typeName === "object",
|
|
150
|
+
name: displayTypeName as TypeNames
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// TODO we don't support array of arrays
|
|
155
|
+
// for array of multiple type we get the first type
|
|
156
|
+
function getItemTypeName(schema: JSONSchema | JSONSchema[] | undefined) {
|
|
157
|
+
if (!schema) {
|
|
158
|
+
return "any"
|
|
159
|
+
}
|
|
160
|
+
let name: JSONSchemaTypeName;
|
|
161
|
+
if (Array.isArray(schema)) {
|
|
162
|
+
name = getFirstNotNullType(schema[0].type)
|
|
163
|
+
} else {
|
|
164
|
+
name = getFirstNotNullType(schema.type)
|
|
165
|
+
}
|
|
166
|
+
if (name === "array" || name === "null") {
|
|
167
|
+
name = "any";
|
|
168
|
+
}
|
|
169
|
+
return name;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function getFirstNotNullType(type: JSONSchemaTypeName | JSONSchemaTypeName[] | undefined) {
|
|
173
|
+
if (!type) {
|
|
174
|
+
return "any";
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(type)) {
|
|
177
|
+
return type.find(x => x !== "null") || "any";
|
|
178
|
+
}
|
|
179
|
+
return type;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
function addRequired(required: string[], name: string) {
|
|
184
|
+
if (!required.includes(name)) {
|
|
185
|
+
required.push(name);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
export enum TypeNames {
|
|
3
|
+
string = "string",
|
|
4
|
+
number = "number",
|
|
5
|
+
integer = "integer",
|
|
6
|
+
boolean = "boolean",
|
|
7
|
+
object = "object",
|
|
8
|
+
any = "any",
|
|
9
|
+
text = "text", // a string with an additional editor: textarea property
|
|
10
|
+
media = "media", // a media file ref
|
|
11
|
+
document = "document", // a document ref
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export interface TypeSignature {
|
|
16
|
+
name: TypeNames,
|
|
17
|
+
isObject: boolean,
|
|
18
|
+
isNullable: boolean,
|
|
19
|
+
isArray: boolean,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export function parseTypeSignature(text: string): TypeSignature {
|
|
24
|
+
text = text.trim();
|
|
25
|
+
let isArray = false, isNullable = false;
|
|
26
|
+
if (text.endsWith('?')) {
|
|
27
|
+
isNullable = true;
|
|
28
|
+
text = text.substring(0, text.length - 1).trim();
|
|
29
|
+
}
|
|
30
|
+
if (text.endsWith('[]')) {
|
|
31
|
+
isArray = true;
|
|
32
|
+
text = text.substring(0, text.length - 2).trim();
|
|
33
|
+
}
|
|
34
|
+
const name = TypeNames[text as TypeNames]
|
|
35
|
+
if (!name) {
|
|
36
|
+
throw new Error(`Unknown type "${text}"`);
|
|
37
|
+
}
|
|
38
|
+
return { name, isArray, isNullable, isObject: name === TypeNames.object };
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useXMLViewerContext } from '../../context/xml-viewer-context';
|
|
2
|
+
import { AttributesObject } from '../../types';
|
|
3
|
+
|
|
4
|
+
export interface AttributesProps {
|
|
5
|
+
attributes?: AttributesObject;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function Attributes(props: AttributesProps) {
|
|
9
|
+
const { attributes } = props;
|
|
10
|
+
const { theme } = useXMLViewerContext();
|
|
11
|
+
|
|
12
|
+
if (!attributes) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<span>
|
|
18
|
+
{Object.entries(attributes).map(([key, value]) => (
|
|
19
|
+
<span key={`attribute-${key}`}>
|
|
20
|
+
<span style={{ color: theme.attributeKeyColor }}>{` ${key}`}</span>
|
|
21
|
+
<span style={{ color: theme.separatorColor }}>=</span>
|
|
22
|
+
<span style={{ color: theme.attributeValueColor }}>{`"${value}"`}</span>
|
|
23
|
+
</span>
|
|
24
|
+
))}
|
|
25
|
+
</span>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useXMLViewerContext } from '../../context/xml-viewer-context';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface CDataTagProps {
|
|
5
|
+
indentation: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
isInline: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function CDataTag(props: CDataTagProps) {
|
|
11
|
+
const { indentation, children, isInline } = props;
|
|
12
|
+
const { theme } = useXMLViewerContext();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div style={{ color: theme.cdataColor }}>
|
|
16
|
+
<span>{`${indentation}<![CDATA[`}</span>
|
|
17
|
+
{children}
|
|
18
|
+
<span>{`${isInline ? '' : indentation}]]>`}</span>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|