@@ -894,9 +894,7 @@ const assertGrammarsParse = () => {
894894 grammarOf ( syntax ) ;
895895 } catch ( err ) {
896896 throw new Error (
897- `${ label } does not parse: ${
898- /** @type {Error } */ ( err ) . message
899- } \n ${ syntax } `,
897+ `${ label } does not parse: ${ /** @type {Error } */ ( err ) . message } \n ${ syntax } ` ,
900898 { cause : err }
901899 ) ;
902900 }
@@ -2387,13 +2385,18 @@ const collectNthNamedEquivalents = () => {
23872385 * value, as `property -> keyword`. The keyword comes from the property table,
23882386 * and it must really be the initial and really be one alternative of a top-level
23892387 * `||` group, so a spec moving either way fails generation rather than the page.
2388+ * @param {string[] } names the properties stated to have one
2389+ * @param {PartialPropertyTable } propertyTable where their grammars are read
23902390 * @returns {[string, string][] } `[property, keyword]`, sorted
23912391 */
2392- const collectOmittableInitialKeywords = ( ) => {
2392+ const collectOmittableInitialKeywords = (
2393+ names = SUPPLEMENT . omittableInitialKeywords ,
2394+ propertyTable = properties
2395+ ) => {
23932396 /** @type {[string, string][] } */
23942397 const out = [ ] ;
2395- for ( const name of [ ...SUPPLEMENT . omittableInitialKeywords ] . sort ( ) ) {
2396- const property = properties [ name ] ;
2398+ for ( const name of [ ...names ] . sort ( ) ) {
2399+ const property = propertyTable [ name ] ;
23972400 const initial = /** @type {string } */ ( property . initial ) ;
23982401 const syntax = /** @type {string } */ ( property . syntax ) ;
23992402 const tree = parseValueSyntax ( syntax ) ;
@@ -2576,27 +2579,21 @@ const setLiteral = (names) =>
25762579 * @returns {string } its `new Map([…])` literal — prettier wraps it on emit
25772580 */
25782581const mapLiteral = ( entries ) =>
2579- `new Map([${ entries
2580- . map ( ( [ key , value ] ) => `["${ key } ", "${ value } "]` )
2581- . join ( ", " ) } ])`;
2582+ `new Map([${ entries . map ( ( [ key , value ] ) => `["${ key } ", "${ value } "]` ) . join ( ", " ) } ])` ;
25822583
25832584/**
25842585 * @param {[string, number][] } entries string-keyed, number-valued pairs
25852586 * @returns {string } the `Map` literal
25862587 */
25872588const countMapLiteral = ( entries ) =>
2588- `new Map([${ entries
2589- . map ( ( [ key , value ] ) => `["${ key } ", ${ value } ]` )
2590- . join ( ", " ) } ])`;
2589+ `new Map([${ entries . map ( ( [ key , value ] ) => `["${ key } ", ${ value } ]` ) . join ( ", " ) } ])` ;
25912590
25922591/**
25932592 * @param {[number, number][] } entries number-keyed pairs
25942593 * @returns {string } the `Map` literal
25952594 */
25962595const numberMapLiteral = ( entries ) =>
2597- `new Map([${ entries
2598- . map ( ( [ key , value ] ) => `[${ key } , ${ value } ]` )
2599- . join ( ", " ) } ])`;
2596+ `new Map([${ entries . map ( ( [ key , value ] ) => `[${ key } , ${ value } ]` ) . join ( ", " ) } ])` ;
26002597
26012598/**
26022599 * A trig table as `eighth turn -> value`, the irrational eighths simply absent
@@ -3585,9 +3582,7 @@ const collectData = () => {
35853582*/
35863583
35873584// GENERATED by tooling/generate-css-data.js — do not edit.
3588- // Sources: mdn-data ${ mdnDataPackage . version } , color-name ${
3589- colorNamePackage . version
3590- } .
3585+ // Sources: mdn-data ${ mdnDataPackage . version } , color-name ${ colorNamePackage . version } .
35913586
35923587"use strict";
35933588
@@ -3604,9 +3599,7 @@ ${SUPPLEMENT.mathPrimitives.map(([, body]) => body).join("\n\n")}
36043599// is copied from the opposite side. That makes a repeated value redundant:
36053600// \`margin:1px 1px 1px 1px\` is \`margin:1px\`. \`border-radius\` collapses each side
36063601// of its \`/\` independently.
3607- const BOX_SHORTHANDS = ${ setLiteral (
3608- [ ...boxShorthands , ...slashShorthands ] . sort ( )
3609- ) } ;
3602+ const BOX_SHORTHANDS = ${ setLiteral ( [ ...boxShorthands , ...slashShorthands ] . sort ( ) ) } ;
36103603
36113604// The subset carrying a second box after a \`/\`, which collapses on its own.
36123605const SLASH_BOX_SHORTHANDS = ${ setLiteral ( slashShorthands ) } ;
@@ -3886,14 +3879,10 @@ const COMPOUND_CONTINUATIONS = ${setLiteral(SUPPLEMENT.compoundContinuations)};
38863879
38873880// The properties whose zero length keeps its unit — the one place it is still
38883881// load-bearing.
3889- const ZERO_UNIT_KEEPING_PROPERTIES = ${ setLiteral (
3890- SUPPLEMENT . zeroUnitKeepingProperties
3891- ) } ;
3882+ const ZERO_UNIT_KEEPING_PROPERTIES = ${ setLiteral ( SUPPLEMENT . zeroUnitKeepingProperties ) } ;
38923883
38933884// At-rules whose empty block is inert, so dropping it changes nothing.
3894- const DROPPABLE_WHEN_EMPTY_AT_RULES = ${ setLiteral (
3895- SUPPLEMENT . droppableWhenEmptyAtRules
3896- ) } ;
3885+ const DROPPABLE_WHEN_EMPTY_AT_RULES = ${ setLiteral ( SUPPLEMENT . droppableWhenEmptyAtRules ) } ;
38973886
38983887// At-rules whose block holds rules and whose prelude states a condition, so two
38993888// adjacent blocks with the same prelude are the one block they resolve to.
@@ -3939,37 +3928,25 @@ const QUARTER_TURN_ANGLE = new Map([${SUPPLEMENT.quarterTurnAngle
39393928// where the value is irrational are absent — sine and cosine on the odd ones,
39403929// tangent on the asymptotes. Cosine is sine a quarter turn along.
39413930/** @type {Map<number, number>} */
3942- const EIGHTH_TURN_SINE = ${ numberMapLiteral (
3943- eighthTurnEntries ( SUPPLEMENT . eighthTurnSine )
3944- ) } ;
3931+ const EIGHTH_TURN_SINE = ${ numberMapLiteral ( eighthTurnEntries ( SUPPLEMENT . eighthTurnSine ) ) } ;
39453932
39463933/** @type {Map<number, number>} */
3947- const EIGHTH_TURN_COSINE = ${ numberMapLiteral (
3948- eighthTurnEntries ( eighthTurnCosine )
3949- ) } ;
3934+ const EIGHTH_TURN_COSINE = ${ numberMapLiteral ( eighthTurnEntries ( eighthTurnCosine ) ) } ;
39503935
39513936/** @type {Map<number, number>} */
3952- const EIGHTH_TURN_TANGENT = ${ numberMapLiteral (
3953- eighthTurnEntries ( SUPPLEMENT . eighthTurnTangent )
3954- ) } ;
3937+ const EIGHTH_TURN_TANGENT = ${ numberMapLiteral ( eighthTurnEntries ( SUPPLEMENT . eighthTurnTangent ) ) } ;
39553938
39563939// What each inverse trig function answers, as \`argument -> degrees\`, by
39573940// inverting the table above it over that function's principal branch. Every
39583941// other argument is transcendental and leaves the call written out.
39593942/** @type {Map<number, number>} */
3960- const ARC_SINE_DEGREES = ${ numberMapLiteral (
3961- collectArcAngles ( SUPPLEMENT . eighthTurnSine , - 2 , 2 )
3962- ) } ;
3943+ const ARC_SINE_DEGREES = ${ numberMapLiteral ( collectArcAngles ( SUPPLEMENT . eighthTurnSine , - 2 , 2 ) ) } ;
39633944
39643945/** @type {Map<number, number>} */
3965- const ARC_COSINE_DEGREES = ${ numberMapLiteral (
3966- collectArcAngles ( eighthTurnCosine , 0 , 4 )
3967- ) } ;
3946+ const ARC_COSINE_DEGREES = ${ numberMapLiteral ( collectArcAngles ( eighthTurnCosine , 0 , 4 ) ) } ;
39683947
39693948/** @type {Map<number, number>} */
3970- const ARC_TANGENT_DEGREES = ${ numberMapLiteral (
3971- collectArcAngles ( SUPPLEMENT . eighthTurnTangent , - 1 , 1 )
3972- ) } ;
3949+ const ARC_TANGENT_DEGREES = ${ numberMapLiteral ( collectArcAngles ( SUPPLEMENT . eighthTurnTangent , - 1 , 1 ) ) } ;
39733950
39743951// The reader that needs a table, built once here — \`mathPrimitives\` knows the
39753952// arithmetic of an eighth turn but not which units spell one.
@@ -3985,9 +3962,7 @@ const MATH_FUNCTION_FOLD = new Map([
39853962${ SUPPLEMENT . mathFunctionFold
39863963 . map (
39873964 ( [ name , read , apply , result , table ] ) =>
3988- `\t["${ name } ", { read: ${ read } , apply: ${ apply } , result: "${ result } ", table: ${
3989- table === null ? "null" : table
3990- } }]`
3965+ `\t["${ name } ", { read: ${ read } , apply: ${ apply } , result: "${ result } ", table: ${ table === null ? "null" : table } }]`
39913966 )
39923967 . join ( ",\n" ) }
39933968]);
@@ -4021,17 +3996,13 @@ ${cssModulesKeywords
40213996]);
40223997
40233998// The parser option gating each of them.
4024- const CSS_MODULES_KEYWORD_OPTIONS = ${ mapLiteral (
4025- cssModulesKeywords . map ( ( [ name , option ] ) => [ name , option ] )
4026- ) } ;
3999+ const CSS_MODULES_KEYWORD_OPTIONS = ${ mapLiteral ( cssModulesKeywords . map ( ( [ name , option ] ) => [ name , option ] ) ) } ;
40274000
40284001// The properties a negative value is valid on, so \`calc(-5px)\` may lose its
40294002// parentheses there. Read to permit a rewrite, which is the opposite of
40304003// \`INTEGER_PROPERTIES\` above: naming one property too many is a bug, naming one
40314004// too few only costs a rewrite.
4032- const NEGATIVE_ACCEPTING_PROPERTIES = ${ setLiteral (
4033- negativeAcceptingProperties
4034- ) } ;
4005+ const NEGATIVE_ACCEPTING_PROPERTIES = ${ setLiteral ( negativeAcceptingProperties ) } ;
40354006
40364007// The functions whose every numeric argument is a length, so a zero inside one
40374008// drops its unit the way a whole component's does. Read to permit a rewrite:
@@ -4097,24 +4068,7 @@ module.exports.ZERO_ANGLE_FUNCTIONS = ZERO_ANGLE_FUNCTIONS;
40974068module.exports.ZERO_UNIT_KEEPING_PROPERTIES = ZERO_UNIT_KEEPING_PROPERTIES;\n// The exact arithmetic the printer's own evaluator needs. Sorted after the\n// tables: \`import/order\` orders exports by case, uppercase first.\nmodule.exports.exactAdd = exactAdd;\nmodule.exports.exactDivide = exactDivide;\nmodule.exports.exactMultiply = exactMultiply;
40984069` ;
40994070
4100- const summary = `${
4101- boxShorthands . length + slashShorthands . length
4102- } box shorthands (${ slashShorthands . length } with a \`/\`), ${
4103- colorFunctions . length
4104- } color functions, ${ substitutionFunctions . length } substitution functions, ${
4105- colorNames . length
4106- } color names, ${ integerProperties . length } integer properties, ${
4107- negativeAcceptingProperties . length
4108- } negative-accepting properties, ${
4109- lengthOnlyFunctions . length
4110- } length-only functions, ${ pairLonghands . length } pair shorthands, ${
4111- mathFunctionArity . length
4112- } of ${ mathFunctions . length } math functions with a readable arity, ${
4113- cssModulesKeywords . length
4114- } css modules scoped properties (${ cssModulesKeywords . reduce (
4115- ( total , [ , , table ] ) => total + table . length ,
4116- 0
4117- ) } keywords)`;
4071+ const summary = `${ boxShorthands . length + slashShorthands . length } box shorthands (${ slashShorthands . length } with a \`/\`), ${ colorFunctions . length } color functions, ${ substitutionFunctions . length } substitution functions, ${ colorNames . length } color names, ${ integerProperties . length } integer properties, ${ negativeAcceptingProperties . length } negative-accepting properties, ${ lengthOnlyFunctions . length } length-only functions, ${ pairLonghands . length } pair shorthands, ${ mathFunctionArity . length } of ${ mathFunctions . length } math functions with a readable arity, ${ cssModulesKeywords . length } css modules scoped properties (${ cssModulesKeywords . reduce ( ( total , [ , , table ] ) => total + table . length , 0 ) } keywords)` ;
41184072 return { source, summary } ;
41194073} ;
41204074
0 commit comments