@@ -391,6 +391,25 @@ function serializeColor({ name, types, value }, mixed = false) {
391
391
return `${ name } (${ value . join ( ' ' ) } )`
392
392
}
393
393
394
+ /**
395
+ * @param {object[] } stop
396
+ * @param {object } node
397
+ * @returns {object[] }
398
+ * @see {@link https://drafts.csswg.org/css-images-4/#typedef-angular-color-stop }
399
+ * @see {@link https://drafts.csswg.org/css-images-4/#typedef-linear-color-stop }
400
+ */
401
+ function serializeColorStop ( [ color , position ] ) {
402
+ color = serializeCSSComponentValue ( color )
403
+ if ( isOmitted ( position ) ) {
404
+ return color
405
+ }
406
+ if ( position . length === 2 ) {
407
+ const [ p1 , p2 ] = position . map ( serializeCSSComponentValue )
408
+ return `${ color } ${ p1 } , ${ color } ${ p2 } `
409
+ }
410
+ return `${ color } ${ serializeCSSComponentValue ( position ) } `
411
+ }
412
+
394
413
/**
395
414
* @param {object[] } stripe
396
415
* @returns {string }
@@ -780,6 +799,28 @@ function serializeLineNameList(list) {
780
799
} ) . join ( ' ' )
781
800
}
782
801
802
+ /**
803
+ * @param {object } linear
804
+ * @returns {string }
805
+ * @see {@link https://drafts.csswg.org/css-easing-2/#funcdef-linear }
806
+ */
807
+ function serializeLinear ( { value } ) {
808
+ let string = 'linear('
809
+ for ( const [ output , input ] of value ) {
810
+ const [ x , x2 ] = input . map ( serializeCSSComponentValue )
811
+ const y = serializeCSSComponentValue ( output )
812
+ string += y
813
+ if ( x ) {
814
+ string += ` ${ x } `
815
+ if ( x2 ) {
816
+ string += `, ${ y } ${ x2 } `
817
+ }
818
+ }
819
+ }
820
+ string += ')'
821
+ return string
822
+ }
823
+
783
824
/**
784
825
* @param {object[] } gradient
785
826
* @returns {string }
@@ -1427,6 +1468,9 @@ function serializeCSSComponentValue(component) {
1427
1468
return serializeAlpha ( component )
1428
1469
case '<an+b>' :
1429
1470
return serializeAnB ( component )
1471
+ case '<angular-color-stop>' :
1472
+ case '<linear-color-stop>' :
1473
+ return serializeColorStop ( component )
1430
1474
case '<attr()>' :
1431
1475
return serializeAttribute ( component )
1432
1476
case '<arc-command>' :
@@ -1496,6 +1540,8 @@ function serializeCSSComponentValue(component) {
1496
1540
return serializeLineNames ( component )
1497
1541
case '<line-name-list>' :
1498
1542
return serializeLineNameList ( component )
1543
+ case '<linear()>' :
1544
+ return serializeLinear ( component )
1499
1545
case '<linear-gradient-syntax>' :
1500
1546
return serializeLinearGradientSyntax ( component )
1501
1547
case '<math-function>' :
0 commit comments