pass computeColor into shadow control, fix shadow switching types due to invalid shadow color
This commit is contained in:
parent
1a38e0273e
commit
098c6af7ef
7 changed files with 19 additions and 7 deletions
|
|
@ -21,7 +21,11 @@ export const parseShadow = string => {
|
|||
const regex = new RegExp(regexPrep, 'gis') // global, (stable) indices, single-string
|
||||
const result = regex.exec(string)
|
||||
if (result == null) {
|
||||
return string
|
||||
if (string.startsWith('$') || string.startsWith('--')) {
|
||||
return string
|
||||
} else {
|
||||
throw new Error(`Invalid shadow definition: ${string}`)
|
||||
}
|
||||
} else {
|
||||
const numeric = new Set(['x', 'y', 'blur', 'spread', 'alpha'])
|
||||
const { x, y, blur, spread, alpha, inset, color } = Object.fromEntries(modes.map((mode, i) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { unroll } from './iss_utils.js'
|
||||
|
||||
export const serializeShadow = s => {
|
||||
export const serializeShadow = (s, throwOnInvalid) => {
|
||||
if (typeof s === 'object') {
|
||||
return `${s.inset ? 'inset ' : ''}${s.x} ${s.y} ${s.blur} ${s.spread} ${s.color} / ${s.alpha}`
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue