@neetechs/ui 0.0.3 → 0.0.4

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 (312) hide show
  1. package/README.md +118 -16
  2. package/dist/ai/ai-action-button/ai-action-button.css +36 -35
  3. package/dist/ai/ai-approval-card/ai-approval-card.css +20 -17
  4. package/dist/ai/ai-conversation-panel/ai-conversation-panel.css +70 -26
  5. package/dist/ai/ai-prompt-input/ai-prompt-input.css +36 -33
  6. package/dist/ai/ai-proposal-card/ai-proposal-card.css +17 -17
  7. package/dist/ai/ai-suggestion-card/ai-suggestion-card.css +27 -25
  8. package/dist/ai/ai-tool-call/ai-tool-call.css +15 -14
  9. package/dist/appearance/cache.d.ts +6 -1
  10. package/dist/appearance/cache.d.ts.map +1 -1
  11. package/dist/appearance/cache.js +57 -1
  12. package/dist/appearance/cache.js.map +1 -1
  13. package/dist/appearance/cookie.d.ts +16 -1
  14. package/dist/appearance/cookie.d.ts.map +1 -1
  15. package/dist/appearance/cookie.js +73 -4
  16. package/dist/appearance/cookie.js.map +1 -1
  17. package/dist/appearance/index.d.ts +7 -6
  18. package/dist/appearance/index.d.ts.map +1 -1
  19. package/dist/appearance/index.js +4 -4
  20. package/dist/appearance/index.js.map +1 -1
  21. package/dist/appearance/preference.d.ts +9 -1
  22. package/dist/appearance/preference.d.ts.map +1 -1
  23. package/dist/appearance/preference.js +54 -0
  24. package/dist/appearance/preference.js.map +1 -1
  25. package/dist/appearance/theme-controller.d.ts +31 -49
  26. package/dist/appearance/theme-controller.d.ts.map +1 -1
  27. package/dist/appearance/theme-controller.js +150 -145
  28. package/dist/appearance/theme-controller.js.map +1 -1
  29. package/dist/appearance/types.d.ts +29 -2
  30. package/dist/appearance/types.d.ts.map +1 -1
  31. package/dist/behaviors/announcer.d.ts +34 -0
  32. package/dist/behaviors/announcer.d.ts.map +1 -0
  33. package/dist/behaviors/announcer.js +150 -0
  34. package/dist/behaviors/announcer.js.map +1 -0
  35. package/dist/behaviors/calendar.d.ts +15 -0
  36. package/dist/behaviors/calendar.d.ts.map +1 -0
  37. package/dist/behaviors/calendar.js +77 -0
  38. package/dist/behaviors/calendar.js.map +1 -0
  39. package/dist/behaviors/data-grid.d.ts +18 -0
  40. package/dist/behaviors/data-grid.d.ts.map +1 -0
  41. package/dist/behaviors/data-grid.js +114 -0
  42. package/dist/behaviors/data-grid.js.map +1 -0
  43. package/dist/behaviors/dialog.d.ts +14 -0
  44. package/dist/behaviors/dialog.d.ts.map +1 -1
  45. package/dist/behaviors/dialog.js +24 -6
  46. package/dist/behaviors/dialog.js.map +1 -1
  47. package/dist/behaviors/direction.d.ts +10 -0
  48. package/dist/behaviors/direction.d.ts.map +1 -0
  49. package/dist/behaviors/direction.js +24 -0
  50. package/dist/behaviors/direction.js.map +1 -0
  51. package/dist/behaviors/drawer.d.ts +15 -3
  52. package/dist/behaviors/drawer.d.ts.map +1 -1
  53. package/dist/behaviors/drawer.js +25 -10
  54. package/dist/behaviors/drawer.js.map +1 -1
  55. package/dist/behaviors/dropdown.d.ts +11 -0
  56. package/dist/behaviors/dropdown.d.ts.map +1 -1
  57. package/dist/behaviors/dropdown.js +53 -11
  58. package/dist/behaviors/dropdown.js.map +1 -1
  59. package/dist/behaviors/focus-trap.d.ts.map +1 -1
  60. package/dist/behaviors/focus-trap.js +45 -5
  61. package/dist/behaviors/focus-trap.js.map +1 -1
  62. package/dist/behaviors/forms.d.ts +32 -0
  63. package/dist/behaviors/forms.d.ts.map +1 -0
  64. package/dist/behaviors/forms.js +147 -0
  65. package/dist/behaviors/forms.js.map +1 -0
  66. package/dist/behaviors/index.d.ts +8 -0
  67. package/dist/behaviors/index.d.ts.map +1 -1
  68. package/dist/behaviors/index.js +8 -0
  69. package/dist/behaviors/index.js.map +1 -1
  70. package/dist/behaviors/keyboard.d.ts.map +1 -1
  71. package/dist/behaviors/keyboard.js +4 -2
  72. package/dist/behaviors/keyboard.js.map +1 -1
  73. package/dist/behaviors/overlay.d.ts +6 -0
  74. package/dist/behaviors/overlay.d.ts.map +1 -1
  75. package/dist/behaviors/overlay.js +93 -3
  76. package/dist/behaviors/overlay.js.map +1 -1
  77. package/dist/behaviors/state.d.ts +49 -0
  78. package/dist/behaviors/state.d.ts.map +1 -0
  79. package/dist/behaviors/state.js +220 -0
  80. package/dist/behaviors/state.js.map +1 -0
  81. package/dist/behaviors/tabs.d.ts +18 -0
  82. package/dist/behaviors/tabs.d.ts.map +1 -0
  83. package/dist/behaviors/tabs.js +103 -0
  84. package/dist/behaviors/tabs.js.map +1 -0
  85. package/dist/behaviors/viewport.d.ts +40 -0
  86. package/dist/behaviors/viewport.d.ts.map +1 -0
  87. package/dist/behaviors/viewport.js +47 -0
  88. package/dist/behaviors/viewport.js.map +1 -0
  89. package/dist/components/alert/alert.css +13 -10
  90. package/dist/components/avatar/avatar.css +16 -15
  91. package/dist/components/badge/badge.css +6 -6
  92. package/dist/components/breadcrumb/breadcrumb.css +12 -10
  93. package/dist/components/button/button.css +65 -37
  94. package/dist/components/card/card.css +15 -14
  95. package/dist/components/checkbox/checkbox.css +13 -11
  96. package/dist/components/chip/chip.css +22 -20
  97. package/dist/components/data-grid/data-grid.css +167 -16
  98. package/dist/components/dialog/dialog.css +127 -63
  99. package/dist/components/drawer/drawer.css +117 -36
  100. package/dist/components/dropdown/dropdown.css +32 -14
  101. package/dist/components/icon-button/icon-button.css +41 -37
  102. package/dist/components/index.css +1 -2
  103. package/dist/components/input/input.css +10 -10
  104. package/dist/components/menu/menu.css +18 -17
  105. package/dist/components/pagination/pagination.css +13 -12
  106. package/dist/components/panel/panel.css +13 -12
  107. package/dist/components/progress/progress.css +20 -12
  108. package/dist/components/radio/radio.css +11 -9
  109. package/dist/components/segmented-control/segmented-control.css +20 -20
  110. package/dist/components/select/select.css +23 -9
  111. package/dist/components/skeleton/skeleton.css +14 -14
  112. package/dist/components/split-button/split-button.css +38 -31
  113. package/dist/components/switch/switch.css +25 -11
  114. package/dist/components/table/table.css +220 -0
  115. package/dist/components/tabs/tabs.css +36 -32
  116. package/dist/components/textarea/textarea.css +13 -13
  117. package/dist/components/toast/toast.css +43 -21
  118. package/dist/components/tooltip/tooltip.css +22 -19
  119. package/dist/domain/billing/index.css +19 -19
  120. package/dist/domain/calendar/agenda-list/agenda-list.css +224 -0
  121. package/dist/domain/calendar/day-slice/day-slice.css +18 -17
  122. package/dist/domain/calendar/day-timeline/day-timeline.css +42 -34
  123. package/dist/domain/calendar/event-card/event-card.css +20 -18
  124. package/dist/domain/calendar/index.css +2 -1
  125. package/dist/domain/calendar/month-grid/month-grid.css +34 -28
  126. package/dist/domain/calendar/week-grid/week-grid.css +63 -53
  127. package/dist/domain/companies/index.css +30 -29
  128. package/dist/index.d.ts +2 -1
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +2 -1
  131. package/dist/index.js.map +1 -1
  132. package/dist/localization/index.d.ts +8 -0
  133. package/dist/localization/index.d.ts.map +1 -0
  134. package/dist/localization/index.js +22 -0
  135. package/dist/localization/index.js.map +1 -0
  136. package/dist/patterns/command-palette/command-palette.css +39 -31
  137. package/dist/patterns/company-switcher/company-switcher.css +112 -85
  138. package/dist/patterns/content-state/content-state.css +236 -0
  139. package/dist/patterns/empty-state/empty-state.css +16 -15
  140. package/dist/patterns/error-state/error-state.css +14 -13
  141. package/dist/patterns/form-layout/form-layout.css +106 -0
  142. package/dist/patterns/index.css +8 -3
  143. package/dist/patterns/loading-state/loading-state.css +9 -9
  144. package/dist/patterns/master-detail/master-detail.css +103 -0
  145. package/dist/patterns/notification-center/notification-center.css +38 -33
  146. package/dist/patterns/page/page.css +219 -0
  147. package/dist/patterns/profile-menu/profile-menu.css +15 -14
  148. package/dist/patterns/search-bar/search-bar.css +38 -25
  149. package/dist/patterns/settings-layout/settings-layout.css +150 -0
  150. package/dist/patterns/workflow/workflow.css +168 -0
  151. package/dist/shell/app-shell/app-shell.css +8 -1
  152. package/dist/shell/header/header.css +14 -12
  153. package/dist/shell/index.css +2 -2
  154. package/dist/shell/mobile-nav/mobile-nav.css +18 -16
  155. package/dist/shell/sidebar/sidebar.css +10 -10
  156. package/dist/styles/accessibility.css +116 -0
  157. package/dist/styles/animations/motion.css +2 -2
  158. package/dist/styles/appearance/accent.css +173 -0
  159. package/dist/styles/appearance/density.css +61 -0
  160. package/dist/styles/appearance/motion.css +40 -0
  161. package/dist/styles/base.css +6 -5
  162. package/dist/styles/index.css +8 -1
  163. package/dist/styles/localization.css +56 -0
  164. package/dist/styles/reset.css +1 -0
  165. package/dist/styles/responsive.css +101 -0
  166. package/dist/styles/themes/dark.css +95 -13
  167. package/dist/styles/themes/high-contrast.css +182 -11
  168. package/dist/styles/themes/light.css +97 -15
  169. package/dist/styles/tokens/breakpoints.css +29 -7
  170. package/dist/styles/tokens/compatibility.css +33 -0
  171. package/dist/styles/tokens/elevation.css +1 -7
  172. package/dist/styles/tokens/index.css +2 -1
  173. package/dist/styles/tokens/radius.css +6 -1
  174. package/dist/styles/tokens/spacing.css +12 -6
  175. package/dist/styles/tokens/typography.css +3 -2
  176. package/dist/styles/utilities/layout.css +20 -2
  177. package/dist/styles/utilities/text.css +1 -1
  178. package/dist/types/index.d.ts +1 -0
  179. package/dist/types/index.d.ts.map +1 -1
  180. package/docs/accessibility.md +218 -0
  181. package/docs/appearance-and-theming.md +118 -0
  182. package/docs/component-architecture.md +137 -0
  183. package/docs/component-guidelines.md +64 -0
  184. package/docs/content-and-terminology.md +207 -0
  185. package/docs/design-system-baseline-audit.md +226 -0
  186. package/docs/design-token-contract.md +279 -0
  187. package/docs/localization-and-rtl.md +147 -0
  188. package/docs/migration.md +142 -0
  189. package/docs/page-patterns-and-workflows.md +260 -0
  190. package/docs/responsive-and-adaptive-design.md +351 -0
  191. package/docs/semantic-role-migration-audit.md +77 -0
  192. package/docs/states-feedback-and-recovery.md +206 -0
  193. package/docs/theming.md +3 -225
  194. package/package.json +32 -3
  195. package/src/ai/ai-action-button/ai-action-button.css +36 -35
  196. package/src/ai/ai-approval-card/ai-approval-card.css +20 -17
  197. package/src/ai/ai-conversation-panel/ai-conversation-panel.css +70 -26
  198. package/src/ai/ai-prompt-input/ai-prompt-input.css +36 -33
  199. package/src/ai/ai-proposal-card/ai-proposal-card.css +17 -17
  200. package/src/ai/ai-suggestion-card/ai-suggestion-card.css +27 -25
  201. package/src/ai/ai-tool-call/ai-tool-call.css +15 -14
  202. package/src/appearance/cache.ts +78 -2
  203. package/src/appearance/cookie.ts +123 -7
  204. package/src/appearance/index.ts +44 -2
  205. package/src/appearance/preference.ts +87 -1
  206. package/src/appearance/theme-controller.ts +221 -233
  207. package/src/appearance/types.ts +40 -2
  208. package/src/behaviors/announcer.ts +222 -0
  209. package/src/behaviors/calendar.ts +92 -0
  210. package/src/behaviors/data-grid.ts +133 -0
  211. package/src/behaviors/dialog.ts +42 -7
  212. package/src/behaviors/direction.ts +34 -0
  213. package/src/behaviors/drawer.ts +48 -15
  214. package/src/behaviors/dropdown.ts +76 -13
  215. package/src/behaviors/focus-trap.ts +49 -6
  216. package/src/behaviors/forms.ts +205 -0
  217. package/src/behaviors/index.ts +9 -1
  218. package/src/behaviors/keyboard.ts +5 -3
  219. package/src/behaviors/overlay.ts +116 -3
  220. package/src/behaviors/state.ts +282 -0
  221. package/src/behaviors/tabs.ts +137 -0
  222. package/src/behaviors/viewport.ts +61 -0
  223. package/src/components/alert/alert.css +13 -10
  224. package/src/components/avatar/avatar.css +16 -15
  225. package/src/components/badge/badge.css +6 -6
  226. package/src/components/breadcrumb/breadcrumb.css +12 -10
  227. package/src/components/button/button.css +65 -37
  228. package/src/components/card/card.css +15 -14
  229. package/src/components/checkbox/checkbox.css +13 -11
  230. package/src/components/chip/chip.css +22 -20
  231. package/src/components/data-grid/data-grid.css +167 -16
  232. package/src/components/dialog/dialog.css +127 -63
  233. package/src/components/drawer/drawer.css +117 -36
  234. package/src/components/dropdown/dropdown.css +32 -14
  235. package/src/components/icon-button/icon-button.css +41 -37
  236. package/src/components/index.css +1 -2
  237. package/src/components/input/input.css +10 -10
  238. package/src/components/menu/menu.css +18 -17
  239. package/src/components/pagination/pagination.css +13 -12
  240. package/src/components/panel/panel.css +13 -12
  241. package/src/components/progress/progress.css +20 -12
  242. package/src/components/radio/radio.css +11 -9
  243. package/src/components/segmented-control/segmented-control.css +20 -20
  244. package/src/components/select/select.css +23 -9
  245. package/src/components/skeleton/skeleton.css +14 -14
  246. package/src/components/split-button/split-button.css +38 -31
  247. package/src/components/switch/switch.css +25 -11
  248. package/src/components/table/table.css +220 -0
  249. package/src/components/tabs/tabs.css +36 -32
  250. package/src/components/textarea/textarea.css +13 -13
  251. package/src/components/toast/toast.css +43 -21
  252. package/src/components/tooltip/tooltip.css +22 -19
  253. package/src/domain/billing/index.css +19 -19
  254. package/src/domain/calendar/agenda-list/agenda-list.css +224 -0
  255. package/src/domain/calendar/day-slice/day-slice.css +18 -17
  256. package/src/domain/calendar/day-timeline/day-timeline.css +42 -34
  257. package/src/domain/calendar/event-card/event-card.css +20 -18
  258. package/src/domain/calendar/index.css +2 -1
  259. package/src/domain/calendar/month-grid/month-grid.css +34 -28
  260. package/src/domain/calendar/week-grid/week-grid.css +63 -53
  261. package/src/domain/companies/index.css +30 -29
  262. package/src/index.ts +3 -2
  263. package/src/localization/index.ts +56 -0
  264. package/src/patterns/command-palette/command-palette.css +39 -31
  265. package/src/patterns/company-switcher/company-switcher.css +112 -85
  266. package/src/patterns/content-state/content-state.css +236 -0
  267. package/src/patterns/empty-state/empty-state.css +16 -15
  268. package/src/patterns/error-state/error-state.css +14 -13
  269. package/src/patterns/form-layout/form-layout.css +106 -0
  270. package/src/patterns/index.css +8 -3
  271. package/src/patterns/loading-state/loading-state.css +9 -9
  272. package/src/patterns/master-detail/master-detail.css +103 -0
  273. package/src/patterns/notification-center/notification-center.css +38 -33
  274. package/src/patterns/page/page.css +219 -0
  275. package/src/patterns/profile-menu/profile-menu.css +15 -14
  276. package/src/patterns/search-bar/search-bar.css +38 -25
  277. package/src/patterns/settings-layout/settings-layout.css +150 -0
  278. package/src/patterns/workflow/workflow.css +168 -0
  279. package/src/shell/app-shell/app-shell.css +8 -1
  280. package/src/shell/header/header.css +14 -12
  281. package/src/shell/index.css +2 -2
  282. package/src/shell/mobile-nav/mobile-nav.css +18 -16
  283. package/src/shell/sidebar/sidebar.css +10 -10
  284. package/src/styles/accessibility.css +116 -0
  285. package/src/styles/animations/motion.css +2 -2
  286. package/src/styles/appearance/accent.css +173 -0
  287. package/src/styles/appearance/density.css +61 -0
  288. package/src/styles/appearance/motion.css +40 -0
  289. package/src/styles/base.css +6 -5
  290. package/src/styles/index.css +8 -1
  291. package/src/styles/localization.css +56 -0
  292. package/src/styles/reset.css +1 -0
  293. package/src/styles/responsive.css +101 -0
  294. package/src/styles/themes/dark.css +95 -13
  295. package/src/styles/themes/high-contrast.css +182 -11
  296. package/src/styles/themes/light.css +97 -15
  297. package/src/styles/tokens/breakpoints.css +29 -7
  298. package/src/styles/tokens/compatibility.css +33 -0
  299. package/src/styles/tokens/elevation.css +1 -7
  300. package/src/styles/tokens/index.css +2 -1
  301. package/src/styles/tokens/radius.css +6 -1
  302. package/src/styles/tokens/spacing.css +12 -6
  303. package/src/styles/tokens/typography.css +3 -2
  304. package/src/styles/utilities/layout.css +20 -2
  305. package/src/styles/utilities/text.css +1 -1
  306. package/src/types/index.ts +2 -1
  307. package/dist/components/modal/modal.css +0 -318
  308. package/dist/patterns/workspace-switcher/workspace-switcher.css +0 -380
  309. package/dist/shell/right-drawer/right-drawer.css +0 -108
  310. package/src/components/modal/modal.css +0 -318
  311. package/src/patterns/workspace-switcher/workspace-switcher.css +0 -380
  312. package/src/shell/right-drawer/right-drawer.css +0 -108
@@ -0,0 +1,77 @@
1
+ # Semantic role migration audit
2
+
3
+ Audit date: 2026-07-13. This report records the Prompt 3 role decisions for production CSS under `src/components`, `src/patterns`, `src/ai`, `src/domain`, and `src/shell`. Token-definition and theme files are intentionally analyzed separately because they are allowed to select primitive values.
4
+
5
+ ## Baseline and result
6
+
7
+ | Production use | Before Prompt 3 | After Prompt 3 | Enforcement |
8
+ | --- | ---: | ---: | --- |
9
+ | Primitive palette references (`var(--nt-color-*)`) | 0 | 0 | `prohibited-primitive-token` |
10
+ | Raw shadow-scale references | 63 in 34 files | 0 | `prohibited-raw-shadow` |
11
+ | Raw radius-scale references | 229 in 51 files | 0 | `prohibited-raw-radius` |
12
+ | Hardcoded hex/RGB/HSL/named colors | 3 in one file | 0 | `hardcoded-color` |
13
+ | Deprecated Prompt 2 aliases | 0 | 0 | `deprecated-internal-usage` |
14
+ | Undefined tokens | 0 | 0 | `undefined-token` |
15
+
16
+ The pre-migration raw shadow set was `--nt-shadow-xs`, `--nt-shadow-sm`, `--nt-shadow-md`, `--nt-shadow-lg`, `--nt-shadow-xl`, and `--nt-shadow-overlay`. The pre-migration raw radius set was `--nt-radius-sm`, `--nt-radius-md`, `--nt-radius-lg`, `--nt-radius-xl`, `--nt-radius-2xl`, and `--nt-radius-full`. No `none` or `3xl` raw radius was used by a production component.
17
+
18
+ ## Role decision report
19
+
20
+ | File / selector or selector family | Previous value or token | Intended role | Replacement |
21
+ | --- | --- | --- | --- |
22
+ | `src/components/button/button.css`: `.nt-button--primary` and hover/active | `--nt-accent*` | Primary product action | `--nt-action-primary-*` |
23
+ | `src/components/button/button.css`: secondary/ghost/danger variants | control, surface, and danger tokens selected locally | Secondary, neutral, and destructive actions | `--nt-action-secondary-*`, `--nt-action-neutral-*`, `--nt-action-danger-*` |
24
+ | `src/components/icon-button/icon-button.css`: all variants | Same local choices as button | Same action contract as text buttons | Action roles matching the variant |
25
+ | `src/components/split-button/split-button.css`: main/toggle variants | control, accent, danger, and surface tokens | Secondary, primary, destructive, and neutral actions | Matching `--nt-action-*` roles |
26
+ | `src/ai/ai-action-button/ai-action-button.css`: primary action | Orange product accent | Explicitly AI-powered action | `--nt-ai-action`, `--nt-ai-action-hover`, `--nt-ai-action-fg` |
27
+ | `src/ai/**/*.css`: AI identity, generated artifacts, processing, and borders | Product accent and legacy AI presentation names | AI origin/processing, not generic selection or status | `--nt-ai-fg`, `--nt-ai-bg-subtle`, `--nt-ai-border`, `--nt-ai-processing`, `--nt-ai-generated-surface` |
28
+ | Menu, chip, tabs, segmented control, pagination, switchers, command palette, data grid, app navigation active selectors | `--nt-accent*`, `--nt-border-interactive`, or generic surface hover | Selected/current state | `--nt-selection-bg`, `--nt-selection-bg-hover`, `--nt-selection-border`, `--nt-selection-fg`, `--nt-selection-indicator` |
29
+ | Button/form/control disabled selectors | `--nt-disabled-bg`, `--nt-disabled-border`, `--nt-disabled-text` | Shared disabled surface, border, and text | `--nt-bg-surface-disabled`, `--nt-border-disabled`, `--nt-text-disabled` |
30
+ | Dialog/modal/drawer backdrops and shell/loading scrims | `--nt-bg-overlay` | Backdrop/scrim | `--nt-bg-backdrop` |
31
+ | Dialog, modal, drawer, dropdown, tooltip, toast, search results, switchers, menu, command palette, notification center | Generic base surface | Overlay surface at the component's established color value | `--nt-bg-surface-overlay` |
32
+ | `src/domain/billing/index.css`: amount row muted/success/danger values | generic muted/success/danger text | Financial neutral/positive/negative meaning | `--nt-financial-neutral`, `--nt-financial-positive`, `--nt-financial-negative` |
33
+ | `src/components/progress/progress.css`: `.nt-progress__bar--striped` gradient | three `rgba(255, 255, 255, 0.18)` occurrences | Theme-owned progress stripe color | `--nt-progress-stripe-color` |
34
+
35
+ Status UI in alerts, badges, billing status blocks, timelines, toasts, and error/success patterns continues to use the established semantic families `--nt-info-*`, `--nt-success-*`, `--nt-warning-*`, and `--nt-danger-*`. Those names already express foreground/background/border meaning and were not replaced by duplicate synonyms.
36
+
37
+ Calendar event-category and availability styling remains status/accent-semantic rather than being forced into generic selection. Consumer-selected calendar color inputs are legitimate component data and are not converted to a fixed palette by this migration.
38
+
39
+ ## Elevation mapping
40
+
41
+ Every prior occurrence was reviewed by selector context. The scale-to-role conversion preserved light/dark values, then overlay/control cases were narrowed further.
42
+
43
+ | Previous token | Default migration role | Context-specific role |
44
+ | --- | --- | --- |
45
+ | `--nt-shadow-xs` | `--nt-elevation-inline` | Small event or inline raised detail |
46
+ | `--nt-shadow-sm` | `--nt-elevation-card` | `--nt-elevation-control` for selected controls |
47
+ | `--nt-shadow-md` | `--nt-elevation-card-hover` | Interactive card/event hover |
48
+ | `--nt-shadow-lg` | `--nt-elevation-raised` | Tooltip uses `--nt-elevation-popover` |
49
+ | `--nt-shadow-xl` | `--nt-elevation-popover` | Toast uses `--nt-elevation-toast` |
50
+ | `--nt-shadow-overlay` | `--nt-elevation-dialog` | Drawers use `--nt-elevation-drawer` |
51
+
52
+ Dark and light themes map semantic elevation to the same primitive shadow values that components previously used. High contrast maps semantic elevation to `none`; its existing strong border roles carry hierarchy instead.
53
+
54
+ ## Radius mapping
55
+
56
+ The values are unchanged. The migration replaces scale selection with purpose selection.
57
+
58
+ | Previous token | Semantic role | Typical selectors |
59
+ | --- | --- | --- |
60
+ | `--nt-radius-sm` | `--nt-radius-indicator` | Small focus target, key hint, compact marker |
61
+ | `--nt-radius-md` | `--nt-radius-control` | Controls and compact interactive rows |
62
+ | `--nt-radius-lg` | `--nt-radius-item` | List items and nested content items |
63
+ | `--nt-radius-xl` | `--nt-radius-card` | Cards and content surfaces |
64
+ | `--nt-radius-2xl` | `--nt-radius-dialog` | Dialog-scale or large overlay surfaces |
65
+ | `--nt-radius-full` | `--nt-radius-pill` | Pills, dots, rings, and circular geometry |
66
+
67
+ Popover and toast roots were narrowed to `--nt-radius-popover` and `--nt-radius-toast`. Existing component-specific roles such as `--nt-radius-button`, `--nt-radius-input`, `--nt-radius-avatar`, and `--nt-radius-drawer` remain canonical.
68
+
69
+ ## Files migrated
70
+
71
+ Fifty-seven production CSS files now reference at least one Prompt 3 semantic role: all seven AI modules; 29 non-empty core component modules except the empty table module; all seven domain modules; all nine patterns; and five shell modules. `src/patterns/loading-state/loading-state.css`, `src/shell/app-shell/app-shell.css`, and the shell drawers are included because their scrims/elevation were migrated. Index-only CSS files and the empty table file contain no role decision to migrate.
72
+
73
+ ## Legitimate exceptions
74
+
75
+ The production literal-color allowlist is empty. The validator supports only exact `{ filePath, value, reason }` entries for future legitimate swatches, user-selected calendar colors, visualization palettes, syntax highlighting, or brand assets. Transparent values, `currentColor`, and CSS system keywords are not treated as palette literals.
76
+
77
+ Primitive values remain permitted in `src/styles/tokens/color.css` and theme values remain permitted in `src/styles/themes/*.css`; those are the architecture's palette-to-semantic boundary, not component exceptions.
@@ -0,0 +1,206 @@
1
+ # States, feedback, and recovery
2
+
3
+ This document defines the Prompt 8 state contract for `@neetechs/ui`. It is framework-agnostic: the package provides CSS, DOM behavior helpers, and validation rules. Applications still own data fetching, translations, backend idempotency, routing, permissions, and business policy.
4
+
5
+ ## State Audit
6
+
7
+ | Area | Current state representation | Conflicts found | Canonical replacement |
8
+ | --- | --- | --- | --- |
9
+ | Button, icon button, split button, AI action button | `--loading`, `--disabled`, native `disabled`, `aria-disabled`, `aria-busy` | Loading was visually grouped with disabled in several classes, which can imply unavailable instead of in-progress | Native `disabled` only for unavailable; `data-nt-state="pending"` plus `aria-busy="true"` for pending; old classes remain compatible |
10
+ | Inputs, textarea, select, checkbox, radio, switch | `--error`, `--disabled`, `--readonly`, native states, `aria-invalid` | Error, invalid, and warning were not separated as validation dimensions; read-only and disabled were visually close | Native `disabled`/`readonly` first; `aria-invalid` for invalid; `data-nt-validation` for neutral/valid/invalid/warning when behavior needs it |
11
+ | Tabs, menu, dropdown, switchers, navigation | `aria-selected`, `aria-expanded`, `aria-current`, `--active`, `data-state` | `active` meant current page, selected value, or highlighted command depending on component | ARIA remains authoritative; `selected`, `expanded`, and `current` are separate interaction/navigation meanings |
12
+ | Dialog, modal, drawer, toast, command palette | `data-state="open|closed"` | `data-state` is too generic and overlaps operation state | Existing `data-state` remains compatibility; new state helpers use `data-nt-state` for async operation and component controllers keep overlay `data-state` |
13
+ | Empty, error, loading patterns | Separate public class families | Shared structure but separate state vocabulary; offline exists only under error; no unauthenticated/forbidden/not-found/maintenance contract | Canonical `.nt-content-state` with `data-nt-content-state`; old pattern classes remain supported |
14
+ | Toasts and alerts | Tone classes, `role=status|alert`, `aria-live` | Timeout, dedupe, pause, and critical-error behavior were documented but not owned by a controller | `ntCreateToastController` owns viewport-level timer/dedupe/cleanup; urgency sets live-region semantics |
15
+ | AI approval/proposal/tool-call | `pending`, `approved`, `rejected`, `running`, `success`, `error`, tone classes | Proposal, approval, execution, and result could collapse into one loading/success visual | AI write actions use proposal/execution/result terms in copy and `data-nt-state` only for the current operation |
16
+ | Domain status | Billing `draft/sent/paid/overdue`, company `active/pending/disabled`, calendar `busy/free/tentative/private` | Domain statuses are not platform operation states | Keep as domain statuses with visible text; do not map every domain word into the global state model |
17
+
18
+ Duplicate names found: `active`, `pending`, `success`, `error`, `danger`, `disabled`, and `loading` appear in multiple families. The canonical model separates dimensions so a name is interpreted in context. Deprecated state names: none are removed in this prompt. Modifier classes such as `--loading`, `--error`, `--active`, and `--disabled` remain compatibility styling hooks; new behavior should prefer native attributes and `data-nt-*` state attributes.
19
+
20
+ ## State Dimensions
21
+
22
+ Availability:
23
+
24
+ ```text
25
+ enabled | disabled | read-only
26
+ ```
27
+
28
+ Interaction:
29
+
30
+ ```text
31
+ rest | hover | focus-visible | pressed | selected | expanded | dragging
32
+ ```
33
+
34
+ Async operation:
35
+
36
+ ```text
37
+ idle | pending | success | error | canceled
38
+ ```
39
+
40
+ Validation:
41
+
42
+ ```text
43
+ neutral | valid | invalid | warning
44
+ ```
45
+
46
+ Content:
47
+
48
+ ```text
49
+ initial | loading | ready | refreshing | empty | partial | stale | error | offline | unauthenticated | forbidden | not-found | maintenance | success
50
+ ```
51
+
52
+ Valid combinations include `enabled + focus-visible + invalid`, `enabled + selected + pending`, `read-only + valid`, `ready + refreshing`, and `partial + warning`. Invalid combinations include `disabled + pressed`, `read-only + pending`, `pending + success content`, and `loading content + success operation`.
53
+
54
+ ## State Priority
55
+
56
+ Visual priority is contextual, but the default order is:
57
+
58
+ ```text
59
+ disabled -> pending -> error/invalid -> selected/expanded -> pressed -> focus-visible -> hover -> rest
60
+ ```
61
+
62
+ Focus remains visible over every state. Disabled controls suppress hover and pressed treatment. Pending controls are not disabled unless the operation also makes the control unavailable. Error and selected states must remain distinguishable by boundary, icon/text, and copy, not hue alone.
63
+
64
+ ## Native Attributes Versus Data Attributes
65
+
66
+ Use native semantics first:
67
+
68
+ - Native `disabled` for unavailable native controls.
69
+ - Native `readonly` for readable non-editable inputs and textareas.
70
+ - `aria-selected` for selectable items.
71
+ - `aria-expanded` for disclosures.
72
+ - `aria-current` for current navigation.
73
+ - `aria-invalid` for invalid fields.
74
+ - `aria-busy` for busy controls or regions.
75
+ - `aria-disabled` only when native disabled is unavailable or inappropriate, with explicit activation guards.
76
+
77
+ Use `data-nt-state` for async operation state and `data-nt-content-state` for content state. Existing `data-state` remains for overlays and compatibility. Do not mirror a state into native, ARIA, class, and data attributes unless each representation serves a distinct purpose.
78
+
79
+ ## Async Action Lifecycle
80
+
81
+ Canonical lifecycle:
82
+
83
+ ```text
84
+ idle -> pending -> success | error | canceled -> idle
85
+ ```
86
+
87
+ `ntCreateAsyncAction()` prevents duplicate activation while pending, keeps focus on the control, preserves the visible/accessibility name, sets `aria-busy`, sets `data-nt-state`, supports real cancellation through `AbortController`, resets success by default, and cleans up listeners and timers on destroy. It does not call APIs, retry requests, or invent cancellation after a request can no longer stop.
88
+
89
+ Pending buttons use `data-nt-state="pending"` and must retain their original label. A spinner may be added as a decorative child, but it must not replace the accessible name.
90
+
91
+ ## Loading and Progress
92
+
93
+ Use immediate control loading for save, delete, send, submit, refresh, AI approval, and upload initiation. Use section loading when one region waits for data. Use page loading only when the experience cannot render meaningfully. Use refreshing when useful stale content remains visible. Use determinate progress only when real completion is known; otherwise use indeterminate status text.
94
+
95
+ Skeletons are decorative unless they communicate a useful status. Mark skeleton geometry `aria-hidden="true"` and put `aria-busy="true"` plus readable text on the affected region. Reduced motion removes shimmer/spin; progress must still be understandable.
96
+
97
+ ## Content-State Architecture
98
+
99
+ Use `.nt-content-state` plus `data-nt-content-state` for new loading, empty, error, offline, unauthenticated, forbidden, not-found, maintenance, partial, stale, and success states. Presentation modes are `--inline`, `--section`, `--page`, `--compact`, and `--left`. The pattern supports icon/spinner, heading, description, actions, metadata, and optional details.
100
+
101
+ Existing `.nt-empty-state`, `.nt-error-state`, and `.nt-loading-state` remain public compatibility patterns. New product work should prefer `.nt-content-state`.
102
+
103
+ Empty states explain what is empty, whether that is expected, and the next useful action. Error states explain what failed, whether data was preserved, whether retry is available, and what to do next. Offline distinguishes device offline, backend unreachable, cached content, and queued changes. Unauthenticated means sign in is required; forbidden means the signed-in user lacks permission. Maintenance explains affected service, safety of existing work, and whether retrying helps.
104
+
105
+ ## Forms and Validation
106
+
107
+ Field states are `pristine`, `dirty`, `untouched`, `touched`, `validating`, `valid`, `invalid`, `warning`, `disabled`, and `read-only`. Not every state needs a visual style.
108
+
109
+ Validation appears after interaction or submission attempt, except when preventing harmful or impossible input. Server errors appear after submission and are cleared or updated when relevant values change. Do not use green success styling for every valid field. Warnings do not block submission unless the business rule says they do.
110
+
111
+ `ntConnectField()` owns stable label/help/error references. `ntCreateFormController()` owns submission state:
112
+
113
+ ```text
114
+ editing -> submitting -> success | failure
115
+ ```
116
+
117
+ It prevents duplicate submission, preserves entered data after failure, focuses the error summary when validation fails, distinguishes native validation from system failure through callbacks, sets busy state, and cleans up listeners.
118
+
119
+ ## Feedback Channel Matrix
120
+
121
+ | Channel | Use | Do not use for |
122
+ | --- | --- | --- |
123
+ | Field error | One field needs correction | Page-wide failures |
124
+ | Helper text | Stable constraints or guidance | Dynamic critical errors |
125
+ | Form summary | Submitted form has errors | Every keystroke |
126
+ | Inline status | One object or section changed | Global service outage |
127
+ | Alert | Contextual attention or urgent dynamic failure | Static decorative empty states |
128
+ | Page banner | Page-wide or service-wide status | Brief successful save |
129
+ | Toast | Brief noncritical result after an action | Field validation, blocking permission denial, irreversible confirmation, long error copy |
130
+ | Progress | Long running visible operation | Unknown state without text |
131
+ | Badge | Compact metadata/status | Interactive selection token |
132
+ | Dialog | User must decide before continuing | Action succeeded messages |
133
+ | Content state | Whole region/page cannot show normal content | Field-level issues |
134
+
135
+ ## Toast Rules
136
+
137
+ `ntCreateToastController()` is scoped to a viewport. It supports info, success, warning, error, and progress tones, dedupes by id, limits the visible stack, pauses auto-dismiss on hover/focus, keeps critical errors until dismissed, wires accessible close actions, and cleans up timers/listeners. Error toasts are assertive; routine toasts are polite. Critical actionable failures must also remain recoverable outside a disappearing toast.
138
+
139
+ ## Alert and Banner Rules
140
+
141
+ Static information should not use assertive announcements. Use `role="status"` for routine dynamic updates and `role="alert"` for immediate actionable failures. Banners support actions and explicit dismissal. Dismissing a critical banner must not remove the only recovery path.
142
+
143
+ ## Confirmations
144
+
145
+ No confirmation is needed for minor reversible actions with clear undo. Standard confirmation is used for meaningful consequences. Strong destructive confirmation is used for permanent deletion, revoked access, finalized financial records, multi-user impact, or costly reversal.
146
+
147
+ Confirmations state exact action, target, scope, consequence, reversibility, secondary effects, safe cancellation, and a specific primary label such as `Delete invoice` or `Revoke access`. For destructive confirmations, default focus usually favors the safe action.
148
+
149
+ ## AI Write-Action Confirmation
150
+
151
+ AI write actions must distinguish:
152
+
153
+ ```text
154
+ proposed | awaiting-confirmation | approved | executing | succeeded | partially-succeeded | failed | canceled | expired
155
+ ```
156
+
157
+ Before execution, show what AI intends to do, target system/record, exact affected fields, scope, reversibility, permission used, optional preview/diff, confirm action, and cancel/revise action. Do not claim success until backend confirmation. Partial success must identify what succeeded and failed. Raw API JSON may be expandable detail, never the only explanation.
158
+
159
+ ## Unsaved Changes
160
+
161
+ Contracts distinguish unsaved local changes, saved draft, saving in progress, save failed, and recovered draft. The design system provides banners, confirmation-dialog layout, and recovery action structure. Applications own router guards. Do not warn when nothing meaningful changed, and do not use a destructive red dialog for ordinary unsaved changes.
162
+
163
+ ## Retry, Cancel, Undo, and Rollback
164
+
165
+ Retry is shown only when safe to attempt again. Idempotency is an application responsibility. Cancel is shown only while an operation is actually cancellable. Undo is for succeeded reversible operations and must remain available long enough to understand the affected object. Rollback restores optimistic UI when the backend rejects a change and explains what happened while preserving input where possible.
166
+
167
+ ## Accessibility Requirements
168
+
169
+ State must not depend only on color. Busy controls keep their name. Live-region announcements are intentional and not repeated on every rerender. Error summaries receive focus only when useful. Toasts do not take focus automatically. Focus remains visible in forced colors and reduced motion.
170
+
171
+ ## Localization Requirements
172
+
173
+ Applications pass complete translated labels, errors, confirmations, and announcements. Do not concatenate fragments. Content states and dialogs must tolerate long Swedish copy and Arabic RTL content. Technical details use bidi isolation and `.nt-technical-value`.
174
+
175
+ ## Testing Commands
176
+
177
+ ```bash
178
+ npm run check:tokens
179
+ npm run check:a11y
180
+ npm run check:rtl
181
+ npm run check:architecture
182
+ npm run check:states
183
+ npm test
184
+ npm run test:browser
185
+ npm run build
186
+ npm pack --dry-run
187
+ ```
188
+
189
+ ## Manual QA Checklist
190
+
191
+ - Form validation failure and server failure preserve entered data.
192
+ - Successful save returns from pending and communicates completion.
193
+ - Delete confirmation uses specific labels and safe initial focus.
194
+ - Failed delete shows retry only when retry is safe.
195
+ - Upload progress has a label and failure recovery.
196
+ - Empty search result differs from permission-limited absence.
197
+ - Offline cached content differs from backend unreachable.
198
+ - Permission denied, maintenance, and not-found use distinct content states.
199
+ - Toast stack dedupes, pauses, and does not hide critical recovery.
200
+ - Unsaved-change confirmation does not appear for unchanged forms.
201
+ - AI proposal, execution success, and partial failure are distinct.
202
+ - Verify light, dark, high contrast, LTR, RTL, compact, comfortable, narrow viewport, 200 percent text, and reduced motion.
203
+
204
+ ## Known Limitations
205
+
206
+ The design system cannot implement router-specific unsaved-change guards, backend retries, permission decisions, request idempotency, upload transport, or permanent AI confirmation policy. Native screen-reader testing remains required. Responsive behavior for every state surface follows [responsive-and-adaptive-design.md](./responsive-and-adaptive-design.md); empty-state categories, confirmation structure, and message copy follow [content-and-terminology.md](./content-and-terminology.md) and the page-level placements in [page-patterns-and-workflows.md](./page-patterns-and-workflows.md).
package/docs/theming.md CHANGED
@@ -1,227 +1,5 @@
1
- # Theming & the shared appearance system
1
+ # Theming compatibility guide
2
2
 
3
- `@neetechs/ui/appearance` is the single appearance system for every
4
- `*.neetechs.com` application. It bootstraps, resolves and applies the
5
- account appearance preference. It is framework-neutral (no Angular, no
6
- React), SSR-safe, and touches no browser global at module import time.
3
+ The canonical guide is [appearance-and-theming.md](./appearance-and-theming.md).
7
4
 
8
- > **The database is the source of truth.**
9
- > **The cookie and local cache only reduce theme flashing.**
10
-
11
- ## Source-of-truth order
12
-
13
- 1. **Backend account preference** — stored by the Django backend, edited in
14
- MyAccount, applied via `setPreference(..., { source: 'backend' })`.
15
- 2. **Shared-domain bootstrap cookie** — `nt_theme`, set by the backend.
16
- 3. **Optional local cache** — `nt_theme_preference` in `localStorage`.
17
- 4. **System preference** — `(prefers-color-scheme: dark)`.
18
- 5. **Default fallback** — `dark` (matches the package `:root` tokens).
19
-
20
- The cookie and cache are bootstrap mechanisms only. They must never become
21
- independent per-application settings, and this package never persists the
22
- preference to the backend — MyAccount and Django own persistence.
23
-
24
- ## Values
25
-
26
- | Stored preference (`ThemePreference`) | Resolved theme (`ResolvedTheme`) |
27
- | ------------------------------------- | -------------------------------- |
28
- | `system`, `light`, `dark` | `light`, `dark` |
29
-
30
- `ResolvedThemeState` carries `{ preference, resolved, source }`, where
31
- `source` is one of `backend | cookie | cache | system | default`.
32
-
33
- The `high-contrast` theme remains available by setting
34
- `data-nt-theme="high-contrast"` manually; it is outside the stored
35
- preference contract for now.
36
-
37
- ## DOM contract
38
-
39
- The document root is canonical. The controller sets:
40
-
41
- ```html
42
- <html data-nt-theme="dark" data-nt-theme-preference="system">
43
- ```
44
-
45
- - `data-nt-theme="light|dark"` — the attribute the theme CSS renders from.
46
- - `data-nt-theme-preference="system|light|dark"` — informational.
47
-
48
- Applications must not set theme attributes on `body` or app roots
49
- independently. The theme token files
50
- (`src/styles/themes/{dark,light,high-contrast}.css`) already select on
51
- `[data-nt-theme='…']`; `:root` defaults to the dark token set.
52
-
53
- ## Cookie contract
54
-
55
- The backend may set the bootstrap cookie:
56
-
57
- ```text
58
- nt_theme=system | light | dark
59
- Domain=.neetechs.com; Secure; SameSite=Lax (production)
60
- ```
61
-
62
- `readThemeCookie(cookieString?)` reads only this cookie, tolerates
63
- malformed values, and rejects anything but the three allowed values. Pass
64
- the request `Cookie` header explicitly during SSR; without an argument it
65
- reads `document.cookie` when a document exists. The frontend never writes
66
- this cookie.
67
-
68
- ## Cache contract
69
-
70
- - Key: `nt_theme_preference` (`NT_THEME_CACHE_KEY`).
71
- - Values: `system | light | dark`; invalid values are deleted on read.
72
- - Read only when no cookie value exists; overridden by backend and cookie.
73
- - All storage access is guarded — storage errors never throw.
74
- - Disable with `useCache: false`.
75
-
76
- Legacy app keys (`themeMode`, `selectedTheme`, `aiTheme`, `billingTheme`)
77
- are not read by the controller. Migrate them once at startup:
78
-
79
- ```ts
80
- import { migrateLegacyThemeCache } from '@neetechs/ui/appearance';
81
-
82
- migrateLegacyThemeCache(); // adopts a legacy value only if no canonical
83
- // cache exists, then deletes the legacy keys
84
- ```
85
-
86
- Migration only touches the local cache; it can never overwrite a backend
87
- or cookie preference because the cache sits below both.
88
-
89
- ## Early bootstrap (anti-flash)
90
-
91
- Run before framework rendering — `main.ts`, `main.tsx`, an inline script,
92
- or an Angular initializer:
93
-
94
- ```ts
95
- import { bootstrapNeetechsTheme } from '@neetechs/ui/appearance';
96
-
97
- bootstrapNeetechsTheme(); // cookie → cache → system → default, applies data-nt-theme
98
- ```
99
-
100
- No network requests, no listeners, no framework dependency. During SSR it
101
- resolves from an explicit cookie string and no-ops on the DOM:
102
-
103
- ```ts
104
- bootstrapNeetechsTheme({ cookieString: request.headers.cookie ?? '' });
105
- ```
106
-
107
- ## The controller
108
-
109
- Create exactly one controller per application:
110
-
111
- ```ts
112
- import { createThemeController } from '@neetechs/ui/appearance';
113
-
114
- const themeController = createThemeController();
115
-
116
- themeController.initialize(); // bootstrap sources + system listener
117
- themeController.getState(); // { preference, resolved, source }
118
- themeController.subscribe(state => { /* react to changes */ });
119
-
120
- // After the app fetches account settings (the app owns the API call):
121
- themeController.setPreference(settings.appearance, {
122
- source: 'backend',
123
- updateCache: true,
124
- });
125
-
126
- themeController.destroy(); // removes listeners; re-initializable
127
- ```
128
-
129
- ### System mode
130
-
131
- When the preference is `system`, the controller listens to
132
- `(prefers-color-scheme: dark)` via `addEventListener` (with an
133
- `addListener` fallback for older engines) and re-applies the resolved
134
- theme immediately on change. The stored preference stays `system` — the
135
- resolved value is never written back as the preference or to the cache. A
136
- non-`system` preference ignores system changes. `initialize()` is
137
- idempotent; `destroy()` removes the listener.
138
-
139
- ## Angular SSR integration
140
-
141
- ```ts
142
- // app.config.ts (application, not this package)
143
- import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
144
- import {
145
- bootstrapNeetechsTheme,
146
- createThemeController,
147
- type ThemeController,
148
- } from '@neetechs/ui/appearance';
149
-
150
- export const NT_THEME_CONTROLLER = new InjectionToken<ThemeController>('nt-theme');
151
-
152
- export const appConfig: ApplicationConfig = {
153
- providers: [
154
- { provide: NT_THEME_CONTROLLER, useFactory: () => createThemeController() },
155
- {
156
- provide: APP_INITIALIZER,
157
- multi: true,
158
- deps: [NT_THEME_CONTROLLER],
159
- useFactory: (controller: ThemeController) => () => {
160
- controller.initialize(); // SSR-safe: no-ops without document/window
161
- },
162
- },
163
- ],
164
- };
165
- ```
166
-
167
- - On the server, pass the request cookie so the rendered HTML already
168
- carries the right attribute: `createThemeController({ cookieString:
169
- requestCookieHeader })` (or call `bootstrapNeetechsTheme` with it).
170
- - Hydration is safe because client bootstrap reads the same `nt_theme`
171
- cookie and sets the same root attribute the server rendered.
172
- - After the app's own settings service loads the account, call
173
- `controller.setPreference(appearance, { source: 'backend' })`.
174
- - Wrap the controller in an app-local injectable exposing signals if
175
- desired; the design-system package intentionally ships no Angular code.
176
-
177
- ## React / Vite integration
178
-
179
- ```tsx
180
- // main.tsx (application, not this package)
181
- import { bootstrapNeetechsTheme, createThemeController } from '@neetechs/ui/appearance';
182
-
183
- bootstrapNeetechsTheme(); // before createRoot — prevents flash
184
-
185
- const themeController = createThemeController();
186
- themeController.initialize();
187
-
188
- createRoot(document.getElementById('root')!).render(<App />);
189
- ```
190
-
191
- In components, subscribe with `useSyncExternalStore` so Strict Mode
192
- mount/unmount cycles cannot leak listeners (the controller also tolerates
193
- repeated `initialize()`/`destroy()`):
194
-
195
- ```tsx
196
- function useNeetechsTheme() {
197
- const state = useSyncExternalStore(
198
- themeController.subscribe,
199
- themeController.getState,
200
- themeController.getState,
201
- );
202
- return { ...state, applyBackendPreference: (p) =>
203
- themeController.setPreference(p, { source: 'backend' }) };
204
- }
205
- ```
206
-
207
- ## Migrating existing app code
208
-
209
- | Replace | With |
210
- | -------------------------------------------------------------- | ------------------------------------------------------- |
211
- | `localStorage.getItem('themeMode')` (and similar keys) | `migrateLegacyThemeCache()` once, then the controller |
212
- | `document.body.setAttribute('data-nt-theme', mode)` | `bootstrapNeetechsTheme()` / controller (root `<html>`) |
213
- | `document.querySelector('app-root')?.setAttribute(...)` | same — the document root is canonical |
214
- | per-app `matchMedia('(prefers-color-scheme: dark)')` listeners | the controller's built-in system listener |
215
- | per-app resolved-theme persistence (`dark`/`light` written back) | keep `system` stored; only the DOM attribute resolves |
216
-
217
- Old `body`/`app-root` attribute selectors keep working while the CSS
218
- matches `[data-nt-theme]` on any element, but they are deprecated:
219
- migrate to the document root and remove app-local theme stores. Duplicate
220
- APIs will not be preserved once all apps are migrated.
221
-
222
- ## What this package deliberately does not do
223
-
224
- - No calls to `/api/v1/account/settings/` or any endpoint.
225
- - No knowledge of authentication, users, or companies.
226
- - No writing of the shared-domain cookie.
227
- - No JavaScript color mapping — colors live only in the CSS token files.
5
+ Legacy `bootstrapNeetechsTheme`, `createThemeController`, and theme-only persistence remain available. New applications should use `bootstrapNeetechsAppearance` and `createAppearanceController` so accent, density, contrast, and motion are typed and applied together. `data-nt-theme="high-contrast"` is deprecated; use a resolved light/dark theme with `data-nt-contrast="high"` through the controller.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neetechs/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Official framework-agnostic Neetechs UI design system.",
5
5
  "license": "MIT",
6
6
  "author": "Neetechs",
@@ -21,7 +21,16 @@
21
21
  "scripts": {
22
22
  "clean": "rimraf dist",
23
23
  "build": "tsc -p tsconfig.json && node scripts/copy-assets.mjs",
24
- "test": "npm run build && node --test \"tests/**/*.test.mjs\"",
24
+ "check:tokens": "node scripts/check-design-tokens.mjs",
25
+ "check:a11y": "node scripts/check-accessibility.mjs",
26
+ "check:rtl": "node scripts/check-rtl.mjs",
27
+ "check:architecture": "node scripts/check-component-architecture.mjs",
28
+ "check:states": "node scripts/check-state-contracts.mjs",
29
+ "check:responsive": "node scripts/check-responsive.mjs",
30
+ "check:content": "node scripts/check-content-contracts.mjs",
31
+ "test:unit": "node --test \"tests/**/*.test.mjs\"",
32
+ "test:browser": "npm run build && playwright test",
33
+ "test": "npm run check:tokens && npm run check:a11y && npm run check:rtl && npm run check:architecture && npm run check:states && npm run check:responsive && npm run check:content && npm run build && npm run test:unit",
25
34
  "pack:local": "npm run build && npm pack",
26
35
  "release": "semantic-release"
27
36
  },
@@ -41,12 +50,17 @@
41
50
  "./utilities/layout.css": "./src/styles/utilities/layout.css",
42
51
  "./utilities/text.css": "./src/styles/utilities/text.css",
43
52
  "./utilities/visibility.css": "./src/styles/utilities/visibility.css",
53
+ "./localization.css": "./src/styles/localization.css",
54
+ "./responsive.css": "./src/styles/responsive.css",
44
55
  "./animations/motion.css": "./src/styles/animations/motion.css",
45
56
  "./shell.css": "./src/shell/index.css",
57
+ "./shell/right-drawer.css": "./src/components/drawer/drawer.css",
46
58
  "./shell/*.css": "./src/shell/*/*.css",
47
59
  "./components.css": "./src/components/index.css",
60
+ "./components/modal.css": "./src/components/dialog/dialog.css",
48
61
  "./components/*.css": "./src/components/*/*.css",
49
62
  "./patterns.css": "./src/patterns/index.css",
63
+ "./patterns/workspace-switcher.css": "./src/patterns/company-switcher/company-switcher.css",
50
64
  "./patterns/*.css": "./src/patterns/*/*.css",
51
65
  "./ai.css": "./src/ai/index.css",
52
66
  "./ai/*.css": "./src/ai/*/*.css",
@@ -67,12 +81,18 @@
67
81
  "types": "./dist/behaviors/*.d.ts",
68
82
  "import": "./dist/behaviors/*.js"
69
83
  },
84
+ "./localization": {
85
+ "types": "./dist/localization/index.d.ts",
86
+ "import": "./dist/localization/index.js"
87
+ },
70
88
  "./types": {
71
89
  "types": "./dist/types/index.d.ts",
72
90
  "import": "./dist/types/index.js"
73
91
  }
74
92
  },
75
93
  "devDependencies": {
94
+ "@axe-core/playwright": "^4.12.1",
95
+ "@playwright/test": "^1.61.1",
76
96
  "@semantic-release/commit-analyzer": "^13.0.1",
77
97
  "@semantic-release/github": "^12.0.9",
78
98
  "@semantic-release/npm": "^13.1.5",
@@ -88,5 +108,14 @@
88
108
  "publishConfig": {
89
109
  "access": "public",
90
110
  "registry": "https://registry.npmjs.org/"
91
- }
111
+ },
112
+ "directories": {
113
+ "doc": "docs",
114
+ "test": "tests"
115
+ },
116
+ "keywords": [],
117
+ "bugs": {
118
+ "url": "https://github.com/jihadelsayed/Neetechs_Design_System/issues"
119
+ },
120
+ "homepage": "https://github.com/jihadelsayed/Neetechs_Design_System#readme"
92
121
  }