@tmorrow/cre8-wc 1.1.6 → 1.2.1

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 (271) hide show
  1. package/lib/components/accordion/accordion.styles.d.ts.map +1 -1
  2. package/lib/components/accordion/accordion.styles.js +627 -1
  3. package/lib/components/accordion/accordion.styles.js.map +1 -1
  4. package/lib/components/accordion-item/accordion-item.styles.d.ts.map +1 -1
  5. package/lib/components/accordion-item/accordion-item.styles.js +808 -1
  6. package/lib/components/accordion-item/accordion-item.styles.js.map +1 -1
  7. package/lib/components/alert/alert.styles.d.ts.map +1 -1
  8. package/lib/components/alert/alert.styles.js +746 -1
  9. package/lib/components/alert/alert.styles.js.map +1 -1
  10. package/lib/components/badge/badge.styles.d.ts.map +1 -1
  11. package/lib/components/badge/badge.styles.js +716 -1
  12. package/lib/components/badge/badge.styles.js.map +1 -1
  13. package/lib/components/band/band.styles.d.ts.map +1 -1
  14. package/lib/components/band/band.styles.js +611 -1
  15. package/lib/components/band/band.styles.js.map +1 -1
  16. package/lib/components/breadcrumbs/breadcrumbs.styles.d.ts.map +1 -1
  17. package/lib/components/breadcrumbs/breadcrumbs.styles.js +598 -1
  18. package/lib/components/breadcrumbs/breadcrumbs.styles.js.map +1 -1
  19. package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.d.ts.map +1 -1
  20. package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js +613 -1
  21. package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js.map +1 -1
  22. package/lib/components/button-group/button-group.styles.d.ts.map +1 -1
  23. package/lib/components/button-group/button-group.styles.js +612 -1
  24. package/lib/components/button-group/button-group.styles.js.map +1 -1
  25. package/lib/components/card/card.d.ts.map +1 -1
  26. package/lib/components/card/card.js.map +1 -1
  27. package/lib/components/card/card.styles.d.ts.map +1 -1
  28. package/lib/components/card/card.styles.js +364 -2
  29. package/lib/components/card/card.styles.js.map +1 -1
  30. package/lib/components/chart/chart.styles.d.ts.map +1 -1
  31. package/lib/components/chart/chart.styles.js +361 -1
  32. package/lib/components/chart/chart.styles.js.map +1 -1
  33. package/lib/components/checkbox-field/checkbox-field.styles.d.ts.map +1 -1
  34. package/lib/components/checkbox-field/checkbox-field.styles.js +619 -1
  35. package/lib/components/checkbox-field/checkbox-field.styles.js.map +1 -1
  36. package/lib/components/checkbox-field-item/checkbox-field-item.styles.d.ts.map +1 -1
  37. package/lib/components/checkbox-field-item/checkbox-field-item.styles.js +864 -1
  38. package/lib/components/checkbox-field-item/checkbox-field-item.styles.js.map +1 -1
  39. package/lib/components/danger-button/danger-button.styles.d.ts.map +1 -1
  40. package/lib/components/danger-button/danger-button.styles.js +1114 -1
  41. package/lib/components/danger-button/danger-button.styles.js.map +1 -1
  42. package/lib/components/date-picker/calendar/calendar.styles.d.ts.map +1 -1
  43. package/lib/components/date-picker/calendar/calendar.styles.js +686 -1
  44. package/lib/components/date-picker/calendar/calendar.styles.js.map +1 -1
  45. package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.d.ts.map +1 -1
  46. package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js +607 -1
  47. package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js.map +1 -1
  48. package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.d.ts.map +1 -1
  49. package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js +595 -1
  50. package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js.map +1 -1
  51. package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.d.ts.map +1 -1
  52. package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js +614 -1
  53. package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js.map +1 -1
  54. package/lib/components/divider/divider.styles.d.ts.map +1 -1
  55. package/lib/components/divider/divider.styles.js +620 -1
  56. package/lib/components/divider/divider.styles.js.map +1 -1
  57. package/lib/components/dropdown/dropdown.styles.d.ts.map +1 -1
  58. package/lib/components/dropdown/dropdown.styles.js +656 -1
  59. package/lib/components/dropdown/dropdown.styles.js.map +1 -1
  60. package/lib/components/dropdown-item/dropdown-item.styles.d.ts.map +1 -1
  61. package/lib/components/dropdown-item/dropdown-item.styles.js +611 -1
  62. package/lib/components/dropdown-item/dropdown-item.styles.js.map +1 -1
  63. package/lib/components/feature/feature.styles.d.ts.map +1 -1
  64. package/lib/components/feature/feature.styles.js +645 -1
  65. package/lib/components/feature/feature.styles.js.map +1 -1
  66. package/lib/components/field/field.styles.d.ts.map +1 -1
  67. package/lib/components/field/field.styles.js +365 -17
  68. package/lib/components/field/field.styles.js.map +1 -1
  69. package/lib/components/field-note/field-note.styles.d.ts.map +1 -1
  70. package/lib/components/field-note/field-note.styles.js +625 -1
  71. package/lib/components/field-note/field-note.styles.js.map +1 -1
  72. package/lib/components/footer/footer.styles.d.ts.map +1 -1
  73. package/lib/components/footer/footer.styles.js +603 -1
  74. package/lib/components/footer/footer.styles.js.map +1 -1
  75. package/lib/components/global-nav/global-nav.styles.d.ts.map +1 -1
  76. package/lib/components/global-nav/global-nav.styles.js +602 -1
  77. package/lib/components/global-nav/global-nav.styles.js.map +1 -1
  78. package/lib/components/global-nav-item/global-nav-item.styles.d.ts.map +1 -1
  79. package/lib/components/global-nav-item/global-nav-item.styles.js +662 -1
  80. package/lib/components/global-nav-item/global-nav-item.styles.js.map +1 -1
  81. package/lib/components/grid/grid.styles.d.ts.map +1 -1
  82. package/lib/components/grid/grid.styles.js +932 -1
  83. package/lib/components/grid/grid.styles.js.map +1 -1
  84. package/lib/components/grid-item/grid-item.styles.d.ts.map +1 -1
  85. package/lib/components/grid-item/grid-item.styles.js +589 -1
  86. package/lib/components/grid-item/grid-item.styles.js.map +1 -1
  87. package/lib/components/header/header.styles.d.ts.map +1 -1
  88. package/lib/components/header/header.styles.js +642 -1
  89. package/lib/components/header/header.styles.js.map +1 -1
  90. package/lib/components/heading/heading.styles.d.ts.map +1 -1
  91. package/lib/components/heading/heading.styles.js +904 -1
  92. package/lib/components/heading/heading.styles.js.map +1 -1
  93. package/lib/components/hero/hero.styles.d.ts.map +1 -1
  94. package/lib/components/hero/hero.styles.js +721 -1
  95. package/lib/components/hero/hero.styles.js.map +1 -1
  96. package/lib/components/icon/icon.styles.d.ts.map +1 -1
  97. package/lib/components/icon/icon.styles.js +657 -1
  98. package/lib/components/icon/icon.styles.js.map +1 -1
  99. package/lib/components/inline-alert/inline-alert.styles.d.ts.map +1 -1
  100. package/lib/components/inline-alert/inline-alert.styles.js +365 -5
  101. package/lib/components/inline-alert/inline-alert.styles.js.map +1 -1
  102. package/lib/components/layout/layout.styles.d.ts.map +1 -1
  103. package/lib/components/layout/layout.styles.js +615 -1
  104. package/lib/components/layout/layout.styles.js.map +1 -1
  105. package/lib/components/layout-container/layout-container.styles.d.ts.map +1 -1
  106. package/lib/components/layout-container/layout-container.styles.js +602 -1
  107. package/lib/components/layout-container/layout-container.styles.js.map +1 -1
  108. package/lib/components/layout-section/layout-section.styles.d.ts.map +1 -1
  109. package/lib/components/layout-section/layout-section.styles.js +590 -1
  110. package/lib/components/layout-section/layout-section.styles.js.map +1 -1
  111. package/lib/components/linelength-container/linelength-container.styles.d.ts.map +1 -1
  112. package/lib/components/linelength-container/linelength-container.styles.js +589 -1
  113. package/lib/components/linelength-container/linelength-container.styles.js.map +1 -1
  114. package/lib/components/link/link.styles.d.ts.map +1 -1
  115. package/lib/components/link/link.styles.js +762 -1
  116. package/lib/components/link/link.styles.js.map +1 -1
  117. package/lib/components/link-list/link-list.styles.d.ts.map +1 -1
  118. package/lib/components/link-list/link-list.styles.js +695 -1
  119. package/lib/components/link-list/link-list.styles.js.map +1 -1
  120. package/lib/components/link-list-item/link-list-item.styles.d.ts.map +1 -1
  121. package/lib/components/link-list-item/link-list-item.styles.js +641 -1
  122. package/lib/components/link-list-item/link-list-item.styles.js.map +1 -1
  123. package/lib/components/list/list.styles.d.ts.map +1 -1
  124. package/lib/components/list/list.styles.js +631 -1
  125. package/lib/components/list/list.styles.js.map +1 -1
  126. package/lib/components/list-item/list-item.styles.d.ts.map +1 -1
  127. package/lib/components/list-item/list-item.styles.js +586 -1
  128. package/lib/components/list-item/list-item.styles.js.map +1 -1
  129. package/lib/components/loading-spinner/loading-spinner.styles.d.ts.map +1 -1
  130. package/lib/components/loading-spinner/loading-spinner.styles.js +719 -1
  131. package/lib/components/loading-spinner/loading-spinner.styles.js.map +1 -1
  132. package/lib/components/logo/logo.styles.d.ts.map +1 -1
  133. package/lib/components/logo/logo.styles.js +589 -1
  134. package/lib/components/logo/logo.styles.js.map +1 -1
  135. package/lib/components/main/main.styles.d.ts.map +1 -1
  136. package/lib/components/main/main.styles.js +603 -1
  137. package/lib/components/main/main.styles.js.map +1 -1
  138. package/lib/components/modal/modal.styles.d.ts.map +1 -1
  139. package/lib/components/modal/modal.styles.js +740 -1
  140. package/lib/components/modal/modal.styles.js.map +1 -1
  141. package/lib/components/multi-select/multi-select.styles.d.ts.map +1 -1
  142. package/lib/components/multi-select/multi-select.styles.js +826 -1
  143. package/lib/components/multi-select/multi-select.styles.js.map +1 -1
  144. package/lib/components/nav-container/nav-container.styles.d.ts.map +1 -1
  145. package/lib/components/nav-container/nav-container.styles.js +618 -1
  146. package/lib/components/nav-container/nav-container.styles.js.map +1 -1
  147. package/lib/components/page-header/page-header.styles.d.ts.map +1 -1
  148. package/lib/components/page-header/page-header.styles.js +636 -1
  149. package/lib/components/page-header/page-header.styles.js.map +1 -1
  150. package/lib/components/pagination/page-counter/page-counter.styles.d.ts.map +1 -1
  151. package/lib/components/pagination/page-counter/page-counter.styles.js +599 -1
  152. package/lib/components/pagination/page-counter/page-counter.styles.js.map +1 -1
  153. package/lib/components/pagination/pagination.styles.d.ts.map +1 -1
  154. package/lib/components/pagination/pagination.styles.js +645 -1
  155. package/lib/components/pagination/pagination.styles.js.map +1 -1
  156. package/lib/components/percent-bar/percent-bar.styles.d.ts.map +1 -1
  157. package/lib/components/percent-bar/percent-bar.styles.js +611 -1
  158. package/lib/components/percent-bar/percent-bar.styles.js.map +1 -1
  159. package/lib/components/popover/popover.styles.d.ts.map +1 -1
  160. package/lib/components/popover/popover.styles.js +766 -1
  161. package/lib/components/popover/popover.styles.js.map +1 -1
  162. package/lib/components/primary-nav/primary-nav.styles.d.ts.map +1 -1
  163. package/lib/components/primary-nav/primary-nav.styles.js +613 -1
  164. package/lib/components/primary-nav/primary-nav.styles.js.map +1 -1
  165. package/lib/components/primary-nav-item/primary-nav-item.styles.d.ts.map +1 -1
  166. package/lib/components/primary-nav-item/primary-nav-item.styles.js +767 -1
  167. package/lib/components/primary-nav-item/primary-nav-item.styles.js.map +1 -1
  168. package/lib/components/progress-meter/progress-meter.styles.d.ts.map +1 -1
  169. package/lib/components/progress-meter/progress-meter.styles.js +699 -1
  170. package/lib/components/progress-meter/progress-meter.styles.js.map +1 -1
  171. package/lib/components/progress-steps/progress-steps.styles.d.ts.map +1 -1
  172. package/lib/components/progress-steps/progress-steps.styles.js +597 -1
  173. package/lib/components/progress-steps/progress-steps.styles.js.map +1 -1
  174. package/lib/components/progress-steps-item/progress-steps-item.styles.d.ts.map +1 -1
  175. package/lib/components/progress-steps-item/progress-steps-item.styles.js +711 -1
  176. package/lib/components/progress-steps-item/progress-steps-item.styles.js.map +1 -1
  177. package/lib/components/radio-field/radio-field.styles.d.ts.map +1 -1
  178. package/lib/components/radio-field/radio-field.styles.js +624 -1
  179. package/lib/components/radio-field/radio-field.styles.js.map +1 -1
  180. package/lib/components/radio-field-item/radio-field-item.styles.d.ts.map +1 -1
  181. package/lib/components/radio-field-item/radio-field-item.styles.js +721 -1
  182. package/lib/components/radio-field-item/radio-field-item.styles.js.map +1 -1
  183. package/lib/components/remove-tag/remove-tag.styles.d.ts.map +1 -1
  184. package/lib/components/remove-tag/remove-tag.styles.js +681 -1
  185. package/lib/components/remove-tag/remove-tag.styles.js.map +1 -1
  186. package/lib/components/section/section.styles.d.ts.map +1 -1
  187. package/lib/components/section/section.styles.js +608 -1
  188. package/lib/components/section/section.styles.js.map +1 -1
  189. package/lib/components/select/select.styles.d.ts.map +1 -1
  190. package/lib/components/select/select.styles.js +739 -1
  191. package/lib/components/select/select.styles.js.map +1 -1
  192. package/lib/components/select-tile-list/select-tile-list.styles.d.ts.map +1 -1
  193. package/lib/components/select-tile-list/select-tile-list.styles.js +620 -1
  194. package/lib/components/select-tile-list/select-tile-list.styles.js.map +1 -1
  195. package/lib/components/skeleton-loader/skeleton-loader.styles.d.ts.map +1 -1
  196. package/lib/components/skeleton-loader/skeleton-loader.styles.js +634 -1
  197. package/lib/components/skeleton-loader/skeleton-loader.styles.js.map +1 -1
  198. package/lib/components/split-button/split-button.styles.d.ts.map +1 -1
  199. package/lib/components/split-button/split-button.styles.js +595 -1
  200. package/lib/components/split-button/split-button.styles.js.map +1 -1
  201. package/lib/components/submenu/submenu.styles.d.ts.map +1 -1
  202. package/lib/components/submenu/submenu.styles.js +591 -1
  203. package/lib/components/submenu/submenu.styles.js.map +1 -1
  204. package/lib/components/submenu-item/submenu-item.styles.d.ts.map +1 -1
  205. package/lib/components/submenu-item/submenu-item.styles.js +599 -1
  206. package/lib/components/submenu-item/submenu-item.styles.js.map +1 -1
  207. package/lib/components/tab/tab.styles.d.ts.map +1 -1
  208. package/lib/components/tab/tab.styles.js +680 -1
  209. package/lib/components/tab/tab.styles.js.map +1 -1
  210. package/lib/components/tab-panel/tab-panel.styles.d.ts.map +1 -1
  211. package/lib/components/tab-panel/tab-panel.styles.js +615 -1
  212. package/lib/components/tab-panel/tab-panel.styles.js.map +1 -1
  213. package/lib/components/table/table.styles.d.ts.map +1 -1
  214. package/lib/components/table/table.styles.js +633 -1
  215. package/lib/components/table/table.styles.js.map +1 -1
  216. package/lib/components/table-body/table-body.styles.d.ts.map +1 -1
  217. package/lib/components/table-body/table-body.styles.js +592 -1
  218. package/lib/components/table-body/table-body.styles.js.map +1 -1
  219. package/lib/components/table-cell/table-cell.styles.d.ts.map +1 -1
  220. package/lib/components/table-cell/table-cell.styles.js +625 -1
  221. package/lib/components/table-cell/table-cell.styles.js.map +1 -1
  222. package/lib/components/table-header/table-header.styles.d.ts.map +1 -1
  223. package/lib/components/table-header/table-header.styles.js +612 -1
  224. package/lib/components/table-header/table-header.styles.js.map +1 -1
  225. package/lib/components/table-header-cell/table-header-cell.styles.d.ts.map +1 -1
  226. package/lib/components/table-header-cell/table-header-cell.styles.js +604 -1
  227. package/lib/components/table-header-cell/table-header-cell.styles.js.map +1 -1
  228. package/lib/components/table-object/table-object.styles.d.ts.map +1 -1
  229. package/lib/components/table-object/table-object.styles.js +599 -1
  230. package/lib/components/table-object/table-object.styles.js.map +1 -1
  231. package/lib/components/table-row/table-row.styles.d.ts.map +1 -1
  232. package/lib/components/table-row/table-row.styles.js +691 -1
  233. package/lib/components/table-row/table-row.styles.js.map +1 -1
  234. package/lib/components/tabs/tabs.styles.d.ts.map +1 -1
  235. package/lib/components/tabs/tabs.styles.js +678 -1
  236. package/lib/components/tabs/tabs.styles.js.map +1 -1
  237. package/lib/components/tag/tag.styles.d.ts.map +1 -1
  238. package/lib/components/tag/tag.styles.js +695 -1
  239. package/lib/components/tag/tag.styles.js.map +1 -1
  240. package/lib/components/tag-list/tag-list.styles.d.ts.map +1 -1
  241. package/lib/components/tag-list/tag-list.styles.js +612 -1
  242. package/lib/components/tag-list/tag-list.styles.js.map +1 -1
  243. package/lib/components/tertiary-nav/tertiary-nav.styles.d.ts.map +1 -1
  244. package/lib/components/tertiary-nav/tertiary-nav.styles.js +613 -1
  245. package/lib/components/tertiary-nav/tertiary-nav.styles.js.map +1 -1
  246. package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.d.ts.map +1 -1
  247. package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js +635 -1
  248. package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js.map +1 -1
  249. package/lib/components/text-link/text-link.styles.d.ts.map +1 -1
  250. package/lib/components/text-link/text-link.styles.js +652 -1
  251. package/lib/components/text-link/text-link.styles.js.map +1 -1
  252. package/lib/components/text-passage/text-passage-light-dom.styles.d.ts.map +1 -1
  253. package/lib/components/text-passage/text-passage-light-dom.styles.js +840 -1
  254. package/lib/components/text-passage/text-passage-light-dom.styles.js.map +1 -1
  255. package/lib/components/text-passage/text-passage.styles.d.ts.map +1 -1
  256. package/lib/components/text-passage/text-passage.styles.js +622 -1
  257. package/lib/components/text-passage/text-passage.styles.js.map +1 -1
  258. package/lib/components/tooltip/tooltip.styles.d.ts.map +1 -1
  259. package/lib/components/tooltip/tooltip.styles.js +781 -1
  260. package/lib/components/tooltip/tooltip.styles.js.map +1 -1
  261. package/lib/components/utility-nav/utility-nav.styles.d.ts.map +1 -1
  262. package/lib/components/utility-nav/utility-nav.styles.js +613 -1
  263. package/lib/components/utility-nav/utility-nav.styles.js.map +1 -1
  264. package/lib/components/utility-nav-item/utility-nav-item.styles.d.ts.map +1 -1
  265. package/lib/components/utility-nav-item/utility-nav-item.styles.js +643 -1
  266. package/lib/components/utility-nav-item/utility-nav-item.styles.js.map +1 -1
  267. package/lib/{icon-D22g8aWB.js → icon-BzSGJsMA.js} +727 -71
  268. package/lib/scripts/convert-scss-to-ts.js +99 -20
  269. package/lib/scripts/convert-scss-to-ts.js.map +1 -1
  270. package/mcp-manifest.json +1 -1
  271. package/package.json +3 -2
@@ -1,25 +1,104 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- // Use the correct baseDir relative to this script's location
4
- const baseDir = path.join(__dirname, '../components');
5
- function walk(dir, callback) {
6
- fs.readdirSync(dir, { withFileTypes: true }).forEach(dirent => {
7
- const fullPath = path.join(dir, dirent.name);
8
- if (dirent.isDirectory()) {
9
- walk(fullPath, callback);
10
- }
11
- else if (dirent.isFile() && dirent.name.endsWith('.scss')) {
12
- callback(fullPath);
3
+ import { fileURLToPath } from 'url';
4
+ import { glob } from 'glob';
5
+ import * as sass from 'sass';
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const packageRoot = path.join(__dirname, '..');
8
+ // Read the pre-compiled head.css to prepend as additionalData (matches Vite config behavior)
9
+ const headCssPath = path.join(packageRoot, 'design-tokens/core/scss/theming/head.css');
10
+ const headCss = fs.readFileSync(headCssPath, 'utf8');
11
+ // Find all component SCSS modules
12
+ const scssFiles = glob.sync('components/**/*.module.scss', { cwd: packageRoot });
13
+ let successCount = 0;
14
+ let errorCount = 0;
15
+ let fatalErrors = 0;
16
+ /**
17
+ * Pre-process SCSS source to fix syntax issues before compilation:
18
+ * 1. Convert @use to @import (avoid @use ordering issues with head.css prepend)
19
+ * 2. De-namespace `component.$var` → `$var` and `@include component.mixin()` → `@include mixin()`
20
+ * 3. Remove `@import ... as X` (invalid @import syntax, convert to plain @import)
21
+ * 4. Remap old package name @cre8_dev → @tmorrow
22
+ */
23
+ function preprocessScss(source) {
24
+ const lines = source.split('\n');
25
+ return lines.map((line) => {
26
+ // Remap old package name
27
+ line = line.replace(/@cre8_dev\/cre8-design-tokens/g, '@tmorrow/cre8-design-tokens');
28
+ // Convert @use '...' as X → @import '...'
29
+ line = line.replace(/^(\s*)@use\s+(['"])(.+?)\2\s+as\s+\w+\s*;/, '$1@import $2$3$2;');
30
+ // Remove invalid `as X` from @import
31
+ line = line.replace(/^(\s*@import\s+['"].+?['"])\s+as\s+\w+\s*;/, '$1;');
32
+ // De-namespace component.$var → $var
33
+ line = line.replace(/component\.\$/g, '$');
34
+ // De-namespace @include component.mixin → @include mixin
35
+ line = line.replace(/@include\s+component\./g, '@include ');
36
+ return line;
37
+ }).join('\n');
38
+ }
39
+ for (const relPath of scssFiles) {
40
+ const scssPath = path.join(packageRoot, relPath);
41
+ const tsPath = scssPath.replace(/\.module\.scss$/, '.styles.ts');
42
+ const fileDir = path.dirname(scssPath);
43
+ try {
44
+ let scssContent = fs.readFileSync(scssPath, 'utf8');
45
+ // Pre-process to fix @use/@import and namespace issues
46
+ scssContent = preprocessScss(scssContent);
47
+ // Prepend head.css content (already compiled CSS, passes through SCSS compiler)
48
+ const fullSource = headCss + '\n' + scssContent;
49
+ const result = sass.compileString(fullSource, {
50
+ style: 'expanded',
51
+ url: new URL(`file://${scssPath}`),
52
+ loadPaths: [
53
+ fileDir,
54
+ packageRoot,
55
+ path.join(packageRoot, 'node_modules/@tmorrow/cre8-design-tokens'),
56
+ path.join(packageRoot, 'node_modules'),
57
+ ],
58
+ importers: [
59
+ {
60
+ findFileUrl(url) {
61
+ // Handle absolute-style paths like /design-tokens/...
62
+ if (url.startsWith('/design-tokens/')) {
63
+ const cleaned = url.substring(1);
64
+ const resolved = path.join(packageRoot, cleaned);
65
+ return new URL(`file://${resolved}`);
66
+ }
67
+ // Handle bare design-tokens/ paths
68
+ if (url.startsWith('design-tokens/')) {
69
+ const resolved = path.join(packageRoot, url);
70
+ return new URL(`file://${resolved}`);
71
+ }
72
+ return null;
73
+ },
74
+ },
75
+ ],
76
+ silenceDeprecations: ['import'],
77
+ });
78
+ // Escape backticks and template literal expressions in the compiled CSS
79
+ const escapedCss = result.css
80
+ .replace(/\\/g, '\\\\')
81
+ .replace(/`/g, '\\`')
82
+ .replace(/\$\{/g, '\\${');
83
+ const tsContent = `import { css } from 'lit';\nconst styles = css\`${escapedCss}\`;\nexport default styles;\n`;
84
+ fs.writeFileSync(tsPath, tsContent, 'utf8');
85
+ console.log(`Compiled: ${relPath} -> ${path.basename(tsPath)}`);
86
+ successCount++;
87
+ }
88
+ catch (err) {
89
+ // Check if an existing .styles.ts exists (from prior compilation)
90
+ const hasExisting = fs.existsSync(tsPath);
91
+ const label = hasExisting ? 'WARN' : 'ERROR';
92
+ console.error(`${label} compiling ${relPath}: ${err.message}${hasExisting ? ' (keeping existing .styles.ts)' : ''}`);
93
+ errorCount++;
94
+ if (!hasExisting) {
95
+ fatalErrors++;
13
96
  }
14
- });
97
+ }
98
+ }
99
+ console.log(`\nDone: ${successCount} compiled, ${errorCount} warnings/errors`);
100
+ if (fatalErrors > 0) {
101
+ console.error(`${fatalErrors} file(s) failed with no existing .styles.ts fallback`);
102
+ process.exit(1);
15
103
  }
16
- walk(baseDir, (scssPath) => {
17
- const tsPath = scssPath.replace(/\.scss$/, '.ts');
18
- const scssContent = fs.readFileSync(scssPath, 'utf8');
19
- const tsContent = `import { css } from 'lit';\nconst styles = css\`` +
20
- scssContent.replace(/`/g, '\`') +
21
- `\`;\nexport default styles;\n`;
22
- fs.writeFileSync(tsPath, tsContent, 'utf8');
23
- console.log(`Converted: ${scssPath} -> ${tsPath}`);
24
- });
25
104
  //# sourceMappingURL=convert-scss-to-ts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-scss-to-ts.js","sourceRoot":"","sources":["../../scripts/convert-scss-to-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,6DAA6D;AAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAEtD,SAAS,IAAI,CAAC,GAAW,EAAE,QAAgC;IACzD,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3B,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5D,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,SAAS,GACb,kDAAkD;QAClD,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/B,+BAA+B,CAAC;IAClC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,cAAc,QAAQ,OAAO,MAAM,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// Use the correct baseDir relative to this script's location\nconst baseDir = path.join(__dirname, '../components');\n\nfunction walk(dir: string, callback: (file: string) => void): void {\n fs.readdirSync(dir, { withFileTypes: true }).forEach(dirent => {\n const fullPath = path.join(dir, dirent.name);\n if (dirent.isDirectory()) {\n walk(fullPath, callback);\n } else if (dirent.isFile() && dirent.name.endsWith('.scss')) {\n callback(fullPath);\n }\n });\n}\n\nwalk(baseDir, (scssPath) => {\n const tsPath = scssPath.replace(/\\.scss$/, '.ts');\n const scssContent = fs.readFileSync(scssPath, 'utf8');\n const tsContent =\n `import { css } from 'lit';\\nconst styles = css\\`` +\n scssContent.replace(/`/g, '\\`') +\n `\\`;\\nexport default styles;\\n`;\n fs.writeFileSync(tsPath, tsContent, 'utf8');\n console.log(`Converted: ${scssPath} -> ${tsPath}`);\n});\n"]}
1
+ {"version":3,"file":"convert-scss-to-ts.js","sourceRoot":"","sources":["../../scripts/convert-scss-to-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM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W,EAAE,CAAC;YACjB,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;AACH,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,WAAW,YAAY,cAAc,UAAU,kBAAkB,CAAC,CAAC;AAE/E,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;IACpB,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,sDAAsD,CAAC,CAAC;IACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { glob } from 'glob';\nimport * as sass from 'sass';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst packageRoot = path.join(__dirname, '..');\n\n// Read the pre-compiled head.css to prepend as additionalData (matches Vite config behavior)\nconst headCssPath = path.join(packageRoot, 'design-tokens/core/scss/theming/head.css');\nconst headCss = fs.readFileSync(headCssPath, 'utf8');\n\n// Find all component SCSS modules\nconst scssFiles = glob.sync('components/**/*.module.scss', { cwd: packageRoot });\n\nlet successCount = 0;\nlet errorCount = 0;\nlet fatalErrors = 0;\n\n/**\n * Pre-process SCSS source to fix syntax issues before compilation:\n * 1. Convert @use to @import (avoid @use ordering issues with head.css prepend)\n * 2. De-namespace `component.$var` → `$var` and `@include component.mixin()` → `@include mixin()`\n * 3. Remove `@import ... as X` (invalid @import syntax, convert to plain @import)\n * 4. Remap old package name @cre8_dev → @tmorrow\n */\nfunction preprocessScss(source: string): string {\n const lines = source.split('\\n');\n\n return lines.map((line) => {\n // Remap old package name\n line = line.replace(/@cre8_dev\\/cre8-design-tokens/g, '@tmorrow/cre8-design-tokens');\n\n // Convert @use '...' as X → @import '...'\n line = line.replace(/^(\\s*)@use\\s+(['\"])(.+?)\\2\\s+as\\s+\\w+\\s*;/, '$1@import $2$3$2;');\n\n // Remove invalid `as X` from @import\n line = line.replace(/^(\\s*@import\\s+['\"].+?['\"])\\s+as\\s+\\w+\\s*;/, '$1;');\n\n // De-namespace component.$var → $var\n line = line.replace(/component\\.\\$/g, '$');\n\n // De-namespace @include component.mixin → @include mixin\n line = line.replace(/@include\\s+component\\./g, '@include ');\n\n return line;\n }).join('\\n');\n}\n\nfor (const relPath of scssFiles) {\n const scssPath = path.join(packageRoot, relPath);\n const tsPath = scssPath.replace(/\\.module\\.scss$/, '.styles.ts');\n const fileDir = path.dirname(scssPath);\n\n try {\n let scssContent = fs.readFileSync(scssPath, 'utf8');\n\n // Pre-process to fix @use/@import and namespace issues\n scssContent = preprocessScss(scssContent);\n\n // Prepend head.css content (already compiled CSS, passes through SCSS compiler)\n const fullSource = headCss + '\\n' + scssContent;\n\n const result = sass.compileString(fullSource, {\n style: 'expanded',\n url: new URL(`file://${scssPath}`),\n loadPaths: [\n fileDir,\n packageRoot,\n path.join(packageRoot, 'node_modules/@tmorrow/cre8-design-tokens'),\n path.join(packageRoot, 'node_modules'),\n ],\n importers: [\n {\n findFileUrl(url: string) {\n // Handle absolute-style paths like /design-tokens/...\n if (url.startsWith('/design-tokens/')) {\n const cleaned = url.substring(1);\n const resolved = path.join(packageRoot, cleaned);\n return new URL(`file://${resolved}`);\n }\n // Handle bare design-tokens/ paths\n if (url.startsWith('design-tokens/')) {\n const resolved = path.join(packageRoot, url);\n return new URL(`file://${resolved}`);\n }\n return null;\n },\n },\n ],\n silenceDeprecations: ['import' as any],\n });\n\n // Escape backticks and template literal expressions in the compiled CSS\n const escapedCss = result.css\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/`/g, '\\\\`')\n .replace(/\\$\\{/g, '\\\\${');\n\n const tsContent = `import { css } from 'lit';\\nconst styles = css\\`${escapedCss}\\`;\\nexport default styles;\\n`;\n\n fs.writeFileSync(tsPath, tsContent, 'utf8');\n console.log(`Compiled: ${relPath} -> ${path.basename(tsPath)}`);\n successCount++;\n } catch (err: any) {\n // Check if an existing .styles.ts exists (from prior compilation)\n const hasExisting = fs.existsSync(tsPath);\n const label = hasExisting ? 'WARN' : 'ERROR';\n console.error(`${label} compiling ${relPath}: ${err.message}${hasExisting ? ' (keeping existing .styles.ts)' : ''}`);\n errorCount++;\n if (!hasExisting) {\n fatalErrors++;\n }\n }\n}\n\nconsole.log(`\\nDone: ${successCount} compiled, ${errorCount} warnings/errors`);\n\nif (fatalErrors > 0) {\n console.error(`${fatalErrors} file(s) failed with no existing .styles.ts fallback`);\n process.exit(1);\n}\n"]}
package/mcp-manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.5",
2
+ "version": "1.2.0",
3
3
  "library": "@tmorrow/cre8-wc",
4
4
  "tagPrefix": "cre8",
5
5
  "description": "cre8 Web Components is a library of presentational UI web components to be consumed by # web applications.",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@tmorrow/cre8-wc",
3
- "version": "1.1.6",
3
+ "version": "1.2.1",
4
4
  "description": "cre8 Web Components is a library of presentational UI web components to be consumed by # web applications.",
5
5
  "license": "BSD-3-Clause",
6
6
  "scripts": {
7
7
  "start": "pnpm run build:custom-elements.json && pnpm run storybook",
8
- "build": "rm -rf lib && vite build && tsc && cp .storybook/custom-elements.json custom-elements.json && npx tsx scripts/generate-react-wrappers.ts && cd react-wrappers && npx tsc && cd .. && pnpm run build:mcp-manifest",
8
+ "compile-styles": "npx tsx scripts/convert-scss-to-ts.ts",
9
+ "build": "rm -rf lib && pnpm run compile-styles && vite build && tsc && cp .storybook/custom-elements.json custom-elements.json && npx tsx scripts/generate-react-wrappers.ts && cd react-wrappers && npx tsc && cd .. && pnpm run build:mcp-manifest",
9
10
  "build:mcp-manifest": "npx web-component-analyzer analyze \"components/*/*.ts\" --format json --outFile /tmp/wca-raw.json && npx tsx scripts/generate-mcp-manifest.ts",
10
11
  "build:cdn": "rm -rf cdn && vite build --config vite.config.cdn.ts",
11
12
  "build:all": "pnpm run build:cdn && pnpm run build",