@@ -181,17 +181,16 @@ const getPositionValue = (positionValues, position) => {
181181 *
182182 * @param {string } property - The specific background longhand property being updated.
183183 * @param {Map } properties - The map of all properties.
184- * @param {Object } opt - Parsing options including global object and configurations.
185184 * @returns {string } The constructed background shorthand string.
186185 */
187- const replaceBackgroundShorthand = ( property , properties , opt ) => {
186+ const replaceBackgroundShorthand = ( property , properties ) => {
188187 const { value : propertyValue } = properties . get ( property ) ;
189- const parsedValue = background . shorthandFor . get ( property ) . parse ( propertyValue , opt ) ;
188+ const parsedValue = background . shorthandFor . get ( property ) . parse ( propertyValue ) ;
190189 const values = splitValue ( parsedValue , {
191190 delimiter : ","
192191 } ) ;
193192 const { value : shorthandValue } = properties . get ( background . property ) ;
194- const bgValues = background . parse ( shorthandValue , opt ) ;
193+ const bgValues = background . parse ( shorthandValue ) ;
195194 const bgLength = bgValues . length ;
196195 if ( property === backgroundColor . property ) {
197196 bgValues [ bgLength - 1 ] [ property ] = parsedValue [ 0 ] ;
@@ -224,15 +223,10 @@ const replaceBackgroundShorthand = (property, properties, opt) => {
224223 * @param {string } property - The property to check.
225224 * @param {string } value - The value to compare.
226225 * @param {string } shorthandValue - The shorthand string to parse and compare against.
227- * @param {Object } [opt={}] - Parsing options.
228226 * @returns {boolean } True if the value matches the shorthand's value.
229227 */
230- const matchesBorderShorthandValue = ( property , value , shorthandValue , opt = { } ) => {
231- const { globalObject, options } = opt ;
232- const obj = border . parse ( shorthandValue , {
233- globalObject,
234- options
235- } ) ;
228+ const matchesBorderShorthandValue = ( property , value , shorthandValue ) => {
229+ const obj = border . parse ( shorthandValue ) ;
236230 if ( Object . hasOwn ( obj , property ) ) {
237231 return value === obj [ property ] ;
238232 }
@@ -244,20 +238,14 @@ const matchesBorderShorthandValue = (property, value, shorthandValue, opt = {})
244238 *
245239 * @param {string } value - The new value to insert.
246240 * @param {string } shorthandValue - The existing shorthand string.
247- * @param {Object } [opt={}] - Parsing options.
248241 * @returns {string } The updated border shorthand string.
249242 */
250- const replaceBorderShorthandValue = ( value , shorthandValue , opt = { } ) => {
251- const { globalObject, options } = opt ;
243+ const replaceBorderShorthandValue = ( value , shorthandValue ) => {
252244 const borderFirstInitialKey = border . initialValues . keys ( ) . next ( ) . value ;
253245 const borderFirstInitialValue = border . initialValues . get ( borderFirstInitialKey ) ;
254- const parseOpt = {
255- globalObject,
256- options
257- } ;
258- const valueObj = border . parse ( value , parseOpt ) ;
246+ const valueObj = border . parse ( value ) ;
259247 const shorthandObj = shorthandValue
260- ? border . parse ( shorthandValue , parseOpt )
248+ ? border . parse ( shorthandValue )
261249 : {
262250 [ borderFirstInitialKey ] : borderFirstInitialValue
263251 } ;
@@ -499,7 +487,6 @@ const replacePositionValue = (value, positionValues, position) => {
499487 * @param {string } params.priority - The property priority.
500488 * @param {Map } params.properties - The map of properties.
501489 * @param {Object } params.parts - The split property name parts.
502- * @param {Object } params.opt - Parsing options.
503490 * @param {Map } params.borderItems - The map to store processed border items.
504491 */
505492const prepareBorderStringValue = ( {
@@ -508,15 +495,9 @@ const prepareBorderStringValue = ({
508495 priority,
509496 properties,
510497 parts,
511- opt,
512498 borderItems
513499} ) => {
514500 const { prop1, prop2, prop3 } = parts ;
515- const { globalObject, options } = opt ;
516- const parseOpt = {
517- globalObject,
518- options
519- } ;
520501 const shorthandItem = getPropertyItem ( border . property , properties ) ;
521502 const imageItem = getPropertyItem ( BORDER_IMAGE , properties ) ;
522503 // Handle longhand properties.
@@ -547,7 +528,7 @@ const prepareBorderStringValue = ({
547528 } else {
548529 if (
549530 shorthandItem . value &&
550- ! matchesBorderShorthandValue ( lineProperty , propertyValue , shorthandItem . value , parseOpt )
531+ ! matchesBorderShorthandValue ( lineProperty , propertyValue , shorthandItem . value )
551532 ) {
552533 shorthandItem . value = "" ;
553534 }
@@ -556,7 +537,7 @@ const prepareBorderStringValue = ({
556537 }
557538 if (
558539 positionItem . value &&
559- ! matchesBorderShorthandValue ( lineProperty , propertyValue , positionItem . value , parseOpt )
540+ ! matchesBorderShorthandValue ( lineProperty , propertyValue , positionItem . value )
560541 ) {
561542 positionItem . value = "" ;
562543 }
@@ -600,26 +581,17 @@ const prepareBorderStringValue = ({
600581 } else {
601582 if (
602583 shorthandItem . value &&
603- ! matchesBorderShorthandValue ( property , propertyValue , shorthandItem . value , parseOpt )
584+ ! matchesBorderShorthandValue ( property , propertyValue , shorthandItem . value )
604585 ) {
605586 shorthandItem . value = "" ;
606587 }
607- if (
608- lineWidthItem . value &&
609- isValidPropertyValue ( lineWidthProperty , propertyValue , globalObject )
610- ) {
588+ if ( lineWidthItem . value && isValidPropertyValue ( lineWidthProperty , propertyValue ) ) {
611589 lineWidthItem . value = propertyValue ;
612590 }
613- if (
614- lineStyleItem . value &&
615- isValidPropertyValue ( lineStyleProperty , propertyValue , globalObject )
616- ) {
591+ if ( lineStyleItem . value && isValidPropertyValue ( lineStyleProperty , propertyValue ) ) {
617592 lineStyleItem . value = propertyValue ;
618593 }
619- if (
620- lineColorItem . value &&
621- isValidPropertyValue ( lineColorProperty , propertyValue , globalObject )
622- ) {
594+ if ( lineColorItem . value && isValidPropertyValue ( lineColorProperty , propertyValue ) ) {
623595 lineColorItem . value = propertyValue ;
624596 }
625597 }
@@ -656,11 +628,7 @@ const prepareBorderStringValue = ({
656628 const longhandProperty = `${ prop1 } -${ position } -${ prop2 } ` ;
657629 const longhandItem = getPropertyItem ( longhandProperty , properties ) ;
658630 if ( propertyValue ) {
659- positionItem . value = replaceBorderShorthandValue (
660- propertyValue ,
661- positionItem . value ,
662- parseOpt
663- ) ;
631+ positionItem . value = replaceBorderShorthandValue ( propertyValue , positionItem . value ) ;
664632 } else {
665633 positionItem . value = "" ;
666634 }
@@ -710,16 +678,10 @@ const prepareBorderStringValue = ({
710678 * @param {string } params.priority - The property priority.
711679 * @param {Map } params.properties - The map of properties.
712680 * @param {Object } params.parts - The split property name parts.
713- * @param {Object } params.opt - Parsing options.
714681 * @param {Map } params.borderItems - The map to store processed border items.
715682 */
716- const prepareBorderArrayValue = ( { value, priority, properties, parts, opt , borderItems } ) => {
683+ const prepareBorderArrayValue = ( { value, priority, properties, parts, borderItems } ) => {
717684 const { prop1, prop2 } = parts ;
718- const { globalObject, options } = opt ;
719- const parseOpt = {
720- globalObject,
721- options
722- } ;
723685 if ( ! value . length || ! borderLines . has ( prop2 ) ) {
724686 return ;
725687 }
@@ -733,11 +695,7 @@ const prepareBorderArrayValue = ({ value, priority, properties, parts, opt, bord
733695 if ( hasVarFunc ( shorthandItem . value ) ) {
734696 shorthandItem . value = "" ;
735697 } else if ( propertyValue ) {
736- shorthandItem . value = replaceBorderShorthandValue (
737- propertyValue ,
738- shorthandItem . value ,
739- parseOpt
740- ) ;
698+ shorthandItem . value = replaceBorderShorthandValue ( propertyValue , shorthandItem . value ) ;
741699 }
742700 }
743701 } else {
@@ -783,8 +741,7 @@ const prepareBorderArrayValue = ({ value, priority, properties, parts, opt, bord
783741 if ( positionItem . value && positionValues [ position ] ) {
784742 positionItem . value = replaceBorderShorthandValue (
785743 positionValues [ position ] ,
786- positionItem . value ,
787- parseOpt
744+ positionItem . value
788745 ) ;
789746 }
790747 const longhandProperty = `${ positionProperty } -${ prop2 } ` ;
@@ -808,7 +765,6 @@ const prepareBorderArrayValue = ({ value, priority, properties, parts, opt, bord
808765 * @param {string } params.priority - The property priority.
809766 * @param {Map } params.properties - The map of properties.
810767 * @param {Object } params.parts - The split property name parts.
811- * @param {Object } params.opt - Parsing options.
812768 * @param {Map } params.borderItems - The map to store processed border items.
813769 */
814770const prepareBorderObjectValue = ( {
@@ -817,15 +773,9 @@ const prepareBorderObjectValue = ({
817773 priority,
818774 properties,
819775 parts,
820- opt,
821776 borderItems
822777} ) => {
823778 const { prop1, prop2 } = parts ;
824- const { globalObject, options } = opt ;
825- const parseOpt = {
826- globalObject,
827- options
828- } ;
829779 const imageItem = getPropertyItem ( BORDER_IMAGE , properties ) ;
830780 // Handle position shorthands.
831781 if ( prop2 ) {
@@ -843,7 +793,7 @@ const prepareBorderObjectValue = ({
843793 const positionItem = getPropertyItem ( positionProperty , properties ) ;
844794 if ( shorthandItem . value ) {
845795 for ( const positionValue of Object . values ( value ) ) {
846- if ( ! matchesBorderShorthandValue ( property , positionValue , shorthandItem . value , parseOpt ) ) {
796+ if ( ! matchesBorderShorthandValue ( property , positionValue , shorthandItem . value ) ) {
847797 shorthandItem . value = "" ;
848798 break ;
849799 }
@@ -951,10 +901,9 @@ const prepareBorderObjectValue = ({
951901 * @param {string|Array|Object } value - The value of the property.
952902 * @param {string } priority - The priority of the property (e.g., "important").
953903 * @param {Map } properties - The map of all properties.
954- * @param {Object } [opt={}] - Parsing options.
955904 * @returns {Map|undefined } A map of expanded or updated border properties.
956905 */
957- const prepareBorderProperties = ( property , value , priority , properties , opt = { } ) => {
906+ const prepareBorderProperties = ( property , value , priority , properties ) => {
958907 if ( typeof property !== "string" || value === null ) {
959908 return ;
960909 }
@@ -996,7 +945,6 @@ const prepareBorderProperties = (property, value, priority, properties, opt = {}
996945 priority,
997946 properties,
998947 parts,
999- opt,
1000948 borderItems
1001949 } ) ;
1002950 } else if ( Array . isArray ( value ) ) {
@@ -1005,7 +953,6 @@ const prepareBorderProperties = (property, value, priority, properties, opt = {}
1005953 priority,
1006954 properties,
1007955 parts,
1008- opt,
1009956 borderItems
1010957 } ) ;
1011958 } else if ( value && typeof value === "object" ) {
@@ -1015,7 +962,6 @@ const prepareBorderProperties = (property, value, priority, properties, opt = {}
1015962 priority,
1016963 properties,
1017964 parts,
1018- opt,
1019965 borderItems
1020966 } ) ;
1021967 }
@@ -1309,16 +1255,15 @@ const updateLonghandProperties = (property, item, longhandProperties) => {
13091255 * Processes border properties from the borders map, expanding and normalizing them.
13101256 *
13111257 * @param {Map } borders - The map containing accumulated border properties.
1312- * @param {Object } parseOpt - Options for parsing values.
13131258 * @returns {Map } A map of fully processed and normalized border properties.
13141259 */
1315- const processBorderProperties = ( borders , parseOpt ) => {
1260+ const processBorderProperties = ( borders ) => {
13161261 const longhandProperties = new Map ( ) ;
13171262 for ( const [ property , item ] of borders ) {
13181263 if ( shorthandProperties . has ( property ) ) {
13191264 const { value, priority } = item ;
13201265 if ( property === border . property ) {
1321- const lineItems = border . parse ( value , parseOpt ) ;
1266+ const lineItems = border . parse ( value ) ;
13221267 for ( const [ key , initialValue ] of border . initialValues ) {
13231268 if ( ! Object . hasOwn ( lineItems , key ) ) {
13241269 lineItems [ key ] = initialValue ;
@@ -1348,7 +1293,7 @@ const processBorderProperties = (borders, parseOpt) => {
13481293 }
13491294 } else {
13501295 const shorthandItem = shorthandProperties . get ( property ) ;
1351- const parsedItem = shorthandItem . parse ( value , parseOpt ) ;
1296+ const parsedItem = shorthandItem . parse ( value ) ;
13521297 if ( Array . isArray ( parsedItem ) ) {
13531298 let namePart , linePart ;
13541299 const hyphenIndex = property . indexOf ( "-" ) ;
@@ -1395,15 +1340,9 @@ const processBorderProperties = (borders, parseOpt) => {
13951340 * Normalize and prepare CSS properties, handling shorthands and longhands.
13961341 *
13971342 * @param {Map } properties - The initial map of properties.
1398- * @param {Object } [opt={}] - Parsing options.
13991343 * @returns {Map } The normalized map of properties.
14001344 */
1401- const prepareProperties = ( properties , opt = { } ) => {
1402- const { globalObject, options } = opt ;
1403- const parseOpt = {
1404- globalObject,
1405- options
1406- } ;
1345+ const prepareProperties = ( properties ) => {
14071346 const parsedProperties = new Map ( ) ;
14081347 const shorthands = new Map ( ) ;
14091348 const borders = new Map ( ) ;
@@ -1434,7 +1373,7 @@ const prepareProperties = (properties, opt = {}) => {
14341373 parsedProperties . set ( property , item ) ;
14351374 } else if ( shorthandProperties . has ( property ) ) {
14361375 const shorthandItem = shorthandProperties . get ( property ) ;
1437- const parsedValues = shorthandItem . parse ( value , parseOpt ) ;
1376+ const parsedValues = shorthandItem . parse ( value ) ;
14381377 let omitShorthandProperty = false ;
14391378 if ( Array . isArray ( parsedValues ) ) {
14401379 const [ parsedValue ] = parsedValues ;
@@ -1485,11 +1424,7 @@ const prepareProperties = (properties, opt = {}) => {
14851424 background . property
14861425 ) ;
14871426 if ( ( ! shorthandPriority || priority ) && ! hasVarFunc ( shorthandValue ) ) {
1488- const replacedShorthandValue = replaceBackgroundShorthand (
1489- property ,
1490- parsedProperties ,
1491- parseOpt
1492- ) ;
1427+ const replacedShorthandValue = replaceBackgroundShorthand ( property , parsedProperties ) ;
14931428 properties . delete ( background . property ) ;
14941429 properties . set (
14951430 background . property ,
@@ -1506,7 +1441,7 @@ const prepareProperties = (properties, opt = {}) => {
15061441 }
15071442 }
15081443 if ( borders . size ) {
1509- const borderItems = processBorderProperties ( borders , parseOpt ) ;
1444+ const borderItems = processBorderProperties ( borders ) ;
15101445 for ( const [ property , item ] of borderItems ) {
15111446 parsedProperties . set ( property , item ) ;
15121447 }
0 commit comments