Skip to content

Commit 67a995a

Browse files
committed
perf(material-experimental/mdc-table): reduce bundle size
Uses a mixin from MDC that excludes some styles we don't need in order to reduce the bundle size. This shaves off ~3.3kb from the bundle and base component styles.
1 parent 2575b00 commit 67a995a

File tree

5 files changed

+674
-677
lines changed

5 files changed

+674
-677
lines changed

package.json

+48-48
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@types/google.maps": "^3.47.3",
6262
"@types/youtube": "^0.0.46",
6363
"core-js-bundle": "^3.20.3",
64-
"material-components-web": "14.0.0-canary.c047f7c19.0",
64+
"material-components-web": "14.0.0-canary.9f9d928b2.0",
6565
"rxjs": "^6.6.7",
6666
"rxjs-tslint-rules": "^4.34.8",
6767
"tslib": "^2.3.1",
@@ -93,53 +93,53 @@
9393
"@bazel/terser": "4.4.5",
9494
"@bazel/typescript": "4.4.5",
9595
"@firebase/app-types": "^0.7.0",
96-
"@material/animation": "14.0.0-canary.c047f7c19.0",
97-
"@material/auto-init": "14.0.0-canary.c047f7c19.0",
98-
"@material/banner": "14.0.0-canary.c047f7c19.0",
99-
"@material/base": "14.0.0-canary.c047f7c19.0",
100-
"@material/button": "14.0.0-canary.c047f7c19.0",
101-
"@material/card": "14.0.0-canary.c047f7c19.0",
102-
"@material/checkbox": "14.0.0-canary.c047f7c19.0",
103-
"@material/chips": "14.0.0-canary.c047f7c19.0",
104-
"@material/circular-progress": "14.0.0-canary.c047f7c19.0",
105-
"@material/data-table": "14.0.0-canary.c047f7c19.0",
106-
"@material/density": "14.0.0-canary.c047f7c19.0",
107-
"@material/dialog": "14.0.0-canary.c047f7c19.0",
108-
"@material/dom": "14.0.0-canary.c047f7c19.0",
109-
"@material/drawer": "14.0.0-canary.c047f7c19.0",
110-
"@material/elevation": "14.0.0-canary.c047f7c19.0",
111-
"@material/fab": "14.0.0-canary.c047f7c19.0",
112-
"@material/feature-targeting": "14.0.0-canary.c047f7c19.0",
113-
"@material/floating-label": "14.0.0-canary.c047f7c19.0",
114-
"@material/form-field": "14.0.0-canary.c047f7c19.0",
115-
"@material/icon-button": "14.0.0-canary.c047f7c19.0",
116-
"@material/image-list": "14.0.0-canary.c047f7c19.0",
117-
"@material/layout-grid": "14.0.0-canary.c047f7c19.0",
118-
"@material/line-ripple": "14.0.0-canary.c047f7c19.0",
119-
"@material/linear-progress": "14.0.0-canary.c047f7c19.0",
120-
"@material/list": "14.0.0-canary.c047f7c19.0",
121-
"@material/menu": "14.0.0-canary.c047f7c19.0",
122-
"@material/menu-surface": "14.0.0-canary.c047f7c19.0",
123-
"@material/notched-outline": "14.0.0-canary.c047f7c19.0",
124-
"@material/radio": "14.0.0-canary.c047f7c19.0",
125-
"@material/ripple": "14.0.0-canary.c047f7c19.0",
126-
"@material/rtl": "14.0.0-canary.c047f7c19.0",
127-
"@material/segmented-button": "14.0.0-canary.c047f7c19.0",
128-
"@material/select": "14.0.0-canary.c047f7c19.0",
129-
"@material/shape": "14.0.0-canary.c047f7c19.0",
130-
"@material/slider": "14.0.0-canary.c047f7c19.0",
131-
"@material/snackbar": "14.0.0-canary.c047f7c19.0",
132-
"@material/switch": "14.0.0-canary.c047f7c19.0",
133-
"@material/tab": "14.0.0-canary.c047f7c19.0",
134-
"@material/tab-bar": "14.0.0-canary.c047f7c19.0",
135-
"@material/tab-indicator": "14.0.0-canary.c047f7c19.0",
136-
"@material/tab-scroller": "14.0.0-canary.c047f7c19.0",
137-
"@material/textfield": "14.0.0-canary.c047f7c19.0",
138-
"@material/theme": "14.0.0-canary.c047f7c19.0",
139-
"@material/tooltip": "14.0.0-canary.c047f7c19.0",
140-
"@material/top-app-bar": "14.0.0-canary.c047f7c19.0",
141-
"@material/touch-target": "14.0.0-canary.c047f7c19.0",
142-
"@material/typography": "14.0.0-canary.c047f7c19.0",
96+
"@material/animation": "14.0.0-canary.9f9d928b2.0",
97+
"@material/auto-init": "14.0.0-canary.9f9d928b2.0",
98+
"@material/banner": "14.0.0-canary.9f9d928b2.0",
99+
"@material/base": "14.0.0-canary.9f9d928b2.0",
100+
"@material/button": "14.0.0-canary.9f9d928b2.0",
101+
"@material/card": "14.0.0-canary.9f9d928b2.0",
102+
"@material/checkbox": "14.0.0-canary.9f9d928b2.0",
103+
"@material/chips": "14.0.0-canary.9f9d928b2.0",
104+
"@material/circular-progress": "14.0.0-canary.9f9d928b2.0",
105+
"@material/data-table": "14.0.0-canary.9f9d928b2.0",
106+
"@material/density": "14.0.0-canary.9f9d928b2.0",
107+
"@material/dialog": "14.0.0-canary.9f9d928b2.0",
108+
"@material/dom": "14.0.0-canary.9f9d928b2.0",
109+
"@material/drawer": "14.0.0-canary.9f9d928b2.0",
110+
"@material/elevation": "14.0.0-canary.9f9d928b2.0",
111+
"@material/fab": "14.0.0-canary.9f9d928b2.0",
112+
"@material/feature-targeting": "14.0.0-canary.9f9d928b2.0",
113+
"@material/floating-label": "14.0.0-canary.9f9d928b2.0",
114+
"@material/form-field": "14.0.0-canary.9f9d928b2.0",
115+
"@material/icon-button": "14.0.0-canary.9f9d928b2.0",
116+
"@material/image-list": "14.0.0-canary.9f9d928b2.0",
117+
"@material/layout-grid": "14.0.0-canary.9f9d928b2.0",
118+
"@material/line-ripple": "14.0.0-canary.9f9d928b2.0",
119+
"@material/linear-progress": "14.0.0-canary.9f9d928b2.0",
120+
"@material/list": "14.0.0-canary.9f9d928b2.0",
121+
"@material/menu": "14.0.0-canary.9f9d928b2.0",
122+
"@material/menu-surface": "14.0.0-canary.9f9d928b2.0",
123+
"@material/notched-outline": "14.0.0-canary.9f9d928b2.0",
124+
"@material/radio": "14.0.0-canary.9f9d928b2.0",
125+
"@material/ripple": "14.0.0-canary.9f9d928b2.0",
126+
"@material/rtl": "14.0.0-canary.9f9d928b2.0",
127+
"@material/segmented-button": "14.0.0-canary.9f9d928b2.0",
128+
"@material/select": "14.0.0-canary.9f9d928b2.0",
129+
"@material/shape": "14.0.0-canary.9f9d928b2.0",
130+
"@material/slider": "14.0.0-canary.9f9d928b2.0",
131+
"@material/snackbar": "14.0.0-canary.9f9d928b2.0",
132+
"@material/switch": "14.0.0-canary.9f9d928b2.0",
133+
"@material/tab": "14.0.0-canary.9f9d928b2.0",
134+
"@material/tab-bar": "14.0.0-canary.9f9d928b2.0",
135+
"@material/tab-indicator": "14.0.0-canary.9f9d928b2.0",
136+
"@material/tab-scroller": "14.0.0-canary.9f9d928b2.0",
137+
"@material/textfield": "14.0.0-canary.9f9d928b2.0",
138+
"@material/theme": "14.0.0-canary.9f9d928b2.0",
139+
"@material/tooltip": "14.0.0-canary.9f9d928b2.0",
140+
"@material/top-app-bar": "14.0.0-canary.9f9d928b2.0",
141+
"@material/touch-target": "14.0.0-canary.9f9d928b2.0",
142+
"@material/typography": "14.0.0-canary.9f9d928b2.0",
143143
"@octokit/rest": "18.3.5",
144144
"@rollup/plugin-commonjs": "^21.0.0",
145145
"@rollup/plugin-node-resolve": "^13.1.3",

packages.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
33
# version for the placeholders.
44
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0-0"
5-
MDC_PACKAGE_VERSION = "14.0.0-canary.7d8ea4624.0"
5+
MDC_PACKAGE_VERSION = "14.0.0-canary.9f9d928b2.0"
66
TSLIB_PACKAGE_VERSION = "^2.3.0"
77
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"
88

src/material-experimental/mdc-table/_table-theme.scss

+2-9
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
$orig-row-hover-fill-color: mdc-data-table-theme.$row-hover-fill-color;
1616
$orig-header-row-text-color: mdc-data-table-theme.$header-row-text-color;
1717
$orig-row-text-color: mdc-data-table-theme.$row-text-color;
18-
$orig-sort-icon-color: mdc-data-table-theme.$sort-icon-color;
19-
$orig-sort-icon-active-color: mdc-data-table-theme.$sort-icon-active-color;
2018
$orig-stroke-color: mdc-data-table-theme.$stroke-color;
2119

2220
@include mdc-helpers.mat-using-mdc-theme($config) {
@@ -25,12 +23,9 @@
2523
mdc-data-table-theme.$row-hover-fill-color: rgba(mdc-theme-color.prop-value(on-surface), 0.04);
2624
mdc-data-table-theme.$header-row-text-color: rgba(mdc-theme-color.prop-value(on-surface), 0.87);
2725
mdc-data-table-theme.$row-text-color: rgba(mdc-theme-color.prop-value(on-surface), 0.87);
28-
mdc-data-table-theme.$sort-icon-color: rgba(mdc-theme-color.prop-value(on-surface), 0.6);
29-
mdc-data-table-theme.$sort-icon-active-color:
30-
rgba(mdc-theme-color.prop-value(on-surface), 0.87);
3126
mdc-data-table-theme.$stroke-color: rgba(mdc-theme-color.prop-value(on-surface), 0.12);
3227

33-
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-theme-styles-query);
28+
@include mdc-data-table.table-styles($query: mdc-helpers.$mat-theme-styles-query);
3429
}
3530

3631
// Restore original values of MDC global variables.
@@ -39,8 +34,6 @@
3934
mdc-data-table-theme.$row-hover-fill-color: $orig-row-hover-fill-color;
4035
mdc-data-table-theme.$header-row-text-color: $orig-header-row-text-color;
4136
mdc-data-table-theme.$row-text-color: $orig-row-text-color;
42-
mdc-data-table-theme.$sort-icon-color: $orig-sort-icon-color;
43-
mdc-data-table-theme.$sort-icon-active-color: $orig-sort-icon-active-color;
4437
mdc-data-table-theme.$stroke-color: $orig-stroke-color;
4538

4639
.mat-mdc-table {
@@ -53,7 +46,7 @@
5346
$config: typography.private-typography-to-2018-config(
5447
theming.get-typography-config($config-or-theme));
5548
@include mdc-helpers.mat-using-mdc-typography($config) {
56-
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-typography-styles-query);
49+
@include mdc-data-table.table-styles($query: mdc-helpers.$mat-typography-styles-query);
5750
}
5851
}
5952

src/material-experimental/mdc-table/table.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
@use '../mdc-helpers/mdc-helpers';
44
@use '../../material/table/table-flex-styles';
55

6-
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
7-
@include table-flex-styles.private-table-flex-styles();
6+
@include mdc-helpers.disable-fallback-declarations {
7+
@include mdc-data-table.table-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
8+
@include table-flex-styles.private-table-flex-styles();
9+
}
810

911
.mat-mdc-table-sticky {
1012
// Note that the table can either set this class or an inline style to make something sticky.

0 commit comments

Comments
 (0)