Open hnb-ku opened 1 month ago
This is a list to track the current work on stage 1
*Unstable:** ( wait to refactor until later )
(app)/[username]/mastodon/+page.svelte
(app)/[username]/+page.svelte
(app)/account/[user_id]/custom-domain/+page.svelte
(app)/account/codeberg/profile/+page.svelte
(app)/account/codeberg/+page.svelte
(app)/account/github/profile/readme/+page.svelte
(app)/account/github/profile/+page.svelte
(app)/account/github/+page.svelte
(app)/account/link-mastodon/+page.svelte
(app)/account/linktree/profile/+page.svelte
(app)/account/linktree/+page.svelte
(app)/account/pages/edit/[slug]/+page.svelte
(app)/account/pages/new/+page.svelte
(app)/account/pages/+page.svelte
(app)/account/zulip/profile/+page.svelte
(app)/account/zulip/+page.svelte
Stable: ( can be refactored now )
(app)/[username]/[slug]/+page.svelte
(app)/account/forgot-password/+page.svelte
(app)/account/register/confirmation/+page.svelte
(app)/login/+page.svelte
(app)/logout/+page.svelte
(app)/auth/v1/users/[user]/reset/[token]/+page.svelte
(app)/auth/v1/users/register/+page.svelte
(app)/claim-username/+page.svelte
(app)/connect/discord/[linkId]/+page.svelte
(app)/feedback/confirmation/+page.svelte
(app)/feedback/+page.svelte
(app)/people/+page.svelte
(app)/+layout.svelte
(internal)/__internal__/admin/update-username-domains/+page.svelte
(internal)/__internal__/admin/+page.svelte
(subsites)/subsite/[usernameOrDomain]/+page.svelte
- (app)/[username]/[slug]/+page.svelte
@hnb-ku I feel like the +page.svelte
is a little redundant when we have the Page.svelte
component.
I think the +page.svelte
for most pages would just end up identical to each-other then, right?
I'm totally fine keeping it like that if you think it's a good idea for any reason, I just wanted to double-check.
I think the
+page.svelte
for most pages would just end up identical to each-other then, right?
Yes, you're right. We'd just have +page.svelte
files that get the data and pass it down to a single top-level component. We just happen to call it Page in the example PR, but I think it's probably better to use something more specific.
The reason behind this is that Svelete "requires" +page.svelte
file for it to make that path a "route" (at least that's how I understand it)
Creating a separate "Page" component (that we control inside a routes/components/
folder) allows us to have a "component-loader or resolver" somewhere down the line (not a priority for now).
In other words, a theme can provide its own Page.svelte
component for a route and we'll swap it over the default one and pass it the same props without needing to make any changes to svelte's +page.svelte
convention.
Additionally, any lingering route logic that needs to happen on the client can be created there. This includes something like client-side transformations (but we still prefer server-side data if possible).
I'm definitely open to any option here and one of the biggest goals is not to bog down core development in any shape of form.
This is something I kind of forgot to mention. For new paths and routes that we add for new features, we don't need to follow the pattern in this issue. Everything can just stay in the +page.svelte
file for the first pass of a feature. The next pass can deal with splitting stuff and making it themeable. Themeing is a tertiary concern.
Let me know if this works for you.
OK, yeah, that all sounds good. :+1: It's super easy to switch back and forth and isn't hard to understand in either case.
- (app)/account/register/confirmation/+page.svelte
https://github.com/muni-town/weird/pull/193
- (app)/claim-username/+page.svelte
(app)/feedback/confirmation/+page.svelte
https://github.com/muni-town/weird/pull/195
(app)/feedback/+page.svelte
- (app)/account/forgot-password/+page.svelte
https://github.com/muni-town/weird/pull/197
- (app)/auth/v1/users/register/+page.svelte
- (app)/login/+page.svelte
(app)/auth/v1/users/[user]/reset/[token]/+page.svelte
This issue proposes a new pattern to make theming the application easier and more maintainable.
Core Idea:
The idea is to shift towards a more component-centric architecture, separating data fetching and logic from presentation, and allowing themes to override both CSS and component templates (with guardrails).
Implementation Details:
+page.svelte
files. Keep most non-client-side logic in+page.server.ts
and pass data down to components.components
folder inside each route, containing smaller components focused on presentation.$lib/components
for global reusability.$props
for Props: Use the$props
rune for accessing props in Svelte 5 components.Theming Vision:
theme.css
file.Guardrails for Theming:
This enables:
Theming Hierarchy:
theme.css
for site-wide styling changes.Page.svelte
component for a route.+page.server.ts
files.Implementation Stages:
$lib
folder.