4020ad62c5
- Implemented `resolveApiAssetUrl` function to normalize asset URLs based on API base. - Updated `MedialibImage` component to utilize new asset URL resolution and added support for alt text and class properties. - Enhanced image loading behavior with improved width measurement and focal point handling. - Added placeholder image handling and improved accessibility with alt text. - Introduced new test script for auditing broken links in skill documentation. - Expanded seeded test content to include medialib entries and updated related tests for pagebuilder previews. - Improved global setup and teardown logging for clarity on seeded content management.
3.2 KiB
3.2 KiB
Frontend
Svelte 5 SPA bundled with esbuild and styled with Tailwind CSS 4.
Structure
- Entry point:
src/index.ts, main component:src/App.svelte. src/lib/— utilities, stores, actions, API layer.src/widgets/— reusable UI components (Button, Input, Form, etc.).src/css/— global styles and Tailwind imports.src/routes/— page-level components (e.g.NotFound.sveltefor the 404 page). Not file-based routing — these are manually imported byApp.svelte.
Related skills
frontend-architecturefor routing, stores, API behavior, and i18n flow.content-authoringwhen frontend changes are driven by new collections, blocks, lookup paths, ortypes/global.d.tschanges.nova-pagebuilder-modelingwhen block components,BlockRenderer.svelte, and admin preview contracts must stay aligned.media-seo-publishingwhen rendering medialib or file fields; prefersrc/widgets/MedialibImage.svelteas the shared image boundary.
Routing
This project uses a custom SPA router (NOT SvelteKit, NOT file-based routing). Pages are CMS content entries loaded dynamically by URL path.
lib/store.tsproxieshistory.pushState/replaceState→ updates$locationstore.App.sveltereacts to$location.path→ callsgetCachedEntries("content", { lang, path })→ renders blocks.lib/navigation.tsprovidesspaNavigate(url)for programmatic navigation anduse:spaLinkaction for<a>elements.- URL structure:
/{lang}/{path}(e.g./de/ueber-uns,/en/about). - Root
/auto-redirects to/{browserLanguage}/. - For full details see the
frontend-architectureskill.
Conventions
- PascalCase component names; export props at the top of
<script>tag. - Keep code and comments in English.
- SSR safety: guard browser-only code with
typeof window !== "undefined". - API behavior: PUT responses return only changed fields; filter by id uses
_id; API requests reject non-2xx with{ response, data }and error payload inerror.data.error. - Treat public rendering and admin-preview rendering as the same block contract whenever possible.
- If blocks or widgets render foreign media or entities, make the required
lookuppaths explicit instead of assuming_lookupdata is always present.
Tailwind CSS
- Always use canonical Tailwind utility classes instead of arbitrary values when a standard equivalent exists.
- Only use arbitrary values (
[...]) when no standard utility covers the needed value.
i18n
svelte-i18nis configured insrc/lib/i18n/index.tswith lazy loading for locale files.- Locale files live in
src/lib/i18n/locales/{lang}.json. - URL-based language routing:
/{lang}/...(e.g./de/,/en/about). - Language utilities in
src/lib/i18n.ts:extractLanguageFromPath(),localizedPath(),getLanguageSwitchUrl(). - Use
$_("key")fromsvelte-i18nfor translations in components.
Related tests
- When developing frontend features: extend or create corresponding E2E tests in
tests/e2e/. - After frontend changes, run only the affected E2E tests:
npx playwright test tests/e2e/filename.spec.tsor-g "test name". - When tests fail, clarify whether the frontend or the test needs adjustment — coordinate with the user.