css-doodle
Advanced tools
Comparing version 0.40.8 to 0.41.0
{ | ||
"name": "css-doodle", | ||
"version": "0.40.8", | ||
"version": "0.41.0", | ||
"description": "A web component for drawing patterns with CSS", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -84,8 +84,12 @@ import parse_value_group from './parser/parse-value-group.js'; | ||
result.flex = item === '|' ? 'column' : 'row'; | ||
temp.push('§'); | ||
} else if (/border:?/i.test(item)) { | ||
result.border = item.split(':')[1] || ''; | ||
temp.push('§'); | ||
} else if (/^no\-*clip$/i.test(item)) { | ||
result.clip = false; | ||
temp.push('§'); | ||
} else if (/^p3d$/i.test(item)) { | ||
result.p3d = true; | ||
temp.push('§'); | ||
} else if (!result.grid) { | ||
@@ -100,3 +104,3 @@ result.grid = parse_grid(item, options.max_grid); | ||
let groups = parse_value_group(temp.join(' '), { | ||
symbol: ['/', '+', '^', '*', '~', '∆', '_'], | ||
symbol: ['/', '+', '^', '*', '~', '∆', '_', '§'], | ||
noSpace: true, | ||
@@ -103,0 +107,0 @@ verbose: true |
@@ -27,21 +27,23 @@ import calc from './calc.js'; | ||
function compare(rule, value) { | ||
function compare(rule, value, x, y) { | ||
if (rule === 'even') { | ||
return even(value); | ||
return { value: odd(x + y) } | ||
} | ||
if (rule === 'odd') { | ||
return odd(value); | ||
return { value: even(x + y) } | ||
} | ||
if (rule == 'n') { | ||
return true; | ||
if (rule === 'n') { | ||
return { value: true } | ||
} | ||
let { a, b, error } = parse_linear_expr(rule); | ||
if (error) { | ||
return false; | ||
return { value: false, error } | ||
} | ||
if (a === 0) { | ||
return value === b; | ||
return { value: value === b } | ||
} else { | ||
let result = (value - b) / a; | ||
return result >= 0 && Number.isInteger(result); | ||
return { | ||
value: result >= 0 && Number.isInteger(result), | ||
} | ||
} | ||
@@ -59,3 +61,3 @@ } | ||
for (let expr of exprs) { | ||
if (compare(expr, count)) return true; | ||
if (compare(expr, count).value) return true; | ||
} | ||
@@ -68,3 +70,3 @@ } | ||
for (let expr of exprs) { | ||
if (compare(expr, y)) return true; | ||
if (compare(expr, y).value) return true; | ||
} | ||
@@ -77,3 +79,3 @@ }; | ||
for (let expr of exprs) { | ||
if (compare(expr, x)) return true; | ||
if (compare(expr, x).value) return true; | ||
} | ||
@@ -116,2 +118,23 @@ }; | ||
cell({ count, grid, x, y, random }) { | ||
return (...args) => { | ||
if (!args.length) { | ||
return true; | ||
} | ||
let result = args.map(arg => { | ||
let { value, error } = compare(arg, count, x, y); | ||
if (!error) { | ||
return value; | ||
} | ||
return !!calc('(' + arg + ')', { | ||
x, X: grid.x, | ||
y, Y: grid.y, | ||
i: count, I: grid.count, | ||
random, | ||
}); | ||
}); | ||
return result.some(Boolean); | ||
} | ||
}, | ||
hover({ count, x, y, grid, random }) { | ||
@@ -118,0 +141,0 @@ return (...args) => { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
274512
6691