wcz-layout 10.1.2 → 10.1.6

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.
Files changed (84) hide show
  1. package/dist/{AggregatedCell-C7nAQyMO.mjs → AggregatedCell-CqGptV6i.mjs} +199 -150
  2. package/dist/AggregatedCell-CqGptV6i.mjs.map +1 -0
  3. package/dist/Approval-DoD-GRRH.mjs.map +1 -1
  4. package/dist/DialogsContext-DLqA8RJ_.mjs.map +1 -1
  5. package/dist/Email-BzQQkbe9.mjs.map +1 -1
  6. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -1
  7. package/dist/{LayoutTable-DX9IaO8V.d.mts → LayoutTable-CRo43iWr.d.mts} +7 -3
  8. package/dist/{RouterListItemButton-ULMlaQh6.mjs → RouterListItemButton-ke6iPKkL.mjs} +9 -9
  9. package/dist/RouterListItemButton-ke6iPKkL.mjs.map +1 -0
  10. package/dist/{approval-DiNOXd4B.mjs → approval-L09uPzTU.mjs} +2 -2
  11. package/dist/approval-L09uPzTU.mjs.map +1 -0
  12. package/dist/auth.d.mts +1 -0
  13. package/dist/auth.mjs +15 -12
  14. package/dist/auth.mjs.map +1 -1
  15. package/dist/components.d.mts +1 -1
  16. package/dist/components.mjs +594 -361
  17. package/dist/components.mjs.map +1 -1
  18. package/dist/{createApi-DGJJ4I_R.mjs → createApi-BhNkG4jz.mjs} +3 -3
  19. package/dist/createApi-BhNkG4jz.mjs.map +1 -0
  20. package/dist/data/client.mjs +3 -3
  21. package/dist/data/client.mjs.map +1 -1
  22. package/dist/data/server.mjs +4 -4
  23. package/dist/data/server.mjs.map +1 -1
  24. package/dist/{file-C14fhUeg.mjs → file-Chlljz3o.mjs} +4 -4
  25. package/dist/file-Chlljz3o.mjs.map +1 -0
  26. package/dist/{file-C5BOj1q8.mjs → file-Dl8JCcqy.mjs} +4 -4
  27. package/dist/file-Dl8JCcqy.mjs.map +1 -0
  28. package/dist/hooks.d.mts +2 -1
  29. package/dist/hooks.mjs +541 -591
  30. package/dist/hooks.mjs.map +1 -1
  31. package/dist/index.mjs +420 -426
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/middleware.mjs +2 -2
  34. package/dist/middleware.mjs.map +1 -1
  35. package/dist/models.mjs.map +1 -1
  36. package/dist/{peoplesoft-BkJMCcHb.mjs → peoplesoft-BhintHQz.mjs} +3 -3
  37. package/dist/peoplesoft-BhintHQz.mjs.map +1 -0
  38. package/dist/{providers-DrairEO2.mjs → providers-BvuZWkpD.mjs} +2 -2
  39. package/dist/providers-BvuZWkpD.mjs.map +1 -0
  40. package/dist/{tokens-BLRreL1j.mjs → tokens-XuFhVbh5.mjs} +9 -6
  41. package/dist/tokens-XuFhVbh5.mjs.map +1 -0
  42. package/dist/{utils-BUpDoqme.mjs → utils-CaeVFWF-.mjs} +18 -7
  43. package/dist/utils-CaeVFWF-.mjs.map +1 -0
  44. package/dist/utils.mjs +1 -1
  45. package/dist/vite.mjs +11 -0
  46. package/dist/vite.mjs.map +1 -1
  47. package/package.json +131 -130
  48. package/skills/client-db/SKILL.md +136 -136
  49. package/skills/db-schema/SKILL.md +98 -98
  50. package/skills/dialogs/SKILL.md +74 -74
  51. package/skills/forms/SKILL.md +122 -122
  52. package/skills/general/SKILL.md +127 -127
  53. package/skills/general/references/exports.md +109 -109
  54. package/skills/migrations/SKILL.md +57 -57
  55. package/skills/migrations/versions/migrate-v10-to-v11.md +1 -1
  56. package/skills/migrations/versions/migrate-v9-to-v10.md +582 -582
  57. package/skills/routing/SKILL.md +87 -87
  58. package/skills/server-functions/SKILL.md +95 -95
  59. package/skills/services/SKILL.md +34 -34
  60. package/skills/services/docs/email.md +32 -32
  61. package/skills/services/docs/file.md +108 -108
  62. package/skills/services/docs/peoplesoft.md +114 -114
  63. package/skills/start/SKILL.md +52 -52
  64. package/skills/start/steps/01-git-setup.md +10 -10
  65. package/skills/start/steps/02-project-name-setup.md +19 -19
  66. package/skills/start/steps/03-apm-setup.md +97 -208
  67. package/skills/start/steps/04-wicop-setup.md +105 -105
  68. package/skills/start/steps/05-database-setup.md +52 -52
  69. package/skills/start/steps/06-entra-setup.md +96 -96
  70. package/skills/start/steps/07-vault-setup.md +115 -115
  71. package/skills/start/steps/08-generate-favicon.md +8 -8
  72. package/skills/start/steps/09-gitlab-ci.md +25 -25
  73. package/skills/start/steps/10-commit.md +15 -15
  74. package/skills/table/SKILL.md +266 -264
  75. package/dist/AggregatedCell-C7nAQyMO.mjs.map +0 -1
  76. package/dist/RouterListItemButton-ULMlaQh6.mjs.map +0 -1
  77. package/dist/approval-DiNOXd4B.mjs.map +0 -1
  78. package/dist/createApi-DGJJ4I_R.mjs.map +0 -1
  79. package/dist/file-C14fhUeg.mjs.map +0 -1
  80. package/dist/file-C5BOj1q8.mjs.map +0 -1
  81. package/dist/peoplesoft-BkJMCcHb.mjs.map +0 -1
  82. package/dist/providers-DrairEO2.mjs.map +0 -1
  83. package/dist/tokens-BLRreL1j.mjs.map +0 -1
  84. package/dist/utils-BUpDoqme.mjs.map +0 -1
@@ -1,127 +1,127 @@
1
- ---
2
- name: general
3
- description: "Use ALWAYS, before any other skill here, for every code change in this project. Defines the approved stack (TanStack, Vite+, MUI), TypeScript and naming conventions, date formatting, light/dark theming, testing and the validation command, and the src/ and tests/ folder layout that decides where each new file goes."
4
- metadata:
5
- type: convention
6
- library: wcz-layout
7
- ---
8
-
9
- > This is the default skill. Reference it in combination with more specific skills (e.g., `forms`, `table`, `dialogs`, etc.) for targeted tasks. For the full catalogue of every `wcz-layout` import subpath and what it exports, read [references/exports.md](references/exports.md).
10
-
11
- ## Preferred Technology Stack
12
-
13
- Favor the established platform before introducing custom code or a new dependency:
14
-
15
- - **TanStack ecosystem:** Reach for the TanStack library that owns the problem instead of hand-rolling it — Start for the full-stack app and server functions, Router for routing and route-level data loading, DB for client-side collections and live queries, AI for LLM-backed chat and streaming, Form for form state and validation, Hotkeys for keyboard shortcuts, Virtual for long lists and grids, Pacer for debouncing, throttling, rate limiting and queueing or Charts for data visualization.
16
- - **Vite+:** Use Vite+ for the development server, formatting, linting and testing.
17
- - **Material UI:** Use Material UI for interface components and icons.
18
-
19
- When the requirement is not covered above, look for an existing library before writing any logic. Prefer a well-maintained, widely adopted, typed library over custom implementations, even for seemingly simple functionality where a library can reduce edge cases and bugs. If a suitable library exists, install it and use it. Only implement the functionality yourself when it takes a few lines or no suitable library exists.
20
-
21
- ## Coding Conventions
22
-
23
- - Write strict ES2023 TypeScript. Preserve local inference, type public boundaries and never use explicit `any`.
24
- - Stick to double quotes, semicolons, and the `~/` alias for `src/` imports.
25
- - Avoid `useMemo` / `useCallback`; the React Compiler handles memoization.
26
- - Keep code self-documenting; only add comments to clarify non-obvious intent.
27
- - Run the narrow relevant test, then `vp check --fix`. It formats, lints and type-checks.
28
-
29
- ## User Interface
30
-
31
- - Translate every user-facing string via `useTranslation` (or `t` outside components).
32
- - Format all client-side dates with `"L LT"` or `"L"`.
33
- - When building UI, always design for both light and dark mode; this app uses `colorSchemeSelector: "data-mui-color-scheme"`, so prefer `theme.applyStyles("dark", ...)` for mode-specific styling.
34
- - Always design for desktop and mobile, using responsive layouts and breakpoints to keep the UI usable on any screen.
35
- - Build skeletons for loading states.
36
- - Success has no message. Animate the changed item where it lives: created enters, deleted collapses out, edited briefly tints. If the change isn't visible (e.g. before navigating), morph the trigger button to a check for ~400ms.
37
-
38
- ## Testing
39
-
40
- - `vp test` runs `tests/unit` and `tests/integration`; import the test API from `vite-plus/test`.
41
- - Server functions need a request context to run, so integration tests cover what they build on: the schema and constraints against the `DATABASE_URL` Postgres, and collections with the server function mocked.
42
- - `npm run test:e2e` runs Playwright against the dev server, signed in as admin by `tests/e2e/auth.setup.ts`.
43
- - Add or update tests for any new functionality or bug fixes where it matters, don't write tests just for the sake of having them.
44
-
45
- ## File Organization
46
-
47
- Use this ownership model for new application code. Keep feature-specific code close to its route; promote it to a root directory only when it is shared across multiple features.
48
-
49
- ```txt
50
- src/ # client-first architecture
51
- ├── components/ # shared components across multiple routes
52
- ├── db/ # TanStack DB
53
- │ ├── collections/ # collection descriptors
54
- │ │ └── <table>.ts
55
- │ └── queries/ # live query option objects
56
- │ └── <table>.ts
57
- ├── env.ts # clientEnv + serverEnv via createEnv
58
- ├── hooks/ # shared hooks across multiple routes
59
- │ └── useTheme.ts # MUI theme + color schemes
60
- ├── lib/ # isomorphic/shared logic usable by client and server
61
- │ ├── auth/
62
- │ │ ├── permissions.ts # as const satisfies Permissions
63
- │ │ └── scopes.ts # as const satisfies Scopes
64
- │ ├── locales/
65
- │ │ ├── cs.json
66
- │ │ └── en.json
67
- │ └── schemas/ # shared Zod schemas
68
- │ └── <table>.ts
69
- ├── router.tsx # QueryClient, DbClient, router options
70
- ├── routes/ # TanStack Router file-based routing
71
- │ ├── __root.tsx
72
- │ ├── index.tsx
73
- │ ├── login.tsx # required by requireAuth
74
- │ ├── health.ts # Docker HEALTHCHECK, pings the database
75
- │ ├── auth/ # OAuth handlers
76
- │ │ ├── login.ts
77
- │ │ ├── callback.ts
78
- │ │ └── logout.ts
79
- │ ├── api/ # REST API routes (only when a public API is required)
80
- │ │ └── features/
81
- │ │ ├── index.ts
82
- │ │ └── $id.ts
83
- │ └── features/ # feature folder with multiple routes (kebab-case, plural)
84
- │ ├── -components/ # route-specific components
85
- │ ├── -hooks/ # route-specific hooks
86
- │ ├── index.tsx
87
- │ ├── create.tsx
88
- │ ├── $id.tsx
89
- │ └── edit.$id.tsx
90
- ├── server/ # server-only code, never imported from a component
91
- │ ├── actions/
92
- │ │ └── <table>.ts
93
- │ ├── db/
94
- │ │ ├── migrations/
95
- │ │ ├── schemas/ # Drizzle schemas
96
- │ │ │ ├── <table>.ts
97
- │ │ │ └── relations.ts
98
- │ │ └── index.ts # pool, search_path, auto-migrate
99
- │ └── middleware/
100
- │ └── databaseMiddleware.ts # app-local, not a library export
101
- ├── types/
102
- │ ├── i18next.d.ts # types t() against en.json
103
- │ └── wcz-layout.d.ts # declares virtual:wcz-layout
104
- tests/
105
- ├── unit/
106
- │ ├── lib/
107
- │ │ └── schemas/
108
- │ │ └── <table>.test.ts
109
- │ ├── hooks/
110
- │ │ └── useX.test.ts
111
- │ └── routes/
112
- │ └── features/
113
- │ └── -components/
114
- │ └── XCard.test.tsx
115
- ├── integration/
116
- │ ├── server/
117
- │ │ └── db/ # real Postgres from DATABASE_URL
118
- │ │ └── <table>.test.ts
119
- │ └── db/
120
- │ └── collections/ # server function mocked
121
- │ └── <table>.test.ts
122
- └── e2e/ # Playwright
123
- ├── auth.setup.ts # signs in as admin, no Microsoft login
124
- ├── utils.ts # gotoHydrated
125
- └── features/
126
- └── crud.spec.ts
127
- ```
1
+ ---
2
+ name: general
3
+ description: "Use ALWAYS, before any other skill here, for every code change in this project. Defines the approved stack (TanStack, Vite+, MUI), TypeScript and naming conventions, date formatting, light/dark theming, testing and the validation command, and the src/ and tests/ folder layout that decides where each new file goes."
4
+ metadata:
5
+ type: convention
6
+ library: wcz-layout
7
+ ---
8
+
9
+ > This is the default skill. Reference it in combination with more specific skills (e.g., `forms`, `table`, `dialogs`, etc.) for targeted tasks. For the full catalogue of every `wcz-layout` import subpath and what it exports, read [references/exports.md](references/exports.md).
10
+
11
+ ## Preferred Technology Stack
12
+
13
+ Favor the established platform before introducing custom code or a new dependency:
14
+
15
+ - **TanStack ecosystem:** Reach for the TanStack library that owns the problem instead of hand-rolling it — Start for the full-stack app and server functions, Router for routing and route-level data loading, DB for client-side collections and live queries, AI for LLM-backed chat and streaming, Form for form state and validation, Hotkeys for keyboard shortcuts, Virtual for long lists and grids, Pacer for debouncing, throttling, rate limiting and queueing or Charts for data visualization.
16
+ - **Vite+:** Use Vite+ for the development server, formatting, linting and testing.
17
+ - **Material UI:** Use Material UI for interface components and icons.
18
+
19
+ When the requirement is not covered above, look for an existing library before writing any logic. Prefer a well-maintained, widely adopted, typed library over custom implementations, even for seemingly simple functionality where a library can reduce edge cases and bugs. If a suitable library exists, install it and use it. Only implement the functionality yourself when it takes a few lines or no suitable library exists.
20
+
21
+ ## Coding Conventions
22
+
23
+ - Write strict ES2023 TypeScript. Preserve local inference, type public boundaries and never use explicit `any`.
24
+ - Stick to double quotes, semicolons, and the `~/` alias for `src/` imports.
25
+ - Avoid `useMemo` / `useCallback`; the React Compiler handles memoization.
26
+ - Keep code self-documenting; only add comments to clarify non-obvious intent.
27
+ - Run the narrow relevant test, then `vp check --fix`. It formats, lints and type-checks.
28
+
29
+ ## User Interface
30
+
31
+ - Translate every user-facing string via `useTranslation` (or `t` outside components).
32
+ - Format all client-side dates with `"L LT"` or `"L"`.
33
+ - When building UI, always design for both light and dark mode; this app uses `colorSchemeSelector: "data-mui-color-scheme"`, so prefer `theme.applyStyles("dark", ...)` for mode-specific styling.
34
+ - Always design for desktop and mobile, using responsive layouts and breakpoints to keep the UI usable on any screen.
35
+ - Build skeletons for loading states.
36
+ - Success has no message. Animate the changed item where it lives: created enters, deleted collapses out, edited briefly tints. If the change isn't visible (e.g. before navigating), morph the trigger button to a check for ~400ms.
37
+
38
+ ## Testing
39
+
40
+ - `vp test` runs `tests/unit` and `tests/integration`; import the test API from `vite-plus/test`.
41
+ - Server functions need a request context to run, so integration tests cover what they build on: the schema and constraints against the `DATABASE_URL` Postgres, and collections with the server function mocked.
42
+ - `npm run test:e2e` runs Playwright against the dev server, signed in as admin by `tests/e2e/auth.setup.ts`.
43
+ - Add or update tests for any new functionality or bug fixes where it matters, don't write tests just for the sake of having them.
44
+
45
+ ## File Organization
46
+
47
+ Use this ownership model for new application code. Keep feature-specific code close to its route; promote it to a root directory only when it is shared across multiple features.
48
+
49
+ ```txt
50
+ src/ # client-first architecture
51
+ ├── components/ # shared components across multiple routes
52
+ ├── db/ # TanStack DB
53
+ │ ├── collections/ # collection descriptors
54
+ │ │ └── <table>.ts
55
+ │ └── queries/ # live query option objects
56
+ │ └── <table>.ts
57
+ ├── env.ts # clientEnv + serverEnv via createEnv
58
+ ├── hooks/ # shared hooks across multiple routes
59
+ │ └── useTheme.ts # MUI theme + color schemes
60
+ ├── lib/ # isomorphic/shared logic usable by client and server
61
+ │ ├── auth/
62
+ │ │ ├── permissions.ts # as const satisfies Permissions
63
+ │ │ └── scopes.ts # as const satisfies Scopes
64
+ │ ├── locales/
65
+ │ │ ├── cs.json
66
+ │ │ └── en.json
67
+ │ └── schemas/ # shared Zod schemas
68
+ │ └── <table>.ts
69
+ ├── router.tsx # QueryClient, DbClient, router options
70
+ ├── routes/ # TanStack Router file-based routing
71
+ │ ├── __root.tsx
72
+ │ ├── index.tsx
73
+ │ ├── login.tsx # required by requireAuth
74
+ │ ├── health.ts # Docker HEALTHCHECK, pings the database
75
+ │ ├── auth/ # OAuth handlers
76
+ │ │ ├── login.ts
77
+ │ │ ├── callback.ts
78
+ │ │ └── logout.ts
79
+ │ ├── api/ # REST API routes (only when a public API is required)
80
+ │ │ └── features/
81
+ │ │ ├── index.ts
82
+ │ │ └── $id.ts
83
+ │ └── features/ # feature folder with multiple routes (kebab-case, plural)
84
+ │ ├── -components/ # route-specific components
85
+ │ ├── -hooks/ # route-specific hooks
86
+ │ ├── index.tsx
87
+ │ ├── create.tsx
88
+ │ ├── $id.tsx
89
+ │ └── edit.$id.tsx
90
+ ├── server/ # server-only code, never imported from a component
91
+ │ ├── actions/
92
+ │ │ └── <table>.ts
93
+ │ ├── db/
94
+ │ │ ├── migrations/
95
+ │ │ ├── schemas/ # Drizzle schemas
96
+ │ │ │ ├── <table>.ts
97
+ │ │ │ └── relations.ts
98
+ │ │ └── index.ts # pool, search_path, auto-migrate
99
+ │ └── middleware/
100
+ │ └── databaseMiddleware.ts # app-local, not a library export
101
+ ├── types/
102
+ │ ├── i18next.d.ts # types t() against en.json
103
+ │ └── wcz-layout.d.ts # declares virtual:wcz-layout
104
+ tests/
105
+ ├── unit/
106
+ │ ├── lib/
107
+ │ │ └── schemas/
108
+ │ │ └── <table>.test.ts
109
+ │ ├── hooks/
110
+ │ │ └── useX.test.ts
111
+ │ └── routes/
112
+ │ └── features/
113
+ │ └── -components/
114
+ │ └── XCard.test.tsx
115
+ ├── integration/
116
+ │ ├── server/
117
+ │ │ └── db/ # real Postgres from DATABASE_URL
118
+ │ │ └── <table>.test.ts
119
+ │ └── db/
120
+ │ └── collections/ # server function mocked
121
+ │ └── <table>.test.ts
122
+ └── e2e/ # Playwright
123
+ ├── auth.setup.ts # signs in as admin, no Microsoft login
124
+ ├── utils.ts # gotoHydrated
125
+ └── features/
126
+ └── crud.spec.ts
127
+ ```
@@ -1,109 +1,109 @@
1
- # wcz-layout exports
2
-
3
- Public import subpaths and commonly used exports. Read this when you need to know where a
4
- symbol lives; you do not need it loaded for ordinary feature work.
5
-
6
- ## `wcz-layout`
7
-
8
- The root subpath. Everything the application shell needs.
9
-
10
- - `LayoutProvider` — root shell provider. Props: `theme` (required), `navigation?`,
11
- `options?`. Installs the Emotion cache, MUI `ThemeProvider`, `LocalizationProvider`
12
- (dayjs), i18next and the dialogs provider. Wrap `{children}` with it inside `<body>` in
13
- `__root.tsx`. Do not install any of those yourself.
14
- - `Navigation` — the type for the sidebar tree. Items are
15
- `{ kind: "item" | "header" | "group" | "divider" }`; an item takes `to` or `href`,
16
- `title`, `icon` and optional `search`; groups take `title`, `icon` and `children`; headers
17
- take `title`; every kind accepts `hidden`.
18
- - `rootRouteHead` — returns the root route's `head()` value (title, meta, links).
19
- - `getUser({ queryClient })` — resolves the signed-in user. Call it in the root
20
- `beforeLoad` and return `{ user }`; that is what makes `Route.useRouteContext().user`
21
- available on every route.
22
- - `loginProvidersQueryOptions` — query options for the configured OAuth providers. The
23
- `/login` route loads it so the buttons server-render.
24
- - `WISTRON_PRIMARY_COLOR`, `WISTRON_SECONDARY_COLOR` — brand colors for the app's theme.
25
-
26
- ## `wcz-layout/vite`
27
-
28
- - `viteWczLayout()` — **required** Vite plugin. Keep the template's plugin order after
29
- `tanstackStart()`, `nitro()`, `viteReact()` and the React Compiler babel plugin. It
30
- builds the `virtual:wcz-layout` module from the app's `src/lib/locales/*.json`,
31
- `src/lib/auth/permissions.ts`, `src/lib/auth/scopes.ts`, `src/env.ts` and
32
- `public/manifest.json`, and loads Vault secrets into `process.env` during `serve`.
33
- Without it the build fails to resolve
34
- `virtual:wcz-layout`. The app must also declare that module in
35
- `src/types/wcz-layout.d.ts`.
36
-
37
- ## `wcz-layout/components`
38
-
39
- - `LayoutTable` — table renderer; see the `table` skill. Types: `LayoutTableProps`,
40
- `RowAction`, `LayoutColumnMeta`, `FilterOperator`, `TableFilterOption`,
41
- `TableFilterVariant`
42
- - `AggregatedCell` — aggregated value cell for grouped rows
43
- - `Fullscreen` — fills the viewport, for a page whose only content is a table
44
- - `Dropzone`, `FileViewer` — file upload and preview; see the `services` skill
45
- - `LoginForm` — provider buttons for the login route; takes no props and reads
46
- `?returnTo` itself
47
- - `RouterButton`, `RouterFab`, `RouterIconButton`, `RouterLink`, `RouterListItemButton`,
48
- `RouterTab` — MUI components taking router `to` / `params` / `search`
49
- - `RouterNotFound`, `RouterError` — default 404 and error components. Pass them to
50
- `createRouter` as `defaultNotFoundComponent` and `defaultErrorComponent`.
51
-
52
- ## `wcz-layout/hooks`
53
-
54
- - `useLayoutForm`, `withLayoutForm`, `useFormContext`, `useFieldContext` — form instance,
55
- reusable sub-forms, and the contexts custom field components read; see the `forms` skill
56
- - `useLayoutTable`, `createLayoutColumnHelper`, `layoutTableFeatures`, `useTableContext`,
57
- `useHeaderContext`, `useCellContext` — table instance, column helper and contexts, plus
58
- type `LayoutTableFeatures`; see the `table` skill
59
- - `useDialogs` — alert, confirm, custom dialogs and `close`, plus type `DialogProps`; see
60
- the `dialogs` skill
61
- - `useTranslation` — translation inside components
62
- - `useInView` — element visibility observer
63
- - `useScanDetection` — barcode scanner keystrokes
64
-
65
- ## `wcz-layout/middleware`
66
-
67
- - `authMiddleware` — rejects unauthenticated calls, optionally checks a permission key.
68
- Goes in a server function's `.middleware([])`, **after** `databaseMiddleware` so it
69
- narrows `context.user` to `User`. See the `server-functions` skill for the full order.
70
- - `userMiddleware` — attaches the user without requiring one, as `User | null`
71
- - `validationMiddleware` — validates API route input against a Zod schema. REST routes
72
- only; server functions use `.validator()`.
73
- - `csrfMiddleware` — CSRF protection for server functions. Without a `src/start.ts`, Start
74
- applies the same check by default, so the template has none. If the app adds
75
- `src/start.ts` for its own request middleware, list `csrfMiddleware` there too —
76
- `createStart(() => ({ requestMiddleware: [csrfMiddleware, ...] }))` — because a start
77
- instance replaces that default. It is a **request** middleware, never part of a
78
- `.middleware([])` array.
79
-
80
- `databaseMiddleware` is **not** here. It is app-local; every app writes its own. See the
81
- `server-functions` skill.
82
-
83
- ## `wcz-layout/utils`
84
-
85
- - `t`, `i18next` — translation outside components
86
- - `uuidv7` — time-sortable id. Use it for every client-generated primary key.
87
- - `requireAuth` — `beforeLoad` route guard, redirects to `/login`; see the `routing` skill
88
- - `hasPermission` — permission check for a user
89
- - `Platform` — OS detection from the user agent
90
- - `createEnv` — typed environment schema
91
-
92
- ## `wcz-layout/auth`
93
-
94
- - `handleLogin`, `handleCallback`, `handleLogout` — OAuth route handlers. Mount each as a
95
- server `GET` handler at `/auth/login`, `/auth/callback` and `/auth/logout`.
96
- - `getAccessToken` — delegated token for the signed-in user, server-only
97
- - `getAppToken` — app-only token for background jobs, server-only
98
-
99
- ## `wcz-layout/models`
100
-
101
- - Service types: `User`, `Permissions`, `Scopes`, `FileMeta`, `Email`, `EmailAttachment`,
102
- `Employee`, `Department`, `EmployeeStatus`, `EmployeeCategoryGroup`, `Approval*`
103
- - Matching Zod schemas: `FileMetaSchema`, `EmailSchema`, `EmailAttachmentSchema`,
104
- `EmployeeSchema`, `DepartmentSchema` and the approval `*Schema`
105
-
106
- ## `wcz-layout/data/client`, `wcz-layout/data/server`
107
-
108
- - Client query and mutation option factories for file, approval and PeopleSoft services.
109
- Server exports contain those operations plus `sendEmail`; see the `services` skill.
1
+ # wcz-layout exports
2
+
3
+ Public import subpaths and commonly used exports. Read this when you need to know where a
4
+ symbol lives; you do not need it loaded for ordinary feature work.
5
+
6
+ ## `wcz-layout`
7
+
8
+ The root subpath. Everything the application shell needs.
9
+
10
+ - `LayoutProvider` — root shell provider. Props: `theme` (required), `navigation?`,
11
+ `options?`. Installs the Emotion cache, MUI `ThemeProvider`, `LocalizationProvider`
12
+ (dayjs), i18next and the dialogs provider. Wrap `{children}` with it inside `<body>` in
13
+ `__root.tsx`. Do not install any of those yourself.
14
+ - `Navigation` — the type for the sidebar tree. Items are
15
+ `{ kind: "item" | "header" | "group" | "divider" }`; an item takes `to` or `href`,
16
+ `title`, `icon` and optional `search`; groups take `title`, `icon` and `children`; headers
17
+ take `title`; every kind accepts `hidden`.
18
+ - `rootRouteHead` — returns the root route's `head()` value (title, meta, links).
19
+ - `getUser({ queryClient })` — resolves the signed-in user. Call it in the root
20
+ `beforeLoad` and return `{ user }`; that is what makes `Route.useRouteContext().user`
21
+ available on every route.
22
+ - `loginProvidersQueryOptions` — query options for the configured OAuth providers. The
23
+ `/login` route loads it so the buttons server-render.
24
+ - `WISTRON_PRIMARY_COLOR`, `WISTRON_SECONDARY_COLOR` — brand colors for the app's theme.
25
+
26
+ ## `wcz-layout/vite`
27
+
28
+ - `viteWczLayout()` — **required** Vite plugin. Keep the template's plugin order after
29
+ `tanstackStart()`, `nitro()`, `viteReact()` and the React Compiler babel plugin. It
30
+ builds the `virtual:wcz-layout` module from the app's `src/lib/locales/*.json`,
31
+ `src/lib/auth/permissions.ts`, `src/lib/auth/scopes.ts`, `src/env.ts` and
32
+ `public/manifest.json`, and loads Vault secrets into `process.env` during `serve`.
33
+ Without it the build fails to resolve
34
+ `virtual:wcz-layout`. The app must also declare that module in
35
+ `src/types/wcz-layout.d.ts`.
36
+
37
+ ## `wcz-layout/components`
38
+
39
+ - `LayoutTable` — table renderer; see the `table` skill. Types: `LayoutTableProps`,
40
+ `RowAction`, `LayoutColumnMeta`, `FilterOperator`, `TableFilterOption`,
41
+ `TableFilterVariant`
42
+ - `AggregatedCell` — aggregated value cell for grouped rows
43
+ - `Fullscreen` — fills the viewport, for a page whose only content is a table
44
+ - `Dropzone`, `FileViewer` — file upload and preview; see the `services` skill
45
+ - `LoginForm` — provider buttons for the login route; takes no props and reads
46
+ `?returnTo` itself
47
+ - `RouterButton`, `RouterFab`, `RouterIconButton`, `RouterLink`, `RouterListItemButton`,
48
+ `RouterTab` — MUI components taking router `to` / `params` / `search`
49
+ - `RouterNotFound`, `RouterError` — default 404 and error components. Pass them to
50
+ `createRouter` as `defaultNotFoundComponent` and `defaultErrorComponent`.
51
+
52
+ ## `wcz-layout/hooks`
53
+
54
+ - `useLayoutForm`, `withLayoutForm`, `useFormContext`, `useFieldContext` — form instance,
55
+ reusable sub-forms, and the contexts custom field components read; see the `forms` skill
56
+ - `useLayoutTable`, `createLayoutColumnHelper`, `layoutTableFeatures`, `useTableContext`,
57
+ `useHeaderContext`, `useCellContext` — table instance, column helper and contexts, plus
58
+ type `LayoutTableFeatures`; see the `table` skill
59
+ - `useDialogs` — alert, confirm, custom dialogs and `close`, plus type `DialogProps`; see
60
+ the `dialogs` skill
61
+ - `useTranslation` — translation inside components
62
+ - `useInView` — element visibility observer
63
+ - `useScanDetection` — barcode scanner keystrokes
64
+
65
+ ## `wcz-layout/middleware`
66
+
67
+ - `authMiddleware` — rejects unauthenticated calls, optionally checks a permission key.
68
+ Goes in a server function's `.middleware([])`, **after** `databaseMiddleware` so it
69
+ narrows `context.user` to `User`. See the `server-functions` skill for the full order.
70
+ - `userMiddleware` — attaches the user without requiring one, as `User | null`
71
+ - `validationMiddleware` — validates API route input against a Zod schema. REST routes
72
+ only; server functions use `.validator()`.
73
+ - `csrfMiddleware` — CSRF protection for server functions. Without a `src/start.ts`, Start
74
+ applies the same check by default, so the template has none. If the app adds
75
+ `src/start.ts` for its own request middleware, list `csrfMiddleware` there too —
76
+ `createStart(() => ({ requestMiddleware: [csrfMiddleware, ...] }))` — because a start
77
+ instance replaces that default. It is a **request** middleware, never part of a
78
+ `.middleware([])` array.
79
+
80
+ `databaseMiddleware` is **not** here. It is app-local; every app writes its own. See the
81
+ `server-functions` skill.
82
+
83
+ ## `wcz-layout/utils`
84
+
85
+ - `t`, `i18next` — translation outside components
86
+ - `uuidv7` — time-sortable id. Use it for every client-generated primary key.
87
+ - `requireAuth` — `beforeLoad` route guard, redirects to `/login`; see the `routing` skill
88
+ - `hasPermission` — permission check for a user
89
+ - `Platform` — OS detection from the user agent
90
+ - `createEnv` — typed environment schema
91
+
92
+ ## `wcz-layout/auth`
93
+
94
+ - `handleLogin`, `handleCallback`, `handleLogout` — OAuth route handlers. Mount each as a
95
+ server `GET` handler at `/auth/login`, `/auth/callback` and `/auth/logout`.
96
+ - `getAccessToken` — delegated token for the signed-in user, server-only
97
+ - `getAppToken` — app-only token for background jobs, server-only
98
+
99
+ ## `wcz-layout/models`
100
+
101
+ - Service types: `User`, `Permissions`, `Scopes`, `FileMeta`, `Email`, `EmailAttachment`,
102
+ `Employee`, `Department`, `EmployeeStatus`, `EmployeeCategoryGroup`, `Approval*`
103
+ - Matching Zod schemas: `FileMetaSchema`, `EmailSchema`, `EmailAttachmentSchema`,
104
+ `EmployeeSchema`, `DepartmentSchema` and the approval `*Schema`
105
+
106
+ ## `wcz-layout/data/client`, `wcz-layout/data/server`
107
+
108
+ - Client query and mutation option factories for file, approval and PeopleSoft services.
109
+ Server exports contain those operations plus `sendEmail`; see the `services` skill.
@@ -1,57 +1,57 @@
1
- ---
2
- name: migrations
3
- description: "Use when upgrading the wcz-layout package to a newer major version. Each major ships only its own inbound guide, versions/migrate-v<N-1>-to-v<N>.md, delivered by installing it. One major per pass."
4
- metadata:
5
- type: lifecycle
6
- library: wcz-layout
7
- disable-model-invocation: "true"
8
- ---
9
-
10
- # Upgrading wcz-layout
11
-
12
- ## 1. Find the source major
13
-
14
- ```bash
15
- node -p "require('wcz-layout/package.json').version" # installed
16
- npm view wcz-layout version # latest published
17
- ls node_modules/wcz-layout/skills/migrations/versions/
18
- ```
19
-
20
- `package.json` names the installed major, not the one `src/` is written against.
21
- Open the guide on disk and grep `src/` for the symbols on its `from` side —
22
- `requirePermission`, `authenticationMiddleware`, `DataGridPremium`,
23
- `useNotification` and the rest of the left-hand columns.
24
-
25
- - Hits → `src/` is on that guide's `from` major. Apply that guide now, install nothing.
26
- - No hits → the source major is the installed one. Go to step 2.
27
-
28
- ## 2. One pass per major
29
-
30
- For each major from source + 1 up to the latest, in order:
31
-
32
- ```bash
33
- npm install wcz-layout@<major>
34
- ls node_modules/wcz-layout/skills/migrations/versions/
35
- ```
36
-
37
- Re-list after every install — it replaced `versions/` and this skill. Read the
38
- whole `migrate-v<from>-to-v<major>.md` it delivered, and whatever that guide says
39
- to read first, before editing anything. Then work through it top to bottom.
40
-
41
- Never skip a major: only `@10` carries the v9→v10 guide, so v9 → v11 is two
42
- passes — install 10, apply, verify, install 11, apply, verify.
43
-
44
- ## 3. Verify before the next pass
45
-
46
- ```bash
47
- npx vp check --fix
48
- ```
49
-
50
- Formats, lints and type-checks. Fix everything it leaves behind, then:
51
-
52
- ```bash
53
- npx vp dev
54
- ```
55
-
56
- The app must start and render. Stop the dev server, then start the next pass.
57
- Done when no guide is left unapplied and the installed version is the latest.
1
+ ---
2
+ name: migrations
3
+ description: "Use when upgrading the wcz-layout package to a newer major version. Each major ships only its own inbound guide, versions/migrate-v<N-1>-to-v<N>.md, delivered by installing it. One major per pass."
4
+ metadata:
5
+ type: lifecycle
6
+ library: wcz-layout
7
+ disable-model-invocation: "true"
8
+ ---
9
+
10
+ # Upgrading wcz-layout
11
+
12
+ ## 1. Find the source major
13
+
14
+ ```bash
15
+ node -p "require('wcz-layout/package.json').version" # installed
16
+ npm view wcz-layout version # latest published
17
+ ls node_modules/wcz-layout/skills/migrations/versions/
18
+ ```
19
+
20
+ `package.json` names the installed major, not the one `src/` is written against.
21
+ Open the guide on disk and grep `src/` for the symbols on its `from` side —
22
+ `requirePermission`, `authenticationMiddleware`, `DataGridPremium`,
23
+ `useNotification` and the rest of the left-hand columns.
24
+
25
+ - Hits → `src/` is on that guide's `from` major. Apply that guide now, install nothing.
26
+ - No hits → the source major is the installed one. Go to step 2.
27
+
28
+ ## 2. One pass per major
29
+
30
+ For each major from source + 1 up to the latest, in order:
31
+
32
+ ```bash
33
+ npm install wcz-layout@<major>
34
+ ls node_modules/wcz-layout/skills/migrations/versions/
35
+ ```
36
+
37
+ Re-list after every install — it replaced `versions/` and this skill. Read the
38
+ whole `migrate-v<from>-to-v<major>.md` it delivered, and whatever that guide says
39
+ to read first, before editing anything. Then work through it top to bottom.
40
+
41
+ Never skip a major: only `@10` carries the v9→v10 guide, so v9 → v11 is two
42
+ passes — install 10, apply, verify, install 11, apply, verify.
43
+
44
+ ## 3. Verify before the next pass
45
+
46
+ ```bash
47
+ npx vp check --fix
48
+ ```
49
+
50
+ Formats, lints and type-checks. Fix everything it leaves behind, then:
51
+
52
+ ```bash
53
+ npx vp dev
54
+ ```
55
+
56
+ The app must start and render. Stop the dev server, then start the next pass.
57
+ Done when no guide is left unapplied and the installed version is the latest.
@@ -1 +1 @@
1
- https://mui.com/material-ui/react-number-field/
1
+ https://mui.com/material-ui/react-number-field/