@vertesia/ui 1.5.0-dev.20260910.051115Z → 1.6.0-dev.20260912.110338Z
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/README.md +125 -0
- package/lib/boot/branding.d.ts +58 -0
- package/lib/boot/branding.d.ts.map +1 -0
- package/lib/boot/branding.js +62 -0
- package/lib/boot/branding.js.map +1 -0
- package/lib/boot/index.d.ts +27 -0
- package/lib/boot/index.d.ts.map +1 -0
- package/lib/boot/index.js +325 -0
- package/lib/boot/index.js.map +1 -0
- package/lib/boot/vite.d.ts +63 -0
- package/lib/boot/vite.d.ts.map +1 -0
- package/lib/boot/vite.js +108 -0
- package/lib/boot/vite.js.map +1 -0
- package/lib/core/components/Link.js +1 -1
- package/lib/core/components/Link.js.map +1 -1
- package/lib/core/components/Spinner.js +1 -1
- package/lib/core/components/Spinner.js.map +1 -1
- package/lib/core/components/TagsInput.js +7 -7
- package/lib/core/components/TagsInput.js.map +1 -1
- package/lib/core/components/shadcn/badge.js +1 -1
- package/lib/core/components/shadcn/badge.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +3 -4
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js +2 -2
- package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -1
- package/lib/core/components/shadcn/filters/comboBox/SelectCombobox.js +1 -1
- package/lib/core/components/shadcn/filters/comboBox/SelectCombobox.js.map +1 -1
- package/lib/core/components/shadcn/filters/comboBox/StringListCombobox.js +1 -1
- package/lib/core/components/shadcn/filters/comboBox/StringListCombobox.js.map +1 -1
- package/lib/core/components/shadcn/filters/comboBox/TextCombobox.js +1 -1
- package/lib/core/components/shadcn/filters/comboBox/TextCombobox.js.map +1 -1
- package/lib/core/components/shadcn/filters/filter/dateFilter.js +1 -1
- package/lib/core/components/shadcn/filters/filter/dateFilter.js.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.js +4 -4
- package/lib/core/components/shadcn/filters/filters.js +1 -1
- package/lib/core/components/shadcn/filters/filters.js.map +1 -1
- package/lib/core/components/shadcn/label.js +1 -1
- package/lib/core/components/shadcn/label.js.map +1 -1
- package/lib/core/components/shadcn/overflowTabs.js +2 -2
- package/lib/core/components/shadcn/overflowTabs.js.map +1 -1
- package/lib/core/components/shadcn/tabs.js +1 -1
- package/lib/core/components/shadcn/tabs.js.map +1 -1
- package/lib/env/index.d.ts +28 -1
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +51 -3
- package/lib/env/index.js.map +1 -1
- package/lib/features/activity-doc/ActivityDoc.js +1 -1
- package/lib/features/activity-doc/ActivityDoc.js.map +1 -1
- package/lib/features/agent/PayloadBuilder.d.ts +4 -0
- package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/features/agent/chat/AgentRunFeedback.d.ts +59 -0
- package/lib/features/agent/chat/AgentRunFeedback.d.ts.map +1 -0
- package/lib/features/agent/chat/AgentRunFeedback.js +286 -0
- package/lib/features/agent/chat/AgentRunFeedback.js.map +1 -0
- package/lib/features/agent/chat/AskUserWidget.d.ts +1 -0
- package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.js +15 -4
- package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +3 -2
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +16 -13
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +30 -8
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js +2 -0
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js.map +1 -1
- package/lib/features/agent/chat/index.d.ts +1 -0
- package/lib/features/agent/chat/index.d.ts.map +1 -1
- package/lib/features/agent/chat/index.js +1 -0
- package/lib/features/agent/chat/index.js.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts +8 -0
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.js +12 -0
- package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
- package/lib/features/layout/GenericPageNavHeader.js +1 -1
- package/lib/features/layout/GenericPageNavHeader.js.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
- package/lib/features/magic-pdf/GroundedExtractionView.js +3 -3
- package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +15 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +20 -12
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/DocumentPreviewPanel.js +5 -5
- package/lib/features/store/objects/DocumentPreviewPanel.js.map +1 -1
- package/lib/features/store/objects/components/DocumentInput.js +1 -1
- package/lib/features/store/objects/components/DocumentInput.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/objects/upload/DocumentUploadModal.js +1 -1
- package/lib/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
- package/lib/features/store/types/TypeRegistry.d.ts +130 -0
- package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +130 -0
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
- package/lib/features/user/UserInfo.js +1 -1
- package/lib/features/user/UserInfo.js.map +1 -1
- package/lib/i18n/index.d.ts +5 -4
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js +16 -2
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/locales/ar.json +30 -0
- package/lib/i18n/locales/de.json +30 -0
- package/lib/i18n/locales/en.json +30 -0
- package/lib/i18n/locales/es.json +30 -0
- package/lib/i18n/locales/fr.json +30 -0
- package/lib/i18n/locales/it.json +30 -0
- package/lib/i18n/locales/ja.json +30 -0
- package/lib/i18n/locales/ko.json +30 -0
- package/lib/i18n/locales/pt.json +30 -0
- package/lib/i18n/locales/ru.json +30 -0
- package/lib/i18n/locales/tr.json +30 -0
- package/lib/i18n/locales/zh-TW.json +30 -0
- package/lib/i18n/locales/zh.json +30 -0
- package/lib/layout/ErrorPage.js +1 -1
- package/lib/layout/ErrorPage.js.map +1 -1
- package/lib/layout/Navbar.d.ts.map +1 -1
- package/lib/layout/Navbar.js +3 -2
- package/lib/layout/Navbar.js.map +1 -1
- package/lib/router/RouteComponent.d.ts.map +1 -1
- package/lib/router/RouteComponent.js +15 -12
- package/lib/router/RouteComponent.js.map +1 -1
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +6 -3
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts +2 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +10 -1
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +88 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +22 -12
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +35 -21
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/session/auth/useAuthState.d.ts +9 -4
- package/lib/session/auth/useAuthState.d.ts.map +1 -1
- package/lib/session/auth/useAuthState.js +9 -4
- package/lib/session/auth/useAuthState.js.map +1 -1
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +3 -1
- package/lib/session/index.js.map +1 -1
- package/lib/shell/AuthScreenPreview.d.ts +12 -0
- package/lib/shell/AuthScreenPreview.d.ts.map +1 -0
- package/lib/shell/AuthScreenPreview.js +140 -0
- package/lib/shell/AuthScreenPreview.js.map +1 -0
- package/lib/shell/BrandedAuthScreens.d.ts +19 -0
- package/lib/shell/BrandedAuthScreens.d.ts.map +1 -0
- package/lib/shell/BrandedAuthScreens.js +64 -0
- package/lib/shell/BrandedAuthScreens.js.map +1 -0
- package/lib/shell/SplashScreen.d.ts +13 -2
- package/lib/shell/SplashScreen.d.ts.map +1 -1
- package/lib/shell/SplashScreen.js +21 -20
- package/lib/shell/SplashScreen.js.map +1 -1
- package/lib/shell/VertesiaShell.d.ts +15 -4
- package/lib/shell/VertesiaShell.d.ts.map +1 -1
- package/lib/shell/VertesiaShell.js +8 -3
- package/lib/shell/VertesiaShell.js.map +1 -1
- package/lib/shell/apps/StandaloneApp.js +5 -1
- package/lib/shell/apps/StandaloneApp.js.map +1 -1
- package/lib/shell/index.d.ts +6 -0
- package/lib/shell/index.d.ts.map +1 -1
- package/lib/shell/index.js +5 -0
- package/lib/shell/index.js.map +1 -1
- package/lib/shell/login/SignInFlow.d.ts +68 -0
- package/lib/shell/login/SignInFlow.d.ts.map +1 -0
- package/lib/shell/login/SignInFlow.js +108 -0
- package/lib/shell/login/SignInFlow.js.map +1 -0
- package/lib/shell/login/SignInPageShell.d.ts +13 -0
- package/lib/shell/login/SignInPageShell.d.ts.map +1 -0
- package/lib/shell/login/SignInPageShell.js +14 -0
- package/lib/shell/login/SignInPageShell.js.map +1 -0
- package/lib/shell/login/SignInPrimitives.d.ts +3 -3
- package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
- package/lib/shell/login/SignInPrimitives.js +13 -11
- package/lib/shell/login/SignInPrimitives.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +5 -0
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +8 -4
- package/lib/shell/login/SignInRestrictedEnvStep.js.map +1 -1
- package/lib/shell/login/SigninScreen.d.ts +38 -3
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +33 -86
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/SignupForm.d.ts +3 -1
- package/lib/shell/login/SignupForm.d.ts.map +1 -1
- package/lib/shell/login/SignupForm.js +7 -3
- package/lib/shell/login/SignupForm.js.map +1 -1
- package/lib/shell/login/signInUtils.d.ts +11 -0
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +29 -5
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-boot.js +237 -0
- package/lib/vertesia-ui-boot.js.map +1 -0
- package/lib/vertesia-ui-core.js +46 -46
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +222 -208
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +13 -13
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +68 -68
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- 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-shell.js +58 -33
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +94 -94
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/json-view/JSONCode.js +1 -1
- package/lib/widgets/json-view/JSONCode.js.map +1 -1
- package/lib/widgets/upload/DropZone.d.ts.map +1 -1
- package/lib/widgets/upload/DropZone.js +1 -1
- package/lib/widgets/upload/DropZone.js.map +1 -1
- package/llms.txt +6 -2
- package/package.json +44 -35
- package/src/__tests__/a11y.test.tsx +25 -0
- package/src/__tests__/theme.test.ts +91 -0
- package/src/boot/branding.test.ts +72 -0
- package/src/boot/branding.ts +108 -0
- package/src/boot/index.test.ts +216 -0
- package/src/boot/index.ts +356 -0
- package/src/boot/vite.test.ts +93 -0
- package/src/boot/vite.ts +118 -0
- package/src/core/components/Link.tsx +1 -1
- package/src/core/components/Spinner.tsx +1 -1
- package/src/core/components/TagsInput.tsx +7 -7
- package/src/core/components/shadcn/badge.tsx +1 -1
- package/src/core/components/shadcn/button.tsx +3 -5
- package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +2 -2
- package/src/core/components/shadcn/filters/comboBox/SelectCombobox.tsx +1 -1
- package/src/core/components/shadcn/filters/comboBox/StringListCombobox.tsx +1 -1
- package/src/core/components/shadcn/filters/comboBox/TextCombobox.tsx +1 -1
- package/src/core/components/shadcn/filters/filter/dateFilter.tsx +1 -1
- package/src/core/components/shadcn/filters/filter-styles.ts +4 -4
- package/src/core/components/shadcn/filters/filters.tsx +1 -1
- package/src/core/components/shadcn/label.tsx +1 -1
- package/src/core/components/shadcn/overflowTabs.tsx +2 -2
- package/src/core/components/shadcn/tabs.tsx +1 -1
- package/src/css/utilities.css +7 -0
- package/src/env/index.test.ts +100 -0
- package/src/env/index.ts +66 -3
- package/src/features/activity-doc/ActivityDoc.tsx +1 -1
- package/src/features/agent/PayloadBuilder.tsx +4 -0
- package/src/features/agent/chat/AgentRunFeedback.test.tsx +330 -0
- package/src/features/agent/chat/AgentRunFeedback.tsx +452 -0
- package/src/features/agent/chat/AskUserWidget.test.tsx +24 -2
- package/src/features/agent/chat/AskUserWidget.tsx +19 -4
- package/src/features/agent/chat/ModernAgentConversation.tsx +46 -42
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +207 -0
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +50 -31
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +4 -0
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +42 -8
- package/src/features/agent/chat/ModernAgentOutput/SummaryConversation.ts +2 -0
- package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +14 -0
- package/src/features/agent/chat/hooks/useFileProcessing.test.tsx +0 -5
- package/src/features/agent/chat/index.ts +6 -0
- package/src/features/facets/AgentRunnerFacetsNav.tsx +26 -0
- package/src/features/layout/GenericPageNavHeader.test.tsx +36 -0
- package/src/features/layout/GenericPageNavHeader.tsx +1 -1
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +1 -1
- package/src/features/magic-pdf/GroundedExtractionView.tsx +3 -3
- package/src/features/permissions/UserPermissionsProvider.test.tsx +50 -1
- package/src/features/permissions/UserPermissionsProvider.tsx +82 -44
- package/src/features/store/objects/DocumentPreviewPanel.tsx +10 -10
- package/src/features/store/objects/components/DocumentInput.tsx +1 -1
- package/src/features/store/objects/selection/SelectionActions.tsx +4 -1
- package/src/features/store/objects/upload/DocumentUploadModal.tsx +1 -1
- package/src/features/user/UserInfo.tsx +1 -1
- package/src/i18n/index.tsx +25 -2
- package/src/i18n/locales/ar.json +30 -0
- package/src/i18n/locales/de.json +30 -0
- package/src/i18n/locales/en.json +30 -0
- package/src/i18n/locales/es.json +30 -0
- package/src/i18n/locales/fr.json +30 -0
- package/src/i18n/locales/it.json +30 -0
- package/src/i18n/locales/ja.json +30 -0
- package/src/i18n/locales/ko.json +30 -0
- package/src/i18n/locales/pt.json +30 -0
- package/src/i18n/locales/ru.json +30 -0
- package/src/i18n/locales/tr.json +30 -0
- package/src/i18n/locales/zh-TW.json +30 -0
- package/src/i18n/locales/zh.json +30 -0
- package/src/layout/ErrorPage.tsx +1 -1
- package/src/layout/Navbar.test.tsx +58 -0
- package/src/layout/Navbar.tsx +5 -2
- package/src/router/RouteComponent.test.tsx +65 -1
- package/src/router/RouteComponent.tsx +18 -15
- package/src/session/UserSession.test.ts +65 -0
- package/src/session/UserSession.ts +6 -4
- package/src/session/UserSessionProvider.strict-mode.test.tsx +44 -0
- package/src/session/UserSessionProvider.test.ts +62 -1
- package/src/session/UserSessionProvider.tsx +9 -1
- package/src/session/auth/composable.renewal.test.ts +170 -0
- package/src/session/auth/composable.test.ts +23 -1
- package/src/session/auth/composable.ts +101 -2
- package/src/session/auth/domainRouting.test.ts +35 -65
- package/src/session/auth/domainRouting.ts +51 -34
- package/src/session/auth/useAuthState.ts +11 -4
- package/src/session/index.ts +3 -1
- package/src/shell/AuthScreenPreview.test.tsx +44 -0
- package/src/shell/AuthScreenPreview.tsx +228 -0
- package/src/shell/BrandedAuthScreens.test.tsx +181 -0
- package/src/shell/BrandedAuthScreens.tsx +117 -0
- package/src/shell/SplashScreen.test.tsx +37 -0
- package/src/shell/SplashScreen.tsx +45 -40
- package/src/shell/VertesiaShell.tsx +49 -22
- package/src/shell/apps/StandaloneApp.tsx +5 -1
- package/src/shell/index.tsx +6 -0
- package/src/shell/login/SignInFlow.tsx +213 -0
- package/src/shell/login/SignInPageShell.tsx +62 -0
- package/src/shell/login/SignInPrimitives.tsx +14 -11
- package/src/shell/login/SignInRestrictedEnvStep.tsx +19 -7
- package/src/shell/login/SigninScreen.test.tsx +104 -0
- package/src/shell/login/SigninScreen.tsx +115 -145
- package/src/shell/login/SignupForm.tsx +8 -3
- package/src/shell/login/signInUtils.ts +30 -5
- package/src/widgets/json-view/JSONCode.test.tsx +2 -2
- package/src/widgets/json-view/JSONCode.tsx +1 -1
- package/src/widgets/markdown/markdown.css +21 -21
- package/src/widgets/upload/DropZone.tsx +2 -4
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js.map +0 -1
- package/src/session/auth/authState.test.ts +0 -35
package/README.md
CHANGED
|
@@ -169,3 +169,128 @@ For detailed API documentation, visit [docs.vertesiahq.com](https://docs.vertesi
|
|
|
169
169
|
## License
|
|
170
170
|
|
|
171
171
|
Apache-2.0
|
|
172
|
+
|
|
173
|
+
## Color conventions
|
|
174
|
+
|
|
175
|
+
Use `bg-background text-foreground` for pages, `bg-card text-card-foreground` for cards,
|
|
176
|
+
and `bg-popover text-popover-foreground` for dialogs. Page and card surfaces are white in light
|
|
177
|
+
mode. Reserve `bg-muted` for subdued areas; muted text is `text-muted-foreground`.
|
|
178
|
+
|
|
179
|
+
Color names describe surfaces and `-foreground` names describe their text/icons. Status panels
|
|
180
|
+
pair `bg-success text-success-foreground` (likewise info, attention, destructive, and done).
|
|
181
|
+
Primary actions use `<Button>` with its default primary variant, which pairs a blue background
|
|
182
|
+
with `text-primary-foreground`. Avoid overriding button label colors.
|
|
183
|
+
|
|
184
|
+
All standard utilities use the named color token. `/50` changes opacity, never the selected token.
|
|
185
|
+
The CSS compiler contract is checked by `src/__tests__/theme.test.ts`; contrast is checked by
|
|
186
|
+
`src/__tests__/contrast.test.ts`. Verify rendered states in both themes as well.
|
|
187
|
+
|
|
188
|
+
See [the migration guide](COLOR-MIGRATION.md) before updating an existing consumer to this theme.
|
|
189
|
+
|
|
190
|
+
### Custom authentication screens
|
|
191
|
+
|
|
192
|
+
`VertesiaShell` accepts optional `authScreens: AuthScreens` components:
|
|
193
|
+
|
|
194
|
+
- `SignIn` receives `SignInScreenViewProps` from `@vertesia/ui/shell`: sign-in flow state and transitions,
|
|
195
|
+
`authError`, reusable default form `children` and `notice`, logo/positioning preferences, and
|
|
196
|
+
callbacks for account reset, sanitized-scope continuation, retry, and signup. It owns the whole
|
|
197
|
+
page layout; retain `children` for the shared tenant-resolution and authentication forms.
|
|
198
|
+
`flow.onProviderClicked` only changes presentation state; it does not initiate a provider redirect.
|
|
199
|
+
Use `flow.mode` to replace the provider-redirect pending screen. The shell retains loading,
|
|
200
|
+
signed-in, allowed-path, and error-suppression guards.
|
|
201
|
+
- `Loading` receives `AuthLoadingScreenProps` from `@vertesia/ui/shell`. It owns the entire
|
|
202
|
+
authentication loading page without any imposed layout or animation. It disappears immediately
|
|
203
|
+
when authentication finishes or a token becomes available.
|
|
204
|
+
- `Permissions` receives `PermissionLoadingScreenProps` from `@vertesia/ui/features`: the
|
|
205
|
+
`loading`/`retrying`/`error` status, localized title/description, optional error and loading icon,
|
|
206
|
+
and an appropriate recovery `actionLabel`/`onAction`. This is a presentation override only;
|
|
207
|
+
application children never render until permissions are available.
|
|
208
|
+
|
|
209
|
+
Omitted entries retain existing screens and logo/loading-icon behavior. Define component functions
|
|
210
|
+
outside render so state does not reset on parent renders. All screens are under the session, theme,
|
|
211
|
+
and translation providers, but outside the permission context and application providers.
|
|
212
|
+
|
|
213
|
+
See `templates/plugin-template/src/modules/app/ui/auth/` for editable application examples. These
|
|
214
|
+
options customize app-owned pages; they neither enable Firebase mode nor theme external provider
|
|
215
|
+
or central-auth pages.
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
`@vertesia/ui/boot` supports the pre-React stage separately: pass app-authored `html` and `styles`
|
|
219
|
+
to `createBootScreenVitePlugin()` or `injectBootScreenHtml()`. HTML replaces the default inner loader;
|
|
220
|
+
CSS is inlined after the default boot styles. The outer `#loading-indicator` owns the handoff and
|
|
221
|
+
supplies `.vboot` / `.vboot-dark`. The optional root CSS variable `--vertesia-boot-background` sets
|
|
222
|
+
first-paint document color. These inputs must be trusted static developer content. Automatic startup
|
|
223
|
+
also reveals the optional slow-notice/reload elements after 10/30 seconds and wires `data-boot-reload`
|
|
224
|
+
buttons. Hosts with their own startup/error controller can continue using `autoStart: false`.
|
|
225
|
+
|
|
226
|
+
### Shared branding configuration
|
|
227
|
+
|
|
228
|
+
`defineAppBranding` and `AppBranding` from `@vertesia/ui/boot` define the data-only branding contract.
|
|
229
|
+
Pass resolved configuration as `<VertesiaShell branding={branding}>` for shared branded login,
|
|
230
|
+
authentication-loading, and permission screens. `authScreens` entries override individual defaults.
|
|
231
|
+
Without `branding`, existing shell presentation remains unchanged.
|
|
232
|
+
|
|
233
|
+
Branding reuses the existing sign-in, animated loading-icon, permission-recovery, and pre-React
|
|
234
|
+
layouts. Configuration changes assets, theme values, and copy while preserving spacing and controls.
|
|
235
|
+
The `loadingIcon` light/dark assets are separate from the sign-in `logo`. Omitted color and font
|
|
236
|
+
settings retain the existing theme. Different layouts require explicit screen or boot HTML overrides.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
The Node-only `createAppBrandingPlugin(config, configModuleUrl)` from `@vertesia/ui/boot/vite` resolves
|
|
240
|
+
relative image/font paths, exposes `virtual:vertesia-branding`, and generates the boot HTML/CSS, title,
|
|
241
|
+
and favicon. Local assets are embedded for base-path independence; import this adapter only in Vite config.
|
|
242
|
+
The `@vertesia/ui/boot` entry remains free of React, Node, and Vite dependencies.
|
|
243
|
+
|
|
244
|
+
The plugin template README contains the full configuration example and custom HTML/CSS escape hatch.
|
|
245
|
+
Copy overrides are scoped to the shell and preserve shared translation resources. Colors are scoped to
|
|
246
|
+
each screen; decorative accent and button foreground/background are separate settings.
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
Applications using Vite can pass `import.meta.env` as the second argument to `Env.init(props, import.meta.env)`
|
|
250
|
+
to enable `VITE_AUTH_MODE` (`firebase` or `central`) and the `VITE_FIREBASE_API_KEY`,
|
|
251
|
+
`VITE_FIREBASE_AUTH_DOMAIN`, `VITE_FIREBASE_PROJECT_ID`, and `VITE_FIREBASE_APP_ID` build settings.
|
|
252
|
+
Complete Firebase settings select Firebase mode when the mode is omitted; partial settings fail at startup.
|
|
253
|
+
Valid injected runtime configuration takes precedence, while explicit `props.firebase` and `window.AUTH_MODE`
|
|
254
|
+
retain their existing priority. Set `props.endpoints.auth` separately for the central authentication URL.
|
|
255
|
+
|
|
256
|
+
Loading-logo motion is configurable in `loadingIcon`, for both pre-React boot and authentication loading:
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
loadingIcon: {
|
|
260
|
+
light: './assets/icon.svg',
|
|
261
|
+
animation: 'my-app-dim 2s ease-in-out infinite',
|
|
262
|
+
keyframes: '@keyframes my-app-dim { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }',
|
|
263
|
+
},
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`animation` accepts a CSS animation shorthand; `keyframes` contains optional trusted app-authored CSS
|
|
267
|
+
and is embedded before first paint. Use app-specific keyframe names to avoid collisions.
|
|
268
|
+
Set `animation: 'none'` for a static logo. Omitting it preserves the default spin/pulse treatment;
|
|
269
|
+
a custom animation replaces both. Reduced-motion preferences disable loading-logo animation.
|
|
270
|
+
This changes logo motion only; permission/recovery layout and explicitly overridden screens remain app-controlled.
|
|
271
|
+
|
|
272
|
+
### Auth screen previews
|
|
273
|
+
|
|
274
|
+
In `pnpm dev`, open `/?__vertesia_auth=email`. The corner selector links to all shared login,
|
|
275
|
+
redirect-pending, loading, and recovery states. Direct links use these values:
|
|
276
|
+
|
|
277
|
+
- Before redirect: `email`, `providers`, `tenant`, `returning`, `pending`, `blocked`.
|
|
278
|
+
- After redirect: `loading`, `signup`, `restricted`, `scope-project`, `scope-account`, `no-account`,
|
|
279
|
+
`credentials`, `service`, `auth-error`.
|
|
280
|
+
- Permissions: `permissions`, `permission-retry`, `permission-error`, `permission-denied`,
|
|
281
|
+
`permission-session-expired`.
|
|
282
|
+
|
|
283
|
+
`/?__vertesia_boot=slow` keeps the real pre-React loader visible through its slow/reload timers.
|
|
284
|
+
Append `&__vertesia_boot_theme=light` or `dark` to select a theme. These are visual fixtures,
|
|
285
|
+
not an authentication round-trip test: built-in preview forms are inert and no session provider is mounted.
|
|
286
|
+
Branding and optional screen overrides are reused. Custom overrides should also avoid effects in preview.
|
|
287
|
+
The template enables previews only in Vite development; production ignores these selectors.
|
|
288
|
+
|
|
289
|
+
Other hosts can share the same fixtures using `mountAuthScreenPreview(container, screen, branding?, screens?)`
|
|
290
|
+
from `@vertesia/ui/shell`, invoked from an `import.meta.env.DEV` branch before mounting their auth providers.
|
|
291
|
+
|
|
292
|
+
`Env.init(props, import.meta.env)` also reads `VITE_VERTESIA_ACCOUNT_ID` and `VITE_VERTESIA_PROJECT_ID`
|
|
293
|
+
as the default auth workspace. With a valid accessible project, sign-in initializes that project directly,
|
|
294
|
+
so the application can open without manual account/project selection. Explicit URL `a`/`p` selection
|
|
295
|
+
wins as a whole pair; configured defaults precede stored browser selection. Hosts may provide
|
|
296
|
+
`props.defaultAuthSelection` instead. The setting chooses scope and does not bypass app permissions.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Data-only branding shared by the build-time boot screen and the React shell. */
|
|
2
|
+
export interface AppBranding {
|
|
3
|
+
name: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
logo?: {
|
|
6
|
+
light: string;
|
|
7
|
+
dark?: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
};
|
|
10
|
+
favicon?: string;
|
|
11
|
+
/** Small icon used by the existing loading layouts. */
|
|
12
|
+
loadingIcon?: {
|
|
13
|
+
light: string;
|
|
14
|
+
dark?: string;
|
|
15
|
+
/** CSS animation shorthand for boot and auth loading. Use 'none' for a static logo. */
|
|
16
|
+
animation?: string;
|
|
17
|
+
/** Trusted app-authored @keyframes CSS, shared by boot and React. Use app-specific names. */
|
|
18
|
+
keyframes?: string;
|
|
19
|
+
};
|
|
20
|
+
font?: {
|
|
21
|
+
family: string;
|
|
22
|
+
regular: string;
|
|
23
|
+
bold?: string;
|
|
24
|
+
};
|
|
25
|
+
colors?: {
|
|
26
|
+
light?: BrandColors;
|
|
27
|
+
dark?: BrandColors;
|
|
28
|
+
};
|
|
29
|
+
copy?: {
|
|
30
|
+
welcome?: string;
|
|
31
|
+
emailPlaceholder?: string;
|
|
32
|
+
loading?: string;
|
|
33
|
+
slowLoading?: string;
|
|
34
|
+
reload?: string;
|
|
35
|
+
footer?: string;
|
|
36
|
+
/** Optional auth./signup. translation overrides, local to this shell. */
|
|
37
|
+
translations?: Record<string, string>;
|
|
38
|
+
};
|
|
39
|
+
/** File paths in source configuration; trusted HTML/CSS content after build-time resolution. */
|
|
40
|
+
boot?: {
|
|
41
|
+
html?: string;
|
|
42
|
+
styles?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface BrandColors {
|
|
46
|
+
background?: string;
|
|
47
|
+
foreground?: string;
|
|
48
|
+
/** Decorative accents, focus indicators, and spinners; never used as body text. */
|
|
49
|
+
accent?: string;
|
|
50
|
+
button?: string;
|
|
51
|
+
buttonText?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function defineAppBranding(branding: AppBranding): AppBranding;
|
|
54
|
+
export declare function escapeBrandHtml(value: string): string;
|
|
55
|
+
/** Theme tokens only: branding must never replace the shared page layout. */
|
|
56
|
+
export declare function renderBrandStyles(brand: AppBranding, selector?: string): string;
|
|
57
|
+
export declare function brandedBootOptions(brand: AppBranding): import('./index.js').BootScreenOptions;
|
|
58
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/boot/branding.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,WAAW,CAAC,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,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B,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,SAAY,GAAG,MAAM,CAmBlF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,YAAY,EAAE,iBAAiB,CAa7F"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export function defineAppBranding(branding) {
|
|
2
|
+
return branding;
|
|
3
|
+
}
|
|
4
|
+
export function escapeBrandHtml(value) {
|
|
5
|
+
return value.replace(/[&<>"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char] ?? char);
|
|
6
|
+
}
|
|
7
|
+
function cssString(value) {
|
|
8
|
+
return JSON.stringify(value).replace(/</g, '\\3c ');
|
|
9
|
+
}
|
|
10
|
+
function colorDeclarations(colors) {
|
|
11
|
+
const variables = {
|
|
12
|
+
background: ['--background', '--color-background', '--vb-bg'],
|
|
13
|
+
foreground: ['--foreground', '--color-foreground', '--vb-fg'],
|
|
14
|
+
accent: ['--info', '--info-foreground', '--color-info', '--color-info-foreground'],
|
|
15
|
+
button: ['--primary', '--color-primary', '--vb-primary', '--auth-button'],
|
|
16
|
+
buttonText: ['--primary-foreground', '--color-primary-foreground', '--vb-primary-fg', '--auth-button-text'],
|
|
17
|
+
};
|
|
18
|
+
return Object.entries(colors ?? {})
|
|
19
|
+
.map(([key, value]) => {
|
|
20
|
+
if (!Object.hasOwn(variables, key) || /[;{}<>]/.test(value))
|
|
21
|
+
throw new Error(`Invalid branding color: ${key}`);
|
|
22
|
+
return variables[key].map((name) => `${name}:${value};`).join('');
|
|
23
|
+
})
|
|
24
|
+
.join('');
|
|
25
|
+
}
|
|
26
|
+
/** Theme tokens only: branding must never replace the shared page layout. */
|
|
27
|
+
export function renderBrandStyles(brand, selector = '.vbrand') {
|
|
28
|
+
const animation = brand.loadingIcon?.animation;
|
|
29
|
+
const keyframes = brand.loadingIcon?.keyframes ?? '';
|
|
30
|
+
if (animation !== undefined && /[;{}<>]/.test(animation))
|
|
31
|
+
throw new Error('Invalid loading icon animation');
|
|
32
|
+
if (/[<>]/.test(keyframes))
|
|
33
|
+
throw new Error('Invalid loading icon keyframes');
|
|
34
|
+
const motion = animation === undefined
|
|
35
|
+
? ''
|
|
36
|
+
: `--vertesia-loading-animation:${animation};--vertesia-loading-pulse-animation:none;`;
|
|
37
|
+
const font = brand.font;
|
|
38
|
+
const faces = font
|
|
39
|
+
? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.regular)});font-weight:400;font-display:swap; }
|
|
40
|
+
${font.bold ? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.bold)});font-weight:700;font-display:swap; }` : ''}`
|
|
41
|
+
: '';
|
|
42
|
+
return `${faces}
|
|
43
|
+
${keyframes}
|
|
44
|
+
${selector} { ${motion}${colorDeclarations(brand.colors?.light)}${font ? `font-family:${cssString(font.family)};` : ''} }
|
|
45
|
+
.dark ${selector},${selector}.vboot-dark { ${colorDeclarations(brand.colors?.dark)} }
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
export function brandedBootOptions(brand) {
|
|
49
|
+
return {
|
|
50
|
+
iconSrc: brand.loadingIcon?.light,
|
|
51
|
+
darkIconSrc: brand.loadingIcon?.dark,
|
|
52
|
+
loadingLabel: brand.copy?.loading,
|
|
53
|
+
slowLoadingLabel: brand.copy?.slowLoading,
|
|
54
|
+
reloadLabel: brand.copy?.reload,
|
|
55
|
+
html: brand.boot?.html,
|
|
56
|
+
styles: `${renderBrandStyles(brand, '#loading-indicator')}
|
|
57
|
+
${brand.colors?.light?.background ? `:root{--vertesia-boot-background:${brand.colors.light.background}}` : ''}
|
|
58
|
+
${brand.colors?.dark?.background ? `:root.dark{--vertesia-boot-background:${brand.colors.dark.background}}` : ''}
|
|
59
|
+
${brand.boot?.styles ?? ''}`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=branding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.js","source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+
slowLoadingLabel?: string;
|
|
6
|
+
reloadLabel?: string;
|
|
7
|
+
loadingLabel?: string;
|
|
8
|
+
autoStart?: boolean;
|
|
9
|
+
/** Trusted, app-authored HTML inside the loading container. Never pass user content. */
|
|
10
|
+
html?: string;
|
|
11
|
+
/** Inline CSS appended after the defaults; available before application styles load. */
|
|
12
|
+
styles?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface BootScreenHtmlPlugin {
|
|
15
|
+
name: string;
|
|
16
|
+
transformIndexHtml: (html: string) => string;
|
|
17
|
+
}
|
|
18
|
+
export declare const BOOT_SCREEN_STYLES = "\n .vboot {\n --vb-bg: #ffffff;\n --vb-fg: #0a0a0a;\n --vb-muted: #636363;\n --vb-muted-bg: #f5f5f5;\n --vb-border: #e5e5e5;\n --vb-primary: #0048bd;\n --vb-primary-fg: #ffffff;\n --vb-glow: rgba(50, 49, 189, 0.12);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n color: var(--vb-fg);\n }\n .vboot.vboot-dark {\n --vb-bg: #0a0a0a;\n --vb-fg: #fafafa;\n --vb-muted: #a1a1a1;\n --vb-muted-bg: #262626;\n --vb-border: rgba(255, 255, 255, 0.1);\n --vb-primary: #2b69d1;\n --vb-primary-fg: #fafafa;\n --vb-glow: rgba(79, 70, 229, 0.2);\n }\n @keyframes vboot-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n .vboot-overlay {\n position: absolute !important;\n inset: 0 !important;\n box-sizing: border-box !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0 !important;\n padding: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 1.5rem !important;\n transform: none !important;\n background: var(--vb-bg) !important;\n }\n #loading-indicator {\n position: fixed !important;\n inset: 0 !important;\n z-index: 2147483647 !important;\n box-sizing: border-box !important;\n width: 100vw !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n transform: none !important;\n }\n .vboot-spinner {\n width: 2.5rem !important;\n min-width: 2.5rem !important;\n max-width: 2.5rem !important;\n height: 2.5rem !important;\n min-height: 2.5rem !important;\n max-height: 2.5rem !important;\n margin: 0 !important;\n padding: 0 !important;\n object-fit: contain !important;\n flex: none !important;\n border-radius: 100% !important;\n animation: var(--vertesia-loading-animation, vboot-spin 2s linear infinite) !important;\n }\n .vboot-icon-dark { display: none; }\n .vboot-dark .vboot-icon-light { display: none; }\n .vboot-dark .vboot-icon-dark { display: block; }\n .vboot-slow {\n text-align: center;\n }\n .vboot-slow p {\n color: var(--vb-muted);\n font-size: 0.875rem;\n margin: 0 0 0.75rem;\n }\n .vboot-btn {\n display: inline-block;\n padding: 0.5rem 1rem;\n background: var(--vb-primary);\n color: var(--vb-primary-fg);\n border: none;\n border-radius: 0.375rem;\n font: inherit;\n font-size: 0.875rem;\n font-weight: 500;\n cursor: pointer;\n }\n .vboot-btn:hover {\n opacity: 0.9;\n }\n @media (prefers-reduced-motion: reduce) {\n .vboot-spinner { animation: none !important; }\n }\n";
|
|
19
|
+
/** Default markup shared by Studio and configurable applications. */
|
|
20
|
+
export declare function renderDefaultBootContent(options?: BootScreenOptions): string;
|
|
21
|
+
export declare function renderBootScreenRuntime(options?: BootScreenOptions): string;
|
|
22
|
+
export declare function renderBootScreenHead(options?: BootScreenOptions): string;
|
|
23
|
+
export declare function renderBootScreenInitializer(): string;
|
|
24
|
+
export declare function injectBootScreenHtml(html: string, options?: BootScreenOptions): string;
|
|
25
|
+
export declare function createBootScreenVitePlugin(options?: BootScreenOptions): BootScreenHtmlPlugin;
|
|
26
|
+
export * from './branding.js';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/boot/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAA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
--vb-muted-bg: #f5f5f5;
|
|
10
|
+
--vb-border: #e5e5e5;
|
|
11
|
+
--vb-primary: #0048bd;
|
|
12
|
+
--vb-primary-fg: #ffffff;
|
|
13
|
+
--vb-glow: rgba(50, 49, 189, 0.12);
|
|
14
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
15
|
+
color: var(--vb-fg);
|
|
16
|
+
}
|
|
17
|
+
.vboot.vboot-dark {
|
|
18
|
+
--vb-bg: #0a0a0a;
|
|
19
|
+
--vb-fg: #fafafa;
|
|
20
|
+
--vb-muted: #a1a1a1;
|
|
21
|
+
--vb-muted-bg: #262626;
|
|
22
|
+
--vb-border: rgba(255, 255, 255, 0.1);
|
|
23
|
+
--vb-primary: #2b69d1;
|
|
24
|
+
--vb-primary-fg: #fafafa;
|
|
25
|
+
--vb-glow: rgba(79, 70, 229, 0.2);
|
|
26
|
+
}
|
|
27
|
+
@keyframes vboot-spin {
|
|
28
|
+
from { transform: rotate(0deg); }
|
|
29
|
+
to { transform: rotate(360deg); }
|
|
30
|
+
}
|
|
31
|
+
.vboot-overlay {
|
|
32
|
+
position: absolute !important;
|
|
33
|
+
inset: 0 !important;
|
|
34
|
+
box-sizing: border-box !important;
|
|
35
|
+
width: 100% !important;
|
|
36
|
+
height: 100% !important;
|
|
37
|
+
margin: 0 !important;
|
|
38
|
+
padding: 0 !important;
|
|
39
|
+
display: flex !important;
|
|
40
|
+
flex-direction: column !important;
|
|
41
|
+
align-items: center !important;
|
|
42
|
+
justify-content: center !important;
|
|
43
|
+
gap: 1.5rem !important;
|
|
44
|
+
transform: none !important;
|
|
45
|
+
background: var(--vb-bg) !important;
|
|
46
|
+
}
|
|
47
|
+
#loading-indicator {
|
|
48
|
+
position: fixed !important;
|
|
49
|
+
inset: 0 !important;
|
|
50
|
+
z-index: 2147483647 !important;
|
|
51
|
+
box-sizing: border-box !important;
|
|
52
|
+
width: 100vw !important;
|
|
53
|
+
height: 100vh !important;
|
|
54
|
+
margin: 0 !important;
|
|
55
|
+
padding: 0 !important;
|
|
56
|
+
transform: none !important;
|
|
57
|
+
}
|
|
58
|
+
.vboot-spinner {
|
|
59
|
+
width: 2.5rem !important;
|
|
60
|
+
min-width: 2.5rem !important;
|
|
61
|
+
max-width: 2.5rem !important;
|
|
62
|
+
height: 2.5rem !important;
|
|
63
|
+
min-height: 2.5rem !important;
|
|
64
|
+
max-height: 2.5rem !important;
|
|
65
|
+
margin: 0 !important;
|
|
66
|
+
padding: 0 !important;
|
|
67
|
+
object-fit: contain !important;
|
|
68
|
+
flex: none !important;
|
|
69
|
+
border-radius: 100% !important;
|
|
70
|
+
animation: var(--vertesia-loading-animation, vboot-spin 2s linear infinite) !important;
|
|
71
|
+
}
|
|
72
|
+
.vboot-icon-dark { display: none; }
|
|
73
|
+
.vboot-dark .vboot-icon-light { display: none; }
|
|
74
|
+
.vboot-dark .vboot-icon-dark { display: block; }
|
|
75
|
+
.vboot-slow {
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
.vboot-slow p {
|
|
79
|
+
color: var(--vb-muted);
|
|
80
|
+
font-size: 0.875rem;
|
|
81
|
+
margin: 0 0 0.75rem;
|
|
82
|
+
}
|
|
83
|
+
.vboot-btn {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
padding: 0.5rem 1rem;
|
|
86
|
+
background: var(--vb-primary);
|
|
87
|
+
color: var(--vb-primary-fg);
|
|
88
|
+
border: none;
|
|
89
|
+
border-radius: 0.375rem;
|
|
90
|
+
font: inherit;
|
|
91
|
+
font-size: 0.875rem;
|
|
92
|
+
font-weight: 500;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
.vboot-btn:hover {
|
|
96
|
+
opacity: 0.9;
|
|
97
|
+
}
|
|
98
|
+
@media (prefers-reduced-motion: reduce) {
|
|
99
|
+
.vboot-spinner { animation: none !important; }
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
function inlineJson(value) {
|
|
103
|
+
return JSON.stringify(value).replaceAll('<', '\\u003c');
|
|
104
|
+
}
|
|
105
|
+
function normalizedOptions(options) {
|
|
106
|
+
return {
|
|
107
|
+
storageKey: options.storageKey ?? DEFAULT_STORAGE_KEY,
|
|
108
|
+
iconSrc: options.iconSrc ?? DEFAULT_ICON_SRC,
|
|
109
|
+
loadingLabel: options.loadingLabel ?? DEFAULT_LOADING_LABEL,
|
|
110
|
+
autoStart: options.autoStart ?? true,
|
|
111
|
+
html: options.html,
|
|
112
|
+
styles: options.styles,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** Default markup shared by Studio and configurable applications. */
|
|
116
|
+
export function renderDefaultBootContent(options = {}) {
|
|
117
|
+
const escapeMarkup = (value) => value.replace(/[&<>"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char] ?? char);
|
|
118
|
+
const { iconSrc, loadingLabel } = normalizedOptions(options);
|
|
119
|
+
const icon = (src, className = '') => `<img class="vboot-spinner ${className}" width="40" height="40" src="${escapeMarkup(src)}" alt="${escapeMarkup(loadingLabel)}" />`;
|
|
120
|
+
return `<div class="vboot-overlay" role="status" aria-live="polite">${options.darkIconSrc ? icon(iconSrc, 'vboot-icon-light') + icon(options.darkIconSrc, 'vboot-icon-dark') : icon(iconSrc)}
|
|
121
|
+
<div id="loading-slow-notice" class="vboot-slow" style="display: none;">
|
|
122
|
+
<p>${escapeMarkup(options.slowLoadingLabel ?? 'Still loading — this is taking longer than usual.')}</p>
|
|
123
|
+
<div id="loading-slow-reload" style="display: none;"><button type="button" class="vboot-btn" data-boot-reload>${escapeMarkup(options.reloadLabel ?? 'Reload page')}</button></div></div></div>`;
|
|
124
|
+
}
|
|
125
|
+
export function renderBootScreenRuntime(options = {}) {
|
|
126
|
+
const { storageKey, html } = normalizedOptions(options);
|
|
127
|
+
const defaultHtml = renderDefaultBootContent(options);
|
|
128
|
+
return `(() => {
|
|
129
|
+
const storageKey = ${inlineJson(storageKey)};
|
|
130
|
+
|
|
131
|
+
const customHtml = ${html === undefined ? 'undefined' : inlineJson(html)};
|
|
132
|
+
let slowNoticeTimer;
|
|
133
|
+
let slowReloadTimer;
|
|
134
|
+
const previewTheme = (() => {
|
|
135
|
+
try {
|
|
136
|
+
const value = new URL(window.location.href).searchParams.get('__vertesia_boot_theme');
|
|
137
|
+
return value === 'dark' || value === 'light' ? value : null;
|
|
138
|
+
} catch (_error) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
})();
|
|
142
|
+
const prefersDarkTheme = () => {
|
|
143
|
+
if (previewTheme) return previewTheme === 'dark';
|
|
144
|
+
try {
|
|
145
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
146
|
+
if (stored === 'dark') return true;
|
|
147
|
+
if (stored === 'light') return false;
|
|
148
|
+
} catch (_error) {
|
|
149
|
+
// Storage can be unavailable in private or restricted browsing contexts.
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
153
|
+
} catch (_error) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const applyTheme = () => {
|
|
158
|
+
const dark = prefersDarkTheme();
|
|
159
|
+
const root = document.documentElement;
|
|
160
|
+
root.classList.remove('light', 'dark');
|
|
161
|
+
root.classList.add(dark ? 'dark' : 'light');
|
|
162
|
+
return dark;
|
|
163
|
+
};
|
|
164
|
+
const paintDocumentBackground = () => {
|
|
165
|
+
const dark = applyTheme();
|
|
166
|
+
const root = document.documentElement;
|
|
167
|
+
const background = window.getComputedStyle(root).getPropertyValue('--vertesia-boot-background').trim()
|
|
168
|
+
|| (dark ? '#0a0a0a' : '#ffffff');
|
|
169
|
+
root.style.backgroundColor = background;
|
|
170
|
+
root.style.colorScheme = dark ? 'dark' : 'light';
|
|
171
|
+
if (document.body) document.body.style.backgroundColor = background;
|
|
172
|
+
};
|
|
173
|
+
const restoreDocumentBackground = () => {
|
|
174
|
+
applyTheme();
|
|
175
|
+
const root = document.documentElement;
|
|
176
|
+
root.style.removeProperty('background-color');
|
|
177
|
+
root.style.removeProperty('color-scheme');
|
|
178
|
+
if (document.body) document.body.style.removeProperty('background-color');
|
|
179
|
+
};
|
|
180
|
+
const bootThemeClass = () => prefersDarkTheme() ? 'vboot vboot-dark' : 'vboot';
|
|
181
|
+
const ensureLoadingIndicator = () => {
|
|
182
|
+
if (document.getElementById('loading-indicator') || !document.body) return;
|
|
183
|
+
paintDocumentBackground();
|
|
184
|
+
const loading = document.createElement('div');
|
|
185
|
+
loading.id = 'loading-indicator';
|
|
186
|
+
loading.className = bootThemeClass();
|
|
187
|
+
loading.innerHTML = customHtml ?? ${inlineJson(defaultHtml)};
|
|
188
|
+
loading.querySelectorAll('[data-boot-title]').forEach((heading) => {
|
|
189
|
+
if (document.title) heading.textContent = document.title;
|
|
190
|
+
});
|
|
191
|
+
loading.querySelectorAll('[data-boot-reload]').forEach((button) => {
|
|
192
|
+
button.addEventListener('click', () => window.location.reload());
|
|
193
|
+
});
|
|
194
|
+
// Custom landmarks and controls must stay in body to enter the accessibility tree.
|
|
195
|
+
const loadingParent = customHtml === undefined && typeof document.documentElement.appendChild === 'function'
|
|
196
|
+
? document.documentElement
|
|
197
|
+
: document.body;
|
|
198
|
+
loadingParent.appendChild(loading);
|
|
199
|
+
};
|
|
200
|
+
const hideLoadingIndicator = () => {
|
|
201
|
+
clearTimeout(slowNoticeTimer);
|
|
202
|
+
clearTimeout(slowReloadTimer);
|
|
203
|
+
const loading = document.getElementById('loading-indicator');
|
|
204
|
+
if (loading) loading.style.display = 'none';
|
|
205
|
+
};
|
|
206
|
+
const hasAppRendered = (rootId = 'root') => {
|
|
207
|
+
const root = document.getElementById(rootId);
|
|
208
|
+
return Boolean(root && root.innerHTML && root.innerHTML.trim() !== '');
|
|
209
|
+
};
|
|
210
|
+
const hideLoadingIndicatorOnFirstRender = (rootId = 'root') => {
|
|
211
|
+
if (typeof MutationObserver !== 'function') return;
|
|
212
|
+
const root = document.getElementById(rootId);
|
|
213
|
+
if (!root) return;
|
|
214
|
+
if (hasAppRendered(rootId)) {
|
|
215
|
+
hideLoadingIndicator();
|
|
216
|
+
restoreDocumentBackground();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const observer = new MutationObserver(() => {
|
|
220
|
+
if (!hasAppRendered(rootId)) return;
|
|
221
|
+
hideLoadingIndicator();
|
|
222
|
+
restoreDocumentBackground();
|
|
223
|
+
observer.disconnect();
|
|
224
|
+
});
|
|
225
|
+
observer.observe(root, { childList: true });
|
|
226
|
+
};
|
|
227
|
+
// Used by standalone apps. Hosts with their own error handler keep autoStart disabled.
|
|
228
|
+
const scheduleSlowLoadingNotice = () => {
|
|
229
|
+
clearTimeout(slowNoticeTimer);
|
|
230
|
+
clearTimeout(slowReloadTimer);
|
|
231
|
+
if (hasAppRendered()) return;
|
|
232
|
+
slowNoticeTimer = setTimeout(() => {
|
|
233
|
+
const notice = document.getElementById('loading-slow-notice');
|
|
234
|
+
if (notice) notice.style.display = '';
|
|
235
|
+
}, 10000);
|
|
236
|
+
slowReloadTimer = setTimeout(() => {
|
|
237
|
+
const reload = document.getElementById('loading-slow-reload');
|
|
238
|
+
if (reload) reload.style.display = '';
|
|
239
|
+
}, 30000);
|
|
240
|
+
};
|
|
241
|
+
window.__vertesiaBoot = {
|
|
242
|
+
scheduleSlowLoadingNotice,
|
|
243
|
+
applyTheme,
|
|
244
|
+
bootThemeClass,
|
|
245
|
+
ensureLoadingIndicator,
|
|
246
|
+
hasAppRendered,
|
|
247
|
+
hideLoadingIndicator,
|
|
248
|
+
hideLoadingIndicatorOnFirstRender,
|
|
249
|
+
paintDocumentBackground,
|
|
250
|
+
prefersDarkTheme,
|
|
251
|
+
restoreDocumentBackground,
|
|
252
|
+
};
|
|
253
|
+
paintDocumentBackground();
|
|
254
|
+
})();`;
|
|
255
|
+
}
|
|
256
|
+
export function renderBootScreenHead(options = {}) {
|
|
257
|
+
return `<style id="vertesia-boot-styles">${BOOT_SCREEN_STYLES}\n${options.styles ?? ''}</style>\n<script>${renderBootScreenRuntime(options)}</script>`;
|
|
258
|
+
}
|
|
259
|
+
export function renderBootScreenInitializer() {
|
|
260
|
+
return `<script>window.__vertesiaBoot.ensureLoadingIndicator(); window.__vertesiaBoot.hideLoadingIndicatorOnFirstRender(); window.__vertesiaBoot.scheduleSlowLoadingNotice();</script>`;
|
|
261
|
+
}
|
|
262
|
+
function isHtmlWhitespace(character) {
|
|
263
|
+
return character === ' ' || character === '\t' || character === '\n' || character === '\r' || character === '\f';
|
|
264
|
+
}
|
|
265
|
+
function hasAttribute(openingTag, attributeName) {
|
|
266
|
+
const lowerTag = openingTag.toLowerCase();
|
|
267
|
+
let searchFrom = 0;
|
|
268
|
+
while (searchFrom < lowerTag.length) {
|
|
269
|
+
const attributeIndex = lowerTag.indexOf(attributeName, searchFrom);
|
|
270
|
+
if (attributeIndex === -1)
|
|
271
|
+
return false;
|
|
272
|
+
const before = lowerTag[attributeIndex - 1];
|
|
273
|
+
let afterIndex = attributeIndex + attributeName.length;
|
|
274
|
+
while (isHtmlWhitespace(lowerTag[afterIndex]))
|
|
275
|
+
afterIndex += 1;
|
|
276
|
+
if (isHtmlWhitespace(before) && lowerTag[afterIndex] === '=')
|
|
277
|
+
return true;
|
|
278
|
+
searchFrom = attributeIndex + attributeName.length;
|
|
279
|
+
}
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
function findOpeningTagEnd(html, tagName, attributeName) {
|
|
283
|
+
const lowerHtml = html.toLowerCase();
|
|
284
|
+
const tagStart = `<${tagName}`;
|
|
285
|
+
let searchFrom = 0;
|
|
286
|
+
while (searchFrom < lowerHtml.length) {
|
|
287
|
+
const start = lowerHtml.indexOf(tagStart, searchFrom);
|
|
288
|
+
if (start === -1)
|
|
289
|
+
return undefined;
|
|
290
|
+
const boundary = lowerHtml[start + tagStart.length];
|
|
291
|
+
if (boundary === '>' || isHtmlWhitespace(boundary)) {
|
|
292
|
+
const end = lowerHtml.indexOf('>', start + tagStart.length);
|
|
293
|
+
if (end === -1)
|
|
294
|
+
return undefined;
|
|
295
|
+
if (!attributeName || hasAttribute(lowerHtml.slice(start, end + 1), attributeName))
|
|
296
|
+
return end + 1;
|
|
297
|
+
searchFrom = end + 1;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
searchFrom = start + tagStart.length;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
function insertAt(html, index, content) {
|
|
306
|
+
return `${html.slice(0, index)}${content}${html.slice(index)}`;
|
|
307
|
+
}
|
|
308
|
+
export function injectBootScreenHtml(html, options = {}) {
|
|
309
|
+
const normalized = normalizedOptions(options);
|
|
310
|
+
const head = renderBootScreenHead(normalized);
|
|
311
|
+
const insertionPoint = findOpeningTagEnd(html, 'meta', 'charset') ?? findOpeningTagEnd(html, 'head');
|
|
312
|
+
const withHead = insertionPoint === undefined ? html : insertAt(html, insertionPoint, `\n${head}`);
|
|
313
|
+
if (!normalized.autoStart)
|
|
314
|
+
return withHead;
|
|
315
|
+
const bodyEnd = withHead.toLowerCase().indexOf('</body>');
|
|
316
|
+
return bodyEnd === -1 ? withHead : insertAt(withHead, bodyEnd, `${renderBootScreenInitializer()}\n`);
|
|
317
|
+
}
|
|
318
|
+
export function createBootScreenVitePlugin(options = {}) {
|
|
319
|
+
return {
|
|
320
|
+
name: 'vertesia-boot-screen',
|
|
321
|
+
transformIndexHtml: (html) => injectBootScreenHtml(html, options),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
export * from './branding.js';
|
|
325
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/boot/index.ts"],"names":[],"mappings":"AAmBA,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAC5C,MAAM,gBAAgB,GAAG,WAAW,C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