({ negative }: { negative: boolean })
| 1441 | */ |
| 1442 | staticUtility(class="st">'scale-none', [[class="st">'scale', class="st">'none']]) |
| 1443 | function handleScale({ negative }: { negative: boolean }) { |
| 1444 | return (candidate: Extract<Candidate, { kind: class="st">'functional' }>) => { |
| 1445 | if (!candidate.value || candidate.modifier) return |
| 1446 | |
| 1447 | let value |
| 1448 | if (candidate.value.kind === class="st">'arbitrary') { |
| 1449 | value = candidate.value.value |
| 1450 | value = negative ? `calc(${value} * -1)` : value |
| 1451 | return [decl(class="st">'scale', value)] |
| 1452 | } else { |
| 1453 | value = theme.resolve(candidate.value.value, [class="st">'--scale']) |
| 1454 | if (!value && isPositiveInteger(candidate.value.value)) { |
| 1455 | value = `${candidate.value.value}%` |
| 1456 | } |
| 1457 | if (!value) return |
| 1458 | } |
| 1459 | value = negative ? `calc(${value} * -1)` : value |
| 1460 | return [ |
| 1461 | scaleProperties(), |
| 1462 | decl(class="st">'--tw-scale-x', value), |
| 1463 | decl(class="st">'--tw-scale-y', value), |
| 1464 | decl(class="st">'--tw-scale-z', value), |
| 1465 | decl(class="st">'scale', `var(--tw-scale-x) var(--tw-scale-y)`), |
| 1466 | ] |
| 1467 | } |
| 1468 | } |
| 1469 | utilities.functional(class="st">'-scale', handleScale({ negative: true })) |
| 1470 | utilities.functional(class="st">'scale', handleScale({ negative: false })) |
| 1471 |
no test coverage detected