wcz-layout 9.6.6 → 10.0.0

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 (94) hide show
  1. package/dist/AggregatedCell-BtKC5-m6.mjs +497 -0
  2. package/dist/AggregatedCell-BtKC5-m6.mjs.map +1 -0
  3. package/dist/Approval-C-hF4jbT.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-4DLs-NI-.d.mts +752 -0
  8. package/dist/{QueryClientParam-Cbb0MIKg.d.mts → QueryClientParam-JcH0mJWl.d.mts} +2 -2
  9. package/dist/RouterListItemButton-ULMlaQh6.mjs.map +1 -1
  10. package/dist/{User-1gKoYJvW.d.mts → User-D4__w1I1.d.mts} +4 -2
  11. package/dist/approval-DFExxyAJ.mjs +84 -0
  12. package/dist/approval-DFExxyAJ.mjs.map +1 -0
  13. package/dist/auth.d.mts +21 -11
  14. package/dist/auth.mjs +43 -26
  15. package/dist/auth.mjs.map +1 -1
  16. package/dist/components.d.mts +22 -30
  17. package/dist/components.mjs +792 -145
  18. package/dist/components.mjs.map +1 -1
  19. package/dist/createApi-CLYWCzR2.mjs +27 -0
  20. package/dist/createApi-CLYWCzR2.mjs.map +1 -0
  21. package/dist/data/client.d.mts +703 -1152
  22. package/dist/data/client.mjs +4 -3
  23. package/dist/data/client.mjs.map +1 -1
  24. package/dist/data/server.d.mts +3 -3
  25. package/dist/data/server.mjs +4 -2
  26. package/dist/data/server.mjs.map +1 -1
  27. package/dist/{file-BTFDDalH.mjs → file-CZwQfvTU.mjs} +8 -27
  28. package/dist/file-CZwQfvTU.mjs.map +1 -0
  29. package/dist/{file-CuvAmdJW.mjs → file-aSQto2rw.mjs} +7 -9
  30. package/dist/file-aSQto2rw.mjs.map +1 -0
  31. package/dist/hooks.d.mts +7 -46
  32. package/dist/hooks.mjs +2578 -239
  33. package/dist/hooks.mjs.map +1 -1
  34. package/dist/index.d.mts +29 -9
  35. package/dist/index.mjs +1257 -499
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/middleware.d.mts +20 -19
  38. package/dist/middleware.mjs +47 -2
  39. package/dist/middleware.mjs.map +1 -1
  40. package/dist/models.d.mts +17 -10
  41. package/dist/models.mjs.map +1 -1
  42. package/dist/{peoplesoft-D4w8d4s1.d.mts → peoplesoft-BY_75WTS.d.mts} +3 -2
  43. package/dist/{peoplesoft-DGdM1bws.mjs → peoplesoft-CQnc01Hc.mjs} +24 -81
  44. package/dist/peoplesoft-CQnc01Hc.mjs.map +1 -0
  45. package/dist/providers-Dbl95AxR.mjs +74 -0
  46. package/dist/providers-Dbl95AxR.mjs.map +1 -0
  47. package/dist/tokens-D8CVIFTb.mjs +143 -0
  48. package/dist/tokens-D8CVIFTb.mjs.map +1 -0
  49. package/dist/{utils-5x4uNxsX.d.mts → utils-Bhi0KiBx.d.mts} +18 -6
  50. package/dist/{utils-DjdexspV.mjs → utils-KaM5VMTJ.mjs} +64 -42
  51. package/dist/utils-KaM5VMTJ.mjs.map +1 -0
  52. package/dist/utils.d.mts +2 -2
  53. package/dist/utils.mjs +2 -2
  54. package/dist/vite.d.mts +1 -2
  55. package/dist/vite.mjs +3 -3
  56. package/dist/vite.mjs.map +1 -1
  57. package/package.json +128 -127
  58. package/skills/client-db/SKILL.md +104 -96
  59. package/skills/db-schema/SKILL.md +46 -33
  60. package/skills/dialogs/SKILL.md +21 -27
  61. package/skills/forms/SKILL.md +60 -39
  62. package/skills/general/SKILL.md +125 -94
  63. package/skills/general/references/exports.md +106 -0
  64. package/skills/migrations/SKILL.md +57 -0
  65. package/skills/migrations/versions/migrate-v9-to-v10.md +581 -0
  66. package/skills/routing/SKILL.md +50 -60
  67. package/skills/server-functions/SKILL.md +36 -56
  68. package/skills/services/SKILL.md +34 -31
  69. package/skills/services/docs/approval.md +2 -2
  70. package/skills/services/docs/peoplesoft.md +1 -1
  71. package/skills/start/SKILL.md +51 -47
  72. package/skills/start/steps/01-git-setup.md +0 -1
  73. package/skills/start/steps/04-wicop-setup.md +105 -80
  74. package/skills/start/steps/05-database-setup.md +13 -5
  75. package/skills/start/steps/06-entra-setup.md +96 -98
  76. package/skills/start/steps/07-vault-setup.md +57 -24
  77. package/skills/table/SKILL.md +275 -0
  78. package/skills/unslop/SKILL.md +80 -0
  79. package/dist/NotificationContext-CgwUOeW0.mjs +0 -7
  80. package/dist/NotificationContext-CgwUOeW0.mjs.map +0 -1
  81. package/dist/authMiddleware-DPly0b_T.mjs +0 -48
  82. package/dist/authMiddleware-DPly0b_T.mjs.map +0 -1
  83. package/dist/entra-CJSyeQsx.mjs +0 -109
  84. package/dist/entra-CJSyeQsx.mjs.map +0 -1
  85. package/dist/file-BTFDDalH.mjs.map +0 -1
  86. package/dist/file-CuvAmdJW.mjs.map +0 -1
  87. package/dist/msalServer-DLwA7_ta.mjs +0 -30
  88. package/dist/msalServer-DLwA7_ta.mjs.map +0 -1
  89. package/dist/peoplesoft-DGdM1bws.mjs.map +0 -1
  90. package/dist/useDialogs-BUzVrTSP.mjs +0 -248
  91. package/dist/useDialogs-BUzVrTSP.mjs.map +0 -1
  92. package/dist/user-Dzv0N9fj.d.mts +0 -16
  93. package/dist/utils-DjdexspV.mjs.map +0 -1
  94. package/skills/data-grid/SKILL.md +0 -142
@@ -1,14 +1,14 @@
1
1
  # Vault Setup
2
2
 
3
- Move the secrets that currently live in `.env.local` into Vault, then shrink
4
- `.env.local` down to the Vault connection only.
3
+ Move local-development secrets into Vault, then shrink `.env.local` to the Vault connection.
5
4
 
6
5
  Before starting, ask the user via **AskUserQuestion** which environment(s) to
7
- set up: **QAS**, **PRD** or **both**. Both environments follow the exact same
8
- steps — only the login credentials and the Vault path differ (QAS lives under
9
- `sat-qas-01`, PRD under `sat-prd-01`; each has its own Vault account and
10
- password). When doing both, run through Parts 1–2 once per environment. In
11
- Part 3, always write the **QAS** connection into `.env.local` (if available).
6
+ set up: **QAS**, **PRD** or **both**. Both environments follow the same steps —
7
+ the login credentials, the Vault path (QAS lives under `sat-qas-01`, PRD under
8
+ `sat-prd-01`; each has its own Vault account and password) and a few
9
+ environment-specific payload values differ (see Part 2, step 0). When doing
10
+ both, run through Parts 1–2 once per environment. In Part 3, always write the
11
+ **QAS** connection into `.env.local` (if available).
12
12
 
13
13
  To wait for something the user does in the browser — signing in, saving a
14
14
  secret — poll in a tool loop: wait ~5 s, re-read the page, repeat until the
@@ -16,14 +16,11 @@ expected state appears or ~5 minutes pass, then carry straight on. Never end
16
16
  your turn while waiting; announcing "I'll continue once you have signed in"
17
17
  and stopping ends the session, and nothing resumes it.
18
18
 
19
- Do not print secret values into chat, logs, or a commit — reference them by
20
- key name. Values move from `.env.local` into the browser and nowhere else.
21
-
22
19
  ## Part 1 — Collect the payload from `.env.local`
23
20
 
24
- 1. Read `.env.local`. If it does not exist, create it.
25
- 2. If `SESSION_SECRET` is empty or missing, generate one.
26
- 3. Build the JSON payload from every key in `.env.local` (except `DATABASE_AUTOMIGRATE`). A typical payload that goes to Vault:
21
+ 1. Inspect key names and whether they are set without printing their values. Include keys from `.env` such as `*_BASE_URL`, etc.
22
+ 2. If `SESSION_SECRET` is empty or missing, generate it without writing it to command output.
23
+ 3. Build a JSON key skeleton from `.env.local`, excluding `DATABASE_AUTO_MIGRATE`.
27
24
 
28
25
  ```json
29
26
  {
@@ -31,8 +28,7 @@ key name. Values move from `.env.local` into the browser and nowhere else.
31
28
  "ENTRA_TENANT_ID": "...",
32
29
  "ENTRA_CLIENT_SECRET": "...",
33
30
  "SESSION_SECRET": "...",
34
- "DATABASE_URL": "...",
35
- "DATABASE_SCHEMA": "..."
31
+ "DATABASE_URL": "..."
36
32
  }
37
33
  ```
38
34
 
@@ -41,13 +37,37 @@ key name. Values move from `.env.local` into the browser and nowhere else.
41
37
  Repeat this part once per selected environment (QAS and/or PRD) — same steps,
42
38
  different credentials and path.
43
39
 
44
- 1. Ask for the screenshot of WiCOP email or the **Vault path**, **Vault Account** and **Vault Password** one-by-one.
40
+ 0. Derive the environment-specific payload. The Part 1 payload reflects the
41
+ local/QAS setup — before writing to a given environment, adjust these keys:
42
+ - **`*_BASE_URL`** keys: if the host contains `qas` or `dev`, swap the
43
+ environment segment for the target environment. The pattern is
44
+ `https://<service>-api.wcz-sat-<env>-01.k8s.wistron.com`, e.g.
45
+ `https://<service>-api.wcz-sat-qas-01.k8s.wistron.com` becomes
46
+ `https://<service>-api.wcz-sat-prd-01.k8s.wistron.com`. Hosts that don't
47
+ match this k8s pattern stay untouched. Do this automatically — never ask the user for these.
48
+ - **`DATABASE_URL`**: the host is fixed per environment — QAS is always
49
+ `10.82.36.60:5432`, PRD is always `10.82.36.50:5432`. Set the host
50
+ automatically. The **username and password** cannot be derived: local
51
+ usually uses `postgres`, but the provisioned per-app user is
52
+ `wcz-<projectname>` with a **different password per environment** (QAS
53
+ and PRD passwords differ). Ask the user for the target environment's DB
54
+ info block (from the provisioning/WiCOP material, looks like
55
+ `name: wcz-<project>-db / username: wcz-<project> / password: ...`) and
56
+ substitute both username and password into the URL.
57
+ - All other keys (`ENTRA_*`, `SESSION_SECRET`, ...) stay
58
+ as-is.
59
+ 1. Ask for the screenshot of WiCOP email or the **Vault path**, **Vault Account** and **Vault Password** one-by-one. The password is needed as a
60
+ value in Part 3 (`VAULT_PASSWORD`), so it must be given in chat — do not
61
+ have the user type it into the browser only. Note that **QAS and PRD live
62
+ on different Vault hosts** (QAS is typically `vault-dev.wistron.com:8200`,
63
+ PRD `vault-oss-prd.wistron.com:8200`) — the Vault path the user provides
64
+ contains the right host; use it as-is.
45
65
  2. Open the Vault address in the browser. Login with provided account and password and redirect to provided path:
46
66
  - The URL already contains the secret path, so it redirects there after login.
47
67
  - On the "Sign in to Vault" screen, open the **Method** dropdown and select **Userpass** (not the default Token).
48
68
  - Enter the **Username** (Vault Account), then the **Password**, then click **Sign in**.
49
69
  - You land on the secret list for the project path, e.g. `release/wcz/sat-<environment>-01/<project>-wcz`, containing a `default` secret.
50
- 3. Update the `default` secret with the `.env.local` payload:
70
+ 3. Update the `default` secret with the derived environment payload from step 0:
51
71
  - Click the `default` secret to open it, then open the **Secret** tab.
52
72
  - Click **Create new version**.
53
73
  - Toggle the **JSON** switch in the toolbar, select all in the JSON editor (`Ctrl+A`) and replace it with the payload JSON from Part 1 (this also removes any pre-existing keys like `cog_test`).
@@ -56,7 +76,10 @@ different credentials and path.
56
76
  - In the breadcrumb, click `<projectname>-wcz` to go one level up.
57
77
  - Click **Create secret**.
58
78
  - In **Path for this secret**, append `harborvault` to the pre-filled project path (i.e. `wcz/<env>/<projectname>-wcz/harborvault`).
59
- - Toggle the **JSON** switch, then ask the user to copy-paste the harborvault JSON from another project into the JSON editor (contains the `HARBOR_SECRET` key). Autonomously poll the editor until the content is there — do not end the session while waiting.
79
+ - Toggle the **JSON** switch, then ask the user to copy-paste the harborvault JSON from another project into the JSON editor (contains the `HARBOR_SECRET` key). The same JSON is used for both environments — it
80
+ points to the shared PRD harbor registry (`wcz-sat-prd-harbor...`) even in
81
+ QAS; that is intentional. Autonomously poll the editor until the content
82
+ is there — do not end the session while waiting.
60
83
  - Click **Save**. Verify the success toast.
61
84
  5. Close the Vault browser session.
62
85
 
@@ -66,16 +89,26 @@ Use the **QAS** credentials here when both environments were set up.
66
89
 
67
90
  Rewrite the file so it contains **only** these keys. Every app secret is now
68
91
  served by Vault, so its local value is removed — a leftover value would
69
- override Vault. `DATABASE_URL` and `DATABASE_SCHEMA` stay filled because
92
+ override Vault. `DATABASE_URL` stay filled because
70
93
  drizzle-kit reads them directly and never goes through Vault.
71
94
 
95
+ `VAULT_SECRET_PATH` is the secret path **without** the mount point (`release`)
96
+ and **including** the trailing `/default` — the app builds
97
+ `/v1/<mount>/data/<VAULT_SECRET_PATH>` (see `src/lib/vite-plugin.ts`).
98
+ `VAULT_MOUNT_POINT` defaults to `release` and only needs to be set if the
99
+ engine is mounted elsewhere. If `VAULT_ADDRESS` is unset, Vault fetching is
100
+ skipped silently (plain local-dev fallback).
101
+
72
102
  ```dotenv
73
- VAULT_ADDRESS=<from Part 2>
74
- VAULT_SECRET_PATH=<from Part 2>
103
+ VAULT_ADDRESS=<scheme://host:port from Part 2, no path>
104
+ VAULT_SECRET_PATH=wcz/sat-qas-01/<project>-wcz/default
75
105
  VAULT_USERNAME=<from Part 2>
76
106
  VAULT_PASSWORD=<from Part 2>
77
107
 
78
- DATABASE_URL=<kept>
79
- DATABASE_SCHEMA=<kept>
80
- DATABASE_AUTOMIGRATE=<kept>
108
+ DATABASE_URL=<kept — local dev DB or QAS, per user choice>
109
+ DATABASE_AUTO_MIGRATE=<kept>
81
110
  ```
111
+
112
+ After writing, verify end-to-end: start the dev server (or replicate the
113
+ login + fetch from `src/lib/vite-plugin.ts`) and confirm all expected keys
114
+ come back from Vault.
@@ -0,0 +1,275 @@
1
+ ---
2
+ name: table
3
+ description: "Use when building or changing a data table, grid, or list page. Covers useLayoutTable, LayoutTable, createLayoutColumnHelper, column definitions and headers, cell formatters, filter variants, sorting, row selection and bulk actions, per-row actions, pagination, footer aggregation."
4
+ metadata:
5
+ type: convention
6
+ library: wcz-layout
7
+ ---
8
+
9
+ # Table patterns
10
+
11
+ > Mechanics (`createTableHook`, column helpers, row models, faceting, the state
12
+ > atoms) belong to TanStack Table v9 itself. List the skills shipped by
13
+ > `@tanstack/table-core` and `@tanstack/react-table` and load whichever cover the task at
14
+ > hand. This skill covers only the wcz-layout conventions on top of it.
15
+
16
+ ## Rules
17
+
18
+ - For selection and actions display columns, always set `size: 50`,
19
+ `enableResizing: false`, and `enableCellSelection: false`.
20
+ - Create the column helper once at module scope, outside the component:
21
+ `const columnHelper = createLayoutColumnHelper<Todo>()`. Wrap the array in
22
+ `columnHelper.columns([...])` so each column keeps its own value type.
23
+ - Build the instance with `useLayoutTable({ data, columns })` and pass it to
24
+ `<LayoutTable table={table} />`. Rows are keyed by `row.id`, so every row object
25
+ needs an `id`.
26
+ - Render cells with the bound components off the render prop
27
+ (`cell.ValueCell`, `NumberCell`, `DateCell`, `DateTimeCell`, `BooleanCell`)
28
+ instead of raw JSX. They carry the alignment, the number and date locale, and
29
+ the noWrap behaviour. Write raw JSX only when the cell is a link or
30
+ another interactive element.
31
+ - Set `meta.variant` for non-text filters. Omission means `"text"`.
32
+ - Give `meta.label` to any column whose `header` is not a plain string. A string
33
+ header supplies the label automatically; a function or JSX header leaves the
34
+ header menu and column selector without a label; the filter picker falls back to
35
+ `column.id`. `meta` has four keys: `label`, `align`, `variant`, `options`.
36
+ - Do not enumerate `meta.options` for a free-text column. `select` and
37
+ `multi-select` read their options from the faceted unique values, so the choices
38
+ track the data. Pass explicit string options when labels differ from stored values or
39
+ the UI needs a fixed list. Derive database-enum options from `enumValues`, never a
40
+ second hand-written list.
41
+ - Translate every `header`. The table's own strings come from the app's
42
+ `src/lib/locales/*.json` under `Layout.Table`. See the `general` skill for the
43
+ setup step: the app owns the whole `Layout` namespace, not just `Layout.Table`.
44
+ - Wrap the table in `Fullscreen` when it is the only content on the page.
45
+ - Rows and columns virtualize by default. Pass `pagination` for page-based navigation.
46
+ Virtualization reduces rendered DOM; it does not reduce fetched data or replace
47
+ server-side pagination. Column virtualization
48
+ switches off for grouped header rows and while `loading`, which is a real perf
49
+ cliff on wide tables that use `columnHelper.group`.
50
+ - Props go on `LayoutTable`, not on a slot: `title`, `actions`, `showToolbar`,
51
+ `loading`, `pagination`, `pageSizeOptions`, `onRowClick`, `onRowDoubleClick`,
52
+ `sx`, and the `disableSearch` / `disableColumnFilter` / `disableColumnSelector` /
53
+ `disableColumnMenu` escape hatches.
54
+ - Omit the second `useLayoutTable` selector when passing its result to `LayoutTable`; the
55
+ renderer requires the full selected state.
56
+ - For bulk actions read `table.getSelectedRowIds()` and clear with
57
+ `table.resetRowSelection()`. For per-row actions add a `display` column rendering
58
+ `cell.ActionsCell` with a `RowAction[]`.
59
+ - A footer total needs both halves: `aggregationFn` on the column and
60
+ `footer: ({ header }) => <header.AggregationFooter />`.
61
+
62
+ ## Example
63
+
64
+ ```tsx
65
+ import { Fullscreen, LayoutTable, RouterIconButton, RouterLink } from "wcz-layout/components";
66
+ import {
67
+ createLayoutColumnHelper,
68
+ useDialogs,
69
+ useLayoutTable,
70
+ useTranslation,
71
+ } from "wcz-layout/hooks";
72
+
73
+ const columnHelper = createLayoutColumnHelper<Todo>();
74
+
75
+ function RouteComponent() {
76
+ const { t } = useTranslation();
77
+ const { confirm, alert } = useDialogs();
78
+ const navigate = useNavigate();
79
+ const todos = useTodoCollection();
80
+ const { data, isLoading } = useLiveQuery(todosQueryOptions);
81
+
82
+ const columns = columnHelper.columns([
83
+ columnHelper.display({
84
+ id: "select",
85
+ header: ({ header }) => <header.SelectAllCell scope="all" />,
86
+ cell: ({ cell }) => <cell.SelectCell />,
87
+ size: 50,
88
+ enableResizing: false,
89
+ }),
90
+ columnHelper.accessor("name", {
91
+ header: t("Todo.Name"),
92
+ cell: ({ cell }) => (
93
+ <RouterLink
94
+ to="/todos/$id"
95
+ params={{ id: cell.row.original.id }}
96
+ underline="hover"
97
+ color="inherit"
98
+ >
99
+ {cell.getValue()}
100
+ </RouterLink>
101
+ ),
102
+ size: 260,
103
+ }),
104
+ columnHelper.accessor("assignee", {
105
+ header: t("Todo.Assignee"),
106
+ cell: ({ cell }) => <cell.ValueCell />,
107
+ // No options: the filter builds them from the faceted unique values.
108
+ meta: { variant: "multi-select" },
109
+ size: 180,
110
+ }),
111
+ columnHelper.accessor("priority", {
112
+ header: t("Todo.Priority"),
113
+ cell: ({ cell }) => <cell.NumberCell />,
114
+ footer: ({ header }) => <header.AggregationFooter options={{ maximumFractionDigits: 1 }} />,
115
+ aggregationFn: "mean",
116
+ meta: { variant: "number", align: "right" },
117
+ size: 120,
118
+ }),
119
+ columnHelper.accessor("starred", {
120
+ header: t("Todo.Starred"),
121
+ cell: ({ cell }) => <cell.BooleanCell />,
122
+ meta: { variant: "boolean", align: "center" },
123
+ size: 120,
124
+ }),
125
+ columnHelper.accessor("createdAt", {
126
+ header: t("Todo.CreatedAt"),
127
+ cell: ({ cell }) => <cell.DateTimeCell />,
128
+ meta: { variant: "date" },
129
+ size: 190,
130
+ }),
131
+ ]);
132
+
133
+ const table = useLayoutTable({ data, columns });
134
+ const selectedIds = table.getSelectedRowIds();
135
+
136
+ const handleOnDelete = createOptimisticAction<Array<string>>({
137
+ onMutate: (ids) => {
138
+ ids.forEach((id) => {
139
+ todos.delete(id);
140
+ });
141
+ },
142
+ mutationFn: async (ids) => {
143
+ await deleteTodos({ data: ids });
144
+ await todos.utils.refetch({ throwOnError: true });
145
+ },
146
+ });
147
+
148
+ return (
149
+ <Fullscreen>
150
+ <LayoutTable
151
+ table={table}
152
+ loading={isLoading}
153
+ showToolbar
154
+ title={t("Todo.Todos")}
155
+ onRowDoubleClick={(row) => navigate({ to: "/todos/$id", params: { id: row.id } })}
156
+ actions={
157
+ <>
158
+ <Tooltip title={t("Create")}>
159
+ <RouterIconButton to="/todos/create">
160
+ <Add fontSize="small" />
161
+ </RouterIconButton>
162
+ </Tooltip>
163
+
164
+ {selectedIds.length === 1 && (
165
+ <Tooltip title={t("Edit")}>
166
+ <RouterIconButton to="/todos/edit/$id" params={{ id: selectedIds[0] }}>
167
+ <Edit fontSize="small" />
168
+ </RouterIconButton>
169
+ </Tooltip>
170
+ )}
171
+
172
+ {selectedIds.length > 0 && (
173
+ <Tooltip title={t("Delete")}>
174
+ <IconButton
175
+ onClick={async () => {
176
+ const confirmed = await confirm(
177
+ t("DeleteConfirmation", { count: selectedIds.length }),
178
+ );
179
+ if (!confirmed) return;
180
+
181
+ try {
182
+ const transaction = handleOnDelete(selectedIds);
183
+ await transaction.isPersisted.promise;
184
+ table.resetRowSelection();
185
+ } catch (error) {
186
+ if (error instanceof Error) await alert(error.message);
187
+ }
188
+ }}
189
+ >
190
+ <Badge
191
+ badgeContent={selectedIds.length}
192
+ invisible={selectedIds.length <= 1}
193
+ color="error"
194
+ >
195
+ <Delete fontSize="small" />
196
+ </Badge>
197
+ </IconButton>
198
+ </Tooltip>
199
+ )}
200
+ </>
201
+ }
202
+ />
203
+ </Fullscreen>
204
+ );
205
+ }
206
+ ```
207
+
208
+ ### Per-row actions
209
+
210
+ ```tsx
211
+ columnHelper.display({
212
+ id: "actions",
213
+ cell: ({ cell }) => (
214
+ <cell.ActionsCell
215
+ actions={[
216
+ {
217
+ label: t("Edit"),
218
+ icon: <Edit fontSize="small" />,
219
+ onClick: (row) => navigate({ to: "/todos/edit/$id", params: { id: row.id } }),
220
+ },
221
+ {
222
+ label: t("Delete"),
223
+ icon: <Delete fontSize="small" />,
224
+ divider: true,
225
+ onClick: (row) => remove(row.id),
226
+ },
227
+ ]}
228
+ />
229
+ ),
230
+ size: 60,
231
+ enableResizing: false,
232
+ }),
233
+ ```
234
+
235
+ ### Other bound components
236
+
237
+ On the header render prop: `SelectAllCell`, `ExpandAllCell`, `AggregationFooter`,
238
+ `HeaderMenu`, `HeaderSortLabel`, `HeaderResizeHandle`. On the cell one:
239
+ `SelectCell`, `ExpandCell`, `GroupCell`, `PinRowCell`, `ActionsCell` and the
240
+ formatter cells. `LayoutTable` already places the menu, the sort label and the
241
+ resize handle, so reach for those three only when building a table by hand.
242
+
243
+ ### Custom cells and headers
244
+
245
+ The render prop only exposes the components registered in the library. To write your
246
+ own, read the context directly inside a plain component: `useCellContext<TValue>()`,
247
+ `useHeaderContext()` or `useTableContext()` from `wcz-layout/hooks`.
248
+ `layoutTableFeatures` and the `LayoutTableFeatures` type are the feature set
249
+ `useLayoutTable` installs — you need them only to type a hand-built table instance.
250
+
251
+ ## Common Mistakes
252
+
253
+ ### CRITICAL: Writing TanStack Table v8 column definitions
254
+
255
+ Wrong: `accessorKey: "name"`, `cell: (info) => info.getValue()`, `getCoreRowModel:
256
+ getCoreRowModel()`.
257
+
258
+ Correct: `columnHelper.accessor("name", { cell: ({ cell }) => <cell.ValueCell /> })`
259
+ inside `columnHelper.columns([...])`, and no row models at all.
260
+
261
+ This is v9. v8 column defs either type-error inside `columnHelper.columns()` or
262
+ silently no-op, and row models are gone.
263
+
264
+ ### HIGH: Adding your own virtualizer or pager
265
+
266
+ Wrong: wrapping rows in `useVirtualizer` from `@tanstack/react-virtual`, or bolting on
267
+ a `TablePagination`.
268
+
269
+ Correct: render `<LayoutTable table={table} />` and pass `pagination` if the user wants
270
+ a pager.
271
+
272
+ `LayoutTable` already virtualizes rows and columns. A second virtualizer fights the
273
+ first over scroll position.
274
+
275
+ Use only `LayoutTable`'s `pagination` prop for its pager.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: unslop
3
+ description: Cut AI tells from any writing. Must always apply.
4
+ ---
5
+
6
+ # Unslop
7
+
8
+ Edit text to remove AI patterns and add human voice.
9
+
10
+ ## Process
11
+
12
+ 1. Scan for the patterns below.
13
+ 2. Rewrite. Preserve meaning, match intended tone.
14
+ 3. Add soul (see next section).
15
+ 4. Self-audit: "What makes this obviously AI generated?" Fix remaining tells.
16
+
17
+ ## Adding soul
18
+
19
+ Removing patterns is half the job. Sterile, voiceless writing is just as obvious.
20
+
21
+ - **Have opinions.** React to facts instead of neutrally listing pros and cons.
22
+ - **Vary rhythm.** Short sentences. Then longer ones that take their time. Mix it up.
23
+ - **Acknowledge complexity.** "Impressive but also kind of unsettling" beats "impressive."
24
+ - **Use "I" when it fits.** First person isn't unprofessional.
25
+ - **Let some mess in.** Perfect structure looks machine-made.
26
+ - **Be specific.** Not "this is concerning" but "there's something unsettling about agents churning away at 3am."
27
+
28
+ ## Patterns to detect and fix
29
+
30
+ ### Content
31
+
32
+ 1. **Puffery.** "pivotal moment", "testament to", "evolving landscape", "setting the stage for", "indelible mark", "deeply rooted". Cut puffery, state what happened.
33
+ 2. **Name-dropping.** Listing media outlets without context. Pick one, say what was said.
34
+ 3. **Superficial -ing phrases.** "highlighting...", "ensuring...", "reflecting...", "showcasing...", "fostering...". Delete or expand with real sources.
35
+ 4. **Promotional language.** "nestled", "vibrant", "breathtaking", "groundbreaking", "renowned", "stunning", "must-visit". Use neutral descriptions.
36
+ 5. **Vague attributions.** "Experts believe", "Industry reports suggest", "Some critics argue". Name the source or delete.
37
+ 6. **Formulaic challenges.** "Despite challenges... continues to thrive." Replace with specific facts.
38
+
39
+ ### Language
40
+
41
+ 7. **AI vocabulary.** Additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Replace with plain words.
42
+ 8. **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Just say "is" or "has".
43
+ 9. **"Not just X, but Y."** State the point directly instead.
44
+ 10. **Rule of three.** Forcing ideas into groups of three. Use the natural number.
45
+ 11. **Synonym cycling.** Protagonist, main character, central figure, hero all in one paragraph. Pick one, repeat it.
46
+ 12. **False ranges.** "from X to Y" where X and Y aren't on a meaningful scale. List topics directly.
47
+
48
+ ### Style
49
+
50
+ 13. **Em dash overuse.** Avoid em dashes entirely. Use periods or commas only (no parentheses, no en dashes, no hyphen-as-dash substitutes). Em dashes are an AI tell, and reaching for parentheses instead just trades one tell for another. If a thought needs separation, end the sentence or use a comma.
51
+ 14. **Colon overuse.** Colons are fine before a list or example. Not as mid-sentence connectors. "If you're coming from traditional automation: instead of registering event handlers, you describe conditions" adds nothing with the colon. Rewrite to let the point stand on its own without comparison framing. "Describing when the scheduler should fire works best as plain English." Same meaning, no crutch punctuation.
52
+ 15. **Boldface overuse.** Don't bold every proper noun or acronym.
53
+ 16. **Inline-header lists.** The tell is a bold label and colon that restates the line: "**Performance:** Performance improved...". Convert those to prose. A bold lead-in that ends in a period, names the item, and is followed by genuinely new detail ("**Schema in TypeScript.** Tables live in one file.") is fine, not a tell.
54
+ 17. **Title case headings.** Use sentence case.
55
+ 18. **Decorative emojis.** Remove from headings and bullets.
56
+ 19. **Curly quotes.** Replace with straight quotes.
57
+
58
+ ### Communication artifacts
59
+
60
+ 20. **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Of course!", "Certainly!", "Found the smoking gun!" Remove.
61
+ 21. **Cutoff disclaimers.** "While specific details are limited..." Find sources or remove.
62
+ 22. **Sycophantic tone.** "Great question! You're absolutely right!" Respond directly.
63
+
64
+ ### Filler
65
+
66
+ 23. **Filler phrases.** "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.
67
+ 24. **Excessive hedging.** "could potentially possibly be argued that it might" becomes "may".
68
+ 25. **Generic conclusions.** "The future looks bright." State specific plans or facts.
69
+
70
+ ### Jargon
71
+
72
+ 26. **Abstract metaphor nouns.** Substrate, wedge, vector, locus, vantage, nexus, primitive (as noun), harness (as metaphor), surface (as in "API surface"), bedrock, scaffolding (as metaphor), modality, paradigm, gold-plating, ratchet (as metaphor), evacuate (for moving code), endgame, north star, flywheel. These read as technical but usually have a plainer concrete word. "Substrate" becomes "base". "Wedge in" becomes "add". "Vector" becomes "way" or "method". "Gold-plating" becomes "more than the job needs". "Ratchet" becomes the mechanism's real name or "a limit that only tightens". "Evacuate" becomes "move out". "Endgame" becomes "the last phase". Pick the concrete word.
73
+
74
+ ### Plain speech
75
+
76
+ 27. **Say what it does, not how it feels.** "the database stays close at hand", "SQL you can read", "types that follow your schema" name a feeling. The fix names the mechanism or a number: "`.toSQL()` returns the exact string sent to the database", "a column rename fails the build". Ask what the sentence tells the reader to do or know, then write that. If you can't restate it as a concrete instruction, fact, or number, cut it. One more check: if the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it.
77
+ 28. **Shorten or split dense sentences.** If the reader has to backtrack to parse a sentence, break it in two or drop clauses. One idea per sentence.
78
+ 29. **Active voice.** Prefer it. Catch "is/are/was/were + past participle" and name the actor: "queries are validated" becomes "the compiler validates queries", "the file is parsed by the loader" becomes "the loader parses the file". Passive is fine only when the actor is unknown or genuinely doesn't matter.
79
+ 30. **Cut adverbs, or use a stronger verb.** "runs quickly" becomes "is fast" or the number. "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.
80
+ 31. **Prefer the plain word.** "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if". The fancier synonym is rarely clearer.
@@ -1,7 +0,0 @@
1
- import { createContext } from "react";
2
- //#region src/contexts/NotificationContext.tsx
3
- const NotificationContext = createContext(null);
4
- //#endregion
5
- export { NotificationContext as t };
6
-
7
- //# sourceMappingURL=NotificationContext-CgwUOeW0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationContext-CgwUOeW0.mjs","names":[],"sources":["../src/contexts/NotificationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport type { AlertColor } from \"@mui/material/Alert\";\n\nexport interface NotificationOptions {\n severity?: AlertColor;\n autoHideDuration?: number;\n}\n\nexport interface NotificationContextValue {\n notify: (message: string, options?: NotificationOptions) => void;\n}\n\nexport const NotificationContext = createContext<NotificationContextValue | null>(null);\n"],"mappings":";;AAYA,MAAa,sBAAsB,cAA+C,IAAI"}
@@ -1,48 +0,0 @@
1
- import { i as buildUser, m as serverEnv, o as hasPermission, u as getSessionUser } from "./utils-DjdexspV.mjs";
2
- import { createMiddleware } from "@tanstack/react-start";
3
- import * as jose from "jose";
4
- //#region src/middleware/authMiddleware.ts
5
- async function resolveUser(request) {
6
- const authHeader = request.headers.get("Authorization");
7
- if (authHeader?.startsWith("Bearer ")) {
8
- let payload;
9
- try {
10
- payload = await verifyToken(authHeader.substring(7));
11
- } catch (error) {
12
- throw Response.json({ message: error instanceof Error ? error.message : "Unauthorized: Invalid access token" }, { status: 401 });
13
- }
14
- return buildUser(payload);
15
- }
16
- return getSessionUser();
17
- }
18
- const requiredAuthenticationMiddleware = createMiddleware().server(async ({ next, request }) => {
19
- const user = await resolveUser(request);
20
- if (!user) throw Response.json({ message: "Unauthorized: User not signed in" }, { status: 401 });
21
- return next({ context: { user } });
22
- });
23
- const publicAuthenticationMiddleware = createMiddleware().server(async ({ next, request }) => {
24
- return next({ context: { user: await resolveUser(request) } });
25
- });
26
- function authenticationMiddleware(options) {
27
- return options?.optional ? publicAuthenticationMiddleware : requiredAuthenticationMiddleware;
28
- }
29
- const authorizationMiddleware = (permissionKey) => createMiddleware().middleware([authenticationMiddleware()]).server(async ({ next, context }) => {
30
- if (hasPermission(context.user, permissionKey)) return next();
31
- throw Response.json({ message: `Forbidden: User ${context.user.name} is not authorized to access this resource` }, { status: 403 });
32
- });
33
- async function verifyToken(token) {
34
- const { payload } = await jose.jwtVerify(token, getJWKS(), {
35
- issuer: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/v2.0`,
36
- audience: serverEnv.ENTRA_CLIENT_ID
37
- });
38
- return payload;
39
- }
40
- let jwksCache = null;
41
- function getJWKS() {
42
- jwksCache ??= jose.createRemoteJWKSet(new URL(`https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/discovery/v2.0/keys`));
43
- return jwksCache;
44
- }
45
- //#endregion
46
- export { authorizationMiddleware as n, authenticationMiddleware as t };
47
-
48
- //# sourceMappingURL=authMiddleware-DPly0b_T.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authMiddleware-DPly0b_T.mjs","names":[],"sources":["../src/middleware/authMiddleware.ts"],"sourcesContent":["import { createMiddleware } from \"@tanstack/react-start\";\nimport * as jose from \"jose\";\nimport type { permissions } from \"virtual:wcz-layout\";\nimport { serverEnv } from \"~/env\";\nimport { getSessionUser } from \"~/lib/auth/user\";\nimport { buildUser, hasPermission } from \"~/lib/utils\";\nimport type { TokenPayload } from \"~/models/TokenPayload\";\nimport type { User } from \"~/models/User\";\n\nasync function resolveUser(request: Request): Promise<User | null> {\n const authHeader = request.headers.get(\"Authorization\");\n\n if (authHeader?.startsWith(\"Bearer \")) {\n let payload: TokenPayload;\n try {\n payload = await verifyToken(authHeader.substring(\"Bearer \".length));\n } catch (error) {\n throw Response.json(\n { message: error instanceof Error ? error.message : \"Unauthorized: Invalid access token\" },\n { status: 401 },\n );\n }\n return buildUser(payload);\n }\n\n return getSessionUser();\n}\n\nconst requiredAuthenticationMiddleware = createMiddleware().server<{ user: User }>(\n async ({ next, request }) => {\n const user = await resolveUser(request);\n\n if (!user)\n throw Response.json({ message: \"Unauthorized: User not signed in\" }, { status: 401 });\n\n return next({ context: { user } });\n },\n);\n\nconst publicAuthenticationMiddleware = createMiddleware().server<{ user: User | null }>(\n async ({ next, request }) => {\n const user = await resolveUser(request);\n return next({ context: { user } });\n },\n);\n\nexport function authenticationMiddleware(options?: {\n optional?: false;\n}): typeof requiredAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options: {\n optional: true;\n}): typeof publicAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options: {\n optional: boolean;\n}): typeof requiredAuthenticationMiddleware | typeof publicAuthenticationMiddleware;\n\nexport function authenticationMiddleware(options?: { optional?: boolean }) {\n return options?.optional ? publicAuthenticationMiddleware : requiredAuthenticationMiddleware;\n}\n\nexport const authorizationMiddleware = (permissionKey: keyof typeof permissions) =>\n createMiddleware()\n .middleware([authenticationMiddleware()])\n .server(async ({ next, context }) => {\n if (hasPermission(context.user, permissionKey)) return next();\n throw Response.json(\n {\n message: `Forbidden: User ${context.user.name} is not authorized to access this resource`,\n },\n { status: 403 },\n );\n });\n\nasync function verifyToken(token: string): Promise<TokenPayload> {\n const { payload } = await jose.jwtVerify(token, getJWKS(), {\n issuer: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/v2.0`,\n audience: serverEnv.ENTRA_CLIENT_ID,\n });\n return payload as unknown as TokenPayload;\n}\n\nlet jwksCache: ReturnType<typeof jose.createRemoteJWKSet> | null = null;\n\nfunction getJWKS() {\n jwksCache ??= jose.createRemoteJWKSet(\n new URL(`https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}/discovery/v2.0/keys`),\n );\n return jwksCache;\n}\n"],"mappings":";;;;AASA,eAAe,YAAY,SAAwC;CACjE,MAAM,aAAa,QAAQ,QAAQ,IAAI,eAAe;CAEtD,IAAI,YAAY,WAAW,SAAS,GAAG;EACrC,IAAI;EACJ,IAAI;GACF,UAAU,MAAM,YAAY,WAAW,UAAU,CAAgB,CAAC;EACpE,SAAS,OAAO;GACd,MAAM,SAAS,KACb,EAAE,SAAS,iBAAiB,QAAQ,MAAM,UAAU,qCAAqC,GACzF,EAAE,QAAQ,IAAI,CAChB;EACF;EACA,OAAO,UAAU,OAAO;CAC1B;CAEA,OAAO,eAAe;AACxB;AAEA,MAAM,mCAAmC,iBAAiB,CAAC,CAAC,OAC1D,OAAO,EAAE,MAAM,cAAc;CAC3B,MAAM,OAAO,MAAM,YAAY,OAAO;CAEtC,IAAI,CAAC,MACH,MAAM,SAAS,KAAK,EAAE,SAAS,mCAAmC,GAAG,EAAE,QAAQ,IAAI,CAAC;CAEtF,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACnC,CACF;AAEA,MAAM,iCAAiC,iBAAiB,CAAC,CAAC,OACxD,OAAO,EAAE,MAAM,cAAc;CAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAA,MADN,YAAY,OAAO,EACR,EAAE,CAAC;AACnC,CACF;AAcA,SAAgB,yBAAyB,SAAkC;CACzE,OAAO,SAAS,WAAW,iCAAiC;AAC9D;AAEA,MAAa,2BAA2B,kBACtC,iBAAiB,CAAC,CACf,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,CACxC,OAAO,OAAO,EAAE,MAAM,cAAc;CACnC,IAAI,cAAc,QAAQ,MAAM,aAAa,GAAG,OAAO,KAAK;CAC5D,MAAM,SAAS,KACb,EACE,SAAS,mBAAmB,QAAQ,KAAK,KAAI,4CAC/C,GACA,EAAE,QAAQ,IAAI,CAChB;AACF,CAAC;AAEL,eAAe,YAAY,OAAsC;CAC/D,MAAM,EAAE,YAAY,MAAM,KAAK,UAAU,OAAO,QAAQ,GAAG;EACzD,QAAQ,qCAAqC,UAAU,gBAAe;EACtE,UAAU,UAAU;CACtB,CAAC;CACD,OAAO;AACT;AAEA,IAAI,YAA+D;AAEnE,SAAS,UAAU;CACjB,cAAc,KAAK,mBACjB,IAAI,IAAI,qCAAqC,UAAU,gBAAe,qBAAsB,CAC9F;CACA,OAAO;AACT"}