forked from ranile/material-yew
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpostprocess.mjs
45 lines (37 loc) · 1.83 KB
/
postprocess.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import fs from 'fs'
let core_js = fs.readFileSync('./build/core.js').toString()
// customization of textfield icon color
core_js = core_js.replace(
/(\.mdc-text-field:not\(\.mdc-text-field--disabled\) \.mdc-text-field__icon--(?:leading|trailing){color:)(rgba\(0, 0, 0, 0\.54\))(})/g,
'$1var(--mdc-text-field-icon-color, $2)$3',
).replace(
/(\.mdc-text-field--disabled \.mdc-text-field__icon--(?:leading|trailing){color:)(rgba\(0, 0, 0, 0\.3\))(})/g,
'$1var(--mdc-text-field-disabled-icon-color, $2)$3',
)
// allow using native WebKit calendar picker
core_js = core_js.replace(
/(\.mdc-text-field__input)(::-webkit-calendar-picker-indicator)({display:none})/g,
'$1$2$3.mdc-text-field--webkit-date-picker $1{position:relative}.mdc-text-field--webkit-date-picker $1$2{display:inline-block;position:absolute;inset:0;width:auto;height:auto;color:transparent;background:transparent}',
).replace(
/(r\(\[c\({type:Boolean)(,reflect:!0)(}\)],gr\.prototype,")(disabled)(",void 0\))/g,
'$1$2$3$4$5,$1$3webkitDatePicker$5',
).replace(
/(this\.iconTrailing="",this\.disabled=!1)/g,
'$1,this.webkitDatePicker=!1',
).replace(
/("mdc-text-field--disabled":this\.disabled)/g,
'$1,"mdc-text-field--webkit-date-picker":this.webkitDatePicker',
)
// fix textarea internal char counter color
core_js = core_js.replace(
/(\.mdc-text-field-character-counter{color:)(rgba\(0, 0, 0, 0\.6\))(})/g,
'$1var(--mdc-text-field-label-ink-color, $2)$3',
)
fs.writeFileSync('./build/core.js', core_js)
let list_js = fs.readFileSync('./build/mwc-list.js').toString()
// customization of list divider color
list_js = list_js.replace(
/(\.mdc-deprecated-list ::slotted\(\[divider\]\){[^\}]*border-bottom-color:)(rgba\(0, 0, 0, 0\.12\))(})/g,
'$1var(--mdc-deprecated-list-divider-color, $2)$3',
)
fs.writeFileSync('./build/mwc-list.js', list_js)