You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b24fcae
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: skills/flat-layers-design/SKILL.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,6 +237,7 @@ pages/
237
237
index.ts — export * from './Home'; export { Home as default } from './Home'
238
238
Home.tsx
239
239
Home.module.css
240
+
skeleton.tsx — HomePageSkeleton: the page's shape while its code comes
240
241
```
241
242
242
243
-`index.ts` also re-exports the component as `default` so `index.tsx` can lazy-load pages; this is the only place default exports are allowed (lint override for `pages/*/*`).
@@ -246,13 +247,13 @@ pages/
246
247
### Entry points
247
248
248
249
-**CSR:**`index.html` → `app/index.tsx` mounts the app (e.g. `createRoot` in React); the routes → pages tree lives in `app/App.ts`.
249
-
-**SSR:**`app/index.tsx` exports `routes` and the `pages` tree (e.g. `layout(RootLayout, [page('home', loadable(() => import('./pages/Home'), AppLoader)), …])`); `app/server.ts` is the HTTP server (Hono); the SSR Vite plugin points at both.
250
+
-**SSR:**`app/index.tsx` exports `routes` and the `pages` tree (e.g. `layout(RootLayout, [page('home', loadable(() => import('./pages/Home'), HomePageSkeleton)), …])`); `app/server.ts` is the HTTP server (Hono); the SSR Vite plugin points at both.
250
251
251
252
## Import conventions
252
253
253
254
- Cross-layer imports go through the alias: `~/uikit/Button`, `~/stores/garden`, `~/services/garden`.
254
255
- Same-layer imports are relative: `../shared/messages`, `../GardenLinks`, `../Text`, `./router`.
255
-
- Import through the folder's `index.ts`. Deep imports are reserved for opt-in entry points: `~/uikit/RichTextEditor/loadable`, `~/services/api/api.mock`.
256
+
- Import through the folder's `index.ts`. Deep imports are reserved for opt-in entry points: `~/uikit/RichTextEditor/loadable`, `~/uikit/Form/skeleton`, `~/services/api/api.mock`.
256
257
- Order inside a file: packages → `~/…` → relative → the CSS module last.
The wrapper keeps the original component name, props and children, adding only an optional `fallback` prop for what stands in while the chunk loads.
185
+
The wrapper keeps the original component name, props and children and adds no props. It draws the component's own skeleton from the `skeleton.ts` beside it, the shape of what is coming: no `fallback` prop, and never a `null` branch, which leaves a hole that fills in late.
186
+
187
+
## Skeletons
188
+
189
+
A component's shape while it or its data loads is its skeleton, named with the `Skeleton` suffix, never `Loading`: `MDXEditorSkeleton`, `FormSkeleton`. `Loading` names a state, as a `Loading` story or a `LoadingButton` does, not a shape. Every skeleton of a folder lives in the `skeleton.ts` beside the component it draws: a compound's parts (`FormSkeleton`, `FormSectionSkeleton`, `FormGroupSkeleton`), a block's sections, a page's own skeleton and the parts only that page draws.
190
+
191
+
`skeleton.ts` is an opt-in entry point, as `loadable.ts` is: import it by its path, never re-export it from `index.ts`:
A skeleton stands in while code loads, in a `loadable.ts` or as a route's shape while its page's chunk comes, so it lands in the main chunk. Through `index.ts` it would bring the component it stands in for into that chunk too, with everything the component imports.
206
+
207
+
A component that is a shape and nothing else, such as the frame every route's skeleton stands in, is an ordinary component named `<Name>Skeleton`, in a folder of its own with the usual files: `skeleton.ts` is for the skeletons of another component.
The wrapper keeps the original component name and props and adds none. It draws its own `<Name>Loading` beside it, the shape of what is coming: no `fallback` prop, and never `fallback={null}`, which leaves a hole that fills in late.
164
+
The wrapper keeps the original component name and props and adds none. It draws the component's own skeleton from the `skeleton.tsx` beside it, the shape of what is coming: no `fallback` prop, and never `fallback={null}`, which leaves a hole that fills in late.
165
+
166
+
## Skeletons
167
+
168
+
A component's shape while it or its data loads is its skeleton, named with the `Skeleton` suffix, never `Loading`: `MDXEditorSkeleton`, `FormSkeleton`. `Loading` names a state, as a `Loading` story or a `LoadingButton` does, not a shape. Every skeleton of a folder lives in the `skeleton.tsx` beside the component it draws: a compound's parts (`FormSkeleton`, `FormSectionSkeleton`, `FormGroupSkeleton`), a block's sections, a page's own skeleton and the parts only that page draws.
169
+
170
+
`skeleton.tsx` is an opt-in entry point, as `loadable.tsx` is: import it by its path, never re-export it from `index.ts`:
A skeleton stands in while code loads, as a `loadable.tsx` fallback or as a route's shape while its page's chunk comes, so it lands in the main chunk. Through `index.ts` it would bring the component it stands in for into that chunk too, with everything the component imports.
185
+
186
+
A component that is a shape and nothing else, such as the frame every route's skeleton stands in, is an ordinary component named `<Name>Skeleton`, in a folder of its own with the usual files: `skeleton.tsx` is for the skeletons of another component.
0 commit comments