@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.
- package/lib/components/accordion/accordion.styles.d.ts.map +1 -1
- package/lib/components/accordion/accordion.styles.js +627 -1
- package/lib/components/accordion/accordion.styles.js.map +1 -1
- package/lib/components/accordion-item/accordion-item.styles.d.ts.map +1 -1
- package/lib/components/accordion-item/accordion-item.styles.js +808 -1
- package/lib/components/accordion-item/accordion-item.styles.js.map +1 -1
- package/lib/components/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/alert/alert.styles.js +746 -1
- package/lib/components/alert/alert.styles.js.map +1 -1
- package/lib/components/badge/badge.styles.d.ts.map +1 -1
- package/lib/components/badge/badge.styles.js +716 -1
- package/lib/components/badge/badge.styles.js.map +1 -1
- package/lib/components/band/band.styles.d.ts.map +1 -1
- package/lib/components/band/band.styles.js +611 -1
- package/lib/components/band/band.styles.js.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.styles.d.ts.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.styles.js +598 -1
- package/lib/components/breadcrumbs/breadcrumbs.styles.js.map +1 -1
- package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.d.ts.map +1 -1
- package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js +613 -1
- package/lib/components/breadcrumbs-item/breadcrumbs-item.styles.js.map +1 -1
- package/lib/components/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/button-group/button-group.styles.js +612 -1
- package/lib/components/button-group/button-group.styles.js.map +1 -1
- package/lib/components/card/card.d.ts.map +1 -1
- package/lib/components/card/card.js.map +1 -1
- package/lib/components/card/card.styles.d.ts.map +1 -1
- package/lib/components/card/card.styles.js +364 -2
- package/lib/components/card/card.styles.js.map +1 -1
- package/lib/components/chart/chart.styles.d.ts.map +1 -1
- package/lib/components/chart/chart.styles.js +361 -1
- package/lib/components/chart/chart.styles.js.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.styles.d.ts.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.styles.js +619 -1
- package/lib/components/checkbox-field/checkbox-field.styles.js.map +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.d.ts.map +1 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js +864 -1
- package/lib/components/checkbox-field-item/checkbox-field-item.styles.js.map +1 -1
- package/lib/components/danger-button/danger-button.styles.d.ts.map +1 -1
- package/lib/components/danger-button/danger-button.styles.js +1114 -1
- package/lib/components/danger-button/danger-button.styles.js.map +1 -1
- package/lib/components/date-picker/calendar/calendar.styles.d.ts.map +1 -1
- package/lib/components/date-picker/calendar/calendar.styles.js +686 -1
- package/lib/components/date-picker/calendar/calendar.styles.js.map +1 -1
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.d.ts.map +1 -1
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js +607 -1
- package/lib/components/date-picker/calendar-month-modal/calendar-month-modal.styles.js.map +1 -1
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.d.ts.map +1 -1
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js +595 -1
- package/lib/components/date-picker/calendar-navigation/calendar-navigation.styles.js.map +1 -1
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.d.ts.map +1 -1
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js +614 -1
- package/lib/components/date-picker/calendar-year-modal/calendar-year-modal.styles.js.map +1 -1
- package/lib/components/divider/divider.styles.d.ts.map +1 -1
- package/lib/components/divider/divider.styles.js +620 -1
- package/lib/components/divider/divider.styles.js.map +1 -1
- package/lib/components/dropdown/dropdown.styles.d.ts.map +1 -1
- package/lib/components/dropdown/dropdown.styles.js +656 -1
- package/lib/components/dropdown/dropdown.styles.js.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.styles.d.ts.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.styles.js +611 -1
- package/lib/components/dropdown-item/dropdown-item.styles.js.map +1 -1
- package/lib/components/feature/feature.styles.d.ts.map +1 -1
- package/lib/components/feature/feature.styles.js +645 -1
- package/lib/components/feature/feature.styles.js.map +1 -1
- package/lib/components/field/field.styles.d.ts.map +1 -1
- package/lib/components/field/field.styles.js +365 -17
- package/lib/components/field/field.styles.js.map +1 -1
- package/lib/components/field-note/field-note.styles.d.ts.map +1 -1
- package/lib/components/field-note/field-note.styles.js +625 -1
- package/lib/components/field-note/field-note.styles.js.map +1 -1
- package/lib/components/footer/footer.styles.d.ts.map +1 -1
- package/lib/components/footer/footer.styles.js +603 -1
- package/lib/components/footer/footer.styles.js.map +1 -1
- package/lib/components/global-nav/global-nav.styles.d.ts.map +1 -1
- package/lib/components/global-nav/global-nav.styles.js +602 -1
- package/lib/components/global-nav/global-nav.styles.js.map +1 -1
- package/lib/components/global-nav-item/global-nav-item.styles.d.ts.map +1 -1
- package/lib/components/global-nav-item/global-nav-item.styles.js +662 -1
- package/lib/components/global-nav-item/global-nav-item.styles.js.map +1 -1
- package/lib/components/grid/grid.styles.d.ts.map +1 -1
- package/lib/components/grid/grid.styles.js +932 -1
- package/lib/components/grid/grid.styles.js.map +1 -1
- package/lib/components/grid-item/grid-item.styles.d.ts.map +1 -1
- package/lib/components/grid-item/grid-item.styles.js +589 -1
- package/lib/components/grid-item/grid-item.styles.js.map +1 -1
- package/lib/components/header/header.styles.d.ts.map +1 -1
- package/lib/components/header/header.styles.js +642 -1
- package/lib/components/header/header.styles.js.map +1 -1
- package/lib/components/heading/heading.styles.d.ts.map +1 -1
- package/lib/components/heading/heading.styles.js +904 -1
- package/lib/components/heading/heading.styles.js.map +1 -1
- package/lib/components/hero/hero.styles.d.ts.map +1 -1
- package/lib/components/hero/hero.styles.js +721 -1
- package/lib/components/hero/hero.styles.js.map +1 -1
- package/lib/components/icon/icon.styles.d.ts.map +1 -1
- package/lib/components/icon/icon.styles.js +657 -1
- package/lib/components/icon/icon.styles.js.map +1 -1
- package/lib/components/inline-alert/inline-alert.styles.d.ts.map +1 -1
- package/lib/components/inline-alert/inline-alert.styles.js +365 -5
- package/lib/components/inline-alert/inline-alert.styles.js.map +1 -1
- package/lib/components/layout/layout.styles.d.ts.map +1 -1
- package/lib/components/layout/layout.styles.js +615 -1
- package/lib/components/layout/layout.styles.js.map +1 -1
- package/lib/components/layout-container/layout-container.styles.d.ts.map +1 -1
- package/lib/components/layout-container/layout-container.styles.js +602 -1
- package/lib/components/layout-container/layout-container.styles.js.map +1 -1
- package/lib/components/layout-section/layout-section.styles.d.ts.map +1 -1
- package/lib/components/layout-section/layout-section.styles.js +590 -1
- package/lib/components/layout-section/layout-section.styles.js.map +1 -1
- package/lib/components/linelength-container/linelength-container.styles.d.ts.map +1 -1
- package/lib/components/linelength-container/linelength-container.styles.js +589 -1
- package/lib/components/linelength-container/linelength-container.styles.js.map +1 -1
- package/lib/components/link/link.styles.d.ts.map +1 -1
- package/lib/components/link/link.styles.js +762 -1
- package/lib/components/link/link.styles.js.map +1 -1
- package/lib/components/link-list/link-list.styles.d.ts.map +1 -1
- package/lib/components/link-list/link-list.styles.js +695 -1
- package/lib/components/link-list/link-list.styles.js.map +1 -1
- package/lib/components/link-list-item/link-list-item.styles.d.ts.map +1 -1
- package/lib/components/link-list-item/link-list-item.styles.js +641 -1
- package/lib/components/link-list-item/link-list-item.styles.js.map +1 -1
- package/lib/components/list/list.styles.d.ts.map +1 -1
- package/lib/components/list/list.styles.js +631 -1
- package/lib/components/list/list.styles.js.map +1 -1
- package/lib/components/list-item/list-item.styles.d.ts.map +1 -1
- package/lib/components/list-item/list-item.styles.js +586 -1
- package/lib/components/list-item/list-item.styles.js.map +1 -1
- package/lib/components/loading-spinner/loading-spinner.styles.d.ts.map +1 -1
- package/lib/components/loading-spinner/loading-spinner.styles.js +719 -1
- package/lib/components/loading-spinner/loading-spinner.styles.js.map +1 -1
- package/lib/components/logo/logo.styles.d.ts.map +1 -1
- package/lib/components/logo/logo.styles.js +589 -1
- package/lib/components/logo/logo.styles.js.map +1 -1
- package/lib/components/main/main.styles.d.ts.map +1 -1
- package/lib/components/main/main.styles.js +603 -1
- package/lib/components/main/main.styles.js.map +1 -1
- package/lib/components/modal/modal.styles.d.ts.map +1 -1
- package/lib/components/modal/modal.styles.js +740 -1
- package/lib/components/modal/modal.styles.js.map +1 -1
- package/lib/components/multi-select/multi-select.styles.d.ts.map +1 -1
- package/lib/components/multi-select/multi-select.styles.js +826 -1
- package/lib/components/multi-select/multi-select.styles.js.map +1 -1
- package/lib/components/nav-container/nav-container.styles.d.ts.map +1 -1
- package/lib/components/nav-container/nav-container.styles.js +618 -1
- package/lib/components/nav-container/nav-container.styles.js.map +1 -1
- package/lib/components/page-header/page-header.styles.d.ts.map +1 -1
- package/lib/components/page-header/page-header.styles.js +636 -1
- package/lib/components/page-header/page-header.styles.js.map +1 -1
- package/lib/components/pagination/page-counter/page-counter.styles.d.ts.map +1 -1
- package/lib/components/pagination/page-counter/page-counter.styles.js +599 -1
- package/lib/components/pagination/page-counter/page-counter.styles.js.map +1 -1
- package/lib/components/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/pagination/pagination.styles.js +645 -1
- package/lib/components/pagination/pagination.styles.js.map +1 -1
- package/lib/components/percent-bar/percent-bar.styles.d.ts.map +1 -1
- package/lib/components/percent-bar/percent-bar.styles.js +611 -1
- package/lib/components/percent-bar/percent-bar.styles.js.map +1 -1
- package/lib/components/popover/popover.styles.d.ts.map +1 -1
- package/lib/components/popover/popover.styles.js +766 -1
- package/lib/components/popover/popover.styles.js.map +1 -1
- package/lib/components/primary-nav/primary-nav.styles.d.ts.map +1 -1
- package/lib/components/primary-nav/primary-nav.styles.js +613 -1
- package/lib/components/primary-nav/primary-nav.styles.js.map +1 -1
- package/lib/components/primary-nav-item/primary-nav-item.styles.d.ts.map +1 -1
- package/lib/components/primary-nav-item/primary-nav-item.styles.js +767 -1
- package/lib/components/primary-nav-item/primary-nav-item.styles.js.map +1 -1
- package/lib/components/progress-meter/progress-meter.styles.d.ts.map +1 -1
- package/lib/components/progress-meter/progress-meter.styles.js +699 -1
- package/lib/components/progress-meter/progress-meter.styles.js.map +1 -1
- package/lib/components/progress-steps/progress-steps.styles.d.ts.map +1 -1
- package/lib/components/progress-steps/progress-steps.styles.js +597 -1
- package/lib/components/progress-steps/progress-steps.styles.js.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.styles.d.ts.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.styles.js +711 -1
- package/lib/components/progress-steps-item/progress-steps-item.styles.js.map +1 -1
- package/lib/components/radio-field/radio-field.styles.d.ts.map +1 -1
- package/lib/components/radio-field/radio-field.styles.js +624 -1
- package/lib/components/radio-field/radio-field.styles.js.map +1 -1
- package/lib/components/radio-field-item/radio-field-item.styles.d.ts.map +1 -1
- package/lib/components/radio-field-item/radio-field-item.styles.js +721 -1
- package/lib/components/radio-field-item/radio-field-item.styles.js.map +1 -1
- package/lib/components/remove-tag/remove-tag.styles.d.ts.map +1 -1
- package/lib/components/remove-tag/remove-tag.styles.js +681 -1
- package/lib/components/remove-tag/remove-tag.styles.js.map +1 -1
- package/lib/components/section/section.styles.d.ts.map +1 -1
- package/lib/components/section/section.styles.js +608 -1
- package/lib/components/section/section.styles.js.map +1 -1
- package/lib/components/select/select.styles.d.ts.map +1 -1
- package/lib/components/select/select.styles.js +739 -1
- package/lib/components/select/select.styles.js.map +1 -1
- package/lib/components/select-tile-list/select-tile-list.styles.d.ts.map +1 -1
- package/lib/components/select-tile-list/select-tile-list.styles.js +620 -1
- package/lib/components/select-tile-list/select-tile-list.styles.js.map +1 -1
- package/lib/components/skeleton-loader/skeleton-loader.styles.d.ts.map +1 -1
- package/lib/components/skeleton-loader/skeleton-loader.styles.js +634 -1
- package/lib/components/skeleton-loader/skeleton-loader.styles.js.map +1 -1
- package/lib/components/split-button/split-button.styles.d.ts.map +1 -1
- package/lib/components/split-button/split-button.styles.js +595 -1
- package/lib/components/split-button/split-button.styles.js.map +1 -1
- package/lib/components/submenu/submenu.styles.d.ts.map +1 -1
- package/lib/components/submenu/submenu.styles.js +591 -1
- package/lib/components/submenu/submenu.styles.js.map +1 -1
- package/lib/components/submenu-item/submenu-item.styles.d.ts.map +1 -1
- package/lib/components/submenu-item/submenu-item.styles.js +599 -1
- package/lib/components/submenu-item/submenu-item.styles.js.map +1 -1
- package/lib/components/tab/tab.styles.d.ts.map +1 -1
- package/lib/components/tab/tab.styles.js +680 -1
- package/lib/components/tab/tab.styles.js.map +1 -1
- package/lib/components/tab-panel/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/tab-panel/tab-panel.styles.js +615 -1
- package/lib/components/tab-panel/tab-panel.styles.js.map +1 -1
- package/lib/components/table/table.styles.d.ts.map +1 -1
- package/lib/components/table/table.styles.js +633 -1
- package/lib/components/table/table.styles.js.map +1 -1
- package/lib/components/table-body/table-body.styles.d.ts.map +1 -1
- package/lib/components/table-body/table-body.styles.js +592 -1
- package/lib/components/table-body/table-body.styles.js.map +1 -1
- package/lib/components/table-cell/table-cell.styles.d.ts.map +1 -1
- package/lib/components/table-cell/table-cell.styles.js +625 -1
- package/lib/components/table-cell/table-cell.styles.js.map +1 -1
- package/lib/components/table-header/table-header.styles.d.ts.map +1 -1
- package/lib/components/table-header/table-header.styles.js +612 -1
- package/lib/components/table-header/table-header.styles.js.map +1 -1
- package/lib/components/table-header-cell/table-header-cell.styles.d.ts.map +1 -1
- package/lib/components/table-header-cell/table-header-cell.styles.js +604 -1
- package/lib/components/table-header-cell/table-header-cell.styles.js.map +1 -1
- package/lib/components/table-object/table-object.styles.d.ts.map +1 -1
- package/lib/components/table-object/table-object.styles.js +599 -1
- package/lib/components/table-object/table-object.styles.js.map +1 -1
- package/lib/components/table-row/table-row.styles.d.ts.map +1 -1
- package/lib/components/table-row/table-row.styles.js +691 -1
- package/lib/components/table-row/table-row.styles.js.map +1 -1
- package/lib/components/tabs/tabs.styles.d.ts.map +1 -1
- package/lib/components/tabs/tabs.styles.js +678 -1
- package/lib/components/tabs/tabs.styles.js.map +1 -1
- package/lib/components/tag/tag.styles.d.ts.map +1 -1
- package/lib/components/tag/tag.styles.js +695 -1
- package/lib/components/tag/tag.styles.js.map +1 -1
- package/lib/components/tag-list/tag-list.styles.d.ts.map +1 -1
- package/lib/components/tag-list/tag-list.styles.js +612 -1
- package/lib/components/tag-list/tag-list.styles.js.map +1 -1
- package/lib/components/tertiary-nav/tertiary-nav.styles.d.ts.map +1 -1
- package/lib/components/tertiary-nav/tertiary-nav.styles.js +613 -1
- package/lib/components/tertiary-nav/tertiary-nav.styles.js.map +1 -1
- package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.d.ts.map +1 -1
- package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js +635 -1
- package/lib/components/tertiary-nav-item/tertiary-nav-item.styles.js.map +1 -1
- package/lib/components/text-link/text-link.styles.d.ts.map +1 -1
- package/lib/components/text-link/text-link.styles.js +652 -1
- package/lib/components/text-link/text-link.styles.js.map +1 -1
- package/lib/components/text-passage/text-passage-light-dom.styles.d.ts.map +1 -1
- package/lib/components/text-passage/text-passage-light-dom.styles.js +840 -1
- package/lib/components/text-passage/text-passage-light-dom.styles.js.map +1 -1
- package/lib/components/text-passage/text-passage.styles.d.ts.map +1 -1
- package/lib/components/text-passage/text-passage.styles.js +622 -1
- package/lib/components/text-passage/text-passage.styles.js.map +1 -1
- package/lib/components/tooltip/tooltip.styles.d.ts.map +1 -1
- package/lib/components/tooltip/tooltip.styles.js +781 -1
- package/lib/components/tooltip/tooltip.styles.js.map +1 -1
- package/lib/components/utility-nav/utility-nav.styles.d.ts.map +1 -1
- package/lib/components/utility-nav/utility-nav.styles.js +613 -1
- package/lib/components/utility-nav/utility-nav.styles.js.map +1 -1
- package/lib/components/utility-nav-item/utility-nav-item.styles.d.ts.map +1 -1
- package/lib/components/utility-nav-item/utility-nav-item.styles.js +643 -1
- package/lib/components/utility-nav-item/utility-nav-item.styles.js.map +1 -1
- package/lib/{icon-D22g8aWB.js → icon-BzSGJsMA.js} +727 -71
- package/lib/scripts/convert-scss-to-ts.js +99 -20
- package/lib/scripts/convert-scss-to-ts.js.map +1 -1
- package/mcp-manifest.json +1 -1
- package/package.json +3 -2
|
@@ -1,25 +1,104 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
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,MAAM,CAAC;AAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE/C,6FAA6F;AAC7F,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;AACvF,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAErD,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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
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmorrow/cre8-wc",
|
|
3
|
-
"version": "1.1
|
|
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
|
-
"
|
|
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",
|