feat(16.2-01): host plugin field type elements in the admin SPA
- loadFieldTypes fetches GET /field-types after sign-in, loads each script once and adds the styles as global links activateStyles never disables - PluginField creates the type's element, sets the value property and the contract attributes, takes summer-change as the form value and never writes back a value the element just emitted - rendererForField and isRegisteredField route any field with an element to PluginField in forms, previews and the save payload - rebuilt modules/boardwalk/dist
This commit is contained in:
@@ -2,6 +2,7 @@ import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { createAdminRouter } from './app/router'
|
||||
import { onUnauthorized } from './api/client'
|
||||
import { loadFieldTypes } from './app/fieldTypes'
|
||||
import { loadStrings } from './app/i18n'
|
||||
import { applyColorScheme } from './app/theme'
|
||||
import { expireSession, me } from './state/useAuth'
|
||||
@@ -13,13 +14,16 @@ async function boot(): Promise<void> {
|
||||
// Dark mode follows the system preference before anything renders (A6).
|
||||
applyColorScheme()
|
||||
// Boot order (research Pattern 7): the public strings bundle first, so the
|
||||
// login screen is translated, then the session, then navigation.
|
||||
// login screen is translated, then the session, then navigation and the
|
||||
// plugin field types.
|
||||
await loadStrings().catch(() => undefined)
|
||||
// A 401 here only means "not signed in"; the router guard sends the
|
||||
// visitor to the login route with the requested path as redirect.
|
||||
const user = await me().catch(() => null)
|
||||
if (user) {
|
||||
await Promise.all([loadNavigation().catch(() => []), loadSettings().catch(() => [])])
|
||||
// Plugin field types load once per session: their scripts define the
|
||||
// elements any controller's form may use, their styles stay enabled.
|
||||
await Promise.all([loadNavigation().catch(() => []), loadSettings().catch(() => []), loadFieldTypes()])
|
||||
}
|
||||
const router = createAdminRouter()
|
||||
// A session that cannot be recovered ends here: the profile and every
|
||||
|
||||
Reference in New Issue
Block a user