studiocms 0.1.0-beta.24 → 0.1.0-beta.26
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/CHANGELOG.md +136 -0
- package/dist/cli/add/index.d.ts +3 -4
- package/dist/cli/add/index.js +6 -7
- package/dist/cli/crypto/genJWT/index.d.ts +5 -5
- package/dist/cli/crypto/genJWT/index.js +14 -15
- package/dist/cli/crypto/index.d.ts +2 -2
- package/dist/cli/crypto/index.js +4 -4
- package/dist/cli/getTurso/index.d.ts +2 -2
- package/dist/cli/getTurso/index.js +3 -4
- package/dist/cli/index.js +11 -10
- package/dist/cli/init/index.d.ts +4 -4
- package/dist/cli/init/index.js +11 -12
- package/dist/cli/users/index.d.ts +4 -4
- package/dist/cli/users/index.js +11 -12
- package/dist/cli/users/steps/libsqlCreateUsers.js +3 -3
- package/dist/cli/users/steps/libsqlModifyUsers.js +3 -3
- package/dist/{layouts → components}/auth/FallbackCanvas.astro +1 -1
- package/dist/components/auth/OAuthButton.astro +1 -1
- package/dist/components/auth/OAuthButtonStack.astro +2 -2
- package/dist/components/auth/StaticAuthCheck.astro +3 -3
- package/dist/{scripts → components/auth/component-scripts}/formListener.d.ts +3 -0
- package/dist/{scripts → components/auth/component-scripts}/formListener.js +1 -1
- package/dist/components/dashboard/BaseHead.astro +7 -18
- package/dist/components/dashboard/DashboardGrid.astro +4 -4
- package/dist/components/dashboard/DashboardGridItem.astro +3 -2
- package/dist/components/dashboard/DashboardPageHeader.astro +11 -6
- package/dist/components/dashboard/DoubleSidebar.astro +3 -3
- package/dist/components/dashboard/Footer.astro +3 -7
- package/dist/components/dashboard/LoginChecker.astro +17 -17
- package/dist/components/dashboard/MainSidebarContent.astro +27 -18
- package/dist/components/dashboard/PageHeader.astro +3 -2
- package/dist/components/dashboard/SidebarLink.astro +148 -31
- package/dist/components/dashboard/SidebarPluginLink.astro +4 -4
- package/dist/components/dashboard/SingleSidebar.astro +3 -3
- package/dist/components/dashboard/UserName.astro +2 -2
- package/dist/components/dashboard/component-scripts/dateTimeListener.js +4 -9
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.js +10 -7
- package/dist/components/dashboard/configuration/ConfigForm.astro +53 -152
- package/dist/components/dashboard/configuration/LoginPreview.astro +275 -0
- package/dist/components/dashboard/content-mgmt/CreateFolder.astro +6 -5
- package/dist/components/dashboard/content-mgmt/CreatePage.astro +23 -47
- package/dist/components/dashboard/content-mgmt/EditFolder.astro +5 -4
- package/dist/components/dashboard/content-mgmt/EditPage.astro +36 -85
- package/dist/components/dashboard/content-mgmt/InnerSidebarElement.astro +30 -22
- package/dist/components/dashboard/content-mgmt/PageEditorSwapper.astro +107 -0
- package/dist/components/dashboard/content-mgmt/PageHeader.astro +26 -18
- package/dist/components/dashboard/content-mgmt/PageTypeHandler.astro +107 -0
- package/dist/components/dashboard/content-mgmt/PluginFields.astro +6 -1
- package/dist/components/dashboard/content-mgmt/TreeRenderer.astro +8 -8
- package/dist/components/dashboard/content-mgmt/TreeSidebarFolder.astro +116 -24
- package/dist/components/dashboard/content-mgmt/TreeSidebarLink.astro +116 -24
- package/dist/components/dashboard/content-mgmt/runtime.js +1 -1
- package/dist/components/dashboard/plugins/SettingsRenderer.astro +6 -1
- package/dist/components/dashboard/profile/APITokens.astro +18 -12
- package/dist/components/dashboard/profile/BasicInfo.astro +17 -13
- package/dist/components/dashboard/profile/Notifications.astro +20 -8
- package/dist/components/dashboard/profile/SocialSignin.astro +11 -8
- package/dist/components/dashboard/profile/UpdatePassword.astro +10 -7
- package/dist/components/dashboard/profile/oAuthButtonProviders.d.ts +1 -8
- package/dist/components/dashboard/profile/oAuthButtonProviders.js +1 -15
- package/dist/components/dashboard/shared.d.ts +1 -1
- package/dist/components/dashboard/sidebar/UserAccount.astro +5 -6
- package/dist/components/dashboard/sidebar/VersionCheck.astro +7 -7
- package/dist/components/dashboard/sidebar/VersionCheckChangelog.astro +32 -8
- package/dist/components/dashboard/sidebar-modals/UserManagementModals.astro +8 -3
- package/dist/components/dashboard/sidebar-modals/VersionModal.astro +43 -24
- package/dist/components/dashboard/sidebarConfig.d.ts +2 -2
- package/dist/components/dashboard/sidebarConfig.js +7 -7
- package/dist/components/dashboard/user-mgmt/InnerSidebarElement.astro +20 -13
- package/dist/components/dashboard/user-mgmt/RankCheck.astro +10 -10
- package/dist/components/dashboard/user-mgmt/SocialSignin.astro +9 -10
- package/dist/components/dashboard/user-mgmt/UserListItem.astro +86 -30
- package/dist/components/default-grid-items/Recently-created-pages.astro +12 -10
- package/dist/components/default-grid-items/Recently-signed-up.astro +9 -9
- package/dist/components/default-grid-items/Recently-updated-pages.astro +12 -10
- package/dist/components/default-grid-items/Totals.astro +11 -10
- package/dist/{routes/firstTimeSetupRoutes/components → components/first-time-setup}/PageHeader.astro +4 -3
- package/dist/components/shared/Code.astro +72 -0
- package/dist/components/shared/SSRUser.astro +200 -0
- package/dist/components/shared/head/Favicons.astro +6 -0
- package/dist/components/shared/head/Global.astro +4 -0
- package/dist/components/shared/head/TitleTags.astro +14 -0
- package/dist/config.d.ts +1 -4
- package/dist/consts.d.ts +48 -3
- package/dist/consts.js +65 -10
- package/dist/db/config.d.ts +1499 -0
- package/dist/db/config.js +262 -4
- package/dist/effect.d.ts +2 -3
- package/dist/effect.js +2 -17
- package/dist/{styles/dashboard-code.css → fonts/syntax-font.css} +2 -20
- package/dist/{utils → handlers}/astroConfigCheck.js +1 -1
- package/dist/handlers/changelog.d.ts +1 -0
- package/dist/handlers/changelog.js +54 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.js +10 -0
- package/dist/{pluginHandler.d.ts → handlers/pluginHandler.d.ts} +4 -3
- package/dist/{pluginHandler.js → handlers/pluginHandler.js} +264 -127
- package/dist/{routeHandler.d.ts → handlers/routeHandler.d.ts} +1 -1
- package/dist/{routeHandler.js → handlers/routeHandler.js} +7 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +184 -229
- package/dist/{lib → integrations}/dynamic-sitemap/index.js +1 -1
- package/dist/integrations/node-namespace.d.ts +15 -0
- package/dist/integrations/node-namespace.js +31 -0
- package/dist/integrations/plugins.d.ts +4 -0
- package/dist/integrations/plugins.js +7 -0
- package/dist/{lib → integrations}/robots/utils.d.ts +0 -8
- package/dist/{lib → integrations}/robots/utils.js +1 -5
- package/dist/{lib → integrations}/webVitals/checkForWebVitalsPlugin.js +3 -3
- package/{src/lib → dist/integrations}/webVitals/dashboard-grid-items/CoreVitals.astro +1 -1
- package/{src/lib → dist/integrations}/webVitals/dashboard-grid-items/MetricCard.astro +3 -2
- package/dist/{lib → integrations}/webVitals/dashboard-grid-items/SummaryCard.astro +2 -2
- package/dist/{lib → integrations}/webVitals/dashboard-grid-items/metric.css +17 -17
- package/dist/{lib → integrations}/webVitals/dashboard-grid-items/shared.d.ts +4 -4
- package/dist/{lib → integrations}/webVitals/dashboard-grid-items/shared.js +3 -3
- package/{src/lib → dist/integrations}/webVitals/pages/analytics/body.astro +10 -9
- package/dist/{lib → integrations}/webVitals/utils/webVitalsUtils.d.ts +9 -9
- package/dist/layouts/AuthLayout.astro +63 -0
- package/dist/layouts/{dashboard/Layout.astro → DashboardLayout.astro} +22 -10
- package/{src/routes/firstTimeSetupRoutes/components/Layout.astro → dist/layouts/FirstTimeSetupLayout.astro} +15 -3
- package/dist/middleware/index.d.ts +9 -0
- package/dist/middleware/index.js +67 -89
- package/dist/middleware/utils.d.ts +59 -36
- package/dist/middleware/utils.js +59 -40
- package/dist/routes/api/auth/[provider]/callback.d.ts +1 -4
- package/dist/routes/api/auth/[provider]/callback.js +29 -11
- package/dist/routes/api/auth/[provider]/index.d.ts +1 -4
- package/dist/routes/api/auth/[provider]/index.js +29 -11
- package/dist/routes/api/auth/forgot-password.d.ts +1 -4
- package/dist/routes/api/auth/forgot-password.js +85 -66
- package/dist/routes/api/auth/login.d.ts +1 -4
- package/dist/routes/api/auth/login.js +63 -47
- package/dist/routes/api/auth/logout.d.ts +6 -5
- package/dist/routes/api/auth/logout.js +38 -24
- package/dist/routes/api/auth/register.d.ts +1 -4
- package/dist/routes/api/auth/register.js +74 -63
- package/dist/routes/api/auth/shared.d.ts +4 -4
- package/dist/routes/api/auth/shared.js +19 -26
- package/dist/routes/api/dashboard/api-tokens.d.ts +1 -5
- package/dist/routes/api/dashboard/api-tokens.js +70 -64
- package/dist/routes/api/dashboard/config.d.ts +1 -4
- package/dist/routes/api/dashboard/config.js +51 -33
- package/dist/routes/api/dashboard/content/diff.d.ts +1 -4
- package/dist/routes/api/dashboard/content/diff.js +50 -29
- package/dist/routes/api/dashboard/content/folder.d.ts +1 -6
- package/dist/routes/api/dashboard/content/folder.js +106 -86
- package/dist/routes/api/dashboard/content/page.d.ts +1 -5
- package/dist/routes/api/dashboard/content/page.js +207 -202
- package/dist/routes/api/dashboard/create-reset-link.d.ts +1 -4
- package/dist/routes/api/dashboard/create-reset-link.js +53 -40
- package/dist/routes/api/dashboard/create-user-invite.d.ts +1 -4
- package/dist/routes/api/dashboard/create-user-invite.js +128 -106
- package/dist/routes/api/dashboard/create-user.d.ts +1 -4
- package/dist/routes/api/dashboard/create-user.js +132 -68
- package/dist/routes/api/dashboard/email-notification-settings-site.d.ts +1 -4
- package/dist/routes/api/dashboard/email-notification-settings-site.js +47 -21
- package/dist/routes/api/dashboard/partials/LiveRender.astro +21 -16
- package/dist/routes/api/dashboard/plugins/[plugin].d.ts +1 -4
- package/dist/routes/api/dashboard/plugins/[plugin].js +57 -33
- package/dist/routes/api/dashboard/profile.d.ts +1 -4
- package/dist/routes/api/dashboard/profile.js +133 -95
- package/dist/routes/api/dashboard/resend-verify-email.d.ts +1 -4
- package/dist/routes/api/dashboard/resend-verify-email.js +55 -29
- package/dist/routes/api/dashboard/reset-password.d.ts +1 -4
- package/dist/routes/api/dashboard/reset-password.js +76 -50
- package/dist/routes/api/dashboard/search-list.d.ts +1 -4
- package/dist/routes/api/dashboard/search-list.js +45 -37
- package/dist/routes/api/dashboard/update-user-notifications.d.ts +1 -4
- package/dist/routes/api/dashboard/update-user-notifications.js +48 -36
- package/dist/routes/api/dashboard/users.d.ts +1 -5
- package/dist/routes/api/dashboard/users.js +150 -96
- package/dist/routes/api/dashboard/verify-email.d.ts +1 -4
- package/dist/routes/api/dashboard/verify-email.js +52 -33
- package/dist/routes/api/dashboard/verify-session.d.ts +2 -29
- package/dist/routes/api/dashboard/verify-session.js +85 -73
- package/dist/routes/api/mailer/config.d.ts +2 -6
- package/dist/routes/api/mailer/config.js +86 -72
- package/dist/routes/api/mailer/test-email.d.ts +1 -4
- package/dist/routes/api/mailer/test-email.js +56 -33
- package/dist/routes/api/render.astro +1 -1
- package/dist/routes/api/rest/utils/auth-token.d.ts +3 -3
- package/dist/routes/api/rest/utils/auth-token.js +1 -2
- package/dist/routes/api/rest/v1/folders/[id].d.ts +2 -7
- package/dist/routes/api/rest/v1/folders/[id].js +105 -94
- package/dist/routes/api/rest/v1/folders/index.d.ts +2 -6
- package/dist/routes/api/rest/v1/folders/index.js +82 -66
- package/dist/routes/api/rest/v1/pages/[id]/history/[diffid].d.ts +1 -4
- package/dist/routes/api/rest/v1/pages/[id]/history/[diffid].js +46 -34
- package/dist/routes/api/rest/v1/pages/[id]/history/index.d.ts +1 -4
- package/dist/routes/api/rest/v1/pages/[id]/history/index.js +44 -39
- package/dist/routes/api/rest/v1/pages/[id]/index.d.ts +1 -6
- package/dist/routes/api/rest/v1/pages/[id]/index.js +158 -151
- package/dist/routes/api/rest/v1/pages/index.d.ts +1 -5
- package/dist/routes/api/rest/v1/pages/index.js +112 -107
- package/dist/routes/api/rest/v1/public/folders/[id].d.ts +1 -4
- package/dist/routes/api/rest/v1/public/folders/[id].js +32 -23
- package/dist/routes/api/rest/v1/public/folders/index.d.ts +1 -4
- package/dist/routes/api/rest/v1/public/folders/index.js +43 -33
- package/dist/routes/api/rest/v1/public/pages/[id].d.ts +1 -4
- package/dist/routes/api/rest/v1/public/pages/[id].js +38 -26
- package/dist/routes/api/rest/v1/public/pages/index.d.ts +1 -4
- package/dist/routes/api/rest/v1/public/pages/index.js +47 -44
- package/dist/routes/api/rest/v1/settings/index.d.ts +1 -5
- package/dist/routes/api/rest/v1/settings/index.js +60 -54
- package/dist/routes/api/rest/v1/users/[id].d.ts +2 -7
- package/dist/routes/api/rest/v1/users/[id].js +257 -231
- package/dist/routes/api/rest/v1/users/index.d.ts +2 -6
- package/dist/routes/api/rest/v1/users/index.js +154 -136
- package/dist/routes/api/sdk/fallback-list-pages.json.d.ts +1 -4
- package/dist/routes/api/sdk/fallback-list-pages.json.js +26 -33
- package/dist/routes/api/sdk/full-changelog.json.d.ts +1 -4
- package/dist/routes/api/sdk/full-changelog.json.js +27 -26
- package/dist/routes/api/sdk/list-pages.d.ts +1 -4
- package/dist/routes/api/sdk/list-pages.js +36 -29
- package/dist/routes/api/sdk/update-latest-version-cache.d.ts +1 -4
- package/dist/routes/api/sdk/update-latest-version-cache.js +30 -28
- package/dist/routes/api/sdk/utils/changelog.d.ts +5 -21
- package/dist/routes/api/sdk/utils/changelog.js +25 -131
- package/dist/routes/auth/login.astro +68 -58
- package/dist/routes/auth/logout.astro +3 -3
- package/dist/routes/auth/signup.astro +9 -9
- package/dist/routes/dashboard/[...pluginPage].astro +4 -2
- package/dist/routes/dashboard/configuration.astro +7 -4
- package/dist/routes/dashboard/content-management/createfolder.astro +5 -3
- package/dist/routes/dashboard/content-management/createpage.astro +5 -3
- package/dist/routes/dashboard/content-management/diff.astro +19 -15
- package/dist/routes/dashboard/content-management/editfolder.astro +4 -2
- package/dist/routes/dashboard/content-management/editpage.astro +4 -2
- package/dist/routes/dashboard/content-management/index.astro +5 -3
- package/dist/routes/dashboard/index.astro +4 -2
- package/dist/routes/dashboard/password-reset.astro +13 -8
- package/dist/routes/dashboard/plugins/[plugin].astro +10 -7
- package/dist/routes/dashboard/profile.astro +9 -4
- package/dist/routes/dashboard/smtp-configuration.astro +30 -18
- package/dist/routes/dashboard/unverified-email.astro +9 -9
- package/dist/routes/dashboard/user-management/edit.astro +53 -39
- package/dist/routes/dashboard/user-management/index.astro +6 -4
- package/dist/routes/error-pages/404.astro +6 -4
- package/dist/routes/firstTimeSetupRoutes/1-start.astro +18 -110
- package/dist/routes/firstTimeSetupRoutes/2-next.astro +60 -44
- package/dist/routes/firstTimeSetupRoutes/3-done.astro +9 -11
- package/dist/routes/firstTimeSetupRoutes/api/step-1.d.ts +1 -4
- package/dist/routes/firstTimeSetupRoutes/api/step-1.js +98 -87
- package/dist/routes/firstTimeSetupRoutes/api/step-2.d.ts +1 -4
- package/dist/routes/firstTimeSetupRoutes/api/step-2.js +95 -87
- package/dist/routes/firstTimeSetupRoutes/index.astro +6 -0
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +2 -3
- package/dist/schemas/config/index.js +1 -1
- package/dist/schemas/plugins/index.d.ts +57 -57
- package/dist/schemas/plugins/shared.d.ts +196 -77
- package/dist/schemas/plugins/shared.js +10 -16
- package/dist/styles/404.css +1 -1
- package/dist/styles/{authlayout.css → auth-layout.css} +1 -1
- package/dist/styles/code-component.css +56 -0
- package/dist/styles/dashboard-base.css +31 -62
- package/dist/styles/dashboard-diff.css +32 -32
- package/dist/theme.d.ts +1 -0
- package/dist/types.d.ts +3 -23
- package/dist/{lib → utils}/effects/index.d.ts +0 -1
- package/dist/{lib → utils}/effects/index.js +0 -2
- package/dist/{lib → utils}/effects/logger.d.ts +2 -4
- package/dist/{lib → utils}/effects/logger.js +2 -4
- package/dist/utils/effects/smtp.d.ts +40 -0
- package/dist/utils/effects/smtp.js +75 -0
- package/dist/utils/safeString.d.ts +1 -1
- package/dist/utils/safeString.js +1 -3
- package/dist/utils/stripIconify.d.ts +13 -0
- package/dist/utils/stripIconify.js +11 -0
- package/dist/utils/tinyMDParser.d.ts +6 -0
- package/dist/utils/tinyMDParser.js +5 -5
- package/dist/virtual.d.ts +194 -236
- package/dist/virtuals/auth/core.d.ts +91 -0
- package/dist/virtuals/auth/core.js +45 -0
- package/dist/{lib → virtuals}/auth/index.d.ts +1 -4
- package/dist/virtuals/auth/index.js +9 -0
- package/dist/virtuals/auth/scripts/three.d.ts +108 -0
- package/dist/virtuals/auth/scripts/three.js +484 -0
- package/dist/virtuals/auth/scripts/utils/fitModelToViewport.d.ts +10 -0
- package/dist/virtuals/auth/scripts/utils/fitModelToViewport.js +26 -0
- package/dist/{utils/validImages.d.ts → virtuals/auth/validImages/index.d.ts} +1 -1
- package/dist/virtuals/auth/validImages/index.js +39 -0
- package/dist/virtuals/auth/validImages/studiocms-blobs-dark.webp +0 -0
- package/dist/virtuals/auth/validImages/studiocms-blobs-light.webp +0 -0
- package/dist/virtuals/auth/validImages/studiocms-blocks-dark.webp +0 -0
- package/dist/virtuals/auth/validImages/studiocms-blocks-light.webp +0 -0
- package/dist/virtuals/auth/validImages/studiocms-curves-dark.webp +0 -0
- package/dist/virtuals/auth/validImages/studiocms-curves-light.webp +0 -0
- package/dist/{lib → virtuals}/auth/verify-email.d.ts +10 -10
- package/dist/{lib → virtuals}/auth/verify-email.js +19 -20
- package/dist/virtuals/components/Generator.astro +5 -0
- package/{src → dist/virtuals}/components/Renderer.astro +1 -1
- package/{src/lib → dist/virtuals}/i18n/LanguageSelector.astro +1 -1
- package/dist/{lib → virtuals}/i18n/client.d.ts +100 -4
- package/dist/{lib → virtuals}/i18n/client.js +11 -10
- package/dist/virtuals/i18n/config.d.ts +430 -0
- package/dist/virtuals/i18n/config.js +29 -0
- package/dist/virtuals/i18n/server.d.ts +116 -0
- package/dist/{lib/i18n/index.js → virtuals/i18n/server.js} +6 -19
- package/dist/{lib → virtuals}/i18n/translations/de.json +1 -1
- package/dist/virtuals/i18n/v-files.d.ts +30 -0
- package/dist/virtuals/i18n/v-files.js +46 -0
- package/dist/virtuals/lib/head.d.ts +1 -0
- package/dist/virtuals/lib/head.js +1 -0
- package/dist/{lib → virtuals/lib}/headDefaults.d.ts +1 -1
- package/dist/{lib → virtuals/lib}/headDefaults.js +1 -1
- package/dist/{lib → virtuals/lib}/makeAPIRoute.d.ts +1 -1
- package/dist/virtuals/lib/pathGenerators.d.ts +1 -0
- package/dist/virtuals/lib/pathGenerators.js +1 -0
- package/dist/{lib → virtuals/lib}/routeMap.d.ts +4 -0
- package/dist/{lib → virtuals/lib}/routeMap.js +5 -1
- package/dist/{lib → virtuals/lib}/urlGen.d.ts +2 -1
- package/dist/virtuals/lib/urlGen.js +6 -0
- package/dist/virtuals/mailer/index.d.ts +64 -0
- package/dist/{lib → virtuals}/mailer/index.js +7 -24
- package/dist/{lib → virtuals}/notifier/index.d.ts +6 -7
- package/dist/{lib → virtuals}/notifier/index.js +2 -4
- package/dist/virtuals/plugins/dashboard-pages.d.ts +71 -0
- package/dist/virtuals/scripts/user-quick-tools.d.ts +91 -0
- package/dist/{components → virtuals/scripts}/user-quick-tools.js +135 -53
- package/dist/{sdk → virtuals/sdk}/effect/collectors.d.ts +2 -2
- package/dist/{sdk → virtuals/sdk}/effect/collectors.js +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/db.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/db.js +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/foldertree.d.ts +2 -2
- package/dist/{sdk → virtuals/sdk}/effect/foldertree.js +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/generators.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/generators.js +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/getVersionFromNPM.d.ts +4 -5
- package/dist/virtuals/sdk/effect/getVersionFromNPM.js +24 -0
- package/dist/{sdk → virtuals/sdk}/effect/parsers.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/parsers.js +2 -2
- package/dist/{sdk → virtuals/sdk}/effect/pluginUtils.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/pluginUtils.js +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/users.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/effect/users.js +2 -2
- package/dist/{sdk → virtuals/sdk}/errors.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/errors.js +1 -1
- package/dist/{sdk → virtuals/sdk}/index.d.ts +5 -4
- package/dist/{sdk → virtuals/sdk}/index.js +3 -4
- package/dist/{sdk → virtuals/sdk}/modules/auth.d.ts +7 -6
- package/dist/{sdk → virtuals/sdk}/modules/auth.js +2 -2
- package/dist/{sdk → virtuals/sdk}/modules/clear.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/clear.js +1 -1
- package/dist/virtuals/sdk/modules/config.d.ts +272 -0
- package/dist/virtuals/sdk/modules/config.js +205 -0
- package/dist/{sdk → virtuals/sdk}/modules/delete.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/delete.js +2 -2
- package/dist/{sdk → virtuals/sdk}/modules/diffTracking.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/diffTracking.js +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/get.d.ts +14 -27
- package/dist/{sdk → virtuals/sdk}/modules/get.js +29 -42
- package/dist/{sdk → virtuals/sdk}/modules/init.d.ts +5 -19
- package/dist/{sdk → virtuals/sdk}/modules/init.js +8 -9
- package/dist/{sdk → virtuals/sdk}/modules/middlewares.d.ts +2 -2
- package/dist/{sdk → virtuals/sdk}/modules/middlewares.js +18 -12
- package/dist/{sdk → virtuals/sdk}/modules/notificationSettings.d.ts +6 -23
- package/dist/{sdk → virtuals/sdk}/modules/notificationSettings.js +8 -30
- package/dist/{sdk → virtuals/sdk}/modules/plugins.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/plugins.js +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/post.d.ts +7 -7
- package/dist/{sdk → virtuals/sdk}/modules/post.js +15 -10
- package/dist/{sdk → virtuals/sdk}/modules/resetTokenBucket.d.ts +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/resetTokenBucket.js +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/rest_api.d.ts +2 -2
- package/dist/{sdk → virtuals/sdk}/modules/rest_api.js +1 -1
- package/dist/{sdk → virtuals/sdk}/modules/update.d.ts +26 -26
- package/dist/{sdk → virtuals/sdk}/modules/update.js +29 -26
- package/dist/{sdk → virtuals/sdk}/sdkCore.d.ts +6 -4
- package/dist/{sdk → virtuals/sdk}/sdkCore.js +10 -5
- package/dist/virtuals/sdk/tables.d.ts +2 -0
- package/dist/virtuals/sdk/tables.js +5 -0
- package/dist/{sdk → virtuals/sdk}/types/index.d.ts +6 -5
- package/dist/{sdk → virtuals/sdk}/types/tableDefs.d.ts +5 -4
- package/dist/{sdk → virtuals/sdk}/types/tsAlias.d.ts +4 -0
- package/dist/{sdk → virtuals/sdk}/utils.d.ts +4 -3
- package/dist/{sdk → virtuals/sdk}/utils.js +1 -1
- package/dist/virtuals/stubs/config.stub.js +9 -0
- package/dist/virtuals/stubs/logger.stub.js +30 -0
- package/dist/virtuals/utils.d.ts +71 -0
- package/dist/virtuals/utils.js +43 -0
- package/package.json +40 -67
- package/src/cli/add/index.ts +6 -7
- package/src/cli/crypto/genJWT/index.ts +14 -15
- package/src/cli/crypto/index.ts +4 -4
- package/src/cli/getTurso/index.ts +3 -4
- package/src/cli/index.ts +11 -10
- package/src/cli/init/index.ts +11 -12
- package/src/cli/users/index.ts +11 -12
- package/src/cli/users/steps/libsqlCreateUsers.ts +4 -3
- package/src/cli/users/steps/libsqlModifyUsers.ts +4 -3
- package/src/{layouts → components}/auth/FallbackCanvas.astro +1 -1
- package/src/components/auth/OAuthButton.astro +1 -1
- package/src/components/auth/OAuthButtonStack.astro +2 -2
- package/src/components/auth/StaticAuthCheck.astro +3 -3
- package/src/{scripts → components/auth/component-scripts}/formListener.ts +5 -1
- package/src/components/dashboard/BaseHead.astro +7 -18
- package/src/components/dashboard/DashboardGrid.astro +4 -4
- package/src/components/dashboard/DashboardGridItem.astro +3 -2
- package/src/components/dashboard/DashboardPageHeader.astro +11 -6
- package/src/components/dashboard/DoubleSidebar.astro +3 -3
- package/src/components/dashboard/Footer.astro +3 -7
- package/src/components/dashboard/LoginChecker.astro +17 -17
- package/src/components/dashboard/MainSidebarContent.astro +27 -18
- package/src/components/dashboard/PageHeader.astro +3 -2
- package/src/components/dashboard/SidebarLink.astro +148 -31
- package/src/components/dashboard/SidebarPluginLink.astro +4 -4
- package/src/components/dashboard/SingleSidebar.astro +3 -3
- package/src/components/dashboard/UserName.astro +2 -2
- package/src/components/dashboard/component-scripts/dateTimeListener.ts +5 -9
- package/src/components/dashboard/component-scripts/dateWithTimeAndZone.ts +11 -8
- package/src/components/dashboard/configuration/ConfigForm.astro +53 -152
- package/src/components/dashboard/configuration/LoginPreview.astro +275 -0
- package/src/components/dashboard/content-mgmt/CreateFolder.astro +6 -5
- package/src/components/dashboard/content-mgmt/CreatePage.astro +23 -47
- package/src/components/dashboard/content-mgmt/EditFolder.astro +5 -4
- package/src/components/dashboard/content-mgmt/EditPage.astro +36 -85
- package/src/components/dashboard/content-mgmt/InnerSidebarElement.astro +30 -22
- package/src/components/dashboard/content-mgmt/PageEditorSwapper.astro +107 -0
- package/src/components/dashboard/content-mgmt/PageHeader.astro +26 -18
- package/src/components/dashboard/content-mgmt/PageTypeHandler.astro +107 -0
- package/src/components/dashboard/content-mgmt/PluginFields.astro +6 -1
- package/src/components/dashboard/content-mgmt/TreeRenderer.astro +8 -8
- package/src/components/dashboard/content-mgmt/TreeSidebarFolder.astro +116 -24
- package/src/components/dashboard/content-mgmt/TreeSidebarLink.astro +116 -24
- package/src/components/dashboard/content-mgmt/runtime.ts +1 -1
- package/src/components/dashboard/plugins/SettingsRenderer.astro +6 -1
- package/src/components/dashboard/profile/APITokens.astro +18 -12
- package/src/components/dashboard/profile/BasicInfo.astro +17 -13
- package/src/components/dashboard/profile/Notifications.astro +20 -8
- package/src/components/dashboard/profile/SocialSignin.astro +11 -8
- package/src/components/dashboard/profile/UpdatePassword.astro +10 -7
- package/src/components/dashboard/profile/oAuthButtonProviders.ts +1 -20
- package/src/components/dashboard/shared.ts +1 -1
- package/src/components/dashboard/sidebar/UserAccount.astro +5 -6
- package/src/components/dashboard/sidebar/VersionCheck.astro +7 -7
- package/src/components/dashboard/sidebar/VersionCheckChangelog.astro +32 -8
- package/src/components/dashboard/sidebar-modals/UserManagementModals.astro +8 -3
- package/src/components/dashboard/sidebar-modals/VersionModal.astro +43 -24
- package/src/components/dashboard/sidebarConfig.ts +9 -9
- package/src/components/dashboard/user-mgmt/InnerSidebarElement.astro +20 -13
- package/src/components/dashboard/user-mgmt/RankCheck.astro +10 -10
- package/src/components/dashboard/user-mgmt/SocialSignin.astro +9 -10
- package/src/components/dashboard/user-mgmt/UserListItem.astro +86 -30
- package/src/components/default-grid-items/Recently-created-pages.astro +12 -10
- package/src/components/default-grid-items/Recently-signed-up.astro +9 -9
- package/src/components/default-grid-items/Recently-updated-pages.astro +12 -10
- package/src/components/default-grid-items/Totals.astro +11 -10
- package/src/{routes/firstTimeSetupRoutes/components → components/first-time-setup}/PageHeader.astro +4 -3
- package/src/components/shared/Code.astro +72 -0
- package/src/components/shared/SSRUser.astro +200 -0
- package/src/components/shared/head/Favicons.astro +6 -0
- package/src/components/shared/head/Global.astro +4 -0
- package/src/components/shared/head/TitleTags.astro +14 -0
- package/src/config.ts +1 -4
- package/src/consts.ts +94 -14
- package/src/db/config.ts +306 -3
- package/src/effect.ts +5 -10
- package/src/fonts/syntax-font.css +40 -0
- package/src/{utils → handlers}/astroConfigCheck.ts +1 -1
- package/src/handlers/changelog.ts +67 -0
- package/src/handlers/index.ts +4 -0
- package/src/{pluginHandler.ts → handlers/pluginHandler.ts} +359 -142
- package/src/{routeHandler.ts → handlers/routeHandler.ts} +8 -3
- package/src/index.ts +214 -259
- package/src/{lib → integrations}/dynamic-sitemap/index.ts +1 -1
- package/src/integrations/node-namespace.ts +44 -0
- package/src/integrations/plugins.ts +4 -0
- package/src/{lib → integrations}/robots/utils.ts +0 -11
- package/src/{lib → integrations}/webVitals/checkForWebVitalsPlugin.ts +3 -3
- package/{dist/lib → src/integrations}/webVitals/dashboard-grid-items/CoreVitals.astro +1 -1
- package/{dist/lib → src/integrations}/webVitals/dashboard-grid-items/MetricCard.astro +3 -2
- package/src/{lib → integrations}/webVitals/dashboard-grid-items/SummaryCard.astro +2 -2
- package/src/{lib → integrations}/webVitals/dashboard-grid-items/metric.css +17 -17
- package/src/{lib → integrations}/webVitals/dashboard-grid-items/shared.ts +7 -7
- package/{dist/lib → src/integrations}/webVitals/pages/analytics/body.astro +10 -9
- package/src/layouts/AuthLayout.astro +63 -0
- package/src/layouts/{dashboard/Layout.astro → DashboardLayout.astro} +22 -10
- package/{dist/routes/firstTimeSetupRoutes/components/Layout.astro → src/layouts/FirstTimeSetupLayout.astro} +15 -3
- package/src/middleware/index.ts +98 -111
- package/src/middleware/utils.ts +123 -113
- package/src/routes/api/auth/[provider]/callback.ts +31 -15
- package/src/routes/api/auth/[provider]/index.ts +31 -15
- package/src/routes/api/auth/forgot-password.ts +134 -128
- package/src/routes/api/auth/login.ts +80 -67
- package/src/routes/api/auth/logout.ts +59 -43
- package/src/routes/api/auth/register.ts +93 -85
- package/src/routes/api/auth/shared.ts +20 -30
- package/src/routes/api/dashboard/api-tokens.ts +112 -104
- package/src/routes/api/dashboard/config.ts +64 -48
- package/src/routes/api/dashboard/content/diff.ts +59 -38
- package/src/routes/api/dashboard/content/folder.ts +145 -135
- package/src/routes/api/dashboard/content/page.ts +274 -275
- package/src/routes/api/dashboard/create-reset-link.ts +73 -64
- package/src/routes/api/dashboard/create-user-invite.ts +158 -140
- package/src/routes/api/dashboard/create-user.ts +172 -106
- package/src/routes/api/dashboard/email-notification-settings-site.ts +69 -32
- package/src/routes/api/dashboard/partials/LiveRender.astro +21 -16
- package/src/routes/api/dashboard/plugins/[plugin].ts +65 -45
- package/src/routes/api/dashboard/profile.ts +159 -127
- package/src/routes/api/dashboard/resend-verify-email.ts +63 -35
- package/src/routes/api/dashboard/reset-password.ts +108 -77
- package/src/routes/api/dashboard/search-list.ts +50 -50
- package/src/routes/api/dashboard/update-user-notifications.ts +57 -45
- package/src/routes/api/dashboard/users.ts +202 -135
- package/src/routes/api/dashboard/verify-email.ts +57 -42
- package/src/routes/api/dashboard/verify-session.ts +102 -116
- package/src/routes/api/mailer/config.ts +120 -102
- package/src/routes/api/mailer/test-email.ts +73 -52
- package/src/routes/api/render.astro +1 -1
- package/src/routes/api/rest/utils/auth-token.ts +1 -2
- package/src/routes/api/rest/v1/folders/[id].ts +136 -133
- package/src/routes/api/rest/v1/folders/index.ts +102 -90
- package/src/routes/api/rest/v1/pages/[id]/history/[diffid].ts +59 -49
- package/src/routes/api/rest/v1/pages/[id]/history/index.ts +63 -65
- package/src/routes/api/rest/v1/pages/[id]/index.ts +184 -187
- package/src/routes/api/rest/v1/pages/index.ts +136 -137
- package/src/routes/api/rest/v1/public/folders/[id].ts +34 -28
- package/src/routes/api/rest/v1/public/folders/index.ts +54 -47
- package/src/routes/api/rest/v1/public/pages/[id].ts +47 -38
- package/src/routes/api/rest/v1/public/pages/index.ts +60 -62
- package/src/routes/api/rest/v1/settings/index.ts +91 -77
- package/src/routes/api/rest/v1/users/[id].ts +317 -294
- package/src/routes/api/rest/v1/users/index.ts +196 -179
- package/src/routes/api/sdk/fallback-list-pages.json.ts +28 -38
- package/src/routes/api/sdk/full-changelog.json.ts +29 -31
- package/src/routes/api/sdk/list-pages.ts +41 -37
- package/src/routes/api/sdk/update-latest-version-cache.ts +32 -34
- package/src/routes/api/sdk/utils/changelog.ts +29 -168
- package/src/routes/auth/login.astro +68 -58
- package/src/routes/auth/logout.astro +3 -3
- package/src/routes/auth/signup.astro +9 -9
- package/src/routes/dashboard/[...pluginPage].astro +4 -2
- package/src/routes/dashboard/configuration.astro +7 -4
- package/src/routes/dashboard/content-management/createfolder.astro +5 -3
- package/src/routes/dashboard/content-management/createpage.astro +5 -3
- package/src/routes/dashboard/content-management/diff.astro +19 -15
- package/src/routes/dashboard/content-management/editfolder.astro +4 -2
- package/src/routes/dashboard/content-management/editpage.astro +4 -2
- package/src/routes/dashboard/content-management/index.astro +5 -3
- package/src/routes/dashboard/index.astro +4 -2
- package/src/routes/dashboard/password-reset.astro +13 -8
- package/src/routes/dashboard/plugins/[plugin].astro +10 -7
- package/src/routes/dashboard/profile.astro +9 -4
- package/src/routes/dashboard/smtp-configuration.astro +30 -18
- package/src/routes/dashboard/unverified-email.astro +9 -9
- package/src/routes/dashboard/user-management/edit.astro +53 -39
- package/src/routes/dashboard/user-management/index.astro +6 -4
- package/src/routes/error-pages/404.astro +6 -4
- package/src/routes/firstTimeSetupRoutes/1-start.astro +18 -110
- package/src/routes/firstTimeSetupRoutes/2-next.astro +60 -44
- package/src/routes/firstTimeSetupRoutes/3-done.astro +9 -11
- package/src/routes/firstTimeSetupRoutes/api/step-1.ts +116 -98
- package/src/routes/firstTimeSetupRoutes/api/step-2.ts +114 -100
- package/src/routes/firstTimeSetupRoutes/index.astro +6 -0
- package/src/runtime/index.ts +2 -3
- package/src/schemas/config/index.ts +1 -1
- package/src/schemas/plugins/index.ts +1 -1
- package/src/schemas/plugins/shared.ts +149 -23
- package/src/styles/404.css +1 -1
- package/src/styles/{authlayout.css → auth-layout.css} +1 -1
- package/src/styles/code-component.css +64 -0
- package/src/styles/dashboard-base.css +31 -67
- package/src/styles/dashboard-diff.css +32 -32
- package/src/theme.d.ts +1 -0
- package/src/types.ts +4 -21
- package/src/{lib → utils}/effects/index.ts +0 -1
- package/src/{lib → utils}/effects/logger.ts +6 -10
- package/src/utils/effects/smtp.ts +155 -0
- package/src/utils/safeString.ts +1 -6
- package/src/utils/stripIconify.ts +20 -0
- package/src/utils/tinyMDParser.ts +13 -7
- package/src/virtual.d.ts +194 -236
- package/src/virtuals/auth/core.ts +82 -0
- package/src/{lib → virtuals}/auth/index.ts +1 -4
- package/src/virtuals/auth/scripts/three.ts +647 -0
- package/src/virtuals/auth/scripts/utils/fitModelToViewport.ts +50 -0
- package/src/{utils/validImages.ts → virtuals/auth/validImages/index.ts} +10 -10
- package/src/virtuals/auth/validImages/studiocms-blobs-dark.webp +0 -0
- package/src/virtuals/auth/validImages/studiocms-blobs-light.webp +0 -0
- package/src/virtuals/auth/validImages/studiocms-blocks-dark.webp +0 -0
- package/src/virtuals/auth/validImages/studiocms-blocks-light.webp +0 -0
- package/src/virtuals/auth/validImages/studiocms-curves-dark.webp +0 -0
- package/src/virtuals/auth/validImages/studiocms-curves-light.webp +0 -0
- package/src/{lib → virtuals}/auth/verify-email.ts +20 -21
- package/src/virtuals/components/Generator.astro +5 -0
- package/{dist → src/virtuals}/components/Renderer.astro +1 -1
- package/{dist/lib → src/virtuals}/i18n/LanguageSelector.astro +1 -1
- package/src/virtuals/i18n/client.ts +232 -0
- package/src/virtuals/i18n/config.ts +170 -0
- package/src/{lib/i18n/index.ts → virtuals/i18n/server.ts} +42 -46
- package/src/{lib → virtuals}/i18n/translations/de.json +1 -1
- package/src/virtuals/i18n/v-files.ts +122 -0
- package/src/virtuals/lib/head.ts +1 -0
- package/src/{lib → virtuals/lib}/headDefaults.ts +1 -1
- package/src/{lib → virtuals/lib}/makeAPIRoute.ts +1 -1
- package/src/virtuals/lib/pathGenerators.ts +1 -0
- package/src/{lib → virtuals/lib}/routeMap.ts +5 -0
- package/src/virtuals/lib/urlGen.ts +15 -0
- package/src/{lib → virtuals}/mailer/index.ts +10 -44
- package/src/{lib → virtuals}/notifier/index.ts +1 -3
- package/src/{components → virtuals/scripts}/user-quick-tools.ts +151 -59
- package/src/{sdk → virtuals/sdk}/effect/collectors.ts +2 -3
- package/src/{sdk → virtuals/sdk}/effect/db.ts +1 -1
- package/src/{sdk → virtuals/sdk}/effect/foldertree.ts +1 -1
- package/src/{sdk → virtuals/sdk}/effect/generators.ts +1 -1
- package/src/{sdk → virtuals/sdk}/effect/getVersionFromNPM.ts +5 -11
- package/src/{sdk → virtuals/sdk}/effect/parsers.ts +2 -2
- package/src/{sdk → virtuals/sdk}/effect/pluginUtils.ts +1 -1
- package/src/{sdk → virtuals/sdk}/effect/users.ts +2 -2
- package/src/{sdk → virtuals/sdk}/errors.ts +1 -1
- package/src/{sdk → virtuals/sdk}/index.ts +5 -6
- package/src/{sdk → virtuals/sdk}/modules/auth.ts +4 -3
- package/src/{sdk → virtuals/sdk}/modules/clear.ts +1 -1
- package/src/virtuals/sdk/modules/config.ts +602 -0
- package/src/{sdk → virtuals/sdk}/modules/delete.ts +2 -2
- package/src/{sdk → virtuals/sdk}/modules/diffTracking.ts +1 -1
- package/src/{sdk → virtuals/sdk}/modules/get.ts +34 -50
- package/src/{sdk → virtuals/sdk}/modules/init.ts +19 -27
- package/src/{sdk → virtuals/sdk}/modules/middlewares.ts +24 -13
- package/src/{sdk → virtuals/sdk}/modules/notificationSettings.ts +9 -45
- package/src/{sdk → virtuals/sdk}/modules/plugins.ts +1 -1
- package/src/{sdk → virtuals/sdk}/modules/post.ts +18 -19
- package/src/{sdk → virtuals/sdk}/modules/resetTokenBucket.ts +1 -1
- package/src/{sdk → virtuals/sdk}/modules/rest_api.ts +1 -1
- package/src/{sdk → virtuals/sdk}/modules/update.ts +32 -30
- package/src/{sdk → virtuals/sdk}/sdkCore.ts +6 -1
- package/src/virtuals/sdk/tables.ts +2 -0
- package/src/{sdk → virtuals/sdk}/types/index.ts +6 -10
- package/src/{sdk → virtuals/sdk}/types/tableDefs.ts +4 -4
- package/src/{sdk → virtuals/sdk}/types/tsAlias.ts +4 -0
- package/src/{sdk → virtuals/sdk}/utils.ts +3 -3
- package/src/virtuals/stubs/config.stub.js +9 -0
- package/src/virtuals/stubs/logger.stub.js +30 -0
- package/src/virtuals/utils.ts +134 -0
- package/ui.d.ts +1301 -274
- package/dist/componentRegistry/PropsParser.d.ts +0 -15
- package/dist/componentRegistry/PropsParser.js +0 -214
- package/dist/componentRegistry/Registry.d.ts +0 -46
- package/dist/componentRegistry/Registry.js +0 -79
- package/dist/componentRegistry/convert-hyphens.d.ts +0 -14
- package/dist/componentRegistry/convert-hyphens.js +0 -10
- package/dist/componentRegistry/errors.d.ts +0 -67
- package/dist/componentRegistry/errors.js +0 -12
- package/dist/componentRegistry/handler.d.ts +0 -34
- package/dist/componentRegistry/handler.js +0 -110
- package/dist/componentRegistry/index.d.ts +0 -6
- package/dist/componentRegistry/index.js +0 -6
- package/dist/componentRegistry/runtime.d.ts +0 -46
- package/dist/componentRegistry/runtime.js +0 -61
- package/dist/componentRegistry/types.d.ts +0 -59
- package/dist/components/Generator.astro +0 -5
- package/dist/components/dashboard/AstroCodeDiffsScript.astro +0 -25
- package/dist/components/dashboard/Code.astro +0 -23
- package/dist/components/dashboard/component-scripts/makeClientRoutable.d.ts +0 -1
- package/dist/components/dashboard/component-scripts/makeClientRoutable.js +0 -9
- package/dist/components/dashboard/configuration/LightVsDark.astro +0 -67
- package/dist/components/user-quick-tools.d.ts +0 -90
- package/dist/db/tables.js +0 -217
- package/dist/layouts/auth/AuthLayout.astro +0 -71
- package/dist/lib/auth/encryption.d.ts +0 -46
- package/dist/lib/auth/encryption.js +0 -83
- package/dist/lib/auth/index.js +0 -12
- package/dist/lib/auth/password.d.ts +0 -45
- package/dist/lib/auth/password.js +0 -113
- package/dist/lib/auth/session.d.ts +0 -77
- package/dist/lib/auth/session.js +0 -147
- package/dist/lib/auth/user.d.ts +0 -155
- package/dist/lib/auth/user.js +0 -251
- package/dist/lib/auth/utils/lists/passwords.d.ts +0 -2
- package/dist/lib/auth/utils/lists/passwords.js +0 -10006
- package/dist/lib/auth/utils/lists/usernames.d.ts +0 -2
- package/dist/lib/auth/utils/lists/usernames.js +0 -547
- package/dist/lib/auth/utils/scrypt.d.ts +0 -104
- package/dist/lib/auth/utils/scrypt.js +0 -55
- package/dist/lib/auth/utils/unsafeCheck.d.ts +0 -34
- package/dist/lib/auth/utils/unsafeCheck.js +0 -38
- package/dist/lib/dashboardGrid.d.ts +0 -119
- package/dist/lib/dashboardGrid.js +0 -0
- package/dist/lib/effects/convertToVanilla.d.ts +0 -10
- package/dist/lib/effects/convertToVanilla.js +0 -5
- package/dist/lib/effects/smtp.config.d.ts +0 -212
- package/dist/lib/effects/smtp.config.js +0 -123
- package/dist/lib/effects/smtp.d.ts +0 -269
- package/dist/lib/effects/smtp.js +0 -186
- package/dist/lib/endpointResponses.d.ts +0 -2
- package/dist/lib/endpointResponses.js +0 -21
- package/dist/lib/head.d.ts +0 -25
- package/dist/lib/head.js +0 -73
- package/dist/lib/i18n/config.d.ts +0 -16
- package/dist/lib/i18n/config.js +0 -8
- package/dist/lib/i18n/index.d.ts +0 -2471
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.js +0 -7
- package/dist/lib/jsonUtils.d.ts +0 -2
- package/dist/lib/jsonUtils.js +0 -14
- package/dist/lib/mailer/index.d.ts +0 -267
- package/dist/lib/pathGenerators.d.ts +0 -20
- package/dist/lib/pathGenerators.js +0 -66
- package/dist/lib/plugins/dashboard-pages.d.ts +0 -71
- package/dist/lib/removeLeadingTrailingSlashes.d.ts +0 -7
- package/dist/lib/removeLeadingTrailingSlashes.js +0 -13
- package/dist/lib/renderer/errors.d.ts +0 -5
- package/dist/lib/renderer/errors.js +0 -25
- package/dist/lib/urlGen.js +0 -26
- package/dist/lib/webVitals/types.js +0 -0
- package/dist/routes/firstTimeSetupRoutes/components/TabItem.astro +0 -44
- package/dist/routes/firstTimeSetupRoutes/components/Tabs.astro +0 -170
- package/dist/runtime/AstroComponentProxy.d.ts +0 -31
- package/dist/runtime/AstroComponentProxy.js +0 -47
- package/dist/runtime/decoder/decode-codepoint.d.ts +0 -18
- package/dist/runtime/decoder/decode-codepoint.js +0 -58
- package/dist/runtime/decoder/decode-data-html.d.ts +0 -1
- package/dist/runtime/decoder/decode-data-html.js +0 -7
- package/dist/runtime/decoder/decode-data-xml.d.ts +0 -1
- package/dist/runtime/decoder/decode-data-xml.js +0 -7
- package/dist/runtime/decoder/index.d.ts +0 -34
- package/dist/runtime/decoder/index.js +0 -18
- package/dist/runtime/decoder/util.d.ts +0 -208
- package/dist/runtime/decoder/util.js +0 -415
- package/dist/scriptHandler.d.ts +0 -30
- package/dist/scriptHandler.js +0 -25
- package/dist/scripts/three.d.ts +0 -1
- package/dist/scripts/three.js +0 -278
- package/dist/scripts/utils/fitModelToViewport.d.ts +0 -8
- package/dist/scripts/utils/fitModelToViewport.js +0 -19
- package/dist/sdk/effect/convertToVanilla.d.ts +0 -1
- package/dist/sdk/effect/convertToVanilla.js +0 -4
- package/dist/sdk/effect/getVersionFromNPM.js +0 -30
- package/dist/sdk/tables.d.ts +0 -1405
- package/dist/sdk/tables.js +0 -70
- package/dist/utils/addIntegrationArray.d.ts +0 -24
- package/dist/utils/addIntegrationArray.js +0 -11
- package/dist/utils/addIntegrationArrayWithCheck.d.ts +0 -11
- package/dist/utils/addIntegrationArrayWithCheck.js +0 -24
- package/dist/utils/astroEnvConfig.d.ts +0 -45
- package/dist/utils/astroEnvConfig.js +0 -9
- package/dist/utils/authEnvCheck.d.ts +0 -38
- package/dist/utils/authEnvCheck.js +0 -82
- package/dist/utils/changelog.d.ts +0 -1
- package/dist/utils/changelog.js +0 -53
- package/dist/utils/changelogLoader.d.ts +0 -15
- package/dist/utils/changelogLoader.js +0 -104
- package/dist/utils/dynamicResult.d.ts +0 -17
- package/dist/utils/dynamicResult.js +0 -0
- package/dist/utils/getLatestVersion.d.ts +0 -12
- package/dist/utils/getLatestVersion.js +0 -36
- package/dist/utils/integrationLogger.d.ts +0 -7
- package/dist/utils/integrationLogger.js +0 -18
- package/dist/utils/integrations.d.ts +0 -4
- package/dist/utils/integrations.js +0 -32
- package/dist/utils/isDashboardRoute.d.ts +0 -7
- package/dist/utils/isDashboardRoute.js +0 -10
- package/dist/utils/jsonParse.d.ts +0 -9
- package/dist/utils/jsonParse.js +0 -6
- package/dist/utils/loginBackgrounds/studiocms-blobs-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blobs-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-light.png +0 -0
- package/dist/utils/makePageTitle.d.ts +0 -3
- package/dist/utils/makePageTitle.js +0 -7
- package/dist/utils/pageListPackageLabel.d.ts +0 -4
- package/dist/utils/pageListPackageLabel.js +0 -12
- package/dist/utils/pageTypeFilter.d.ts +0 -2
- package/dist/utils/pageTypeFilter.js +0 -16
- package/dist/utils/pluginLogger.d.ts +0 -2
- package/dist/utils/pluginLogger.js +0 -7
- package/dist/utils/readJson.d.ts +0 -1
- package/dist/utils/readJson.js +0 -7
- package/dist/utils/tryCatch.d.ts +0 -10
- package/dist/utils/tryCatch.js +0 -15
- package/dist/utils/validImages.js +0 -39
- package/src/componentRegistry/PropsParser.ts +0 -270
- package/src/componentRegistry/Registry.ts +0 -119
- package/src/componentRegistry/convert-hyphens.ts +0 -21
- package/src/componentRegistry/errors.ts +0 -58
- package/src/componentRegistry/handler.ts +0 -185
- package/src/componentRegistry/index.ts +0 -6
- package/src/componentRegistry/runtime.ts +0 -105
- package/src/componentRegistry/types.ts +0 -63
- package/src/components/Generator.astro +0 -5
- package/src/components/dashboard/AstroCodeDiffsScript.astro +0 -25
- package/src/components/dashboard/Code.astro +0 -23
- package/src/components/dashboard/ThemeManager.astro +0 -53
- package/src/components/dashboard/component-scripts/makeClientRoutable.ts +0 -7
- package/src/components/dashboard/configuration/LightVsDark.astro +0 -67
- package/src/db/tables.ts +0 -226
- package/src/layouts/auth/AuthLayout.astro +0 -71
- package/src/layouts/auth/ThemeManager.astro +0 -53
- package/src/lib/auth/encryption.ts +0 -149
- package/src/lib/auth/password.ts +0 -212
- package/src/lib/auth/session.ts +0 -291
- package/src/lib/auth/user.ts +0 -501
- package/src/lib/auth/utils/lists/passwords.ts +0 -10004
- package/src/lib/auth/utils/lists/usernames.ts +0 -546
- package/src/lib/auth/utils/scrypt.ts +0 -142
- package/src/lib/auth/utils/unsafeCheck.ts +0 -71
- package/src/lib/dashboardGrid.ts +0 -139
- package/src/lib/effects/convertToVanilla.ts +0 -12
- package/src/lib/effects/smtp.config.ts +0 -123
- package/src/lib/effects/smtp.ts +0 -338
- package/src/lib/endpointResponses.ts +0 -20
- package/src/lib/head.ts +0 -114
- package/src/lib/i18n/client.ts +0 -128
- package/src/lib/i18n/config.ts +0 -19
- package/src/lib/index.ts +0 -7
- package/src/lib/jsonUtils.ts +0 -11
- package/src/lib/pathGenerators.ts +0 -72
- package/src/lib/removeLeadingTrailingSlashes.ts +0 -21
- package/src/lib/renderer/errors.ts +0 -29
- package/src/lib/urlGen.ts +0 -40
- package/src/routes/firstTimeSetupRoutes/components/TabItem.astro +0 -44
- package/src/routes/firstTimeSetupRoutes/components/Tabs.astro +0 -170
- package/src/runtime/AstroComponentProxy.ts +0 -93
- package/src/runtime/decoder/decode-codepoint.ts +0 -76
- package/src/runtime/decoder/decode-data-html.ts +0 -6
- package/src/runtime/decoder/decode-data-xml.ts +0 -6
- package/src/runtime/decoder/index.ts +0 -49
- package/src/runtime/decoder/util.ts +0 -587
- package/src/scriptHandler.ts +0 -86
- package/src/scripts/three.ts +0 -415
- package/src/scripts/utils/fitModelToViewport.ts +0 -36
- package/src/sdk/effect/convertToVanilla.ts +0 -1
- package/src/sdk/tables.ts +0 -129
- package/src/styles/dashboard-code.css +0 -56
- package/src/utils/addIntegrationArray.ts +0 -35
- package/src/utils/addIntegrationArrayWithCheck.ts +0 -41
- package/src/utils/astroEnvConfig.ts +0 -12
- package/src/utils/authEnvCheck.ts +0 -144
- package/src/utils/changelog.ts +0 -67
- package/src/utils/changelogLoader.ts +0 -138
- package/src/utils/dynamicResult.ts +0 -19
- package/src/utils/getLatestVersion.ts +0 -67
- package/src/utils/integrationLogger.ts +0 -24
- package/src/utils/integrations.ts +0 -32
- package/src/utils/isDashboardRoute.ts +0 -19
- package/src/utils/jsonParse.ts +0 -11
- package/src/utils/loginBackgrounds/studiocms-blobs-dark.png +0 -0
- package/src/utils/loginBackgrounds/studiocms-blobs-light.png +0 -0
- package/src/utils/loginBackgrounds/studiocms-blocks-dark.png +0 -0
- package/src/utils/loginBackgrounds/studiocms-blocks-light.png +0 -0
- package/src/utils/loginBackgrounds/studiocms-curves-dark.png +0 -0
- package/src/utils/loginBackgrounds/studiocms-curves-light.png +0 -0
- package/src/utils/makePageTitle.ts +0 -11
- package/src/utils/pageListPackageLabel.ts +0 -19
- package/src/utils/pageTypeFilter.ts +0 -13
- package/src/utils/pluginLogger.ts +0 -6
- package/src/utils/readJson.ts +0 -5
- package/src/utils/tryCatch.ts +0 -29
- /package/dist/{layouts → components}/auth/ThreeCanvasLoader.astro +0 -0
- /package/dist/components/{dashboard → shared}/ThemeManager.astro +0 -0
- /package/dist/{styles → fonts}/OnestFont.woff2 +0 -0
- /package/dist/{styles → fonts}/SyntaxFont.woff2 +0 -0
- /package/dist/{styles → fonts}/onest-font.css +0 -0
- /package/dist/{utils → handlers}/astroConfigCheck.d.ts +0 -0
- /package/dist/{lib → integrations}/dynamic-sitemap/index.d.ts +0 -0
- /package/dist/{lib → integrations}/dynamic-sitemap/sitemap-index.xml.d.ts +0 -0
- /package/dist/{lib → integrations}/dynamic-sitemap/sitemap-index.xml.js +0 -0
- /package/dist/{lib → integrations}/robots/core.d.ts +0 -0
- /package/dist/{lib → integrations}/robots/core.js +0 -0
- /package/dist/{lib → integrations}/robots/index.d.ts +0 -0
- /package/dist/{lib → integrations}/robots/index.js +0 -0
- /package/dist/{lib → integrations}/robots/schema.d.ts +0 -0
- /package/dist/{lib → integrations}/robots/schema.js +0 -0
- /package/dist/{lib → integrations}/webVitals/checkForWebVitalsPlugin.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/consts.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/consts.js +0 -0
- /package/dist/{lib → integrations}/webVitals/pages/analytics/header.astro +0 -0
- /package/dist/{lib → integrations}/webVitals/schemas.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/schemas.js +0 -0
- /package/dist/{lib → integrations}/webVitals/types.d.ts +0 -0
- /package/dist/{componentRegistry → integrations/webVitals}/types.js +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildDataObject.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildDataObject.js +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildPageRouteDataObject.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildPageRouteDataObject.js +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildPerPageDataObject.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/buildPerPageDataObject.js +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/checkDate.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/checkDate.js +0 -0
- /package/dist/{lib → integrations}/webVitals/utils/webVitalsUtils.js +0 -0
- /package/dist/{lib → integrations}/webVitals/webVital.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/webVital.js +0 -0
- /package/dist/{lib → integrations}/webVitals/webVitalsRouteSummary.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/webVitalsRouteSummary.js +0 -0
- /package/dist/{lib → integrations}/webVitals/webVitalsSummary.d.ts +0 -0
- /package/dist/{lib → integrations}/webVitals/webVitalsSummary.js +0 -0
- /package/dist/{utils → virtuals/auth}/getLabelForPermissionLevel.d.ts +0 -0
- /package/dist/{utils → virtuals/auth}/getLabelForPermissionLevel.js +0 -0
- /package/dist/{lib → virtuals}/auth/types.d.ts +0 -0
- /package/dist/{lib → virtuals}/auth/types.js +0 -0
- /package/dist/{components/image → virtuals/components}/CustomImage.astro +0 -0
- /package/dist/{components → virtuals/components}/FormattedDate.astro +0 -0
- /package/dist/{lib → virtuals}/i18n/translations/en.json +0 -0
- /package/dist/{lib → virtuals}/i18n/translations/es.json +0 -0
- /package/dist/{lib → virtuals}/i18n/translations/fr.json +0 -0
- /package/dist/{lib → virtuals}/i18n/translations/hi.json +0 -0
- /package/dist/{lib → virtuals}/i18n/translations/zh.json +0 -0
- /package/dist/{lib → virtuals/lib}/makeAPIRoute.js +0 -0
- /package/dist/{lib → virtuals/lib}/makePublicRoute.d.ts +0 -0
- /package/dist/{lib → virtuals/lib}/makePublicRoute.js +0 -0
- /package/dist/{lib → virtuals}/mailer/template.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/template.js +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/index.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/index.js +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/notification.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/notification.js +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/password-reset.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/password-reset.js +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/user-invite.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/user-invite.js +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/verify-email.d.ts +0 -0
- /package/dist/{lib → virtuals}/mailer/templates/verify-email.js +0 -0
- /package/dist/{lib → virtuals}/notifier/client.d.ts +0 -0
- /package/dist/{lib → virtuals}/notifier/client.js +0 -0
- /package/dist/{lib → virtuals}/plugins/dashboard-pages.js +0 -0
- /package/dist/{lib → virtuals}/plugins/frontend-navigation.d.ts +0 -0
- /package/dist/{lib → virtuals}/plugins/frontend-navigation.js +0 -0
- /package/dist/{lib → virtuals}/plugins/index.d.ts +0 -0
- /package/dist/{lib → virtuals}/plugins/index.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/consts.d.ts +0 -0
- /package/dist/{sdk → virtuals/sdk}/consts.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/effect/index.d.ts +0 -0
- /package/dist/{sdk → virtuals/sdk}/effect/index.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/effect/lib/jwt-generator.d.ts +0 -0
- /package/dist/{sdk → virtuals/sdk}/effect/lib/jwt-generator.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/types/index.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/types/tableDefs.js +0 -0
- /package/dist/{sdk → virtuals/sdk}/types/tsAlias.js +0 -0
- /package/src/{layouts → components}/auth/ThreeCanvasLoader.astro +0 -0
- /package/src/{routes/firstTimeSetupRoutes → components/first-time-setup}/snippets/opt1-astro.config.diff +0 -0
- /package/src/{routes/firstTimeSetupRoutes → components/first-time-setup}/snippets/opt2-astro.config.diff +0 -0
- /package/src/{routes/firstTimeSetupRoutes → components/first-time-setup}/snippets/opt2-studiocms.config.diff +0 -0
- /package/{dist/layouts/auth → src/components/shared}/ThemeManager.astro +0 -0
- /package/src/{styles → fonts}/OnestFont.woff2 +0 -0
- /package/src/{styles → fonts}/SyntaxFont.woff2 +0 -0
- /package/src/{styles → fonts}/onest-font.css +0 -0
- /package/src/{lib → integrations}/dynamic-sitemap/sitemap-index.xml.ts +0 -0
- /package/src/{lib → integrations}/robots/core.ts +0 -0
- /package/src/{lib → integrations}/robots/index.ts +0 -0
- /package/src/{lib → integrations}/robots/schema.ts +0 -0
- /package/src/{lib → integrations}/webVitals/consts.ts +0 -0
- /package/src/{lib → integrations}/webVitals/pages/analytics/header.astro +0 -0
- /package/src/{lib → integrations}/webVitals/schemas.ts +0 -0
- /package/src/{lib → integrations}/webVitals/types.ts +0 -0
- /package/src/{lib → integrations}/webVitals/utils/buildDataObject.ts +0 -0
- /package/src/{lib → integrations}/webVitals/utils/buildPageRouteDataObject.ts +0 -0
- /package/src/{lib → integrations}/webVitals/utils/buildPerPageDataObject.ts +0 -0
- /package/src/{lib → integrations}/webVitals/utils/checkDate.ts +0 -0
- /package/src/{lib → integrations}/webVitals/utils/webVitalsUtils.ts +0 -0
- /package/src/{lib → integrations}/webVitals/webVital.ts +0 -0
- /package/src/{lib → integrations}/webVitals/webVitalsRouteSummary.ts +0 -0
- /package/src/{lib → integrations}/webVitals/webVitalsSummary.ts +0 -0
- /package/src/{utils → virtuals/auth}/getLabelForPermissionLevel.ts +0 -0
- /package/src/{lib → virtuals}/auth/types.ts +0 -0
- /package/src/{components/image → virtuals/components}/CustomImage.astro +0 -0
- /package/src/{components → virtuals/components}/FormattedDate.astro +0 -0
- /package/src/{lib → virtuals}/i18n/translations/en.json +0 -0
- /package/src/{lib → virtuals}/i18n/translations/es.json +0 -0
- /package/src/{lib → virtuals}/i18n/translations/fr.json +0 -0
- /package/src/{lib → virtuals}/i18n/translations/hi.json +0 -0
- /package/src/{lib → virtuals}/i18n/translations/zh.json +0 -0
- /package/src/{lib → virtuals/lib}/makePublicRoute.ts +0 -0
- /package/src/{lib → virtuals}/mailer/template.ts +0 -0
- /package/src/{lib → virtuals}/mailer/templates/index.ts +0 -0
- /package/src/{lib → virtuals}/mailer/templates/notification.ts +0 -0
- /package/src/{lib → virtuals}/mailer/templates/password-reset.ts +0 -0
- /package/src/{lib → virtuals}/mailer/templates/user-invite.ts +0 -0
- /package/src/{lib → virtuals}/mailer/templates/verify-email.ts +0 -0
- /package/src/{lib → virtuals}/notifier/client.ts +0 -0
- /package/src/{lib → virtuals}/plugins/dashboard-pages.ts +0 -0
- /package/src/{lib → virtuals}/plugins/frontend-navigation.ts +0 -0
- /package/src/{lib → virtuals}/plugins/index.ts +0 -0
- /package/src/{sdk → virtuals/sdk}/consts.ts +0 -0
- /package/src/{sdk → virtuals/sdk}/effect/index.ts +0 -0
- /package/src/{sdk → virtuals/sdk}/effect/lib/jwt-generator.ts +0 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
/** biome-ignore-all lint/style/noNonNullAssertion: This file is using non-null assertions */
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: This file is using explicit any types */
|
|
3
|
+
const configElement = document.getElementById('auth-pages-config');
|
|
4
|
+
const loginPageBackground =
|
|
5
|
+
configElement instanceof HTMLDivElement ? configElement.dataset.config_background : undefined;
|
|
6
|
+
const loginPageCustomImage =
|
|
7
|
+
configElement instanceof HTMLDivElement ? configElement.dataset.config_custom_image : undefined;
|
|
8
|
+
const currentMode =
|
|
9
|
+
(document.documentElement as HTMLElement | null)?.dataset?.theme === 'light' ? 'light' : 'dark';
|
|
10
|
+
|
|
11
|
+
const studioCMS3DModel = 'https://cdn.studiocms.dev/studiocms-logo.glb';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A valid image that can be used as a background for the StudioCMS Logo.
|
|
15
|
+
*/
|
|
16
|
+
interface ValidImage {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly format: 'local' | 'web';
|
|
20
|
+
readonly light: { src: string } | null;
|
|
21
|
+
readonly dark: { src: string } | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The parameters for the background image.
|
|
26
|
+
*/
|
|
27
|
+
type BackgroundParams = {
|
|
28
|
+
background: string;
|
|
29
|
+
customImageHref: string;
|
|
30
|
+
mode: 'light' | 'dark';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Parses the background image config.
|
|
35
|
+
* @param imageName The name of the image to parse.
|
|
36
|
+
*/
|
|
37
|
+
function parseBackgroundImageConfig(imageName?: string | undefined): string {
|
|
38
|
+
return imageName || 'studiocms-curves';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseToString(value: string | undefined | null): string {
|
|
42
|
+
return value || '';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The parameters for the background image config.
|
|
47
|
+
*/
|
|
48
|
+
const backgroundConfig: BackgroundParams = {
|
|
49
|
+
background: parseBackgroundImageConfig(loginPageBackground),
|
|
50
|
+
customImageHref: parseToString(loginPageCustomImage),
|
|
51
|
+
mode: currentMode as 'light' | 'dark',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Gets the background config based on the parameters.
|
|
56
|
+
*/
|
|
57
|
+
function getBackgroundConfig(config: BackgroundParams, validImages: ValidImage[]): ValidImage {
|
|
58
|
+
return validImages.find((image) => image.name === config.background) || validImages[0];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Selects the background based on the image.
|
|
63
|
+
*/
|
|
64
|
+
function bgSelector(image: ValidImage, params: BackgroundParams) {
|
|
65
|
+
return image.format === 'web'
|
|
66
|
+
? params.customImageHref
|
|
67
|
+
: params.mode === 'dark'
|
|
68
|
+
? image.dark?.src
|
|
69
|
+
: image.light?.src;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Lazy-loading wrapper for the StudioCMS 3D Logo
|
|
74
|
+
*/
|
|
75
|
+
class LazyStudioCMS3DLogo {
|
|
76
|
+
private container: HTMLDivElement;
|
|
77
|
+
private observer: IntersectionObserver;
|
|
78
|
+
private loaded = false;
|
|
79
|
+
private logoInstance: StudioCMS3DLogo | null = null;
|
|
80
|
+
private destroyed = false;
|
|
81
|
+
|
|
82
|
+
constructor(containerEl: HTMLDivElement) {
|
|
83
|
+
this.container = containerEl;
|
|
84
|
+
|
|
85
|
+
// Only load Three.js when the container comes into view
|
|
86
|
+
this.observer = new IntersectionObserver(
|
|
87
|
+
(entries) => {
|
|
88
|
+
entries.forEach((entry) => {
|
|
89
|
+
if (entry.isIntersecting && !this.loaded) {
|
|
90
|
+
this.loaded = true;
|
|
91
|
+
this.observer.disconnect();
|
|
92
|
+
void this.loadThreeJS();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
{ rootMargin: '100px' } // Start loading 100px before it comes into view
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
this.observer.observe(this.container);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private async loadThreeJS() {
|
|
103
|
+
try {
|
|
104
|
+
// Show loading state with some basic styling
|
|
105
|
+
this.showLoadingState();
|
|
106
|
+
|
|
107
|
+
// Dynamic import of all required modules
|
|
108
|
+
const [
|
|
109
|
+
threeModule,
|
|
110
|
+
{ OutlinePass },
|
|
111
|
+
{ GLTFLoader },
|
|
112
|
+
{ RenderPass },
|
|
113
|
+
{ EffectComposer },
|
|
114
|
+
{ validImages },
|
|
115
|
+
{ fitModelToViewport },
|
|
116
|
+
] = await Promise.all([
|
|
117
|
+
import('three'),
|
|
118
|
+
import('three/addons/postprocessing/OutlinePass.js'),
|
|
119
|
+
import('three/addons/loaders/GLTFLoader.js'),
|
|
120
|
+
import('three/addons/postprocessing/RenderPass.js'),
|
|
121
|
+
import('three/addons/postprocessing/EffectComposer.js'),
|
|
122
|
+
import('../validImages/index.js'),
|
|
123
|
+
import('./utils/fitModelToViewport.js'),
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
if (this.destroyed || !this.container.isConnected) return;
|
|
127
|
+
|
|
128
|
+
// Clear loading state
|
|
129
|
+
this.container.replaceChildren();
|
|
130
|
+
|
|
131
|
+
// Create the modules object to pass to StudioCMS3DLogo
|
|
132
|
+
const modules = {
|
|
133
|
+
...threeModule,
|
|
134
|
+
OutlinePass,
|
|
135
|
+
GLTFLoader,
|
|
136
|
+
RenderPass,
|
|
137
|
+
EffectComposer,
|
|
138
|
+
validImages,
|
|
139
|
+
fitModelToViewport,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Initialize the 3D logo
|
|
143
|
+
this.logoInstance = new StudioCMS3DLogo(
|
|
144
|
+
this.container,
|
|
145
|
+
new threeModule.Color(0xaa87f4),
|
|
146
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').matches,
|
|
147
|
+
getBackgroundConfig(backgroundConfig, validImages),
|
|
148
|
+
modules
|
|
149
|
+
);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error('Failed to load 3D experience:', error);
|
|
152
|
+
this.showErrorState();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private showLoadingState() {
|
|
157
|
+
this.container.replaceChildren();
|
|
158
|
+
const wrap = document.createElement('div');
|
|
159
|
+
wrap.className = 'loading-3d';
|
|
160
|
+
Object.assign(wrap.style, {
|
|
161
|
+
display: 'flex',
|
|
162
|
+
flexDirection: 'column',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
height: '100%',
|
|
166
|
+
minHeight: '400px',
|
|
167
|
+
color: 'var(--text-color, #666)',
|
|
168
|
+
fontFamily: 'system-ui, sans-serif',
|
|
169
|
+
});
|
|
170
|
+
const spinner = document.createElement('div');
|
|
171
|
+
spinner.className = 'loading-spinner';
|
|
172
|
+
Object.assign(spinner.style, {
|
|
173
|
+
width: '40px',
|
|
174
|
+
height: '40px',
|
|
175
|
+
border: '3px solid var(--border-color, #e0e0e0)',
|
|
176
|
+
borderTop: '3px solid var(--accent-color, #aa87f4)',
|
|
177
|
+
borderRadius: '50%',
|
|
178
|
+
marginBottom: '16px',
|
|
179
|
+
animation: 'spin 1s linear infinite',
|
|
180
|
+
});
|
|
181
|
+
const label = document.createElement('p');
|
|
182
|
+
label.textContent = 'Loading 3D experience...';
|
|
183
|
+
label.style.margin = '0';
|
|
184
|
+
label.style.fontSize = '14px';
|
|
185
|
+
const keyframes = document.createElement('style');
|
|
186
|
+
keyframes.textContent =
|
|
187
|
+
'@keyframes spin {0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}';
|
|
188
|
+
wrap.append(spinner, label);
|
|
189
|
+
this.container.append(wrap, keyframes);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private showErrorState() {
|
|
193
|
+
this.container.replaceChildren();
|
|
194
|
+
const wrap = document.createElement('div');
|
|
195
|
+
wrap.className = 'error-3d';
|
|
196
|
+
Object.assign(wrap.style, {
|
|
197
|
+
display: 'flex',
|
|
198
|
+
flexDirection: 'column',
|
|
199
|
+
alignItems: 'center',
|
|
200
|
+
justifyContent: 'center',
|
|
201
|
+
height: '100%',
|
|
202
|
+
minHeight: '400px',
|
|
203
|
+
color: 'var(--text-color, #666)',
|
|
204
|
+
fontFamily: 'system-ui, sans-serif',
|
|
205
|
+
});
|
|
206
|
+
const icon = document.createElement('div');
|
|
207
|
+
icon.textContent = '⚠️';
|
|
208
|
+
icon.style.fontSize = '24px';
|
|
209
|
+
icon.style.marginBottom = '8px';
|
|
210
|
+
icon.style.opacity = '0.5';
|
|
211
|
+
const label = document.createElement('p');
|
|
212
|
+
label.textContent = '3D experience unavailable';
|
|
213
|
+
label.style.margin = '0';
|
|
214
|
+
label.style.fontSize = '14px';
|
|
215
|
+
wrap.append(icon, label);
|
|
216
|
+
this.container.append(wrap);
|
|
217
|
+
this.container.classList.add('loaded'); // Still mark as "loaded" to prevent layout shifts
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
destroy() {
|
|
221
|
+
this.destroyed = true;
|
|
222
|
+
this.observer.disconnect();
|
|
223
|
+
if (this.logoInstance) {
|
|
224
|
+
this.logoInstance.dispose?.();
|
|
225
|
+
this.logoInstance = null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Enhanced StudioCMS3DLogo that accepts modules as dependency injection
|
|
232
|
+
*/
|
|
233
|
+
class StudioCMS3DLogo {
|
|
234
|
+
canvasContainer: HTMLDivElement;
|
|
235
|
+
scene: any;
|
|
236
|
+
camera: any;
|
|
237
|
+
renderer: any;
|
|
238
|
+
model: any | undefined;
|
|
239
|
+
mouseX = 0;
|
|
240
|
+
mouseY = 0;
|
|
241
|
+
composer: any;
|
|
242
|
+
outlinePass: any | undefined;
|
|
243
|
+
outlinedObjects: any[] = [];
|
|
244
|
+
defaultComputedCameraZ: number | undefined;
|
|
245
|
+
BackgroundMesh: any | undefined;
|
|
246
|
+
frustumHeight: number | undefined;
|
|
247
|
+
frames = 0;
|
|
248
|
+
fps = 0;
|
|
249
|
+
lastTime = 0;
|
|
250
|
+
lastFrameTimes: number[] = [];
|
|
251
|
+
MAX_FRAME_TIMES_LENGTH = 2;
|
|
252
|
+
private resizeHandler?: () => void;
|
|
253
|
+
private mouseMoveHandler?: (ev: MouseEvent) => void;
|
|
254
|
+
private prevLoadingOnLoad?: (() => void) | null;
|
|
255
|
+
// Track background texture aspect ratio to recompute geometry on resize
|
|
256
|
+
private bgAspect?: number;
|
|
257
|
+
private loadingManager?: any;
|
|
258
|
+
|
|
259
|
+
// Cache materials to avoid recreating them
|
|
260
|
+
private glassMaterial: any | undefined;
|
|
261
|
+
private modules: any;
|
|
262
|
+
|
|
263
|
+
constructor(
|
|
264
|
+
containerEl: HTMLDivElement,
|
|
265
|
+
outlineColor: any,
|
|
266
|
+
reducedMotion: boolean,
|
|
267
|
+
image: ValidImage,
|
|
268
|
+
modules: any
|
|
269
|
+
) {
|
|
270
|
+
this.modules = modules;
|
|
271
|
+
const {
|
|
272
|
+
Scene,
|
|
273
|
+
PerspectiveCamera,
|
|
274
|
+
WebGLRenderer,
|
|
275
|
+
Color,
|
|
276
|
+
AmbientLight,
|
|
277
|
+
RenderPass,
|
|
278
|
+
EffectComposer,
|
|
279
|
+
LoadingManager,
|
|
280
|
+
} = modules;
|
|
281
|
+
|
|
282
|
+
this.scene = new Scene();
|
|
283
|
+
this.scene.background = new Color(0x101010);
|
|
284
|
+
|
|
285
|
+
this.camera = new PerspectiveCamera(
|
|
286
|
+
75,
|
|
287
|
+
window.innerWidth / 2 / window.innerHeight,
|
|
288
|
+
0.01,
|
|
289
|
+
10000
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
// Optimize renderer settings
|
|
293
|
+
this.renderer = new WebGLRenderer({
|
|
294
|
+
antialias: false,
|
|
295
|
+
powerPreference: 'high-performance',
|
|
296
|
+
stencil: false,
|
|
297
|
+
depth: true,
|
|
298
|
+
});
|
|
299
|
+
this.renderer.setSize(window.innerWidth / 2, window.innerHeight);
|
|
300
|
+
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
301
|
+
this.renderer.setClearColor(0x101010, 1);
|
|
302
|
+
this.renderer.setAnimationLoop(this.animate);
|
|
303
|
+
|
|
304
|
+
this.canvasContainer = containerEl;
|
|
305
|
+
this.canvasContainer.appendChild(this.renderer.domElement);
|
|
306
|
+
|
|
307
|
+
// Local LoadingManager to avoid global side effects
|
|
308
|
+
this.loadingManager = new LoadingManager();
|
|
309
|
+
this.loadingManager.onLoad = () => {
|
|
310
|
+
this.canvasContainer.classList.add('loaded');
|
|
311
|
+
};
|
|
312
|
+
this.composer = new EffectComposer(this.renderer);
|
|
313
|
+
// Use real container size for a correct initial fit
|
|
314
|
+
const rect = containerEl.getBoundingClientRect();
|
|
315
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
316
|
+
this.camera.aspect = rect.width / rect.height;
|
|
317
|
+
this.camera.updateProjectionMatrix();
|
|
318
|
+
this.renderer.setSize(rect.width, rect.height);
|
|
319
|
+
this.composer.setSize(rect.width, rect.height);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Simplified lighting
|
|
323
|
+
const light2 = new AmbientLight(0x606060);
|
|
324
|
+
this.scene.add(light2);
|
|
325
|
+
|
|
326
|
+
const renderScene = new RenderPass(this.scene, this.camera);
|
|
327
|
+
this.composer.addPass(renderScene);
|
|
328
|
+
|
|
329
|
+
this.registerLoadingCallback();
|
|
330
|
+
this.loadLogoModel();
|
|
331
|
+
this.addPostProcessing(true, outlineColor);
|
|
332
|
+
this.addBackgroundImage(image);
|
|
333
|
+
this.initListeners(reducedMotion);
|
|
334
|
+
|
|
335
|
+
this.lastTime = performance.now();
|
|
336
|
+
this.updateFPS();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
updateFPS = () => {
|
|
340
|
+
const now = performance.now();
|
|
341
|
+
this.frames++;
|
|
342
|
+
|
|
343
|
+
if (now - this.lastTime >= 1000) {
|
|
344
|
+
this.fps = this.frames;
|
|
345
|
+
this.frames = 0;
|
|
346
|
+
this.lastTime = now;
|
|
347
|
+
|
|
348
|
+
if (this.lastFrameTimes.length >= this.MAX_FRAME_TIMES_LENGTH) {
|
|
349
|
+
this.lastFrameTimes.shift();
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
this.lastFrameTimes.push(this.fps);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (this.lastFrameTimes.length === this.MAX_FRAME_TIMES_LENGTH) {
|
|
356
|
+
const averageFPS =
|
|
357
|
+
this.lastFrameTimes.reduce((a, b) => a + b, 0) / this.MAX_FRAME_TIMES_LENGTH;
|
|
358
|
+
|
|
359
|
+
if (averageFPS < 24) {
|
|
360
|
+
// Graceful degrade for low-end devices
|
|
361
|
+
this.renderer?.setAnimationLoop(null);
|
|
362
|
+
try {
|
|
363
|
+
this.dispose();
|
|
364
|
+
} finally {
|
|
365
|
+
this.canvasContainer?.classList.add('loaded');
|
|
366
|
+
}
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
animate = () => {
|
|
373
|
+
if (this.model && this.canvasContainer) {
|
|
374
|
+
const { MathUtils } = this.modules;
|
|
375
|
+
|
|
376
|
+
// Movement courtesy of Otterlord, easing courtesy of Louis Escher
|
|
377
|
+
const viewportWidth =
|
|
378
|
+
this.renderer?.domElement?.clientWidth ||
|
|
379
|
+
this.canvasContainer?.clientWidth ||
|
|
380
|
+
window.innerWidth;
|
|
381
|
+
const viewportHeight =
|
|
382
|
+
this.renderer?.domElement?.clientHeight ||
|
|
383
|
+
this.canvasContainer?.clientHeight ||
|
|
384
|
+
window.innerHeight;
|
|
385
|
+
const targetRotationX =
|
|
386
|
+
this.mouseY === 0
|
|
387
|
+
? Math.PI / 2
|
|
388
|
+
: 0.1 * ((this.mouseY / viewportHeight) * Math.PI - Math.PI / 2) + Math.PI / 2;
|
|
389
|
+
const targetRotationZ =
|
|
390
|
+
this.mouseX === 0 ? 0 : 0.1 * ((this.mouseX / viewportWidth) * Math.PI - Math.PI / 2);
|
|
391
|
+
|
|
392
|
+
const lerpFactor = 0.035;
|
|
393
|
+
|
|
394
|
+
this.model.rotation.x = MathUtils.lerp(this.model.rotation.x, targetRotationX, lerpFactor);
|
|
395
|
+
this.model.rotation.y = MathUtils.lerp(this.model.rotation.y, 0, lerpFactor);
|
|
396
|
+
this.model.rotation.z = MathUtils.lerp(this.model.rotation.z, -targetRotationZ, lerpFactor);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
this.composer.render();
|
|
400
|
+
this.updateFPS();
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
private getGlassMaterial() {
|
|
404
|
+
if (!this.glassMaterial) {
|
|
405
|
+
const { MeshPhysicalMaterial } = this.modules;
|
|
406
|
+
this.glassMaterial = new MeshPhysicalMaterial({
|
|
407
|
+
color: '#ffffff',
|
|
408
|
+
roughness: 0.6,
|
|
409
|
+
transmission: 1,
|
|
410
|
+
opacity: 1,
|
|
411
|
+
transparent: true,
|
|
412
|
+
thickness: 0.5,
|
|
413
|
+
envMapIntensity: 1,
|
|
414
|
+
clearcoat: 1,
|
|
415
|
+
clearcoatRoughness: 0.2,
|
|
416
|
+
metalness: 0,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
return this.glassMaterial;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
loadLogoModel = async () => {
|
|
423
|
+
const { GLTFLoader, Mesh, fitModelToViewport } = this.modules;
|
|
424
|
+
const loader = new GLTFLoader(this.loadingManager);
|
|
425
|
+
|
|
426
|
+
try {
|
|
427
|
+
const gltf = await loader.loadAsync(studioCMS3DModel);
|
|
428
|
+
if (!this.renderer) return; // disposed
|
|
429
|
+
this.model = gltf.scene;
|
|
430
|
+
|
|
431
|
+
const material = this.getGlassMaterial();
|
|
432
|
+
|
|
433
|
+
this.model.traverse((child: any) => {
|
|
434
|
+
if (child instanceof Mesh) {
|
|
435
|
+
child.material = material;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
this.scene.add(this.model);
|
|
440
|
+
this.model.rotation.set(Math.PI / 2, 0, 0);
|
|
441
|
+
|
|
442
|
+
this.defaultComputedCameraZ = fitModelToViewport(this.model, this.camera);
|
|
443
|
+
this.outlinedObjects.push(this.model);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
console.error('Failed to load logo model:', error);
|
|
446
|
+
this.canvasContainer?.classList.add('loaded');
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
addPostProcessing = (outlines: boolean, outlineColor: any) => {
|
|
451
|
+
if (outlines) this.addOutlines(outlineColor);
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
addOutlines = (outlineColor: any) => {
|
|
455
|
+
const { OutlinePass, Vector2, Color } = this.modules;
|
|
456
|
+
|
|
457
|
+
this.outlinePass = new OutlinePass(
|
|
458
|
+
new Vector2(window.innerWidth / 2, window.innerHeight),
|
|
459
|
+
this.scene,
|
|
460
|
+
this.camera
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
this.outlinePass.selectedObjects = this.outlinedObjects;
|
|
464
|
+
this.outlinePass.edgeStrength = 1.5;
|
|
465
|
+
this.outlinePass.edgeGlow = 0;
|
|
466
|
+
this.outlinePass.edgeThickness = 0.0000000001;
|
|
467
|
+
this.outlinePass.pulsePeriod = 0;
|
|
468
|
+
this.outlinePass.visibleEdgeColor.set(outlineColor);
|
|
469
|
+
this.outlinePass.hiddenEdgeColor.set(new Color(0xffffff));
|
|
470
|
+
|
|
471
|
+
this.composer.addPass(this.outlinePass);
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
addBackgroundImage = async (image: ValidImage) => {
|
|
475
|
+
const { TextureLoader, PlaneGeometry, MeshBasicMaterial, Mesh, MathUtils } = this.modules;
|
|
476
|
+
const bgPositionZ = -5;
|
|
477
|
+
|
|
478
|
+
if (!this.frustumHeight) {
|
|
479
|
+
this.frustumHeight =
|
|
480
|
+
9 *
|
|
481
|
+
Math.tan(MathUtils.degToRad(this.camera.fov / 2)) *
|
|
482
|
+
Math.abs(this.camera.position.z - bgPositionZ);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const loader = new TextureLoader(this.loadingManager);
|
|
486
|
+
const bgUrl = bgSelector(image, backgroundConfig);
|
|
487
|
+
|
|
488
|
+
if (!bgUrl) {
|
|
489
|
+
console.error('ERROR: Invalid background URL');
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
try {
|
|
494
|
+
const texture = await loader.loadAsync(bgUrl);
|
|
495
|
+
if (!this.renderer) return; // disposed
|
|
496
|
+
const planeHeight = this.frustumHeight!;
|
|
497
|
+
const srcW = (texture as any).source?.data?.width ?? (texture as any).image?.width;
|
|
498
|
+
const srcH = (texture as any).source?.data?.height ?? (texture as any).image?.height;
|
|
499
|
+
if (!srcW || !srcH) {
|
|
500
|
+
console.error('ERROR: Unable to determine background texture dimensions');
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
this.bgAspect = srcW / srcH;
|
|
505
|
+
const planeWidth = planeHeight * this.bgAspect;
|
|
506
|
+
|
|
507
|
+
const bgGeo = new PlaneGeometry(planeWidth, planeHeight);
|
|
508
|
+
const bgMat = new MeshBasicMaterial({ map: texture });
|
|
509
|
+
|
|
510
|
+
this.BackgroundMesh = new Mesh(bgGeo, bgMat);
|
|
511
|
+
this.BackgroundMesh.position.set(0, 0, bgPositionZ);
|
|
512
|
+
this.scene.add(this.BackgroundMesh);
|
|
513
|
+
} catch (error) {
|
|
514
|
+
console.error('Failed to load background image:', error);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
initListeners = (reducedMotion: boolean) => {
|
|
519
|
+
this.initResizeListener();
|
|
520
|
+
if (!reducedMotion) {
|
|
521
|
+
this.initMouseMoveListener();
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
initResizeListener = () => {
|
|
526
|
+
this.resizeHandler = () => {
|
|
527
|
+
if (window.innerWidth > 850) {
|
|
528
|
+
const rect = this.canvasContainer.getBoundingClientRect();
|
|
529
|
+
const width = rect.width || window.innerWidth / 2;
|
|
530
|
+
const height = rect.height || window.innerHeight;
|
|
531
|
+
this.camera.aspect = width / height;
|
|
532
|
+
this.camera.updateProjectionMatrix();
|
|
533
|
+
|
|
534
|
+
this.renderer.setSize(width, height);
|
|
535
|
+
this.composer.setSize(width, height);
|
|
536
|
+
if (this.outlinePass?.setSize) this.outlinePass.setSize(width, height);
|
|
537
|
+
|
|
538
|
+
// Recompute background plane size (preserving aspect)
|
|
539
|
+
if (this.BackgroundMesh && this.bgAspect) {
|
|
540
|
+
const { PlaneGeometry, MathUtils } = this.modules;
|
|
541
|
+
const meshZ = this.BackgroundMesh.position?.z ?? -5;
|
|
542
|
+
// 9 is camera "height" factor from original computation
|
|
543
|
+
this.frustumHeight =
|
|
544
|
+
9 *
|
|
545
|
+
Math.tan(MathUtils.degToRad(this.camera.fov / 2)) *
|
|
546
|
+
Math.abs(this.camera.position.z - meshZ);
|
|
547
|
+
const newPlaneHeight = this.frustumHeight!;
|
|
548
|
+
const newPlaneWidth = newPlaneHeight * this.bgAspect;
|
|
549
|
+
// Replace geometry to match new size
|
|
550
|
+
this.BackgroundMesh.geometry?.dispose?.();
|
|
551
|
+
this.BackgroundMesh.geometry = new PlaneGeometry(newPlaneWidth, newPlaneHeight);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
if (window.innerWidth < 1100 && this.defaultComputedCameraZ) {
|
|
555
|
+
this.camera.position.set(
|
|
556
|
+
this.camera.position.x,
|
|
557
|
+
this.camera.position.y,
|
|
558
|
+
this.defaultComputedCameraZ + 5
|
|
559
|
+
);
|
|
560
|
+
} else if (window.innerWidth >= 1100 && this.defaultComputedCameraZ) {
|
|
561
|
+
this.camera.position.set(
|
|
562
|
+
this.camera.position.x,
|
|
563
|
+
this.camera.position.y,
|
|
564
|
+
this.defaultComputedCameraZ
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
window.addEventListener('resize', this.resizeHandler);
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
initMouseMoveListener = () => {
|
|
573
|
+
this.mouseMoveHandler = (ev) => {
|
|
574
|
+
this.mouseX = ev.clientX;
|
|
575
|
+
this.mouseY = ev.clientY;
|
|
576
|
+
};
|
|
577
|
+
document.addEventListener('mousemove', this.mouseMoveHandler);
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
dispose = () => {
|
|
581
|
+
this.renderer?.setAnimationLoop(null);
|
|
582
|
+
if (this.resizeHandler) window.removeEventListener('resize', this.resizeHandler);
|
|
583
|
+
if (this.mouseMoveHandler) document.removeEventListener('mousemove', this.mouseMoveHandler);
|
|
584
|
+
if (this.outlinePass?.dispose) this.outlinePass.dispose();
|
|
585
|
+
this.composer?.dispose?.();
|
|
586
|
+
// Restore global loading manager handler
|
|
587
|
+
try {
|
|
588
|
+
const { DefaultLoadingManager } = this.modules;
|
|
589
|
+
if (this.prevLoadingOnLoad !== undefined) {
|
|
590
|
+
DefaultLoadingManager.onLoad = this.prevLoadingOnLoad as any;
|
|
591
|
+
this.prevLoadingOnLoad = null;
|
|
592
|
+
}
|
|
593
|
+
} catch {}
|
|
594
|
+
if (this.BackgroundMesh) {
|
|
595
|
+
this.BackgroundMesh.material?.map?.dispose?.();
|
|
596
|
+
this.BackgroundMesh.material?.dispose?.();
|
|
597
|
+
this.BackgroundMesh.geometry?.dispose?.();
|
|
598
|
+
this.scene.remove(this.BackgroundMesh);
|
|
599
|
+
this.BackgroundMesh = undefined;
|
|
600
|
+
}
|
|
601
|
+
if (this.model) {
|
|
602
|
+
this.model.traverse((child: any) => {
|
|
603
|
+
child.geometry?.dispose?.();
|
|
604
|
+
child.material?.map?.dispose?.();
|
|
605
|
+
child.material?.dispose?.();
|
|
606
|
+
});
|
|
607
|
+
this.scene.remove(this.model);
|
|
608
|
+
this.model = undefined;
|
|
609
|
+
}
|
|
610
|
+
this.glassMaterial?.dispose?.();
|
|
611
|
+
this.renderer?.forceContextLoss?.();
|
|
612
|
+
this.renderer?.dispose?.();
|
|
613
|
+
this.renderer?.domElement?.remove?.();
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
registerLoadingCallback = () => {
|
|
617
|
+
// No-op when using a local LoadingManager; retained for backward-compat
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
recomputeGlassMaterial = () => {
|
|
621
|
+
if (!this.model) return;
|
|
622
|
+
|
|
623
|
+
const { Mesh } = this.modules;
|
|
624
|
+
const material = this.getGlassMaterial();
|
|
625
|
+
|
|
626
|
+
this.model.traverse((child: any) => {
|
|
627
|
+
if (child instanceof Mesh) {
|
|
628
|
+
child.material = material;
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// Initialize the lazy-loading 3D logo
|
|
635
|
+
const logoContainer = document.querySelector<HTMLDivElement>('#canvas-container');
|
|
636
|
+
const smallScreen = window.matchMedia('(max-width: 850px)').matches;
|
|
637
|
+
|
|
638
|
+
if (logoContainer && !smallScreen) {
|
|
639
|
+
try {
|
|
640
|
+
new LazyStudioCMS3DLogo(logoContainer);
|
|
641
|
+
} catch (err) {
|
|
642
|
+
console.error("ERROR: Couldn't create LazyStudioCMS3DLogo", err);
|
|
643
|
+
logoContainer.classList.add('loaded');
|
|
644
|
+
}
|
|
645
|
+
} else if (logoContainer) {
|
|
646
|
+
logoContainer.classList.add('loaded');
|
|
647
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Import only what's needed from Three.js
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: This file uses explicit any for dynamic compatibility */
|
|
3
|
+
import { Box3, Vector3 } from 'three';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Takes in a GLTF model and fits it into a camera's viewport.
|
|
7
|
+
* Optimized to work with dependency injection pattern.
|
|
8
|
+
* @param model The model to fit
|
|
9
|
+
* @param camera The camera to fit the model into
|
|
10
|
+
* @param threeModules Optional Three.js modules (for dependency injection)
|
|
11
|
+
*/
|
|
12
|
+
function fitModelToViewport(
|
|
13
|
+
model: any, // Using any to support both bundled and injected Three.js
|
|
14
|
+
camera: any,
|
|
15
|
+
threeModules?: any
|
|
16
|
+
): number {
|
|
17
|
+
// Use injected modules if available, otherwise fall back to imports
|
|
18
|
+
const ThreeBox3 = threeModules?.Box3 || Box3;
|
|
19
|
+
const ThreeVector3 = threeModules?.Vector3 || Vector3;
|
|
20
|
+
|
|
21
|
+
// Grab object's bounding box info (ensure world matrices are current)
|
|
22
|
+
if (typeof (model as any).updateWorldMatrix === 'function') {
|
|
23
|
+
model.updateWorldMatrix(true, true);
|
|
24
|
+
} else if (typeof (model as any).updateMatrixWorld === 'function') {
|
|
25
|
+
model.updateMatrixWorld(true);
|
|
26
|
+
}
|
|
27
|
+
const box = new ThreeBox3().setFromObject(model);
|
|
28
|
+
const center = box.getCenter(new ThreeVector3());
|
|
29
|
+
const size = box.getSize(new ThreeVector3());
|
|
30
|
+
|
|
31
|
+
// Adjust model position relative to the center of the bounding box
|
|
32
|
+
model.position.x += model.position.x - center.x;
|
|
33
|
+
model.position.y += model.position.y - center.y;
|
|
34
|
+
model.position.z += model.position.z - center.z;
|
|
35
|
+
|
|
36
|
+
// Change the camera's position to fit the model
|
|
37
|
+
const maxDim = Math.max(size.x, size.y, size.z);
|
|
38
|
+
const fov = camera.fov * (Math.PI / 180);
|
|
39
|
+
let cameraZ = Math.abs(maxDim / 2 / Math.tan(fov / 2));
|
|
40
|
+
|
|
41
|
+
// Change distance from camera to model
|
|
42
|
+
cameraZ *= 2.5;
|
|
43
|
+
camera.position.z = cameraZ;
|
|
44
|
+
|
|
45
|
+
camera.updateProjectionMatrix();
|
|
46
|
+
|
|
47
|
+
return cameraZ;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { fitModelToViewport };
|