@vertesia/ui 0.56.0 → 0.57.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 +68 -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 +189 -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,161 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect } from "react";
|
|
2
|
+
import { HistoryNavigator } from "./HistoryNavigator";
|
|
3
|
+
import { PathMatcher } from "./PathMatcher";
|
|
4
|
+
import { isRootPath, joinPath } from "./path";
|
|
5
|
+
export class BaseRouter {
|
|
6
|
+
// the path to use when navigating to the root of the router
|
|
7
|
+
index;
|
|
8
|
+
matcher = new PathMatcher();
|
|
9
|
+
constructor(routes, index) {
|
|
10
|
+
this.index = index;
|
|
11
|
+
for (const route of routes) {
|
|
12
|
+
this.matcher.addPath(route.path, route);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
match(path) {
|
|
16
|
+
const useIndex = isRootPath(path) && this.index;
|
|
17
|
+
return this.matcher.match(useIndex ? this.index : path);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class Router extends BaseRouter {
|
|
21
|
+
prompt;
|
|
22
|
+
observer;
|
|
23
|
+
navigator = new HistoryNavigator();
|
|
24
|
+
constructor(routes, updateState) {
|
|
25
|
+
super(routes);
|
|
26
|
+
this.navigator.addListener((event) => {
|
|
27
|
+
if (event.isCancelable && this.prompt && !!this.prompt.when) {
|
|
28
|
+
if (!window.confirm(this.prompt.message))
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (this.observer) {
|
|
32
|
+
this.observer(event);
|
|
33
|
+
}
|
|
34
|
+
// only process afterChange events
|
|
35
|
+
if (event.name === "afterChange") {
|
|
36
|
+
const match = this.match(event.location.pathname);
|
|
37
|
+
if (match && match.value) {
|
|
38
|
+
updateState({
|
|
39
|
+
...match,
|
|
40
|
+
state: event.state,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
updateState(null);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
getTopRouter() {
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Subsequent navigations will preserve the given params in the query string.
|
|
54
|
+
* Use null to clear the sticky params.
|
|
55
|
+
* @param params
|
|
56
|
+
*/
|
|
57
|
+
setStickyParams(params) {
|
|
58
|
+
this.navigator.stickyParams = params != null ? params : undefined;
|
|
59
|
+
}
|
|
60
|
+
withObserver(observer) {
|
|
61
|
+
this.observer = observer;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
start() {
|
|
65
|
+
this.navigator.start();
|
|
66
|
+
// initialize with the current location
|
|
67
|
+
this.navigator.firePageLoad();
|
|
68
|
+
}
|
|
69
|
+
stop() {
|
|
70
|
+
this.navigator.stop();
|
|
71
|
+
}
|
|
72
|
+
navigate(path, options) {
|
|
73
|
+
this.navigator.navigate(path, options);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export class NestedRouter extends BaseRouter {
|
|
77
|
+
parent;
|
|
78
|
+
basePath;
|
|
79
|
+
constructor(parent, basePath, routes) {
|
|
80
|
+
super(routes);
|
|
81
|
+
this.parent = parent;
|
|
82
|
+
this.basePath = basePath;
|
|
83
|
+
}
|
|
84
|
+
getTopRouter() {
|
|
85
|
+
if (this.parent instanceof Router) {
|
|
86
|
+
return this.parent;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return this.parent.getTopRouter();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
navigate(path, options) {
|
|
93
|
+
// base path is nested by default in a NestedRouter unless explicitly set to false by caller
|
|
94
|
+
const isBasePathNested = options?.isBasePathNested ?? true;
|
|
95
|
+
let basePath;
|
|
96
|
+
if (isBasePathNested) {
|
|
97
|
+
const childBasePath = options?.basePath;
|
|
98
|
+
// e.g. "/store" + "/objects/123" => "/store/objects/123"
|
|
99
|
+
basePath = childBasePath ? joinPath(this.basePath, childBasePath) : this.basePath;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// e.g. "/store" + "/studio" => "/studio"
|
|
103
|
+
basePath = options?.basePath ?? this.basePath;
|
|
104
|
+
}
|
|
105
|
+
this.parent.navigate(path, {
|
|
106
|
+
...options,
|
|
107
|
+
basePath,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const ReactRouterContext = createContext(undefined);
|
|
112
|
+
export { ReactRouterContext };
|
|
113
|
+
export function useRouterContext() {
|
|
114
|
+
const ctx = useContext(ReactRouterContext);
|
|
115
|
+
if (!ctx) {
|
|
116
|
+
throw new Error("useRouter must be used within a RouterProvider");
|
|
117
|
+
}
|
|
118
|
+
return ctx;
|
|
119
|
+
}
|
|
120
|
+
export function useNavigate() {
|
|
121
|
+
const { navigate } = useRouterContext();
|
|
122
|
+
return navigate;
|
|
123
|
+
}
|
|
124
|
+
export function useParams(arg) {
|
|
125
|
+
const { params } = useRouterContext();
|
|
126
|
+
if (arg) {
|
|
127
|
+
return params[arg];
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return params;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function useLocation() {
|
|
134
|
+
const { location } = useRouterContext();
|
|
135
|
+
return location;
|
|
136
|
+
}
|
|
137
|
+
export function useNavigationPrompt(prompt) {
|
|
138
|
+
const { router } = useRouterContext();
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
router.getTopRouter().prompt = prompt;
|
|
141
|
+
return () => {
|
|
142
|
+
router.getTopRouter().prompt = undefined;
|
|
143
|
+
};
|
|
144
|
+
}, []);
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (prompt.when) {
|
|
147
|
+
const doBlock = prompt.when;
|
|
148
|
+
const listener = function (ev) {
|
|
149
|
+
if (doBlock) {
|
|
150
|
+
ev.preventDefault();
|
|
151
|
+
ev.returnValue = "";
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
window.addEventListener("beforeunload", listener);
|
|
155
|
+
return () => {
|
|
156
|
+
window.removeEventListener("beforeunload", listener);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}, [prompt.when]);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=Router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router.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CAAC;gBACjC,CAAC;YACL,CAAC,CAAC;YACF,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAClD,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YACzD,CAAC,CAAC;QACN,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSafeLayoutEffect } from "@vertesia/ui/core";
|
|
3
|
+
//import { useSafeLayoutEffect } from "../core";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { RouteComponent } from "./RouteComponent";
|
|
6
|
+
import { ReactRouterContext, Router } from "./Router";
|
|
7
|
+
import { createRoute404 } from "./Route404";
|
|
8
|
+
export function RouterProvider({ routes, index, onChange, children }) {
|
|
9
|
+
const [state, setState] = useState(undefined);
|
|
10
|
+
const router = useMemo(() => {
|
|
11
|
+
if (typeof window === 'undefined')
|
|
12
|
+
return null;
|
|
13
|
+
const router = new Router(routes, (match) => {
|
|
14
|
+
if (match === null) {
|
|
15
|
+
match = createRoute404();
|
|
16
|
+
}
|
|
17
|
+
setState({
|
|
18
|
+
location: window.location,
|
|
19
|
+
route: match.value,
|
|
20
|
+
params: match.params,
|
|
21
|
+
state: match.state,
|
|
22
|
+
router: router,
|
|
23
|
+
matchedRoutePath: '/' + match.matchedSegments.join('/'),
|
|
24
|
+
remainingPath: match.remainingSegments ? '/' + match.remainingSegments.join('/') : undefined,
|
|
25
|
+
navigate: (to, options) => {
|
|
26
|
+
return router.navigate(to, options);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}).withObserver(onChange);
|
|
30
|
+
router.index = index;
|
|
31
|
+
return router;
|
|
32
|
+
}, []);
|
|
33
|
+
useSafeLayoutEffect(() => {
|
|
34
|
+
router && router.start();
|
|
35
|
+
return () => {
|
|
36
|
+
router && router.stop();
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
return state && (_jsx(ReactRouterContext.Provider, { value: state, children: children ? children : _jsx(RouteComponent, {}) }));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=RouterProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouterProvider.js","sourceRoot":"","sources":["../../../src/router/RouterProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,gDAAgD;AAChD,OAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAS,MAAM,EAAiB,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAa5C,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAuB;IACrF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA4B,SAAS,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACxC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACjB,KAAK,GAAG,cAAc,EAAE,CAAC;YAC7B,CAAC;YACD,QAAQ,CAAC;gBACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,MAAM;gBACd,gBAAgB,EAAE,GAAG,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC;gBACvD,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC5F,QAAQ,EAAE,CAAC,EAAU,EAAE,OAAyB,EAAE,EAAE;oBAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;gBACxC,CAAC;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC1B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,mBAAmB,CAAC,GAAG,EAAE;QACrB,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,GAAG,EAAE;YACR,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC,CAAA;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,KAAK,IAAI,CACZ,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACpC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAC,cAAc,KAAG,GACf,CACjC,CAAA;AACL,CAAC"}
|
package/lib/esm/router/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * from "./FixLinks.js";
|
|
2
|
+
export * from "./HistoryNavigator.js";
|
|
3
|
+
export * from "./Nav.js";
|
|
4
|
+
export * from "./NestedNavigationContext.js";
|
|
5
|
+
export * from "./NestedRouterProvider.js";
|
|
6
|
+
export * as Path from "./path.js";
|
|
7
|
+
export * from "./PathMatcher.js";
|
|
8
|
+
export * from "./RouteComponent.js";
|
|
9
|
+
export * from "./Router.js";
|
|
10
|
+
export * from "./RouterProvider.js";
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/index.ts"],"names":[],"mappings":"AAAA,cAAc;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export function isRootPath(path) {
|
|
2
|
+
return path === '/' || path === '';
|
|
3
|
+
}
|
|
4
|
+
export function joinPath(path1, path2) {
|
|
5
|
+
if (path1.endsWith('/') && path2.startsWith('/')) {
|
|
6
|
+
path2 = path1 + path2.substring(1);
|
|
7
|
+
}
|
|
8
|
+
else if (path1.endsWith('/')) {
|
|
9
|
+
path2 = path1 + path2;
|
|
10
|
+
}
|
|
11
|
+
else if (path2.startsWith('/')) {
|
|
12
|
+
path2 = path1 + path2;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
path2 = path1 + '/' + path2;
|
|
16
|
+
}
|
|
17
|
+
return path2;
|
|
18
|
+
}
|
|
19
|
+
export function getPathSegments(path) {
|
|
20
|
+
if (path === '' || path === '/') {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
let s = 0, e = path.length;
|
|
24
|
+
if (path.startsWith('./')) {
|
|
25
|
+
s = 2;
|
|
26
|
+
}
|
|
27
|
+
else if (path.startsWith('/')) {
|
|
28
|
+
s = 1;
|
|
29
|
+
}
|
|
30
|
+
if (path.endsWith('/')) {
|
|
31
|
+
e = path.length - 1;
|
|
32
|
+
}
|
|
33
|
+
return (s > 0 || e < path.length ? path.substring(s, e) : path).split('/');
|
|
34
|
+
}
|
|
35
|
+
export function toSegments(path) {
|
|
36
|
+
if (typeof path === 'string') {
|
|
37
|
+
return getPathSegments(path);
|
|
38
|
+
}
|
|
39
|
+
else if (Array.isArray(path)) {
|
|
40
|
+
return path;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error(`Unsupported path object: ${path}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// export class Path {
|
|
47
|
+
// static parse(path: string, abs = false) {
|
|
48
|
+
// if (abs !== undefined) {
|
|
49
|
+
// abs = path.startsWith('/');
|
|
50
|
+
// }
|
|
51
|
+
// return new Path(getPathSegments(path), abs);
|
|
52
|
+
// }
|
|
53
|
+
// constructor(public segments: string[], public isAbsolute = false) {
|
|
54
|
+
// }
|
|
55
|
+
// getParameters() {
|
|
56
|
+
// const out = [];
|
|
57
|
+
// for (const segment of this.segments) {
|
|
58
|
+
// if (segment[0] === ':') {
|
|
59
|
+
// out.push(segment.substring(1));
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
// if (this.segments[this.segments.length - 1] === '*') {
|
|
63
|
+
// out.push('_');
|
|
64
|
+
// }
|
|
65
|
+
// return out;
|
|
66
|
+
// }
|
|
67
|
+
// resolveParameters(path: string) {
|
|
68
|
+
// const params: PathMatchParams = {};
|
|
69
|
+
// const resolvedSegments = getPathSegments(path);
|
|
70
|
+
// if (resolvedSegments.length < this.segments.length) {
|
|
71
|
+
// return null;
|
|
72
|
+
// }
|
|
73
|
+
// const segments = this.segments;
|
|
74
|
+
// for (let i = 0, l = segments.length; i < l; i++) {
|
|
75
|
+
// const seg = segments[i];
|
|
76
|
+
// if (seg[0] === ':') {
|
|
77
|
+
// params[seg.substring(1)] = resolvedSegments[i];
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
// if (resolvedSegments.length - this.segments.length) {
|
|
81
|
+
// params._ = resolvedSegments.slice(this.segments.length);
|
|
82
|
+
// }
|
|
83
|
+
// return params;
|
|
84
|
+
// }
|
|
85
|
+
// match(path: string | string[] | Path) {
|
|
86
|
+
// const segments = toSegments(path);
|
|
87
|
+
// if (segments.length < this.segments.length) {
|
|
88
|
+
// return false;
|
|
89
|
+
// }
|
|
90
|
+
// let params: PathMatchParams | undefined;
|
|
91
|
+
// const mySegments = this.segments;
|
|
92
|
+
// for (let i = 0, l = mySegments.length; i < l; i++) {
|
|
93
|
+
// const segment = mySegments[i];
|
|
94
|
+
// if (segment === ':') {
|
|
95
|
+
// if (!params) params = {};
|
|
96
|
+
// params[segment.substring(1)] = segment;
|
|
97
|
+
// } else if (segment !== segments[i]) {
|
|
98
|
+
// if (i === l - 1 && segment === '*') {
|
|
99
|
+
// if (!params) params = {};
|
|
100
|
+
// params._ = segments.slice(i);
|
|
101
|
+
// return params;
|
|
102
|
+
// }
|
|
103
|
+
// return false;
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
// return params ? params : false;
|
|
107
|
+
// }
|
|
108
|
+
// join(path: Path | string | string[]) {
|
|
109
|
+
// const segments = toSegments(path);
|
|
110
|
+
// return new Path(this.segments.concat(segments), this.isAbsolute);
|
|
111
|
+
// }
|
|
112
|
+
// getRelativePath(path: Path | string | string[], asAbsolute: boolean = false) {
|
|
113
|
+
// const segments = toSegments(path);
|
|
114
|
+
// const extraSegmentsCount = segments.length - this.segments.length;
|
|
115
|
+
// if (extraSegmentsCount <= 0) {
|
|
116
|
+
// return null;
|
|
117
|
+
// }
|
|
118
|
+
// return new Path(segments.slice(this.segments.length), asAbsolute);
|
|
119
|
+
// }
|
|
120
|
+
// prependSegments(segments: string[]) {
|
|
121
|
+
// this.segments = segments.concat(this.segments);
|
|
122
|
+
// }
|
|
123
|
+
// appendSegments(segments: string[]) {
|
|
124
|
+
// this.segments = this.segments.concat(segments);
|
|
125
|
+
// }
|
|
126
|
+
// toAbsolutePath() {
|
|
127
|
+
// return '/' + this.segments.join('/');
|
|
128
|
+
// }
|
|
129
|
+
// toRelativePath() {
|
|
130
|
+
// return this.segments.join('/');
|
|
131
|
+
// }
|
|
132
|
+
// toString() {
|
|
133
|
+
// const path = this.segments.join('/');
|
|
134
|
+
// return this.isAbsolute ? '/' + path : path;
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/router/path.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,KAAa;IACjD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1B,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1B,CAAC;SAAM,CAAC;QACJ,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IACxC,I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|
+
this.types = types;
|
|
6
|
+
//sort types
|
|
7
|
+
types.sort((a, b) => a.name.localeCompare(b.name));
|
|
8
|
+
for (const type of types) {
|
|
9
|
+
this.map[type.id] = type;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
getType(id) {
|
|
13
|
+
return this.map[id];
|
|
14
|
+
}
|
|
15
|
+
getTypeLayout(id) {
|
|
16
|
+
const type = this.map[id];
|
|
17
|
+
return type ? type.table_layout : undefined;
|
|
18
|
+
}
|
|
19
|
+
getTypeName(id) {
|
|
20
|
+
const type = this.map[id];
|
|
21
|
+
return type ? type.name : undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=TypeRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeRegistry.js","sourceRoot":"","sources":["../../../src/session/TypeRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IAEF;IADnB,GAAG,GAA0C,EAAE,CAAC;IAChD,YAAmB,KAA8B;QAA9B,UAAK,GAAL,KAAK,CAAyB;QAC7C,YAAY;QACZ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAClD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QAC7B,CAAC;IACL,CAAC;IAED,OAAO,CAAC,EAAU;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,aAAa,CAAC,EAAU;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,WAAW,CAAC,EAAU;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACxC,CAAC;CAEJ"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { jwtDecode } from 'jwt-decode';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
import { VertesiaClient } from '@vertesia/client';
|
|
4
|
+
import { Env } from '@vertesia/ui/env';
|
|
5
|
+
import { getComposableToken } from './auth/composable';
|
|
6
|
+
import { getFirebaseAuth } from './auth/firebase';
|
|
7
|
+
import { TypeRegistry } from './TypeRegistry';
|
|
8
|
+
export const LastSelectedAccountId_KEY = 'composableai.lastSelectedAccountId';
|
|
9
|
+
export const LastSelectedProjectId_KEY = 'composableai.lastSelectedProjectId';
|
|
10
|
+
class UserSession {
|
|
11
|
+
isLoading = true;
|
|
12
|
+
client;
|
|
13
|
+
authError;
|
|
14
|
+
authToken;
|
|
15
|
+
typeRegistry;
|
|
16
|
+
setSession;
|
|
17
|
+
lastSelectedAccount;
|
|
18
|
+
lastSelectedProject;
|
|
19
|
+
onboardingComplete;
|
|
20
|
+
constructor(client, setSession) {
|
|
21
|
+
if (client) {
|
|
22
|
+
this.client = client;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.client = new VertesiaClient({
|
|
26
|
+
serverUrl: Env.endpoints.studio,
|
|
27
|
+
storeUrl: Env.endpoints.zeno,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (setSession) {
|
|
31
|
+
this.setSession = setSession;
|
|
32
|
+
}
|
|
33
|
+
this.logout = this.logout.bind(this);
|
|
34
|
+
}
|
|
35
|
+
get store() {
|
|
36
|
+
return this.client.store;
|
|
37
|
+
}
|
|
38
|
+
get user() {
|
|
39
|
+
return this.authToken;
|
|
40
|
+
}
|
|
41
|
+
get account() {
|
|
42
|
+
return this.authToken?.account;
|
|
43
|
+
}
|
|
44
|
+
get project() {
|
|
45
|
+
return this.authToken?.project;
|
|
46
|
+
}
|
|
47
|
+
get accounts() {
|
|
48
|
+
return this.authToken?.accounts;
|
|
49
|
+
}
|
|
50
|
+
get authCallback() {
|
|
51
|
+
return this.rawAuthToken.then(token => `Bearer ${token}`);
|
|
52
|
+
}
|
|
53
|
+
get rawAuthToken() {
|
|
54
|
+
return getComposableToken().then(res => {
|
|
55
|
+
const token = res?.rawToken;
|
|
56
|
+
if (!token) {
|
|
57
|
+
throw new Error('No token available');
|
|
58
|
+
}
|
|
59
|
+
this.authToken = jwtDecode(token);
|
|
60
|
+
return token;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
signOut() {
|
|
64
|
+
this.logout();
|
|
65
|
+
}
|
|
66
|
+
getAccount() {
|
|
67
|
+
return this.authToken?.account;
|
|
68
|
+
}
|
|
69
|
+
async login(token) {
|
|
70
|
+
this.authError = undefined;
|
|
71
|
+
this.isLoading = false;
|
|
72
|
+
this.client.withAuthCallback(() => this.authCallback);
|
|
73
|
+
this.authToken = jwtDecode(token);
|
|
74
|
+
console.log(`Logging in as ${this.authToken?.name} with account ${this.authToken?.account.name} (${this.authToken?.account.id}, and project ${this.authToken?.project?.name} (${this.authToken?.project?.id})`);
|
|
75
|
+
//store selected account in local storage
|
|
76
|
+
localStorage.setItem(LastSelectedAccountId_KEY, this.authToken.account.id);
|
|
77
|
+
localStorage.setItem(LastSelectedProjectId_KEY + '-' + this.authToken.account.id, this.authToken.project?.id ?? '');
|
|
78
|
+
// notify the host app of the login
|
|
79
|
+
Env.onLogin?.(this.authToken);
|
|
80
|
+
// Independent async calls
|
|
81
|
+
await Promise.all([
|
|
82
|
+
this._loadTypes(),
|
|
83
|
+
this.fetchOnboardingStatus(),
|
|
84
|
+
]);
|
|
85
|
+
return Promise.resolve();
|
|
86
|
+
}
|
|
87
|
+
isLoggedIn() {
|
|
88
|
+
return !!this.authToken;
|
|
89
|
+
}
|
|
90
|
+
logout() {
|
|
91
|
+
console.log('Logging out');
|
|
92
|
+
if (this.authToken) {
|
|
93
|
+
getFirebaseAuth().signOut();
|
|
94
|
+
}
|
|
95
|
+
this.authError = undefined;
|
|
96
|
+
this.isLoading = false;
|
|
97
|
+
this.authToken = undefined;
|
|
98
|
+
this.typeRegistry = undefined;
|
|
99
|
+
this.setSession = undefined;
|
|
100
|
+
this.client.withAuthCallback(undefined);
|
|
101
|
+
}
|
|
102
|
+
async switchAccount(targetAccountId) {
|
|
103
|
+
localStorage.setItem(LastSelectedAccountId_KEY, targetAccountId);
|
|
104
|
+
if (this) {
|
|
105
|
+
if (this.account && this.project) {
|
|
106
|
+
localStorage.setItem(LastSelectedProjectId_KEY + '-' + this.account.id, this.project.id);
|
|
107
|
+
}
|
|
108
|
+
else if (this.account) {
|
|
109
|
+
localStorage.removeItem(LastSelectedProjectId_KEY + '-' + this.account.id);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
window.location.replace('/?a=' + targetAccountId);
|
|
113
|
+
}
|
|
114
|
+
async switchProject(targetProjectId) {
|
|
115
|
+
if (this.account) {
|
|
116
|
+
localStorage.setItem(LastSelectedProjectId_KEY + '-' + this.account.id, targetProjectId);
|
|
117
|
+
}
|
|
118
|
+
window.location.replace('/?a=' + this.account?.id + '&p=' + targetProjectId);
|
|
119
|
+
}
|
|
120
|
+
async _loadTypes() {
|
|
121
|
+
if (this.project) {
|
|
122
|
+
return this.store.types.list({}, { layout: true }).then(types => this.typeRegistry = new TypeRegistry(types)).catch(err => {
|
|
123
|
+
console.error('Failed to fetch object types', err);
|
|
124
|
+
throw err;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
console.log('No project selected');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async reloadTypes() {
|
|
132
|
+
return this._loadTypes().then(() => {
|
|
133
|
+
this.setSession?.(this.clone());
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async fetchAccounts() {
|
|
137
|
+
return this.client.accounts.list().then(accounts => {
|
|
138
|
+
if (!this.authToken) {
|
|
139
|
+
throw new Error('No token available');
|
|
140
|
+
}
|
|
141
|
+
this.authToken.accounts = accounts;
|
|
142
|
+
this.setSession?.(this.clone());
|
|
143
|
+
}).catch(err => {
|
|
144
|
+
console.error('Failed to fetch accounts', err);
|
|
145
|
+
throw err;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async fetchOnboardingStatus() {
|
|
149
|
+
if (this.onboardingComplete) {
|
|
150
|
+
console.log('Onboarding already completed');
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
const previousStatus = this.onboardingComplete;
|
|
154
|
+
try {
|
|
155
|
+
const onboarding = await this.client.account.onboardingProgress();
|
|
156
|
+
this.onboardingComplete = Object.values(onboarding).every(value => value === true);
|
|
157
|
+
if (previousStatus !== this.onboardingComplete) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
this.setSession?.(this.clone());
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error('Error fetching onboarding status:', error);
|
|
164
|
+
this.onboardingComplete = false;
|
|
165
|
+
this.setSession?.(this.clone());
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
clone() {
|
|
170
|
+
const session = new UserSession(this.client);
|
|
171
|
+
session.isLoading = this.isLoading;
|
|
172
|
+
session.authError = this.authError;
|
|
173
|
+
session.authToken = this.authToken;
|
|
174
|
+
session.setSession = this.setSession;
|
|
175
|
+
session.lastSelectedAccount = this.lastSelectedAccount;
|
|
176
|
+
session.switchAccount = this.switchAccount;
|
|
177
|
+
session.typeRegistry = this.typeRegistry;
|
|
178
|
+
session.onboardingComplete = this.onboardingComplete;
|
|
179
|
+
return session;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const UserSessionContext = createContext(undefined);
|
|
183
|
+
export function useUserSession() {
|
|
184
|
+
const session = useContext(UserSessionContext);
|
|
185
|
+
if (!session) {
|
|
186
|
+
throw new Error('useUserSession must be used within a UserSessionProvider');
|
|
187
|
+
}
|
|
188
|
+
return session;
|
|
189
|
+
}
|
|
190
|
+
export { UserSession, UserSessionContext };
|
|
191
|
+
//# sourceMappingURL=UserSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserSession.js","sourceRoot":"","sources":["../../../src/session/UserSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,oCAAoC,CAAC;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,oCAAoC,CAAC;AAG9E,MAAM,WAAW;IAEb,SAAS,GAAG,IAAI,CAAC;IACjB,MAAM,CAAiB;IACvB,SAAS,CAAS;IAClB,SAAS,CAAoB;IAC7B,YAAY,CAAgB;IAC5B,UAAU,CAAkC;IAC5C,mBAAmB,CAAiB;IACpC,mBAAmB,CAAiB;IACpC,kBAAkB,CAAW;IAE7B,YAAY,MAAuB,EAAE,UAA2C;QAE5E,IAAI,MAAM,EAAE,CAAC;YACT,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC;gBAC7B,SAAS,EAAE,GAAG,CAAC,SAA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