@sdcorejs/angular 21.2.15 → 21.3.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 (203) hide show
  1. package/README.md +7 -5
  2. package/assets/STYLE-GUIDE.md +6 -3
  3. package/assets/THEME.md +166 -0
  4. package/assets/fonts/fonts.scss +1 -1
  5. package/assets/scss/ckeditor5.scss +2 -2
  6. package/assets/scss/core/_inline-edit.scss +3 -3
  7. package/assets/scss/core/_read-state-panel.scss +2 -2
  8. package/assets/scss/core/color.scss +4 -2
  9. package/assets/scss/core/form.scss +35 -12
  10. package/assets/scss/core/scrollbar.scss +3 -3
  11. package/assets/scss/core/utilities/_base.scss +5 -5
  12. package/assets/scss/core/utilities/_typography.scss +22 -22
  13. package/assets/scss/sd-core.scss +12 -0
  14. package/assets/scss/themes/_component-tokens.scss +261 -0
  15. package/assets/scss/themes/_presets.scss +3 -0
  16. package/assets/scss/themes/_ramps.scss +56 -0
  17. package/assets/scss/themes/_scales.scss +90 -0
  18. package/assets/scss/themes/_semantic.scss +22 -0
  19. package/assets/scss/themes/default.scss +113 -10
  20. package/assets/scss/themes/material-theme.scss +3 -0
  21. package/fesm2022/sdcorejs-angular-components-anchor.mjs +2 -2
  22. package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
  23. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +6 -6
  24. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
  25. package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +2 -2
  26. package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
  27. package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +2 -2
  28. package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
  29. package/fesm2022/sdcorejs-angular-components-avatar.mjs +34 -27
  30. package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
  31. package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
  32. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  33. package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +35 -5
  34. package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
  35. package/fesm2022/sdcorejs-angular-components-button.mjs +13 -11
  36. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  37. package/fesm2022/sdcorejs-angular-components-card.mjs +2 -2
  38. package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
  39. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +2 -2
  40. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
  41. package/fesm2022/sdcorejs-angular-components-code-editor.mjs +2 -2
  42. package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
  43. package/fesm2022/sdcorejs-angular-components-data-state.mjs +8 -4
  44. package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
  45. package/fesm2022/sdcorejs-angular-components-editor.mjs +12 -4
  46. package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
  47. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +105 -50
  48. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
  49. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +5844 -6504
  50. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  51. package/fesm2022/sdcorejs-angular-components-highlight.mjs +63 -0
  52. package/fesm2022/sdcorejs-angular-components-highlight.mjs.map +1 -0
  53. package/fesm2022/sdcorejs-angular-components-history.mjs +2 -2
  54. package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
  55. package/fesm2022/sdcorejs-angular-components-image-editor.mjs +2088 -0
  56. package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -0
  57. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +2 -2
  58. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  59. package/fesm2022/sdcorejs-angular-components-inform.mjs +9 -5
  60. package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
  61. package/fesm2022/sdcorejs-angular-components-job-progress.mjs +2 -2
  62. package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
  63. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +40 -22
  64. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
  65. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +2 -2
  66. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
  67. package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
  68. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  69. package/fesm2022/sdcorejs-angular-components-operator.mjs +2 -2
  70. package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
  71. package/fesm2022/sdcorejs-angular-components-org-chart.mjs +2 -2
  72. package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
  73. package/fesm2022/sdcorejs-angular-components-preview.mjs +129 -7
  74. package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
  75. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +33 -24
  76. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  77. package/fesm2022/sdcorejs-angular-components-query-builder.mjs +2 -2
  78. package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
  79. package/fesm2022/sdcorejs-angular-components-quick-action.mjs +2 -2
  80. package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
  81. package/fesm2022/sdcorejs-angular-components-section.mjs +11 -7
  82. package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
  83. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +28 -4
  84. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  85. package/fesm2022/sdcorejs-angular-components-splitter.mjs +2 -2
  86. package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
  87. package/fesm2022/sdcorejs-angular-components-stepper.mjs +2 -2
  88. package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
  89. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +4 -4
  90. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  91. package/fesm2022/sdcorejs-angular-components-tab.mjs +2 -2
  92. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  93. package/fesm2022/sdcorejs-angular-components-table.mjs +308 -113
  94. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  95. package/fesm2022/sdcorejs-angular-components-tree.mjs +2 -2
  96. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  97. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +14 -5
  98. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  99. package/fesm2022/sdcorejs-angular-components.mjs +2 -0
  100. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  101. package/fesm2022/sdcorejs-angular-directives.mjs +99 -13
  102. package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
  103. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +149 -6
  104. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  105. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +19 -4
  106. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  107. package/fesm2022/sdcorejs-angular-forms-chip.mjs +19 -4
  108. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  109. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +2 -2
  110. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  111. package/fesm2022/sdcorejs-angular-forms-date.mjs +17 -7
  112. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  113. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +17 -7
  114. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  115. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
  116. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
  117. package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +3 -3
  118. package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
  119. package/fesm2022/sdcorejs-angular-forms-input-color.mjs +2 -2
  120. package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
  121. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +18 -4
  122. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  123. package/fesm2022/sdcorejs-angular-forms-input.mjs +29 -5
  124. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  125. package/fesm2022/sdcorejs-angular-forms-label.mjs +27 -2
  126. package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
  127. package/fesm2022/sdcorejs-angular-forms-radio.mjs +1 -1
  128. package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
  129. package/fesm2022/sdcorejs-angular-forms-select.mjs +498 -7
  130. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  131. package/fesm2022/sdcorejs-angular-forms-switch.mjs +1 -1
  132. package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
  133. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +20 -4
  134. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  135. package/fesm2022/sdcorejs-angular-forms-time-range.mjs +2 -2
  136. package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
  137. package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
  138. package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
  139. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
  140. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
  141. package/fesm2022/sdcorejs-angular-i18n.mjs +1429 -271
  142. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  143. package/fesm2022/sdcorejs-angular-modules-auth.mjs +35 -3
  144. package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
  145. package/fesm2022/sdcorejs-angular-modules-icon.mjs +19 -0
  146. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  147. package/fesm2022/sdcorejs-angular-modules-layout.mjs +39 -48
  148. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  149. package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
  150. package/fesm2022/sdcorejs-angular-services-api.mjs +196 -8
  151. package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
  152. package/fesm2022/sdcorejs-angular-services-confirm.mjs +10 -3
  153. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  154. package/fesm2022/sdcorejs-angular-services-excel.mjs +5 -0
  155. package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
  156. package/fesm2022/sdcorejs-angular-services-loading.mjs +1 -1
  157. package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
  158. package/fesm2022/sdcorejs-angular-services-notify.mjs +107 -7
  159. package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
  160. package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +458 -1
  161. package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
  162. package/fesm2022/sdcorejs-angular-utilities-theme.mjs +169 -0
  163. package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -0
  164. package/fesm2022/sdcorejs-angular-utilities.mjs +1 -0
  165. package/fesm2022/sdcorejs-angular-utilities.mjs.map +1 -1
  166. package/package.json +14 -2
  167. package/types/sdcorejs-angular-components-breadcrumb.d.ts +2 -1
  168. package/types/sdcorejs-angular-components-data-state.d.ts +6 -2
  169. package/types/sdcorejs-angular-components-file-explorer.d.ts +3 -0
  170. package/types/sdcorejs-angular-components-form-generic.d.ts +897 -835
  171. package/types/sdcorejs-angular-components-highlight.d.ts +27 -0
  172. package/types/sdcorejs-angular-components-image-editor.d.ts +478 -0
  173. package/types/sdcorejs-angular-components-inform.d.ts +5 -2
  174. package/types/sdcorejs-angular-components-mini-editor.d.ts +1 -1
  175. package/types/sdcorejs-angular-components-preview.d.ts +51 -2
  176. package/types/sdcorejs-angular-components-query-builder.d.ts +1 -1
  177. package/types/sdcorejs-angular-components-section.d.ts +5 -1
  178. package/types/sdcorejs-angular-components-table.d.ts +6 -0
  179. package/types/sdcorejs-angular-components.d.ts +2 -0
  180. package/types/sdcorejs-angular-directives.d.ts +8 -0
  181. package/types/sdcorejs-angular-forms-autocomplete.d.ts +19 -1
  182. package/types/sdcorejs-angular-forms-chip-calendar.d.ts +13 -2
  183. package/types/sdcorejs-angular-forms-chip.d.ts +13 -2
  184. package/types/sdcorejs-angular-forms-date.d.ts +7 -2
  185. package/types/sdcorejs-angular-forms-datetime.d.ts +7 -2
  186. package/types/sdcorejs-angular-forms-inline-text.d.ts +1 -1
  187. package/types/sdcorejs-angular-forms-input-number.d.ts +12 -2
  188. package/types/sdcorejs-angular-forms-input.d.ts +21 -5
  189. package/types/sdcorejs-angular-forms-label.d.ts +16 -1
  190. package/types/sdcorejs-angular-forms-models.d.ts +16 -1
  191. package/types/sdcorejs-angular-forms-select.d.ts +66 -4
  192. package/types/sdcorejs-angular-forms-textarea.d.ts +9 -2
  193. package/types/sdcorejs-angular-i18n.d.ts +285 -54
  194. package/types/sdcorejs-angular-modules-auth.d.ts +3 -3
  195. package/types/sdcorejs-angular-modules-icon.d.ts +11 -1
  196. package/types/sdcorejs-angular-modules-layout.d.ts +2 -2
  197. package/types/sdcorejs-angular-modules-permission.d.ts +3 -2
  198. package/types/sdcorejs-angular-services-api.d.ts +49 -2
  199. package/types/sdcorejs-angular-services-confirm.d.ts +15 -0
  200. package/types/sdcorejs-angular-services-notify.d.ts +8 -0
  201. package/types/sdcorejs-angular-utilities-extensions.d.ts +68 -1
  202. package/types/sdcorejs-angular-utilities-theme.d.ts +25 -0
  203. package/types/sdcorejs-angular-utilities.d.ts +1 -0
package/README.md CHANGED
@@ -156,6 +156,8 @@ html {
156
156
  }
157
157
  ```
158
158
 
159
+ Dark mode for the default palette is opt-in: set `data-sd-theme="dark"` on `<html>`, or emit `@include sd.theme($mode: 'auto')` to follow the operating system. Besides the palette colors, `sd.theme()` emits color ramps, semantic roles, spacing/radius/shadow/z-index/motion/typography scales, and per-component tokens; read resolved colors from TypeScript with `readSdTokens()` from `@sdcorejs/angular/utilities/theme`. See the [theme and tokens guide](https://sdcorejs.github.io/sdcorejs-angular/docs/latest/assets/THEME.md).
160
+
159
161
  See the [assets and SCSS reference](https://sdcorejs.github.io/sdcorejs-angular/docs/latest/assets/STYLE-GUIDE.md) for supported `--sd-*` tokens, Material M3 guidance, utilities, fonts, and image assets.
160
162
 
161
163
  ## Internationalization
@@ -175,17 +177,17 @@ export const appConfig: ApplicationConfig = {
175
177
  };
176
178
  ```
177
179
 
178
- `I18nService.setLanguage()` persists a built-in language and reloads by default. A complete custom catalog can be supplied through the synchronous `language: () => catalog` hook. See the [i18n reference](https://sdcorejs.github.io/sdcorejs-angular/docs/latest/i18n/i18n.md) for catalog typing and fallback behavior.
180
+ `I18nService.locale()` is a signal with the BCP 47 locale of the current language (`vi-VN`, `en-US`, `ja-JP`, `ko-KR`, or `zh-CN`); dates and numbers formatted by Core UI follow it. `I18nService.setLanguage()` persists a built-in language and reloads by default. A complete custom catalog can be supplied through the synchronous `language: () => catalog` hook. See the [i18n reference](https://sdcorejs.github.io/sdcorejs-angular/docs/latest/i18n/i18n.md) for catalog typing and fallback behavior.
179
181
 
180
182
  ## Documentation and examples
181
183
 
182
184
  | Resource | Purpose |
183
185
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
184
186
  | [Live showcase](https://sdcorejs.github.io/sdcorejs-angular/) | Interactive component, form, and service demos |
185
- | [Button example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/versions/v19/projects/showcase/src/app/pages/components/button/button-demo.component.ts) | Action variants, icons, disabled state, and loading state |
186
- | [Input example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/versions/v19/projects/showcase/src/app/pages/forms/input/input-demo.component.ts) | Model binding, validation, and viewed states |
187
- | [Table example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/versions/v19/projects/showcase/src/app/pages/components/table/table-demo.component.ts) | Data, selection, filters, grouping, paging, and tree workflows |
188
- | [Persistence example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/versions/v19/projects/showcase/src/app/pages/services/persistence/persistence-demo.component.ts) | Graph round-trip, identity, envelopes, and error containment |
187
+ | [Button example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/showcase/src/app/pages/components/button/button-demo.component.ts) | Action variants, icons, disabled state, and loading state |
188
+ | [Input example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/showcase/src/app/pages/forms/input/input-demo.component.ts) | Model binding, validation, and viewed states |
189
+ | [Table example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/showcase/src/app/pages/components/table/table-demo.component.ts) | Data, selection, filters, grouping, paging, and tree workflows |
190
+ | [Persistence example source](https://github.com/sdcorejs/sdcorejs-angular/blob/main/showcase/src/app/pages/services/persistence/persistence-demo.component.ts) | Graph round-trip, identity, envelopes, and error containment |
189
191
  | [Latest API manifest](https://sdcorejs.github.io/sdcorejs-angular/docs/latest/index.json) | Discover all Markdown docs for the latest release |
190
192
  | [Versions registry](https://sdcorejs.github.io/sdcorejs-angular/docs/versions.json) | Select docs matching an installed package version |
191
193
  | [Machine-readable catalog](https://sdcorejs.github.io/sdcorejs-angular/docs/catalog.json) | Discover documentation across maintained package lines |
@@ -107,6 +107,8 @@ projects/sdcorejs-angular/assets/
107
107
 
108
108
  Màu được định nghĩa dưới dạng **CSS custom properties** với prefix `--sd-*`, cho phép override runtime (không cần recompile SCSS). Default theme sở hữu màu độc lập. Dùng `$source: 'material'` để chủ động bật nguồn màu tương thích cũ.
109
109
 
110
+ Bảng §3.1 là tầng **palette** (33 token của 2.15, không đổi). Từ 3.0 `sd.theme()` còn phát thêm: **ramp** `--sd-{family}-{50…950}`, **semantic role** (`--sd-status-*-bg/fg`, `--sd-link`, `--sd-text-on-solid`, `--sd-focus-ring-color`, …), **scale** không phải màu (`--sd-space-*`, `--sd-radius-*`, `--sd-shadow-*`, `--sd-z-*`, `--sd-duration-*`, `--sd-font-size-*`, …) và **component token** `--sd-{component}-{part}`; cùng chế độ dark cho palette default. Chi tiết tầng, cách đặt tên, dark/auto, focus ring và contrast: [THEME.md](./THEME.md).
111
+
110
112
  ### 3.1 Color tokens
111
113
 
112
114
  | Token | CSS variable | Default bridge / fallback | Use for |
@@ -544,7 +546,7 @@ Omit `$source` (or use `'core'`) for independent Core colors. Scoped calls emit
544
546
 
545
547
  ### 14.1 Choose a preset
546
548
 
547
- Core ships eight **light** presets in addition to the unchanged `default` palette. They change colors only; typography, spacing, density and corner radius remain unchanged. No dark palette is included.
549
+ Core ships eight **light** presets in addition to the unchanged `default` palette. They change colors only; typography, spacing, density and corner radius remain unchanged. Only the `default` palette has a dark variant (`$mode`, see [THEME.md](./THEME.md)); combining a named preset with `$mode: 'dark'` or `'auto'` stops the Sass build.
548
550
 
549
551
  In the consumer's global `styles.scss`, load Core first, then emit the selected palette:
550
552
 
@@ -589,7 +591,7 @@ Unlisted tokens inherit the default map in section 3: secondary, info, success,
589
591
  ### 14.2 Mixin contract and overrides
590
592
 
591
593
  ```scss
592
- @mixin theme($theme: (), $source: 'core', $preset: 'default');
594
+ @mixin theme($theme: (), $source: 'core', $preset: 'default', $mode: 'light');
593
595
  ```
594
596
 
595
597
  | Parameter | Accepted values | Default |
@@ -597,6 +599,7 @@ Unlisted tokens inherit the default map in section 3: secondary, info, success,
597
599
  | `$theme` | Map of public color tokens from section 3 | `()` |
598
600
  | `$source` | `'core'`, `'material'` | `'core'` |
599
601
  | `$preset` | `'default'` and the eight lowercase names above | `'default'` |
602
+ | `$mode` | `'light'`, `'dark'`, `'auto'` — dark and auto only with `$preset: 'default'` (see [THEME.md](./THEME.md)) | `'light'` |
600
603
 
601
604
  For the Core source, precedence is **default → preset → consumer overrides**. Existing `sd.theme()`, `sd.theme((...))`, and positional `sd.theme((), 'material')` calls remain valid. Unknown preset/source names fail Sass compilation. Combining `$source: 'material'` with any non-default preset also fails: choose one palette owner.
602
605
 
@@ -639,7 +642,7 @@ Root switching also reaches overlays attached under `body`. A local screen class
639
642
 
640
643
  These presets own **Core color tokens**, not the full Material palette. They do not rewrite global `--mat-sys-*`. Core styling that consumes `--sd-*` changes immediately; Material-only styles still follow the consumer's `mat.theme()` configuration. Keep that distinction when testing focus, ripples, calendars, dialogs and third-party controls. Font/density configuration remains separate.
641
644
 
642
- Table quick-search/footer backgrounds intentionally remain fixed white; a global `surface` override does not change those regions. Tab header/body classes and inline styles also take precedence where supplied.
645
+ Table quick-search/footer backgrounds follow the component token `--sd-table-bg` (white in every light palette, dark with `$mode: 'dark'`); a global `surface` override does not change those regions — override `--sd-table-bg` instead. Tab header/body classes and inline styles also take precedence where supplied.
643
646
 
644
647
  The preset tests verify white text against primary and primary-dark at **at least 4.5:1**, primary/secondary body text against surface and surface-muted at **at least 4.5:1**, and strong control borders against those surfaces at **at least 3:1**. Subtle `border` is for dividers, not the sole boundary of an interactive control. These checks are palette checks, not a claim that every component/state is accessibility-certified. Recheck actual rendered states after consumer overrides; retain labels/icons for status information.
645
648
 
@@ -0,0 +1,166 @@
1
+ # Theme & tokens
2
+
3
+ Core UI colours, sizes and motion are CSS custom properties with the `--sd-` prefix. `sd.theme()` emits
4
+ them; components read them with `var(--sd-*)`. This page covers the token tiers, light/dark/auto modes,
5
+ custom palettes, the focus ring, contrast checks and the hex rules that keep components on tokens.
6
+ Utility classes, presets in detail and Material integration are in [STYLE-GUIDE §3 and §14](./STYLE-GUIDE.md).
7
+
8
+ ## Quick start
9
+
10
+ ```scss
11
+ // styles.scss — after sd-core.scss (already in angular.json for most apps)
12
+ @use '@sdcorejs/angular/assets/scss/themes/default' as sd;
13
+
14
+ html {
15
+ @include sd.theme(); // light, default palette — the same values as 2.15
16
+ }
17
+ ```
18
+
19
+ Dark mode for the default palette is built in: set `data-sd-theme="dark"` on `<html>` (the library never
20
+ writes this attribute). `data-sd-theme="light"` forces light inside a dark page.
21
+
22
+ ```ts
23
+ document.documentElement.dataset['sdTheme'] = 'dark'; // or 'light'; delete it to return to the app default
24
+ ```
25
+
26
+ Nothing changes for an app that does not opt in: the light output keeps every 2.15 declaration with the
27
+ same value, and only adds new custom properties.
28
+
29
+ ## Tiers and names
30
+
31
+ | Tier | Names | What it is for |
32
+ | --- | --- | --- |
33
+ | Palette | `--sd-primary`, `--sd-primary-light`, `--sd-primary-dark`, `--sd-primary-contrast`, the same four for `secondary`, `info`, `success`, `warning`, `error`, then `--sd-surface`, `--sd-surface-muted`, `--sd-text`, `--sd-text-secondary`, `--sd-text-muted`, `--sd-border`, `--sd-border-strong`, `--sd-disabled-bg`, `--sd-disabled-text` | The 33 public colours of 2.15, unchanged. Presets and `$theme` set them. |
34
+ | Ramps | `--sd-{family}-{step}` — families `primary`, `secondary`, `info`, `success`, `warning`, `error`, `neutral`; steps `50 100 200 300 400 500 600 700 800 900 950` | Tints and shades of each family (`color-mix()`), `500` is the base colour. For charts, badges and subtle backgrounds. |
35
+ | Semantic roles | `--sd-status-{info,success,warning,error}-{bg,fg}`, `--sd-link`, `--sd-surface-inverse`, `--sd-text-on-solid`, `--sd-border-focus`, `--sd-border-danger`, `--sd-overlay-backdrop`, `--sd-focus-ring-color` | A role instead of a palette slot, so dark mode and custom palettes change the colour without touching the component. |
36
+ | Scales | `--sd-space-{0…48}`, `--sd-radius-{2…24, 999}`, `--sd-shadow-{xs,sm,md,lg,xl}`, `--sd-z-{sidebar,header,popover,drawer-mobile,floating,backdrop,drawer,dropdown,overlay,modal,devtools}`, `--sd-duration-{fast,base,slow}`, `--sd-ease-standard`, `--sd-font-size-{10…48}`, `--sd-font-weight-{regular,medium,semibold,bold}`, `--sd-line-height-{16…28}`, `--sd-focus-ring-width`, `--sd-focus-ring-offset` | Non-colour tokens. Each value equals a literal the library already used; names carry the pixel value (`--sd-radius-8` is `8px`). Same in light and dark. |
37
+ | Component tokens | `--sd-{component}-{part}`, for example `--sd-table-header-bg`, `--sd-tooltip-bg`, `--sd-query-bar-bg`, `--sd-scrollbar-thumb` | One colour of one component. Light values are the colours the component had in 2.15; each has a dark value. |
38
+
39
+ Rules for new code:
40
+
41
+ - Use a semantic role or a palette token first, a ramp step for a shade, and a component token only for a
42
+ colour that belongs to one component.
43
+ - A component token is declared only in `assets/scss/themes/_component-tokens.scss`. A component's
44
+ `:host` may alias it to a local name, never give it a new value.
45
+ - Replace a literal with a scale token only when the value is exactly equal (`8px` → `var(--sd-radius-8)`);
46
+ `7px` stays `7px`.
47
+
48
+ Every library reference to a token added in 3.0 carries its 2.15 value as a fallback —
49
+ `var(--sd-table-bg, #ffffff)`, `var(--sd-radius-8, 8px)` — so a page that declares only the 2.15 palette
50
+ without `sd.theme()` still renders as before.
51
+
52
+ ## Modes
53
+
54
+ ```scss
55
+ @mixin theme($theme: (), $source: 'core', $preset: 'default', $mode: 'light');
56
+ ```
57
+
58
+ | `$mode` | Output |
59
+ | --- | --- |
60
+ | `'light'` (default) | The 2.15 declarations, unchanged, plus the ramp, semantic, scale and component tiers. |
61
+ | `'dark'` | The full set with the dark palette, `color-scheme: dark`, and Material's dark colour tokens. |
62
+ | `'auto'` | Light on the selector; the dark set under `@media (prefers-color-scheme: dark)`, unless the element has `data-sd-theme="light"`. |
63
+
64
+ - **Dark exists only for the `default` preset.** The eight named presets (`ocean`, `indigo`, `teal`,
65
+ `copper`, `slate`, `forest`, `plum`, `rose`) are light palettes: `sd.theme($preset: 'teal', $mode: 'dark')`
66
+ (or `'auto'`) stops the Sass build with an error that points to the `$theme` route below.
67
+ - `sd-core.scss` already contains `[data-sd-theme=dark] { @include sd.theme($mode: 'dark'); }` and a matching
68
+ light block, for the default palette from the core source.
69
+ - In dark, `-light` variants mix the colour with the dark surface and `-dark` variants mix it toward white,
70
+ so "tinted background" and "strong text" keep their meaning.
71
+ - Material: dark mode adds only Material's colour tokens (`theme-type: dark`). Typography and density stay
72
+ with your `mat.theme()` configuration.
73
+ - Always-dark components (code editor, the default image/PDF preview shells) keep their dark look in both
74
+ modes; they have their own component tokens.
75
+
76
+ ### Your own colours, in light and dark
77
+
78
+ Pass your colours through `$theme` on the default preset, once per mode:
79
+
80
+ ```scss
81
+ html {
82
+ @include sd.theme((primary: #00696b, primary-light: #e0f2f1, primary-dark: #004f51));
83
+ }
84
+
85
+ html[data-sd-theme='dark'] {
86
+ @include sd.theme((primary: #4cdadb, primary-contrast: #003738), $mode: 'dark');
87
+ }
88
+ ```
89
+
90
+ Unlisted tokens keep the default light or dark values. `$mode: 'auto'` applies one `$theme` map to both
91
+ schemes; with different light and dark overrides, follow the operating system yourself:
92
+
93
+ ```scss
94
+ html { @include sd.theme((primary: #00696b, primary-light: #e0f2f1, primary-dark: #004f51)); }
95
+
96
+ @media (prefers-color-scheme: dark) {
97
+ html:not([data-sd-theme='light']) { @include sd.theme((primary: #4cdadb, primary-contrast: #003738), $mode: 'dark'); }
98
+ }
99
+ ```
100
+
101
+ An app that uses `$source: 'material'` includes `sd.theme($source: 'material', $mode: 'dark')` under its own
102
+ dark selector.
103
+
104
+ ### Your own preset
105
+
106
+ A preset is only a map of palette tokens. Keep your brand map in your app and pass it as `$theme`:
107
+
108
+ ```scss
109
+ $brand: (primary: #6b4414, primary-light: #f4f2f1, primary-dark: #4a2f0e, surface-muted: #f7f5f2);
110
+ $brand-dark: (primary: #f0b98a, primary-contrast: #3d2200);
111
+
112
+ html { @include sd.theme($brand); }
113
+ html[data-sd-theme='dark'] { @include sd.theme($brand-dark, $mode: 'dark'); }
114
+ ```
115
+
116
+ Set `primary-light` and `primary-dark` whenever you set `primary`: overriding the base does not recompute
117
+ explicit variants.
118
+
119
+ ### Scopes
120
+
121
+ `sd.theme()` can be included on any selector; each scope re-declares every token, so a nested scope never
122
+ inherits values computed from its parent's palette. Overlays (dialogs, select panels) render under `body`:
123
+ theme the root, or give the overlay container the same scope.
124
+
125
+ ## Focus ring
126
+
127
+ - Colour: `var(--sd-focus-ring-color)` (the primary colour). Width and offset: `--sd-focus-ring-width` and
128
+ `--sd-focus-ring-offset` (both `2px`).
129
+ - A component that already had a colour hook keeps it first: `var(--sd-tab-label-active-color, var(--sd-focus-ring-color))`.
130
+ - On an always-dark surface the ring uses that component's focus token (for example
131
+ `--sd-preview-pdf-focus-ring`), so it stays visible.
132
+ - Focus rules never contain a hex colour, not even as a fallback. `currentColor` is allowed.
133
+
134
+ ## Contrast
135
+
136
+ `npm run test:theme` (repository root) compiles the themes and checks these pairs for the default palette,
137
+ every named preset and the dark palette:
138
+
139
+ | Foreground | Background | Minimum |
140
+ | --- | --- | --- |
141
+ | `text`, `text-secondary` | `surface`, `surface-muted` | 4.5 |
142
+ | `link` | `surface` | 4.5 |
143
+ | `primary-contrast` | `primary` | 4.5 |
144
+ | `status-*-fg` | `status-*-bg` | 4.5 |
145
+ | `border-strong`, `focus-ring-color` | `surface`, `surface-muted` | 3 |
146
+
147
+ These are palette checks. Recheck real component states after changing colours, and keep labels or icons
148
+ for status information.
149
+
150
+ ## Keeping components on tokens
151
+
152
+ Two checks run in CI:
153
+
154
+ - `npm run check:scss-hex` — library SCSS and TS: no raw hex colour, and every `:focus` / `:focus-visible` /
155
+ `:focus-within` outline uses the focus-ring token (or a hook falling back to it, a component focus token,
156
+ or `currentColor`). `--report --literals` also lists literals equal to a scale token.
157
+ - ESLint (`npm run lint` in `versions/v19`) — the same hex rule for TypeScript and templates.
158
+
159
+ Allowed: a hex inside a `var()` fallback (`var(--sd-card-border, #e6e6e6)`), the theme partials in
160
+ `assets/scss/themes/`, specs, `*.generated.ts`, the colour values of `sd-input-color`, and the static
161
+ Keycloak error page (served outside the app, without the theme).
162
+
163
+ ## From TypeScript
164
+
165
+ `@sdcorejs/angular/utilities/theme` exports `readSdTokens()`, `SdColorToken` and `SD_COLOR_TOKENS` for code
166
+ that needs concrete colours (charts, canvas). See `utilities/theme/theme.md`.
@@ -77,7 +77,7 @@
77
77
  %icon-shared-style {
78
78
  font-weight: normal;
79
79
  font-style: normal;
80
- font-size: 24px;
80
+ font-size: var(--sd-font-size-24, 24px);
81
81
  line-height: 1;
82
82
  letter-spacing: normal;
83
83
  text-transform: none;
@@ -70,8 +70,8 @@
70
70
  padding: 2px !important;
71
71
 
72
72
  /* Làm màu nền toolbar nhạt hơn cho hiện đại */
73
- background: #f8f9fa !important;
74
- border-bottom: 1px solid #e0e0e0 !important;
73
+ background: var(--sd-ckeditor-toolbar-bg, #f8f9fa) !important;
74
+ border-bottom: 1px solid var(--sd-ckeditor-toolbar-border, #e0e0e0) !important;
75
75
  }
76
76
 
77
77
  .ck-toolbar__items {
@@ -17,7 +17,7 @@
17
17
  transition: color 0.15s ease;
18
18
 
19
19
  sd-icon {
20
- font-size: 16px;
20
+ font-size: var(--sd-font-size-16, 16px);
21
21
  width: 16px;
22
22
  height: 16px;
23
23
  }
@@ -47,7 +47,7 @@
47
47
  width: 100%;
48
48
  // why: nền nhẹ + đậm hơn khi hover → tín hiệu "viewed có thể bấm để sửa".
49
49
  padding: 1px 6px;
50
- border-radius: 4px;
50
+ border-radius: var(--sd-radius-4, 4px);
51
51
  background-color: rgba(0, 0, 0, 0.04);
52
52
  transition: background-color 0.15s ease;
53
53
 
@@ -81,7 +81,7 @@
81
81
  @mixin sd-inline-textarea {
82
82
  .sd-inline-textarea {
83
83
  cursor: text;
84
- border-radius: 4px;
84
+ border-radius: var(--sd-radius-4, 4px);
85
85
  background-color: rgba(0, 0, 0, 0.04);
86
86
  transition: background-color 0.15s ease;
87
87
 
@@ -43,11 +43,11 @@
43
43
  .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__icon {
44
44
  width: 18px;
45
45
  height: 18px;
46
- font-size: 18px;
46
+ font-size: var(--sd-font-size-18, 18px);
47
47
  }
48
48
 
49
49
  .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__message {
50
- line-height: 18px;
50
+ line-height: var(--sd-line-height-18, 18px);
51
51
  }
52
52
 
53
53
  .sd-read-state-region .sd-data-state.sd-data-state--compact .sd-data-state__actions {
@@ -46,9 +46,11 @@ $public-colors:
46
46
  }
47
47
 
48
48
  $color_map: create_var_map($public-colors);
49
+ // why: `.text-white` / `.bg-black` mean literally white and black in every mode, so they use the colour
50
+ // keywords (same computed value as #fff / #000) instead of a themeable token.
49
51
  $basic_color_map: (
50
- 'white': #fff,
51
- 'black': #000,
52
+ 'white': white,
53
+ 'black': black,
52
54
  );
53
55
 
54
56
  $disabled-bg: map.get($color-map, 'disabled-bg');
@@ -3,7 +3,7 @@
3
3
 
4
4
  // Form field
5
5
  .mat-mdc-form-field {
6
- font-size: 16px;
6
+ font-size: var(--sd-font-size-16, 16px);
7
7
  width: 100%;
8
8
 
9
9
  .sd-form-field-label {
@@ -68,10 +68,10 @@
68
68
  }
69
69
 
70
70
  sd-icon {
71
- font-size: 16px;
71
+ font-size: var(--sd-font-size-16, 16px);
72
72
  width: 16px;
73
73
  height: 16px;
74
- line-height: 16px;
74
+ line-height: var(--sd-line-height-16, 16px);
75
75
  }
76
76
  }
77
77
 
@@ -118,7 +118,7 @@
118
118
  mat-date-range-input.mat-mdc-date-range-input,
119
119
  input.mat-mdc-input-element,
120
120
  textarea.mat-mdc-input-element {
121
- font-size: 14px;
121
+ font-size: var(--sd-font-size-14, 14px);
122
122
  margin-top: 10px; // Text hiển thị trong auto complete
123
123
  }
124
124
  }
@@ -172,7 +172,7 @@
172
172
  }
173
173
 
174
174
  .mat-mdc-form-field-label-wrapper {
175
- font-size: 14px;
175
+ font-size: var(--sd-font-size-14, 14px);
176
176
  padding-top: 12px;
177
177
  top: -18px;
178
178
  }
@@ -189,7 +189,7 @@
189
189
  .sd-error-icon {
190
190
  height: 20px;
191
191
  width: 20px;
192
- font-size: 20px;
192
+ font-size: var(--sd-font-size-20, 20px);
193
193
  text-align: center;
194
194
  padding: 0;
195
195
  }
@@ -202,7 +202,7 @@
202
202
  .sd-prefix-icon {
203
203
  height: 20px;
204
204
  width: 20px;
205
- font-size: 20px;
205
+ font-size: var(--sd-font-size-20, 20px);
206
206
  text-align: center;
207
207
  padding: 0;
208
208
  }
@@ -257,12 +257,12 @@
257
257
  input.mat-mdc-input-element,
258
258
  textarea.mat-mdc-input-element {
259
259
  margin-top: 2px; // Text hiển thị trong auto complete
260
- font-size: 14px;
260
+ font-size: var(--sd-font-size-14, 14px);
261
261
  }
262
262
  }
263
263
 
264
264
  .mat-mdc-form-field-label-wrapper {
265
- font-size: 14px;
265
+ font-size: var(--sd-font-size-14, 14px);
266
266
  padding-top: 8px;
267
267
  top: -14px;
268
268
  }
@@ -279,7 +279,7 @@
279
279
  .sd-error-icon {
280
280
  height: 16px;
281
281
  width: 16px;
282
- font-size: 16px;
282
+ font-size: var(--sd-font-size-16, 16px);
283
283
  text-align: center;
284
284
  padding: 0;
285
285
  }
@@ -293,7 +293,7 @@
293
293
  .sd-prefix-icon {
294
294
  height: 16px;
295
295
  width: 16px;
296
- font-size: 16px;
296
+ font-size: var(--sd-font-size-16, 16px);
297
297
  text-align: center;
298
298
  padding: 0;
299
299
  }
@@ -347,5 +347,28 @@ mat-checkbox {
347
347
 
348
348
  // Placeholder mặc định 1rem (16px), mong muốn nên là 14px
349
349
  .mat-mdc-floating-label {
350
- font-size: 14px !important;
350
+ font-size: var(--sd-font-size-14, 14px) !important;
351
+ }
352
+
353
+ // --------------------------------------------------------------------------
354
+ // Nhãn rời — `labelPlacement="top"` trên sd-input / sd-input-number / sd-textarea / sd-select /
355
+ // sd-date / sd-datetime / sd-chip / sd-chip-calendar. Host mang class `.sd-label-top`, nhãn là
356
+ // `<sd-label>` con trực tiếp (label thật, luôn hiển thị), helper text là `<mat-hint>`.
357
+ // --------------------------------------------------------------------------
358
+ .sd-label-top > sd-label {
359
+ display: block;
360
+ margin-bottom: 4px;
361
+ color: map.get(color.$color_map, 'text');
362
+
363
+ .sd-label__text {
364
+ display: inline;
365
+ margin: 0;
366
+ cursor: default;
367
+ }
368
+ }
369
+
370
+ .mat-mdc-form-field.sd-label-top .mat-mdc-form-field-hint {
371
+ color: map.get(color.$color_map, 'text-secondary');
372
+ font-size: var(--sd-font-size-12, 12px);
373
+ line-height: var(--sd-line-height-16, 16px);
351
374
  }
@@ -14,17 +14,17 @@
14
14
 
15
15
  /* Track */
16
16
  ::-webkit-scrollbar-track {
17
- background: #f1f1f1;
17
+ background: var(--sd-scrollbar-track, #f1f1f1);
18
18
  }
19
19
 
20
20
  /* Handle */
21
21
  ::-webkit-scrollbar-thumb {
22
- background: #c5c5c5;
22
+ background: var(--sd-scrollbar-thumb, #c5c5c5);
23
23
  border-radius: 50px;
24
24
  }
25
25
 
26
26
  /* Handle on hover */
27
27
  ::-webkit-scrollbar-thumb:hover {
28
28
  // background: #555555;
29
- background: #c5c5c5;
29
+ background: var(--sd-scrollbar-thumb, #c5c5c5);
30
30
  }
@@ -34,8 +34,8 @@ html {
34
34
  body {
35
35
  margin: 0;
36
36
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
37
- font-size: 14px;
38
- font-weight: 400;
37
+ font-size: var(--sd-font-size-14, 14px);
38
+ font-weight: var(--sd-font-weight-regular, 400);
39
39
  line-height: 1.5;
40
40
  color: var(--sd-text, #1a1b1f);
41
41
  background-color: var(--sd-surface, #fdfbff);
@@ -98,7 +98,7 @@ ol ol, ul ul, ol ul, ul ol {
98
98
  margin-bottom: 0;
99
99
  }
100
100
 
101
- dt { font-weight: 700; }
101
+ dt { font-weight: var(--sd-font-weight-bold, 700); }
102
102
 
103
103
  dd {
104
104
  margin-bottom: 0.5rem;
@@ -187,13 +187,13 @@ table {
187
187
  caption {
188
188
  padding-top: 0.75rem;
189
189
  padding-bottom: 0.75rem;
190
- color: #6c757d;
190
+ color: var(--sd-reboot-caption, #6c757d);
191
191
  text-align: left;
192
192
  caption-side: bottom;
193
193
  }
194
194
 
195
195
  th {
196
- font-weight: 600; // Không dùng bold mặc định của browser
196
+ font-weight: var(--sd-font-weight-semibold, 600); // Không dùng bold mặc định của browser
197
197
  text-align: inherit;
198
198
  text-align: -webkit-match-parent;
199
199
  }
@@ -21,33 +21,33 @@ $fs-xxxl: 42px;
21
21
  // Quy ước: T{size}{weight} | M = Medium (500), R = Regular (400)
22
22
  // Mỗi class bao gồm font-size + font-weight + line-height chuẩn hóa
23
23
  // --------------------------------------------------------------------------
24
- .T48M { font-size: 48px; font-weight: 500; line-height: 56px; }
25
- .T48R { font-size: 48px; font-weight: 400; line-height: 56px; }
24
+ .T48M { font-size: var(--sd-font-size-48, 48px); font-weight: var(--sd-font-weight-medium, 500); line-height: 56px; }
25
+ .T48R { font-size: var(--sd-font-size-48, 48px); font-weight: var(--sd-font-weight-regular, 400); line-height: 56px; }
26
26
 
27
- .T32M { font-size: 32px; font-weight: 500; line-height: 48px; }
28
- .T32R { font-size: 32px; font-weight: 400; line-height: 48px; }
27
+ .T32M { font-size: var(--sd-font-size-32, 32px); font-weight: var(--sd-font-weight-medium, 500); line-height: 48px; }
28
+ .T32R { font-size: var(--sd-font-size-32, 32px); font-weight: var(--sd-font-weight-regular, 400); line-height: 48px; }
29
29
 
30
- .T24M { font-size: 24px; font-weight: 500; line-height: 28px; }
31
- .T24R { font-size: 20px; font-weight: 400; line-height: 28px; }
30
+ .T24M { font-size: var(--sd-font-size-24, 24px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-28, 28px); }
31
+ .T24R { font-size: var(--sd-font-size-20, 20px); font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-28, 28px); }
32
32
 
33
- .T20M { font-size: 20px; font-weight: 500; line-height: 28px; }
34
- .T20R { font-size: 20px; font-weight: 400; line-height: 28px; }
33
+ .T20M { font-size: var(--sd-font-size-20, 20px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-28, 28px); }
34
+ .T20R { font-size: var(--sd-font-size-20, 20px); font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-28, 28px); }
35
35
 
36
- .T18M { font-size: 18px; font-weight: 500; line-height: 28px; }
37
- .T18R { font-size: 18px; font-weight: 400; line-height: 28px; }
36
+ .T18M { font-size: var(--sd-font-size-18, 18px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-28, 28px); }
37
+ .T18R { font-size: var(--sd-font-size-18, 18px); font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-28, 28px); }
38
38
 
39
- .T16M { font-size: 16px; font-weight: 500; line-height: 24px; }
40
- .T16R { font-size: 16px; font-weight: 400; line-height: 24px; }
39
+ .T16M { font-size: var(--sd-font-size-16, 16px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-24, 24px); }
40
+ .T16R { font-size: var(--sd-font-size-16, 16px); font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-24, 24px); }
41
41
 
42
- .T14M { font-size: 14px; font-weight: 500; line-height: 20px; }
43
- .T14R { font-size: 14px; font-weight: 400; line-height: 20px; }
42
+ .T14M { font-size: var(--sd-font-size-14, 14px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-20, 20px); }
43
+ .T14R { font-size: var(--sd-font-size-14, 14px); font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-20, 20px); }
44
44
 
45
- .T12M { font-size: 12px; font-weight: 500; line-height: 16px; }
45
+ .T12M { font-size: var(--sd-font-size-12, 12px); font-weight: var(--sd-font-weight-medium, 500); line-height: var(--sd-line-height-16, 16px); }
46
46
  // !important vì T12R thường bị override bởi material components
47
- .T12R { font-size: 12px !important; font-weight: 400; line-height: 16px; }
47
+ .T12R { font-size: var(--sd-font-size-12, 12px) !important; font-weight: var(--sd-font-weight-regular, 400); line-height: var(--sd-line-height-16, 16px); }
48
48
 
49
- .T10M { font-size: 10px; font-weight: 500; line-height: 12px; }
50
- .T10R { font-size: 10px; font-weight: 400; line-height: 12px; }
49
+ .T10M { font-size: var(--sd-font-size-10, 10px); font-weight: var(--sd-font-weight-medium, 500); line-height: 12px; }
50
+ .T10R { font-size: var(--sd-font-size-10, 10px); font-weight: var(--sd-font-weight-regular, 400); line-height: 12px; }
51
51
 
52
52
  // --------------------------------------------------------------------------
53
53
  // Font-size utilities (px-based, 0–200)
@@ -61,10 +61,10 @@ $fs-xxxl: 42px;
61
61
  // Font-weight utilities
62
62
  // --------------------------------------------------------------------------
63
63
  .font-weight-light { font-weight: 300 !important; }
64
- .font-weight-normal { font-weight: 400 !important; }
65
- .font-weight-medium { font-weight: 500 !important; }
66
- .font-weight-bold { font-weight: 600 !important; }
67
- .font-weight-bolder { font-weight: 700 !important; }
64
+ .font-weight-normal { font-weight: var(--sd-font-weight-regular, 400) !important; }
65
+ .font-weight-medium { font-weight: var(--sd-font-weight-medium, 500) !important; }
66
+ .font-weight-bold { font-weight: var(--sd-font-weight-semibold, 600) !important; }
67
+ .font-weight-bolder { font-weight: var(--sd-font-weight-bold, 700) !important; }
68
68
 
69
69
  // --------------------------------------------------------------------------
70
70
  // Text alignment
@@ -13,6 +13,18 @@ html {
13
13
  @include default.theme(default.$default-theme);
14
14
  }
15
15
 
16
+ // Dark mode is opt-in: set data-sd-theme="dark" on <html> (the library never writes this attribute).
17
+ // These two blocks cover the default preset from the core source; an app with its own colours or
18
+ // $source: 'material' includes sd.theme(<same arguments>, $mode: 'dark') under its own dark selector.
19
+ [data-sd-theme=dark] {
20
+ @include default.theme($mode: 'dark');
21
+ }
22
+
23
+ [data-sd-theme=light] {
24
+ @include default.theme(default.$default-theme);
25
+ color-scheme: light;
26
+ }
27
+
16
28
  html, body {
17
29
  font-family: Roboto, 'Helvetica Neue', sans-serif;
18
30
  }