@exxatdesignux/ui 0.2.15 → 0.2.17

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 (110) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/consumer-extras/cursor-skills/exxat-collaboration-access/SKILL.md +3 -1
  3. package/consumer-extras/cursor-skills/exxat-ds-skill/SKILL.md +151 -3
  4. package/consumer-extras/cursor-skills/exxat-ds-skill/references/accessibility.md +142 -0
  5. package/consumer-extras/cursor-skills/exxat-ds-skill/references/coach-marks.md +169 -0
  6. package/consumer-extras/cursor-skills/exxat-ds-skill/references/data-table-pattern.md +382 -0
  7. package/consumer-extras/cursor-skills/exxat-mono-ids/SKILL.md +56 -0
  8. package/consumer-extras/cursor-skills/exxat-primary-nav-secondary-panel/SKILL.md +17 -1
  9. package/consumer-extras/patterns/collaboration-access-pattern.md +2 -0
  10. package/package.json +3 -3
  11. package/src/components/ui/banner.tsx +2 -0
  12. package/src/components/ui/chart.tsx +57 -2
  13. package/src/components/ui/sidebar.tsx +1 -0
  14. package/src/globals.css +21 -2
  15. package/src/theme.css +4 -2
  16. package/template/.claude/skills/exxat-ds-skill/SKILL.md +1 -1
  17. package/template/.cursor/rules/exxat-mono-ids.mdc +30 -0
  18. package/template/AGENTS.md +23 -18
  19. package/template/app/(app)/data-list/page.tsx +2 -2
  20. package/template/app/(app)/question-bank/layout.tsx +27 -7
  21. package/template/app/(app)/question-bank/new/page.tsx +58 -0
  22. package/template/app/globals.css +136 -2
  23. package/template/app/layout.tsx +41 -5
  24. package/template/components/app-sidebar.tsx +141 -59
  25. package/template/components/ask-leo-sidebar.tsx +1 -4
  26. package/template/components/brand-color-picker.tsx +344 -0
  27. package/template/components/compliance-list-view.tsx +33 -51
  28. package/template/components/compliance-table.tsx +24 -0
  29. package/template/components/data-table/index.tsx +68 -24
  30. package/template/components/data-table/pagination.tsx +0 -1
  31. package/template/components/data-table/types.ts +4 -1
  32. package/template/components/data-table/use-table-state.ts +243 -94
  33. package/template/components/data-views/data-row-list.tsx +183 -0
  34. package/template/components/data-views/finder-panel-view.tsx +2 -2
  35. package/template/components/data-views/index.ts +26 -3
  36. package/template/components/data-views/list-page-split-details-placeholder.tsx +3 -3
  37. package/template/components/data-views/list-page-split-hub-tokens.ts +1 -1
  38. package/template/components/data-views/list-page-tree-column-header.tsx +1 -1
  39. package/template/components/data-views/os-folder-glyph.tsx +8 -0
  40. package/template/components/data-views/outline-tree-menu.tsx +157 -0
  41. package/template/components/data-views/question-bank-folder-tree-branch.tsx +210 -0
  42. package/template/components/export-drawer.tsx +1 -1
  43. package/template/components/exxat-product-logo.tsx +173 -379
  44. package/template/components/folder-details-shell.tsx +1 -1
  45. package/template/components/hub-tree-panel-view.tsx +88 -80
  46. package/template/components/invite-collaborators-drawer.tsx +5 -3
  47. package/template/components/key-metrics.tsx +116 -51
  48. package/template/components/new-placement-form.tsx +4 -2
  49. package/template/components/new-question-composer.tsx +2208 -0
  50. package/template/components/page-breadcrumb-trail.tsx +131 -0
  51. package/template/components/page-header.tsx +21 -11
  52. package/template/components/{data-views/placement-board-card.tsx → placement-board-card.tsx} +1 -1
  53. package/template/components/placement-detail.tsx +1 -1
  54. package/template/components/placements-board-view.tsx +1 -1
  55. package/template/components/{data-list-client.tsx → placements-client.tsx} +9 -7
  56. package/template/components/placements-list-view.tsx +18 -132
  57. package/template/components/{data-list-table-cells.test.tsx → placements-table-cells.test.tsx} +2 -2
  58. package/template/components/{data-list-table-cells.tsx → placements-table-cells.tsx} +1 -1
  59. package/template/components/placements-table-columns.tsx +2 -2
  60. package/template/components/{data-list-table.tsx → placements-table.tsx} +67 -58
  61. package/template/components/product-switcher.tsx +26 -11
  62. package/template/components/product-wordmark.tsx +285 -0
  63. package/template/components/question-bank-client.tsx +130 -70
  64. package/template/components/question-bank-hub-client.tsx +108 -115
  65. package/template/components/question-bank-list-view.tsx +30 -54
  66. package/template/components/question-bank-new-folder-sheet.tsx +1 -1
  67. package/template/components/question-bank-page-header.tsx +18 -2
  68. package/template/components/question-bank-secondary-nav.tsx +12 -228
  69. package/template/components/question-bank-table.tsx +30 -5
  70. package/template/components/rotations-empty-state.tsx +3 -0
  71. package/template/components/secondary-panel.tsx +24 -4
  72. package/template/components/settings-appearance-card.tsx +584 -141
  73. package/template/components/site-header.tsx +56 -32
  74. package/template/components/sites-list-view.tsx +31 -36
  75. package/template/components/sites-table.tsx +24 -0
  76. package/template/components/table-properties/drawer.tsx +1 -1
  77. package/template/components/team-client.tsx +1 -1
  78. package/template/components/team-list-view.tsx +34 -50
  79. package/template/components/team-table.tsx +29 -3
  80. package/template/components/templates/dedicated-search-landing-template.tsx +86 -20
  81. package/template/components/templates/list-page.tsx +1 -3
  82. package/template/components/templates/nested-secondary-panel-shell.tsx +11 -6
  83. package/template/components/ui/dot-pattern.tsx +50 -26
  84. package/template/components/ui/leo-icon.tsx +23 -3
  85. package/template/contexts/product-context.tsx +51 -7
  86. package/template/contexts/system-banner-context.tsx +112 -4
  87. package/template/docs/collaboration-access-pattern.md +2 -0
  88. package/template/docs/question-bank-hub-header-pattern.md +25 -0
  89. package/template/eslint.config.mjs +18 -0
  90. package/template/hooks/use-secondary-panel-hub-nav.ts +17 -1
  91. package/template/hooks/use-sidebar-reflow-zoom.ts +21 -11
  92. package/template/lib/data-list-persistence.ts +57 -257
  93. package/template/lib/dev-log.test.ts +6 -5
  94. package/template/lib/exxat-palette.json +1462 -0
  95. package/template/lib/exxat-palette.ts +136 -0
  96. package/template/lib/list-page-table-properties.ts +1 -1
  97. package/template/lib/list-status-badges.ts +1 -1
  98. package/template/lib/mailto.ts +29 -0
  99. package/template/lib/mock/navigation.tsx +30 -1
  100. package/template/lib/placement-board-card-layout.ts +1 -1
  101. package/template/lib/product-brand.ts +268 -0
  102. package/template/lib/question-bank-authoring.ts +308 -0
  103. package/template/lib/question-bank-nav.ts +70 -0
  104. package/template/lib/raf-throttle.ts +45 -0
  105. package/template/lib/table-state-lifecycle.ts +474 -0
  106. package/template/next.config.mjs +156 -0
  107. package/template/package.json +6 -6
  108. package/template/stores/app-store.ts +46 -1
  109. package/template/components/command-menu-01.tsx +0 -133
  110. package/template/components/command-menu-02.tsx +0 -386
@@ -1,280 +1,80 @@
1
1
  /**
2
- * Persist Data list page UI: per-page shell (tabs, display options) and per–lifecycle-tab table state.
3
- * Keys are versioned so future migrations can bump `v` or the key suffix.
2
+ * @deprecated Placements-specific shim around the generic
3
+ * `@/lib/table-state-lifecycle`. New code SHOULD import the generic helpers
4
+ * (and the `useTableStateLifecycle` hook) directly. This file preserves the
5
+ * old API + the old storage key prefix (`exxat-ds:data-list:*`) so existing
6
+ * placements `localStorage` payloads continue to work during the migration.
4
7
  */
5
8
 
6
- import type { Dispatch, SetStateAction } from "react"
7
- import type { RowHeight } from "@/lib/row-height"
8
- import type { DataListDisplayOptions } from "@/lib/data-list-display-options"
9
- import type { ActiveFilter, ConditionalRule, SortRule } from "@/components/table-properties/types"
10
- import type { ViewTab } from "@/components/templates/list-page"
11
- import type { DataListViewType } from "@/lib/data-list-view"
12
-
13
- export const DATA_LIST_PAGE_STORAGE_KEY = "exxat-ds:data-list:page:v1"
9
+ import {
10
+ applyLifecyclePersisted as applyLifecyclePersistedGeneric,
11
+ loadLifecycleFromStorage as loadLifecycleFromStorageGeneric,
12
+ loadPageFromStorage as loadPageFromStorageGeneric,
13
+ lifecycleStorageKey as lifecycleStorageKeyGeneric,
14
+ pageStorageKey,
15
+ parsePersistedLifecycle,
16
+ parsePersistedPage,
17
+ scheduleLifecycleSave as scheduleLifecycleSaveGeneric,
18
+ schedulePageSave as schedulePageSaveGeneric,
19
+ serializeLifecycle as serializeLifecycleGeneric,
20
+ type PersistedLifecycleV1,
21
+ type PersistedPageV1,
22
+ type TableStatePersistSlice,
23
+ } from "@/lib/table-state-lifecycle"
24
+ import type { ConditionalRule } from "@/components/table-properties/types"
25
+
26
+ /** Legacy namespace — kept so existing placements payloads remain readable. */
27
+ const PLACEMENTS_NAMESPACE = "data-list"
28
+
29
+ export const DATA_LIST_PAGE_STORAGE_KEY = pageStorageKey(PLACEMENTS_NAMESPACE)
14
30
 
15
31
  export function lifecycleStorageKey(lifecycleTabId: string): string {
16
- return `exxat-ds:data-list:lifecycle:v1:${lifecycleTabId}`
17
- }
18
-
19
- const LIFECYCLE_SAVE_DEBOUNCE_MS = 400
20
- const PAGE_SAVE_DEBOUNCE_MS = 400
21
-
22
- const lifecycleTimers = new Map<string, ReturnType<typeof setTimeout>>()
23
- const pageTimer: { t?: ReturnType<typeof setTimeout> } = {}
24
-
25
- export interface PersistedLifecycleV1 {
26
- v: 1
27
- sortRules: SortRule[]
28
- search: string
29
- activeFilters: ActiveFilter[]
30
- filterConnectors: Record<string, "and" | "or">
31
- groupBy: string | null
32
- colOrder: string[]
33
- hiddenCols: string[]
34
- colWidths: Record<string, number>
35
- colPins: Record<string, "left" | "right">
36
- colWrap: Record<string, boolean>
37
- colMenuSearch: Record<string, string>
38
- rowHeight: RowHeight
39
- showGridlines: boolean
40
- filterBarVisible: boolean
41
- searchOpen: boolean
42
- conditionalRules: ConditionalRule[]
43
- pagination: boolean
44
- paginationPage: number
45
- paginationPageSize: number
46
- }
47
-
48
- export interface PersistedPageV1 {
49
- v: 1
50
- displayOptions: DataListDisplayOptions
51
- showMetrics: boolean
52
- tabs: ViewTab[]
53
- activeTabId: string
54
- }
55
-
56
- /** Narrow surface used to hydrate / snapshot table state without importing the hook implementation. */
57
- export interface TableStatePersistSlice {
58
- sortRules: SortRule[]
59
- search: string
60
- activeFilters: ActiveFilter[]
61
- filterConnectors: Record<string, "and" | "or">
62
- groupBy: string | null
63
- colOrder: string[]
64
- hiddenCols: Set<string>
65
- colWidths: Record<string, number>
66
- colPins: Record<string, "left" | "right">
67
- colWrap: Record<string, boolean>
68
- colMenuSearch: Record<string, string>
69
- rowHeight: RowHeight
70
- showGridlines: boolean
71
- filterBarVisible: boolean
72
- searchOpen: boolean
73
- setSortRules: Dispatch<SetStateAction<SortRule[]>>
74
- setSearch: Dispatch<SetStateAction<string>>
75
- setActiveFilters: Dispatch<SetStateAction<ActiveFilter[]>>
76
- setFilterConnectors: Dispatch<SetStateAction<Record<string, "and" | "or">>>
77
- setGroupBy: Dispatch<SetStateAction<string | null>>
78
- setColOrder: Dispatch<SetStateAction<string[]>>
79
- setHiddenCols: Dispatch<SetStateAction<Set<string>>>
80
- setColWidths: Dispatch<SetStateAction<Record<string, number>>>
81
- setColPins: Dispatch<SetStateAction<Record<string, "left" | "right">>>
82
- setColWrap: Dispatch<SetStateAction<Record<string, boolean>>>
83
- setColMenuSearch: Dispatch<SetStateAction<Record<string, string>>>
84
- setRowHeight: Dispatch<SetStateAction<RowHeight>>
85
- setShowGridlines: Dispatch<SetStateAction<boolean>>
86
- setFilterBarVisible: Dispatch<SetStateAction<boolean>>
87
- setSearchOpen: Dispatch<SetStateAction<boolean>>
88
- }
89
-
90
- const VIEW_TYPES: DataListViewType[] = ["table", "list", "board", "dashboard"]
91
-
92
- function isViewType(v: unknown): v is DataListViewType {
93
- return typeof v === "string" && (VIEW_TYPES as string[]).includes(v)
32
+ return lifecycleStorageKeyGeneric(PLACEMENTS_NAMESPACE, lifecycleTabId)
94
33
  }
95
34
 
96
- function parseViewTab(raw: unknown): ViewTab | null {
97
- if (!raw || typeof raw !== "object") return null
98
- const o = raw as Record<string, unknown>
99
- if (typeof o.id !== "string" || typeof o.label !== "string") return null
100
- if (!isViewType(o.viewType)) return null
101
- if (typeof o.icon !== "string" || typeof o.filterId !== "string") return null
102
- return {
103
- id: o.id,
104
- label: o.label,
105
- viewType: o.viewType,
106
- icon: o.icon,
107
- filterId: o.filterId,
108
- }
35
+ export {
36
+ parsePersistedLifecycle,
37
+ parsePersistedPage,
38
+ applyLifecyclePersistedGeneric as applyLifecyclePersisted,
39
+ type PersistedLifecycleV1,
40
+ type PersistedPageV1,
41
+ type TableStatePersistSlice,
109
42
  }
110
43
 
111
- export function parsePersistedPage(raw: string | null): PersistedPageV1 | null {
112
- if (!raw) return null
113
- try {
114
- const j = JSON.parse(raw) as unknown
115
- if (!j || typeof j !== "object") return null
116
- const o = j as Record<string, unknown>
117
- if (o.v !== 1) return null
118
- if (!o.displayOptions || typeof o.displayOptions !== "object") return null
119
- if (typeof o.showMetrics !== "boolean") return null
120
- if (!Array.isArray(o.tabs) || typeof o.activeTabId !== "string") return null
121
- const tabs = o.tabs.map(parseViewTab).filter((t): t is ViewTab => t !== null)
122
- if (tabs.length === 0) return null
123
- return {
124
- v: 1,
125
- displayOptions: o.displayOptions as DataListDisplayOptions,
126
- showMetrics: o.showMetrics,
127
- tabs,
128
- activeTabId: o.activeTabId,
129
- }
130
- } catch {
131
- return null
132
- }
44
+ export function loadLifecycleFromStorage(lifecycleTabId: string): PersistedLifecycleV1 | null {
45
+ return loadLifecycleFromStorageGeneric(PLACEMENTS_NAMESPACE, lifecycleTabId)
133
46
  }
134
47
 
135
- export function parsePersistedLifecycle(raw: string | null): PersistedLifecycleV1 | null {
136
- if (!raw) return null
137
- try {
138
- const j = JSON.parse(raw) as unknown
139
- if (!j || typeof j !== "object") return null
140
- const o = j as Record<string, unknown>
141
- if (o.v !== 1) return null
142
- if (!Array.isArray(o.sortRules)) return null
143
- if (typeof o.search !== "string") return null
144
- if (!Array.isArray(o.activeFilters)) return null
145
- if (!o.filterConnectors || typeof o.filterConnectors !== "object") return null
146
- if (o.groupBy !== null && typeof o.groupBy !== "string") return null
147
- if (!Array.isArray(o.colOrder)) return null
148
- if (!Array.isArray(o.hiddenCols)) return null
149
- if (!o.colWidths || typeof o.colWidths !== "object") return null
150
- if (!o.colPins || typeof o.colPins !== "object") return null
151
- if (!o.colWrap || typeof o.colWrap !== "object") return null
152
- if (!o.colMenuSearch || typeof o.colMenuSearch !== "object") return null
153
- if (typeof o.rowHeight !== "string") return null
154
- if (typeof o.showGridlines !== "boolean") return null
155
- if (typeof o.filterBarVisible !== "boolean") return null
156
- if (typeof o.searchOpen !== "boolean") return null
157
- if (!Array.isArray(o.conditionalRules)) return null
158
- if (typeof o.pagination !== "boolean") return null
159
- if (typeof o.paginationPage !== "number" || typeof o.paginationPageSize !== "number") return null
160
- return o as unknown as PersistedLifecycleV1
161
- } catch {
162
- return null
163
- }
48
+ export function scheduleLifecycleSave(
49
+ lifecycleTabId: string,
50
+ payload: PersistedLifecycleV1,
51
+ ): void {
52
+ scheduleLifecycleSaveGeneric(PLACEMENTS_NAMESPACE, lifecycleTabId, payload)
164
53
  }
165
54
 
166
- function mergeColOrder(saved: string[], columnKeys: Set<string>): string[] {
167
- const ordered = saved.filter(k => columnKeys.has(k))
168
- for (const k of columnKeys) {
169
- if (!ordered.includes(k)) ordered.push(k)
170
- }
171
- return ordered
55
+ export function loadPageFromStorage(): PersistedPageV1 | null {
56
+ return loadPageFromStorageGeneric(PLACEMENTS_NAMESPACE)
172
57
  }
173
58
 
174
- function filterRecordKeys<T extends Record<string, unknown>>(obj: T, keys: Set<string>): T {
175
- const out = { ...obj }
176
- for (const k of Object.keys(out)) {
177
- if (!keys.has(k)) delete out[k]
178
- }
179
- return out
59
+ export function schedulePageSave(payload: PersistedPageV1): void {
60
+ schedulePageSaveGeneric(PLACEMENTS_NAMESPACE, payload)
180
61
  }
181
62
 
182
- export function applyLifecyclePersisted(
183
- ts: TableStatePersistSlice,
184
- p: PersistedLifecycleV1,
185
- columnKeys: Set<string>,
186
- ): void {
187
- const colOrder = mergeColOrder(p.colOrder, columnKeys)
188
- const hidden = new Set(p.hiddenCols.filter(k => columnKeys.has(k)))
189
- const colWidths = filterRecordKeys(p.colWidths, columnKeys) as Record<string, number>
190
- const colPins = filterRecordKeys(p.colPins, columnKeys) as Record<string, "left" | "right">
191
- const colWrap = filterRecordKeys(p.colWrap, columnKeys) as Record<string, boolean>
192
- const colMenuSearch = filterRecordKeys(p.colMenuSearch, columnKeys) as Record<string, string>
193
-
194
- ts.setSortRules(p.sortRules)
195
- ts.setSearch(p.search)
196
- ts.setActiveFilters(p.activeFilters)
197
- ts.setFilterConnectors(p.filterConnectors)
198
- ts.setGroupBy(p.groupBy)
199
- ts.setColOrder(colOrder)
200
- ts.setHiddenCols(hidden)
201
- ts.setColWidths(colWidths)
202
- ts.setColPins(colPins)
203
- ts.setColWrap(colWrap)
204
- ts.setColMenuSearch(colMenuSearch)
205
- ts.setRowHeight(p.rowHeight)
206
- ts.setShowGridlines(p.showGridlines)
207
- ts.setFilterBarVisible(p.filterBarVisible)
208
- ts.setSearchOpen(p.searchOpen)
63
+ /**
64
+ * Placements lifecycle includes a few extra fields next to the table state.
65
+ * The generic serializer takes a free-form `extras` record; this thin
66
+ * adapter keeps the original call sites typed and ergonomic.
67
+ */
68
+ export interface PlacementsLifecycleExtras extends Record<string, unknown> {
69
+ conditionalRules: ConditionalRule[]
70
+ pagination: boolean
71
+ paginationPage: number
72
+ paginationPageSize: number
209
73
  }
210
74
 
211
75
  export function serializeLifecycle(
212
76
  ts: TableStatePersistSlice,
213
- extras: {
214
- conditionalRules: ConditionalRule[]
215
- pagination: boolean
216
- paginationPage: number
217
- paginationPageSize: number
218
- },
77
+ extras: PlacementsLifecycleExtras,
219
78
  ): PersistedLifecycleV1 {
220
- return {
221
- v: 1,
222
- sortRules: ts.sortRules,
223
- search: ts.search,
224
- activeFilters: ts.activeFilters,
225
- filterConnectors: ts.filterConnectors,
226
- groupBy: ts.groupBy,
227
- colOrder: ts.colOrder,
228
- hiddenCols: [...ts.hiddenCols],
229
- colWidths: { ...ts.colWidths },
230
- colPins: { ...ts.colPins },
231
- colWrap: { ...ts.colWrap },
232
- colMenuSearch: { ...ts.colMenuSearch },
233
- rowHeight: ts.rowHeight,
234
- showGridlines: ts.showGridlines,
235
- filterBarVisible: ts.filterBarVisible,
236
- searchOpen: ts.searchOpen,
237
- conditionalRules: extras.conditionalRules,
238
- pagination: extras.pagination,
239
- paginationPage: extras.paginationPage,
240
- paginationPageSize: extras.paginationPageSize,
241
- }
242
- }
243
-
244
- export function loadLifecycleFromStorage(lifecycleTabId: string): PersistedLifecycleV1 | null {
245
- if (typeof window === "undefined") return null
246
- return parsePersistedLifecycle(localStorage.getItem(lifecycleStorageKey(lifecycleTabId)))
247
- }
248
-
249
- export function scheduleLifecycleSave(lifecycleTabId: string, payload: PersistedLifecycleV1): void {
250
- if (typeof window === "undefined") return
251
- const prev = lifecycleTimers.get(lifecycleTabId)
252
- if (prev) clearTimeout(prev)
253
- const t = setTimeout(() => {
254
- lifecycleTimers.delete(lifecycleTabId)
255
- try {
256
- localStorage.setItem(lifecycleStorageKey(lifecycleTabId), JSON.stringify(payload))
257
- } catch {
258
- /* quota / private mode */
259
- }
260
- }, LIFECYCLE_SAVE_DEBOUNCE_MS)
261
- lifecycleTimers.set(lifecycleTabId, t)
262
- }
263
-
264
- export function loadPageFromStorage(): PersistedPageV1 | null {
265
- if (typeof window === "undefined") return null
266
- return parsePersistedPage(localStorage.getItem(DATA_LIST_PAGE_STORAGE_KEY))
267
- }
268
-
269
- export function schedulePageSave(payload: PersistedPageV1): void {
270
- if (typeof window === "undefined") return
271
- if (pageTimer.t) clearTimeout(pageTimer.t)
272
- pageTimer.t = setTimeout(() => {
273
- pageTimer.t = undefined
274
- try {
275
- localStorage.setItem(DATA_LIST_PAGE_STORAGE_KEY, JSON.stringify(payload))
276
- } catch {
277
- /* quota */
278
- }
279
- }, PAGE_SAVE_DEBOUNCE_MS)
79
+ return serializeLifecycleGeneric(ts, extras)
280
80
  }
@@ -3,25 +3,26 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
3
3
  import { devLog } from "./dev-log"
4
4
 
5
5
  describe("devLog", () => {
6
- const originalEnv = process.env.NODE_ENV
7
-
8
6
  beforeEach(() => {
9
7
  vi.spyOn(console, "log").mockImplementation(() => {})
10
8
  })
11
9
 
12
10
  afterEach(() => {
13
11
  vi.restoreAllMocks()
14
- process.env.NODE_ENV = originalEnv
12
+ vi.unstubAllEnvs()
15
13
  })
16
14
 
17
15
  it("logs in development", () => {
18
- process.env.NODE_ENV = "development"
16
+ // `process.env.NODE_ENV` is typed as readonly in modern Node typings; use
17
+ // Vitest's `stubEnv` so the test compiles without a `// @ts-expect-error`
18
+ // dance and auto-restores after `unstubAllEnvs()`.
19
+ vi.stubEnv("NODE_ENV", "development")
19
20
  devLog("hello", 1)
20
21
  expect(console.log).toHaveBeenCalledWith("hello", 1)
21
22
  })
22
23
 
23
24
  it("does not log in production", () => {
24
- process.env.NODE_ENV = "production"
25
+ vi.stubEnv("NODE_ENV", "production")
25
26
  devLog("silent")
26
27
  expect(console.log).not.toHaveBeenCalled()
27
28
  })