configuration.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640
  1. // Contains the interpretation of CSS properties, as used by the property optimizer
  2. var breakUp = require('./configuration/break-up');
  3. var canOverride = require('./configuration/can-override');
  4. var restore = require('./configuration/restore');
  5. var propertyOptimizers = require('./level-1/property-optimizers');
  6. var valueOptimizers = require('./level-1/value-optimizers');
  7. var override = require('../utils/override');
  8. // Properties to process
  9. // Extend this object in order to add support for more properties in the optimizer.
  10. //
  11. // Each key in this object represents a CSS property and should be an object.
  12. // Such an object contains properties that describe how the represented CSS property should be handled.
  13. // Possible options:
  14. //
  15. // * components: array (Only specify for shorthand properties.)
  16. // Contains the names of the granular properties this shorthand compacts.
  17. //
  18. // * canOverride: function
  19. // Returns whether two tokens of this property can be merged with each other.
  20. // This property has no meaning for shorthands.
  21. //
  22. // * defaultValue: string
  23. // Specifies the default value of the property according to the CSS standard.
  24. // For shorthand, this is used when every component is set to its default value, therefore it should be the shortest possible default value of all the components.
  25. //
  26. // * shortestValue: string
  27. // Specifies the shortest possible value the property can possibly have.
  28. // (Falls back to defaultValue if unspecified.)
  29. //
  30. // * breakUp: function (Only specify for shorthand properties.)
  31. // Breaks the shorthand up to its components.
  32. //
  33. // * restore: function (Only specify for shorthand properties.)
  34. // Puts the shorthand together from its components.
  35. //
  36. var configuration = {
  37. animation: {
  38. canOverride: canOverride.generic.components([
  39. canOverride.generic.time,
  40. canOverride.generic.timingFunction,
  41. canOverride.generic.time,
  42. canOverride.property.animationIterationCount,
  43. canOverride.property.animationDirection,
  44. canOverride.property.animationFillMode,
  45. canOverride.property.animationPlayState,
  46. canOverride.property.animationName
  47. ]),
  48. components: [
  49. 'animation-duration',
  50. 'animation-timing-function',
  51. 'animation-delay',
  52. 'animation-iteration-count',
  53. 'animation-direction',
  54. 'animation-fill-mode',
  55. 'animation-play-state',
  56. 'animation-name'
  57. ],
  58. breakUp: breakUp.multiplex(breakUp.animation),
  59. defaultValue: 'none',
  60. restore: restore.multiplex(restore.withoutDefaults),
  61. shorthand: true,
  62. valueOptimizers: [
  63. valueOptimizers.whiteSpace,
  64. valueOptimizers.textQuotes,
  65. valueOptimizers.time,
  66. valueOptimizers.fraction,
  67. valueOptimizers.precision,
  68. valueOptimizers.unit,
  69. valueOptimizers.zero
  70. ],
  71. vendorPrefixes: [
  72. '-moz-',
  73. '-o-',
  74. '-webkit-'
  75. ]
  76. },
  77. 'animation-delay': {
  78. canOverride: canOverride.generic.time,
  79. componentOf: [
  80. 'animation'
  81. ],
  82. defaultValue: '0s',
  83. intoMultiplexMode: 'real',
  84. valueOptimizers: [
  85. valueOptimizers.time,
  86. valueOptimizers.fraction,
  87. valueOptimizers.precision,
  88. valueOptimizers.unit,
  89. valueOptimizers.zero
  90. ],
  91. vendorPrefixes: [
  92. '-moz-',
  93. '-o-',
  94. '-webkit-'
  95. ]
  96. },
  97. 'animation-direction': {
  98. canOverride: canOverride.property.animationDirection,
  99. componentOf: [
  100. 'animation'
  101. ],
  102. defaultValue: 'normal',
  103. intoMultiplexMode: 'real',
  104. vendorPrefixes: [
  105. '-moz-',
  106. '-o-',
  107. '-webkit-'
  108. ]
  109. },
  110. 'animation-duration': {
  111. canOverride: canOverride.generic.time,
  112. componentOf: [
  113. 'animation'
  114. ],
  115. defaultValue: '0s',
  116. intoMultiplexMode: 'real',
  117. keepUnlessDefault: 'animation-delay',
  118. valueOptimizers: [
  119. valueOptimizers.time,
  120. valueOptimizers.fraction,
  121. valueOptimizers.precision,
  122. valueOptimizers.unit,
  123. valueOptimizers.zero
  124. ],
  125. vendorPrefixes: [
  126. '-moz-',
  127. '-o-',
  128. '-webkit-'
  129. ]
  130. },
  131. 'animation-fill-mode': {
  132. canOverride: canOverride.property.animationFillMode,
  133. componentOf: [
  134. 'animation'
  135. ],
  136. defaultValue: 'none',
  137. intoMultiplexMode: 'real',
  138. vendorPrefixes: [
  139. '-moz-',
  140. '-o-',
  141. '-webkit-'
  142. ]
  143. },
  144. 'animation-iteration-count': {
  145. canOverride: canOverride.property.animationIterationCount,
  146. componentOf: [
  147. 'animation'
  148. ],
  149. defaultValue: '1',
  150. intoMultiplexMode: 'real',
  151. vendorPrefixes: [
  152. '-moz-',
  153. '-o-',
  154. '-webkit-'
  155. ]
  156. },
  157. 'animation-name': {
  158. canOverride: canOverride.property.animationName,
  159. componentOf: [
  160. 'animation'
  161. ],
  162. defaultValue: 'none',
  163. intoMultiplexMode: 'real',
  164. valueOptimizers: [
  165. valueOptimizers.textQuotes
  166. ],
  167. vendorPrefixes: [
  168. '-moz-',
  169. '-o-',
  170. '-webkit-'
  171. ]
  172. },
  173. 'animation-play-state': {
  174. canOverride: canOverride.property.animationPlayState,
  175. componentOf: [
  176. 'animation'
  177. ],
  178. defaultValue: 'running',
  179. intoMultiplexMode: 'real',
  180. vendorPrefixes: [
  181. '-moz-',
  182. '-o-',
  183. '-webkit-'
  184. ]
  185. },
  186. 'animation-timing-function': {
  187. canOverride: canOverride.generic.timingFunction,
  188. componentOf: [
  189. 'animation'
  190. ],
  191. defaultValue: 'ease',
  192. intoMultiplexMode: 'real',
  193. vendorPrefixes: [
  194. '-moz-',
  195. '-o-',
  196. '-webkit-'
  197. ]
  198. },
  199. background: {
  200. canOverride: canOverride.generic.components([
  201. canOverride.generic.image,
  202. canOverride.property.backgroundPosition,
  203. canOverride.property.backgroundSize,
  204. canOverride.property.backgroundRepeat,
  205. canOverride.property.backgroundAttachment,
  206. canOverride.property.backgroundOrigin,
  207. canOverride.property.backgroundClip,
  208. canOverride.generic.color
  209. ]),
  210. components: [
  211. 'background-image',
  212. 'background-position',
  213. 'background-size',
  214. 'background-repeat',
  215. 'background-attachment',
  216. 'background-origin',
  217. 'background-clip',
  218. 'background-color'
  219. ],
  220. breakUp: breakUp.multiplex(breakUp.background),
  221. defaultValue: '0 0',
  222. propertyOptimizer: propertyOptimizers.background,
  223. restore: restore.multiplex(restore.background),
  224. shortestValue: '0',
  225. shorthand: true,
  226. valueOptimizers: [
  227. valueOptimizers.whiteSpace,
  228. valueOptimizers.urlWhiteSpace,
  229. valueOptimizers.fraction,
  230. valueOptimizers.zero,
  231. valueOptimizers.color,
  232. valueOptimizers.urlPrefix,
  233. valueOptimizers.urlQuotes
  234. ]
  235. },
  236. 'background-attachment': {
  237. canOverride: canOverride.property.backgroundAttachment,
  238. componentOf: [
  239. 'background'
  240. ],
  241. defaultValue: 'scroll',
  242. intoMultiplexMode: 'real'
  243. },
  244. 'background-clip': {
  245. canOverride: canOverride.property.backgroundClip,
  246. componentOf: [
  247. 'background'
  248. ],
  249. defaultValue: 'border-box',
  250. intoMultiplexMode: 'real',
  251. shortestValue: 'border-box'
  252. },
  253. 'background-color': {
  254. canOverride: canOverride.generic.color,
  255. componentOf: [
  256. 'background'
  257. ],
  258. defaultValue: 'transparent',
  259. intoMultiplexMode: 'real', // otherwise real color will turn into default since color appears in last multiplex only
  260. multiplexLastOnly: true,
  261. nonMergeableValue: 'none',
  262. shortestValue: 'red',
  263. valueOptimizers: [
  264. valueOptimizers.whiteSpace,
  265. valueOptimizers.fraction,
  266. valueOptimizers.color
  267. ]
  268. },
  269. 'background-image': {
  270. canOverride: canOverride.generic.image,
  271. componentOf: [
  272. 'background'
  273. ],
  274. defaultValue: 'none',
  275. intoMultiplexMode: 'default',
  276. valueOptimizers: [
  277. valueOptimizers.urlWhiteSpace,
  278. valueOptimizers.urlPrefix,
  279. valueOptimizers.urlQuotes,
  280. valueOptimizers.whiteSpace,
  281. valueOptimizers.fraction,
  282. valueOptimizers.precision,
  283. valueOptimizers.unit,
  284. valueOptimizers.zero,
  285. valueOptimizers.color
  286. ]
  287. },
  288. 'background-origin': {
  289. canOverride: canOverride.property.backgroundOrigin,
  290. componentOf: [
  291. 'background'
  292. ],
  293. defaultValue: 'padding-box',
  294. intoMultiplexMode: 'real',
  295. shortestValue: 'border-box'
  296. },
  297. 'background-position': {
  298. canOverride: canOverride.property.backgroundPosition,
  299. componentOf: [
  300. 'background'
  301. ],
  302. defaultValue: ['0', '0'],
  303. doubleValues: true,
  304. intoMultiplexMode: 'real',
  305. shortestValue: '0',
  306. valueOptimizers: [
  307. valueOptimizers.whiteSpace,
  308. valueOptimizers.fraction,
  309. valueOptimizers.precision,
  310. valueOptimizers.unit,
  311. valueOptimizers.zero
  312. ]
  313. },
  314. 'background-repeat': {
  315. canOverride: canOverride.property.backgroundRepeat,
  316. componentOf: [
  317. 'background'
  318. ],
  319. defaultValue: ['repeat'],
  320. doubleValues: true,
  321. intoMultiplexMode: 'real'
  322. },
  323. 'background-size': {
  324. canOverride: canOverride.property.backgroundSize,
  325. componentOf: [
  326. 'background'
  327. ],
  328. defaultValue: ['auto'],
  329. doubleValues: true,
  330. intoMultiplexMode: 'real',
  331. shortestValue: '0 0',
  332. valueOptimizers: [
  333. valueOptimizers.whiteSpace,
  334. valueOptimizers.fraction,
  335. valueOptimizers.precision,
  336. valueOptimizers.unit,
  337. valueOptimizers.zero
  338. ]
  339. },
  340. bottom: {
  341. canOverride: canOverride.property.bottom,
  342. defaultValue: 'auto',
  343. valueOptimizers: [
  344. valueOptimizers.whiteSpace,
  345. valueOptimizers.fraction,
  346. valueOptimizers.precision,
  347. valueOptimizers.unit,
  348. valueOptimizers.zero
  349. ]
  350. },
  351. border: {
  352. breakUp: breakUp.border,
  353. canOverride: canOverride.generic.components([
  354. canOverride.generic.unit,
  355. canOverride.property.borderStyle,
  356. canOverride.generic.color
  357. ]),
  358. components: [
  359. 'border-width',
  360. 'border-style',
  361. 'border-color'
  362. ],
  363. defaultValue: 'none',
  364. overridesShorthands: [
  365. 'border-bottom',
  366. 'border-left',
  367. 'border-right',
  368. 'border-top'
  369. ],
  370. restore: restore.withoutDefaults,
  371. shorthand: true,
  372. shorthandComponents: true,
  373. valueOptimizers: [
  374. valueOptimizers.whiteSpace,
  375. valueOptimizers.fraction,
  376. valueOptimizers.zero,
  377. valueOptimizers.color
  378. ]
  379. },
  380. 'border-bottom': {
  381. breakUp: breakUp.border,
  382. canOverride: canOverride.generic.components([
  383. canOverride.generic.unit,
  384. canOverride.property.borderStyle,
  385. canOverride.generic.color
  386. ]),
  387. components: [
  388. 'border-bottom-width',
  389. 'border-bottom-style',
  390. 'border-bottom-color'
  391. ],
  392. defaultValue: 'none',
  393. restore: restore.withoutDefaults,
  394. shorthand: true,
  395. valueOptimizers: [
  396. valueOptimizers.whiteSpace,
  397. valueOptimizers.fraction,
  398. valueOptimizers.zero,
  399. valueOptimizers.color
  400. ]
  401. },
  402. 'border-bottom-color': {
  403. canOverride: canOverride.generic.color,
  404. componentOf: [
  405. 'border-bottom',
  406. 'border-color'
  407. ],
  408. defaultValue: 'none',
  409. valueOptimizers: [
  410. valueOptimizers.whiteSpace,
  411. valueOptimizers.fraction,
  412. valueOptimizers.color
  413. ]
  414. },
  415. 'border-bottom-left-radius': {
  416. canOverride: canOverride.generic.unit,
  417. componentOf: [
  418. 'border-radius'
  419. ],
  420. defaultValue: '0',
  421. propertyOptimizer: propertyOptimizers.borderRadius,
  422. valueOptimizers: [
  423. valueOptimizers.whiteSpace,
  424. valueOptimizers.fraction,
  425. valueOptimizers.precision,
  426. valueOptimizers.unit,
  427. valueOptimizers.zero
  428. ],
  429. vendorPrefixes: [
  430. '-moz-',
  431. '-o-'
  432. ]
  433. },
  434. 'border-bottom-right-radius': {
  435. canOverride: canOverride.generic.unit,
  436. componentOf: [
  437. 'border-radius'
  438. ],
  439. defaultValue: '0',
  440. propertyOptimizer: propertyOptimizers.borderRadius,
  441. valueOptimizers: [
  442. valueOptimizers.whiteSpace,
  443. valueOptimizers.fraction,
  444. valueOptimizers.precision,
  445. valueOptimizers.unit,
  446. valueOptimizers.zero
  447. ],
  448. vendorPrefixes: [
  449. '-moz-',
  450. '-o-'
  451. ]
  452. },
  453. 'border-bottom-style': {
  454. canOverride: canOverride.property.borderStyle,
  455. componentOf: [
  456. 'border-bottom',
  457. 'border-style'
  458. ],
  459. defaultValue: 'none'
  460. },
  461. 'border-bottom-width': {
  462. canOverride: canOverride.generic.unit,
  463. componentOf: [
  464. 'border-bottom',
  465. 'border-width'
  466. ],
  467. defaultValue: 'medium',
  468. oppositeTo: 'border-top-width',
  469. shortestValue: '0',
  470. valueOptimizers: [
  471. valueOptimizers.whiteSpace,
  472. valueOptimizers.fraction,
  473. valueOptimizers.precision,
  474. valueOptimizers.unit,
  475. valueOptimizers.zero
  476. ]
  477. },
  478. 'border-collapse': {
  479. canOverride: canOverride.property.borderCollapse,
  480. defaultValue: 'separate'
  481. },
  482. 'border-color': {
  483. breakUp: breakUp.fourValues,
  484. canOverride: canOverride.generic.components([
  485. canOverride.generic.color,
  486. canOverride.generic.color,
  487. canOverride.generic.color,
  488. canOverride.generic.color
  489. ]),
  490. componentOf: [
  491. 'border'
  492. ],
  493. components: [
  494. 'border-top-color',
  495. 'border-right-color',
  496. 'border-bottom-color',
  497. 'border-left-color'
  498. ],
  499. defaultValue: 'none',
  500. restore: restore.fourValues,
  501. shortestValue: 'red',
  502. shorthand: true,
  503. singleTypeComponents: true,
  504. valueOptimizers: [
  505. valueOptimizers.whiteSpace,
  506. valueOptimizers.fraction,
  507. valueOptimizers.color
  508. ]
  509. },
  510. 'border-left': {
  511. breakUp: breakUp.border,
  512. canOverride: canOverride.generic.components([
  513. canOverride.generic.unit,
  514. canOverride.property.borderStyle,
  515. canOverride.generic.color
  516. ]),
  517. components: [
  518. 'border-left-width',
  519. 'border-left-style',
  520. 'border-left-color'
  521. ],
  522. defaultValue: 'none',
  523. restore: restore.withoutDefaults,
  524. shorthand: true,
  525. valueOptimizers: [
  526. valueOptimizers.whiteSpace,
  527. valueOptimizers.fraction,
  528. valueOptimizers.zero,
  529. valueOptimizers.color
  530. ]
  531. },
  532. 'border-left-color': {
  533. canOverride: canOverride.generic.color,
  534. componentOf: [
  535. 'border-color',
  536. 'border-left'
  537. ],
  538. defaultValue: 'none',
  539. valueOptimizers: [
  540. valueOptimizers.whiteSpace,
  541. valueOptimizers.fraction,
  542. valueOptimizers.color
  543. ]
  544. },
  545. 'border-left-style': {
  546. canOverride: canOverride.property.borderStyle,
  547. componentOf: [
  548. 'border-left',
  549. 'border-style'
  550. ],
  551. defaultValue: 'none'
  552. },
  553. 'border-left-width': {
  554. canOverride: canOverride.generic.unit,
  555. componentOf: [
  556. 'border-left',
  557. 'border-width'
  558. ],
  559. defaultValue: 'medium',
  560. oppositeTo: 'border-right-width',
  561. shortestValue: '0',
  562. valueOptimizers: [
  563. valueOptimizers.whiteSpace,
  564. valueOptimizers.fraction,
  565. valueOptimizers.precision,
  566. valueOptimizers.unit,
  567. valueOptimizers.zero
  568. ]
  569. },
  570. 'border-radius': {
  571. breakUp: breakUp.borderRadius,
  572. canOverride: canOverride.generic.components([
  573. canOverride.generic.unit,
  574. canOverride.generic.unit,
  575. canOverride.generic.unit,
  576. canOverride.generic.unit
  577. ]),
  578. components: [
  579. 'border-top-left-radius',
  580. 'border-top-right-radius',
  581. 'border-bottom-right-radius',
  582. 'border-bottom-left-radius'
  583. ],
  584. defaultValue: '0',
  585. propertyOptimizer: propertyOptimizers.borderRadius,
  586. restore: restore.borderRadius,
  587. shorthand: true,
  588. valueOptimizers: [
  589. valueOptimizers.whiteSpace,
  590. valueOptimizers.fraction,
  591. valueOptimizers.precision,
  592. valueOptimizers.unit,
  593. valueOptimizers.zero
  594. ],
  595. vendorPrefixes: [
  596. '-moz-',
  597. '-o-'
  598. ]
  599. },
  600. 'border-right': {
  601. breakUp: breakUp.border,
  602. canOverride: canOverride.generic.components([
  603. canOverride.generic.unit,
  604. canOverride.property.borderStyle,
  605. canOverride.generic.color
  606. ]),
  607. components: [
  608. 'border-right-width',
  609. 'border-right-style',
  610. 'border-right-color'
  611. ],
  612. defaultValue: 'none',
  613. restore: restore.withoutDefaults,
  614. shorthand: true,
  615. valueOptimizers: [
  616. valueOptimizers.whiteSpace,
  617. valueOptimizers.fraction,
  618. valueOptimizers.color
  619. ]
  620. },
  621. 'border-right-color': {
  622. canOverride: canOverride.generic.color,
  623. componentOf: [
  624. 'border-color',
  625. 'border-right'
  626. ],
  627. defaultValue: 'none',
  628. valueOptimizers: [
  629. valueOptimizers.whiteSpace,
  630. valueOptimizers.fraction,
  631. valueOptimizers.color
  632. ]
  633. },
  634. 'border-right-style': {
  635. canOverride: canOverride.property.borderStyle,
  636. componentOf: [
  637. 'border-right',
  638. 'border-style'
  639. ],
  640. defaultValue: 'none'
  641. },
  642. 'border-right-width': {
  643. canOverride: canOverride.generic.unit,
  644. componentOf: [
  645. 'border-right',
  646. 'border-width'
  647. ],
  648. defaultValue: 'medium',
  649. oppositeTo: 'border-left-width',
  650. shortestValue: '0',
  651. valueOptimizers: [
  652. valueOptimizers.whiteSpace,
  653. valueOptimizers.fraction,
  654. valueOptimizers.precision,
  655. valueOptimizers.unit,
  656. valueOptimizers.zero
  657. ]
  658. },
  659. 'border-style': {
  660. breakUp: breakUp.fourValues,
  661. canOverride: canOverride.generic.components([
  662. canOverride.property.borderStyle,
  663. canOverride.property.borderStyle,
  664. canOverride.property.borderStyle,
  665. canOverride.property.borderStyle
  666. ]),
  667. componentOf: [
  668. 'border'
  669. ],
  670. components: [
  671. 'border-top-style',
  672. 'border-right-style',
  673. 'border-bottom-style',
  674. 'border-left-style'
  675. ],
  676. defaultValue: 'none',
  677. restore: restore.fourValues,
  678. shorthand: true,
  679. singleTypeComponents: true
  680. },
  681. 'border-top': {
  682. breakUp: breakUp.border,
  683. canOverride: canOverride.generic.components([
  684. canOverride.generic.unit,
  685. canOverride.property.borderStyle,
  686. canOverride.generic.color
  687. ]),
  688. components: [
  689. 'border-top-width',
  690. 'border-top-style',
  691. 'border-top-color'
  692. ],
  693. defaultValue: 'none',
  694. restore: restore.withoutDefaults,
  695. shorthand: true,
  696. valueOptimizers: [
  697. valueOptimizers.whiteSpace,
  698. valueOptimizers.fraction,
  699. valueOptimizers.precision,
  700. valueOptimizers.zero,
  701. valueOptimizers.color,
  702. valueOptimizers.unit
  703. ]
  704. },
  705. 'border-top-color': {
  706. canOverride: canOverride.generic.color,
  707. componentOf: [
  708. 'border-color',
  709. 'border-top'
  710. ],
  711. defaultValue: 'none',
  712. valueOptimizers: [
  713. valueOptimizers.whiteSpace,
  714. valueOptimizers.fraction,
  715. valueOptimizers.color
  716. ]
  717. },
  718. 'border-top-left-radius': {
  719. canOverride: canOverride.generic.unit,
  720. componentOf: [
  721. 'border-radius'
  722. ],
  723. defaultValue: '0',
  724. propertyOptimizer: propertyOptimizers.borderRadius,
  725. valueOptimizers: [
  726. valueOptimizers.whiteSpace,
  727. valueOptimizers.fraction,
  728. valueOptimizers.precision,
  729. valueOptimizers.unit,
  730. valueOptimizers.zero
  731. ],
  732. vendorPrefixes: [
  733. '-moz-',
  734. '-o-'
  735. ]
  736. },
  737. 'border-top-right-radius': {
  738. canOverride: canOverride.generic.unit,
  739. componentOf: [
  740. 'border-radius'
  741. ],
  742. defaultValue: '0',
  743. propertyOptimizer: propertyOptimizers.borderRadius,
  744. valueOptimizers: [
  745. valueOptimizers.whiteSpace,
  746. valueOptimizers.fraction,
  747. valueOptimizers.precision,
  748. valueOptimizers.unit,
  749. valueOptimizers.zero
  750. ],
  751. vendorPrefixes: [
  752. '-moz-',
  753. '-o-'
  754. ]
  755. },
  756. 'border-top-style': {
  757. canOverride: canOverride.property.borderStyle,
  758. componentOf: [
  759. 'border-style',
  760. 'border-top'
  761. ],
  762. defaultValue: 'none'
  763. },
  764. 'border-top-width': {
  765. canOverride: canOverride.generic.unit,
  766. componentOf: [
  767. 'border-top',
  768. 'border-width'
  769. ],
  770. defaultValue: 'medium',
  771. oppositeTo: 'border-bottom-width',
  772. shortestValue: '0',
  773. valueOptimizers: [
  774. valueOptimizers.whiteSpace,
  775. valueOptimizers.fraction,
  776. valueOptimizers.precision,
  777. valueOptimizers.unit,
  778. valueOptimizers.zero
  779. ]
  780. },
  781. 'border-width': {
  782. breakUp: breakUp.fourValues,
  783. canOverride: canOverride.generic.components([
  784. canOverride.generic.unit,
  785. canOverride.generic.unit,
  786. canOverride.generic.unit,
  787. canOverride.generic.unit
  788. ]),
  789. componentOf: [
  790. 'border'
  791. ],
  792. components: [
  793. 'border-top-width',
  794. 'border-right-width',
  795. 'border-bottom-width',
  796. 'border-left-width'
  797. ],
  798. defaultValue: 'medium',
  799. restore: restore.fourValues,
  800. shortestValue: '0',
  801. shorthand: true,
  802. singleTypeComponents: true,
  803. valueOptimizers: [
  804. valueOptimizers.whiteSpace,
  805. valueOptimizers.fraction,
  806. valueOptimizers.precision,
  807. valueOptimizers.unit,
  808. valueOptimizers.zero
  809. ]
  810. },
  811. 'box-shadow': {
  812. propertyOptimizer: propertyOptimizers.boxShadow,
  813. valueOptimizers: [
  814. valueOptimizers.whiteSpace,
  815. valueOptimizers.fraction,
  816. valueOptimizers.precision,
  817. valueOptimizers.unit,
  818. valueOptimizers.zero,
  819. valueOptimizers.color
  820. ],
  821. vendorPrefixes: [
  822. '-moz-',
  823. '-ms-',
  824. '-o-',
  825. '-webkit-'
  826. ]
  827. },
  828. clear: {
  829. canOverride: canOverride.property.clear,
  830. defaultValue: 'none'
  831. },
  832. clip: {
  833. valueOptimizers: [
  834. valueOptimizers.whiteSpace,
  835. valueOptimizers.fraction,
  836. valueOptimizers.precision,
  837. valueOptimizers.unit,
  838. valueOptimizers.zero
  839. ]
  840. },
  841. color: {
  842. canOverride: canOverride.generic.color,
  843. defaultValue: 'transparent',
  844. shortestValue: 'red',
  845. valueOptimizers: [
  846. valueOptimizers.whiteSpace,
  847. valueOptimizers.fraction,
  848. valueOptimizers.color
  849. ]
  850. },
  851. 'column-gap': {
  852. valueOptimizers: [
  853. valueOptimizers.whiteSpace,
  854. valueOptimizers.fraction,
  855. valueOptimizers.precision,
  856. valueOptimizers.unit,
  857. valueOptimizers.zero
  858. ]
  859. },
  860. cursor: {
  861. canOverride: canOverride.property.cursor,
  862. defaultValue: 'auto'
  863. },
  864. display: { canOverride: canOverride.property.display },
  865. filter: {
  866. propertyOptimizer: propertyOptimizers.filter,
  867. valueOptimizers: [
  868. valueOptimizers.fraction
  869. ]
  870. },
  871. float: {
  872. canOverride: canOverride.property.float,
  873. defaultValue: 'none'
  874. },
  875. font: {
  876. breakUp: breakUp.font,
  877. canOverride: canOverride.generic.components([
  878. canOverride.property.fontStyle,
  879. canOverride.property.fontVariant,
  880. canOverride.property.fontWeight,
  881. canOverride.property.fontStretch,
  882. canOverride.generic.unit,
  883. canOverride.generic.unit,
  884. canOverride.property.fontFamily
  885. ]),
  886. components: [
  887. 'font-style',
  888. 'font-variant',
  889. 'font-weight',
  890. 'font-stretch',
  891. 'font-size',
  892. 'line-height',
  893. 'font-family'
  894. ],
  895. restore: restore.font,
  896. shorthand: true,
  897. valueOptimizers: [
  898. valueOptimizers.textQuotes
  899. ]
  900. },
  901. 'font-family': {
  902. canOverride: canOverride.property.fontFamily,
  903. defaultValue: 'user|agent|specific',
  904. valueOptimizers: [
  905. valueOptimizers.textQuotes
  906. ]
  907. },
  908. 'font-size': {
  909. canOverride: canOverride.generic.unit,
  910. defaultValue: 'medium',
  911. shortestValue: '0',
  912. valueOptimizers: [
  913. valueOptimizers.fraction
  914. ]
  915. },
  916. 'font-stretch': {
  917. canOverride: canOverride.property.fontStretch,
  918. defaultValue: 'normal'
  919. },
  920. 'font-style': {
  921. canOverride: canOverride.property.fontStyle,
  922. defaultValue: 'normal'
  923. },
  924. 'font-variant': {
  925. canOverride: canOverride.property.fontVariant,
  926. defaultValue: 'normal'
  927. },
  928. 'font-weight': {
  929. canOverride: canOverride.property.fontWeight,
  930. defaultValue: 'normal',
  931. propertyOptimizer: propertyOptimizers.fontWeight,
  932. shortestValue: '400'
  933. },
  934. gap: {
  935. valueOptimizers: [
  936. valueOptimizers.whiteSpace,
  937. valueOptimizers.fraction,
  938. valueOptimizers.precision,
  939. valueOptimizers.unit,
  940. valueOptimizers.zero
  941. ]
  942. },
  943. height: {
  944. canOverride: canOverride.generic.unit,
  945. defaultValue: 'auto',
  946. shortestValue: '0',
  947. valueOptimizers: [
  948. valueOptimizers.whiteSpace,
  949. valueOptimizers.fraction,
  950. valueOptimizers.precision,
  951. valueOptimizers.unit,
  952. valueOptimizers.zero
  953. ]
  954. },
  955. left: {
  956. canOverride: canOverride.property.left,
  957. defaultValue: 'auto',
  958. valueOptimizers: [
  959. valueOptimizers.whiteSpace,
  960. valueOptimizers.fraction,
  961. valueOptimizers.precision,
  962. valueOptimizers.unit,
  963. valueOptimizers.zero
  964. ]
  965. },
  966. 'letter-spacing': {
  967. valueOptimizers: [
  968. valueOptimizers.fraction,
  969. valueOptimizers.zero
  970. ]
  971. },
  972. 'line-height': {
  973. canOverride: canOverride.generic.unitOrNumber,
  974. defaultValue: 'normal',
  975. shortestValue: '0',
  976. valueOptimizers: [
  977. valueOptimizers.fraction,
  978. valueOptimizers.zero
  979. ]
  980. },
  981. 'list-style': {
  982. canOverride: canOverride.generic.components([
  983. canOverride.property.listStyleType,
  984. canOverride.property.listStylePosition,
  985. canOverride.property.listStyleImage
  986. ]),
  987. components: [
  988. 'list-style-type',
  989. 'list-style-position',
  990. 'list-style-image'
  991. ],
  992. breakUp: breakUp.listStyle,
  993. restore: restore.withoutDefaults,
  994. defaultValue: 'outside', // can't use 'disc' because that'd override default 'decimal' for <ol>
  995. shortestValue: 'none',
  996. shorthand: true
  997. },
  998. 'list-style-image': {
  999. canOverride: canOverride.generic.image,
  1000. componentOf: [
  1001. 'list-style'
  1002. ],
  1003. defaultValue: 'none'
  1004. },
  1005. 'list-style-position': {
  1006. canOverride: canOverride.property.listStylePosition,
  1007. componentOf: [
  1008. 'list-style'
  1009. ],
  1010. defaultValue: 'outside',
  1011. shortestValue: 'inside'
  1012. },
  1013. 'list-style-type': {
  1014. canOverride: canOverride.property.listStyleType,
  1015. componentOf: [
  1016. 'list-style'
  1017. ],
  1018. // NOTE: we can't tell the real default value here, it's 'disc' for <ul> and 'decimal' for <ol>
  1019. // this is a hack, but it doesn't matter because this value will be either overridden or
  1020. // it will disappear at the final step anyway
  1021. defaultValue: 'decimal|disc',
  1022. shortestValue: 'none'
  1023. },
  1024. margin: {
  1025. breakUp: breakUp.fourValues,
  1026. canOverride: canOverride.generic.components([
  1027. canOverride.generic.unit,
  1028. canOverride.generic.unit,
  1029. canOverride.generic.unit,
  1030. canOverride.generic.unit
  1031. ]),
  1032. components: [
  1033. 'margin-top',
  1034. 'margin-right',
  1035. 'margin-bottom',
  1036. 'margin-left'
  1037. ],
  1038. defaultValue: '0',
  1039. propertyOptimizer: propertyOptimizers.margin,
  1040. restore: restore.fourValues,
  1041. shorthand: true,
  1042. valueOptimizers: [
  1043. valueOptimizers.whiteSpace,
  1044. valueOptimizers.fraction,
  1045. valueOptimizers.precision,
  1046. valueOptimizers.unit,
  1047. valueOptimizers.zero
  1048. ]
  1049. },
  1050. 'margin-bottom': {
  1051. canOverride: canOverride.generic.unit,
  1052. componentOf: [
  1053. 'margin'
  1054. ],
  1055. defaultValue: '0',
  1056. oppositeTo: 'margin-top',
  1057. propertyOptimizer: propertyOptimizers.margin,
  1058. valueOptimizers: [
  1059. valueOptimizers.whiteSpace,
  1060. valueOptimizers.fraction,
  1061. valueOptimizers.precision,
  1062. valueOptimizers.unit,
  1063. valueOptimizers.zero
  1064. ]
  1065. },
  1066. 'margin-inline-end': {
  1067. valueOptimizers: [
  1068. valueOptimizers.whiteSpace,
  1069. valueOptimizers.fraction,
  1070. valueOptimizers.precision,
  1071. valueOptimizers.unit,
  1072. valueOptimizers.zero
  1073. ]
  1074. },
  1075. 'margin-inline-start': {
  1076. valueOptimizers: [
  1077. valueOptimizers.whiteSpace,
  1078. valueOptimizers.fraction,
  1079. valueOptimizers.precision,
  1080. valueOptimizers.unit,
  1081. valueOptimizers.zero
  1082. ]
  1083. },
  1084. 'margin-left': {
  1085. canOverride: canOverride.generic.unit,
  1086. componentOf: [
  1087. 'margin'
  1088. ],
  1089. defaultValue: '0',
  1090. oppositeTo: 'margin-right',
  1091. propertyOptimizer: propertyOptimizers.margin,
  1092. valueOptimizers: [
  1093. valueOptimizers.whiteSpace,
  1094. valueOptimizers.fraction,
  1095. valueOptimizers.precision,
  1096. valueOptimizers.unit,
  1097. valueOptimizers.zero
  1098. ]
  1099. },
  1100. 'margin-right': {
  1101. canOverride: canOverride.generic.unit,
  1102. componentOf: [
  1103. 'margin'
  1104. ],
  1105. defaultValue: '0',
  1106. oppositeTo: 'margin-left',
  1107. propertyOptimizer: propertyOptimizers.margin,
  1108. valueOptimizers: [
  1109. valueOptimizers.whiteSpace,
  1110. valueOptimizers.fraction,
  1111. valueOptimizers.precision,
  1112. valueOptimizers.unit,
  1113. valueOptimizers.zero
  1114. ]
  1115. },
  1116. 'margin-top': {
  1117. canOverride: canOverride.generic.unit,
  1118. componentOf: [
  1119. 'margin'
  1120. ],
  1121. defaultValue: '0',
  1122. oppositeTo: 'margin-bottom',
  1123. propertyOptimizer: propertyOptimizers.margin,
  1124. valueOptimizers: [
  1125. valueOptimizers.whiteSpace,
  1126. valueOptimizers.fraction,
  1127. valueOptimizers.precision,
  1128. valueOptimizers.unit,
  1129. valueOptimizers.zero
  1130. ]
  1131. },
  1132. 'max-height': {
  1133. canOverride: canOverride.generic.unit,
  1134. defaultValue: 'none',
  1135. shortestValue: '0',
  1136. valueOptimizers: [
  1137. valueOptimizers.whiteSpace,
  1138. valueOptimizers.fraction,
  1139. valueOptimizers.precision,
  1140. valueOptimizers.unit,
  1141. valueOptimizers.zero
  1142. ]
  1143. },
  1144. 'max-width': {
  1145. canOverride: canOverride.generic.unit,
  1146. defaultValue: 'none',
  1147. shortestValue: '0',
  1148. valueOptimizers: [
  1149. valueOptimizers.whiteSpace,
  1150. valueOptimizers.fraction,
  1151. valueOptimizers.precision,
  1152. valueOptimizers.unit,
  1153. valueOptimizers.zero
  1154. ]
  1155. },
  1156. 'min-height': {
  1157. canOverride: canOverride.generic.unit,
  1158. defaultValue: '0',
  1159. shortestValue: '0',
  1160. valueOptimizers: [
  1161. valueOptimizers.whiteSpace,
  1162. valueOptimizers.fraction,
  1163. valueOptimizers.precision,
  1164. valueOptimizers.unit,
  1165. valueOptimizers.zero
  1166. ]
  1167. },
  1168. 'min-width': {
  1169. canOverride: canOverride.generic.unit,
  1170. defaultValue: '0',
  1171. shortestValue: '0',
  1172. valueOptimizers: [
  1173. valueOptimizers.whiteSpace,
  1174. valueOptimizers.fraction,
  1175. valueOptimizers.precision,
  1176. valueOptimizers.unit,
  1177. valueOptimizers.zero
  1178. ]
  1179. },
  1180. opacity: {
  1181. valueOptimizers: [
  1182. valueOptimizers.fraction,
  1183. valueOptimizers.precision
  1184. ]
  1185. },
  1186. outline: {
  1187. canOverride: canOverride.generic.components([
  1188. canOverride.generic.color,
  1189. canOverride.property.outlineStyle,
  1190. canOverride.generic.unit
  1191. ]),
  1192. components: [
  1193. 'outline-color',
  1194. 'outline-style',
  1195. 'outline-width'
  1196. ],
  1197. breakUp: breakUp.outline,
  1198. restore: restore.withoutDefaults,
  1199. defaultValue: '0',
  1200. propertyOptimizer: propertyOptimizers.outline,
  1201. shorthand: true,
  1202. valueOptimizers: [
  1203. valueOptimizers.whiteSpace,
  1204. valueOptimizers.fraction,
  1205. valueOptimizers.precision,
  1206. valueOptimizers.unit,
  1207. valueOptimizers.zero
  1208. ]
  1209. },
  1210. 'outline-color': {
  1211. canOverride: canOverride.generic.color,
  1212. componentOf: [
  1213. 'outline'
  1214. ],
  1215. defaultValue: 'invert',
  1216. shortestValue: 'red',
  1217. valueOptimizers: [
  1218. valueOptimizers.whiteSpace,
  1219. valueOptimizers.fraction,
  1220. valueOptimizers.color
  1221. ]
  1222. },
  1223. 'outline-style': {
  1224. canOverride: canOverride.property.outlineStyle,
  1225. componentOf: [
  1226. 'outline'
  1227. ],
  1228. defaultValue: 'none'
  1229. },
  1230. 'outline-width': {
  1231. canOverride: canOverride.generic.unit,
  1232. componentOf: [
  1233. 'outline'
  1234. ],
  1235. defaultValue: 'medium',
  1236. shortestValue: '0',
  1237. valueOptimizers: [
  1238. valueOptimizers.whiteSpace,
  1239. valueOptimizers.fraction,
  1240. valueOptimizers.precision,
  1241. valueOptimizers.unit,
  1242. valueOptimizers.zero
  1243. ]
  1244. },
  1245. overflow: {
  1246. canOverride: canOverride.property.overflow,
  1247. defaultValue: 'visible'
  1248. },
  1249. 'overflow-x': {
  1250. canOverride: canOverride.property.overflow,
  1251. defaultValue: 'visible'
  1252. },
  1253. 'overflow-y': {
  1254. canOverride: canOverride.property.overflow,
  1255. defaultValue: 'visible'
  1256. },
  1257. padding: {
  1258. breakUp: breakUp.fourValues,
  1259. canOverride: canOverride.generic.components([
  1260. canOverride.generic.unit,
  1261. canOverride.generic.unit,
  1262. canOverride.generic.unit,
  1263. canOverride.generic.unit
  1264. ]),
  1265. components: [
  1266. 'padding-top',
  1267. 'padding-right',
  1268. 'padding-bottom',
  1269. 'padding-left'
  1270. ],
  1271. defaultValue: '0',
  1272. propertyOptimizer: propertyOptimizers.padding,
  1273. restore: restore.fourValues,
  1274. shorthand: true,
  1275. valueOptimizers: [
  1276. valueOptimizers.whiteSpace,
  1277. valueOptimizers.fraction,
  1278. valueOptimizers.precision,
  1279. valueOptimizers.unit,
  1280. valueOptimizers.zero
  1281. ]
  1282. },
  1283. 'padding-bottom': {
  1284. canOverride: canOverride.generic.unit,
  1285. componentOf: [
  1286. 'padding'
  1287. ],
  1288. defaultValue: '0',
  1289. oppositeTo: 'padding-top',
  1290. propertyOptimizer: propertyOptimizers.padding,
  1291. valueOptimizers: [
  1292. valueOptimizers.whiteSpace,
  1293. valueOptimizers.fraction,
  1294. valueOptimizers.precision,
  1295. valueOptimizers.unit,
  1296. valueOptimizers.zero
  1297. ]
  1298. },
  1299. 'padding-left': {
  1300. canOverride: canOverride.generic.unit,
  1301. componentOf: [
  1302. 'padding'
  1303. ],
  1304. defaultValue: '0',
  1305. oppositeTo: 'padding-right',
  1306. propertyOptimizer: propertyOptimizers.padding,
  1307. valueOptimizers: [
  1308. valueOptimizers.whiteSpace,
  1309. valueOptimizers.fraction,
  1310. valueOptimizers.precision,
  1311. valueOptimizers.unit,
  1312. valueOptimizers.zero
  1313. ]
  1314. },
  1315. 'padding-right': {
  1316. canOverride: canOverride.generic.unit,
  1317. componentOf: [
  1318. 'padding'
  1319. ],
  1320. defaultValue: '0',
  1321. oppositeTo: 'padding-left',
  1322. propertyOptimizer: propertyOptimizers.padding,
  1323. valueOptimizers: [
  1324. valueOptimizers.whiteSpace,
  1325. valueOptimizers.fraction,
  1326. valueOptimizers.precision,
  1327. valueOptimizers.unit,
  1328. valueOptimizers.zero
  1329. ]
  1330. },
  1331. 'padding-top': {
  1332. canOverride: canOverride.generic.unit,
  1333. componentOf: [
  1334. 'padding'
  1335. ],
  1336. defaultValue: '0',
  1337. oppositeTo: 'padding-bottom',
  1338. propertyOptimizer: propertyOptimizers.padding,
  1339. valueOptimizers: [
  1340. valueOptimizers.whiteSpace,
  1341. valueOptimizers.fraction,
  1342. valueOptimizers.precision,
  1343. valueOptimizers.unit,
  1344. valueOptimizers.zero
  1345. ]
  1346. },
  1347. position: {
  1348. canOverride: canOverride.property.position,
  1349. defaultValue: 'static'
  1350. },
  1351. right: {
  1352. canOverride: canOverride.property.right,
  1353. defaultValue: 'auto',
  1354. valueOptimizers: [
  1355. valueOptimizers.whiteSpace,
  1356. valueOptimizers.fraction,
  1357. valueOptimizers.precision,
  1358. valueOptimizers.unit,
  1359. valueOptimizers.zero
  1360. ]
  1361. },
  1362. 'row-gap': {
  1363. valueOptimizers: [
  1364. valueOptimizers.whiteSpace,
  1365. valueOptimizers.fraction,
  1366. valueOptimizers.precision,
  1367. valueOptimizers.unit,
  1368. valueOptimizers.zero
  1369. ]
  1370. },
  1371. src: {
  1372. valueOptimizers: [
  1373. valueOptimizers.urlWhiteSpace,
  1374. valueOptimizers.urlPrefix,
  1375. valueOptimizers.urlQuotes
  1376. ]
  1377. },
  1378. 'stroke-width': {
  1379. valueOptimizers: [
  1380. valueOptimizers.whiteSpace,
  1381. valueOptimizers.fraction,
  1382. valueOptimizers.precision,
  1383. valueOptimizers.unit,
  1384. valueOptimizers.zero
  1385. ]
  1386. },
  1387. 'text-align': {
  1388. canOverride: canOverride.property.textAlign,
  1389. // NOTE: we can't tell the real default value here, as it depends on default text direction
  1390. // this is a hack, but it doesn't matter because this value will be either overridden or
  1391. // it will disappear anyway
  1392. defaultValue: 'left|right'
  1393. },
  1394. 'text-decoration': {
  1395. canOverride: canOverride.property.textDecoration,
  1396. defaultValue: 'none'
  1397. },
  1398. 'text-indent': {
  1399. canOverride: canOverride.property.textOverflow,
  1400. defaultValue: 'none',
  1401. valueOptimizers: [
  1402. valueOptimizers.fraction,
  1403. valueOptimizers.zero
  1404. ]
  1405. },
  1406. 'text-overflow': {
  1407. canOverride: canOverride.property.textOverflow,
  1408. defaultValue: 'none'
  1409. },
  1410. 'text-shadow': {
  1411. canOverride: canOverride.property.textShadow,
  1412. defaultValue: 'none',
  1413. valueOptimizers: [
  1414. valueOptimizers.whiteSpace,
  1415. valueOptimizers.fraction,
  1416. valueOptimizers.zero,
  1417. valueOptimizers.color
  1418. ]
  1419. },
  1420. top: {
  1421. canOverride: canOverride.property.top,
  1422. defaultValue: 'auto',
  1423. valueOptimizers: [
  1424. valueOptimizers.whiteSpace,
  1425. valueOptimizers.fraction,
  1426. valueOptimizers.precision,
  1427. valueOptimizers.unit,
  1428. valueOptimizers.zero
  1429. ]
  1430. },
  1431. transform: {
  1432. canOverride: canOverride.property.transform,
  1433. valueOptimizers: [
  1434. valueOptimizers.whiteSpace,
  1435. valueOptimizers.degrees,
  1436. valueOptimizers.fraction,
  1437. valueOptimizers.precision,
  1438. valueOptimizers.unit,
  1439. valueOptimizers.zero
  1440. ],
  1441. vendorPrefixes: [
  1442. '-moz-',
  1443. '-ms-',
  1444. '-o-',
  1445. '-webkit-'
  1446. ]
  1447. },
  1448. transition: {
  1449. breakUp: breakUp.multiplex(breakUp.transition),
  1450. canOverride: canOverride.generic.components([
  1451. canOverride.property.transitionProperty,
  1452. canOverride.generic.time,
  1453. canOverride.generic.timingFunction,
  1454. canOverride.generic.time
  1455. ]),
  1456. components: [
  1457. 'transition-property',
  1458. 'transition-duration',
  1459. 'transition-timing-function',
  1460. 'transition-delay'
  1461. ],
  1462. defaultValue: 'none',
  1463. restore: restore.multiplex(restore.withoutDefaults),
  1464. shorthand: true,
  1465. valueOptimizers: [
  1466. valueOptimizers.time,
  1467. valueOptimizers.fraction
  1468. ],
  1469. vendorPrefixes: [
  1470. '-moz-',
  1471. '-ms-',
  1472. '-o-',
  1473. '-webkit-'
  1474. ]
  1475. },
  1476. 'transition-delay': {
  1477. canOverride: canOverride.generic.time,
  1478. componentOf: [
  1479. 'transition'
  1480. ],
  1481. defaultValue: '0s',
  1482. intoMultiplexMode: 'real',
  1483. valueOptimizers: [
  1484. valueOptimizers.time
  1485. ],
  1486. vendorPrefixes: [
  1487. '-moz-',
  1488. '-ms-',
  1489. '-o-',
  1490. '-webkit-'
  1491. ]
  1492. },
  1493. 'transition-duration': {
  1494. canOverride: canOverride.generic.time,
  1495. componentOf: [
  1496. 'transition'
  1497. ],
  1498. defaultValue: '0s',
  1499. intoMultiplexMode: 'real',
  1500. keepUnlessDefault: 'transition-delay',
  1501. valueOptimizers: [
  1502. valueOptimizers.time,
  1503. valueOptimizers.fraction
  1504. ],
  1505. vendorPrefixes: [
  1506. '-moz-',
  1507. '-ms-',
  1508. '-o-',
  1509. '-webkit-'
  1510. ]
  1511. },
  1512. 'transition-property': {
  1513. canOverride: canOverride.generic.propertyName,
  1514. componentOf: [
  1515. 'transition'
  1516. ],
  1517. defaultValue: 'all',
  1518. intoMultiplexMode: 'placeholder',
  1519. placeholderValue: '_', // it's a short value that won't match any property and still be a valid `transition-property`
  1520. vendorPrefixes: [
  1521. '-moz-',
  1522. '-ms-',
  1523. '-o-',
  1524. '-webkit-'
  1525. ]
  1526. },
  1527. 'transition-timing-function': {
  1528. canOverride: canOverride.generic.timingFunction,
  1529. componentOf: [
  1530. 'transition'
  1531. ],
  1532. defaultValue: 'ease',
  1533. intoMultiplexMode: 'real',
  1534. vendorPrefixes: [
  1535. '-moz-',
  1536. '-ms-',
  1537. '-o-',
  1538. '-webkit-'
  1539. ]
  1540. },
  1541. 'vertical-align': {
  1542. canOverride: canOverride.property.verticalAlign,
  1543. defaultValue: 'baseline',
  1544. valueOptimizers: [
  1545. valueOptimizers.whiteSpace,
  1546. valueOptimizers.fraction,
  1547. valueOptimizers.precision,
  1548. valueOptimizers.unit,
  1549. valueOptimizers.zero
  1550. ]
  1551. },
  1552. visibility: {
  1553. canOverride: canOverride.property.visibility,
  1554. defaultValue: 'visible'
  1555. },
  1556. '-webkit-tap-highlight-color': {
  1557. valueOptimizers: [
  1558. valueOptimizers.whiteSpace,
  1559. valueOptimizers.color
  1560. ]
  1561. },
  1562. '-webkit-margin-end': {
  1563. valueOptimizers: [
  1564. valueOptimizers.whiteSpace,
  1565. valueOptimizers.fraction,
  1566. valueOptimizers.precision,
  1567. valueOptimizers.unit,
  1568. valueOptimizers.zero
  1569. ]
  1570. },
  1571. 'white-space': {
  1572. canOverride: canOverride.property.whiteSpace,
  1573. defaultValue: 'normal'
  1574. },
  1575. width: {
  1576. canOverride: canOverride.generic.unit,
  1577. defaultValue: 'auto',
  1578. shortestValue: '0',
  1579. valueOptimizers: [
  1580. valueOptimizers.whiteSpace,
  1581. valueOptimizers.fraction,
  1582. valueOptimizers.precision,
  1583. valueOptimizers.unit,
  1584. valueOptimizers.zero
  1585. ]
  1586. },
  1587. 'z-index': {
  1588. canOverride: canOverride.property.zIndex,
  1589. defaultValue: 'auto'
  1590. }
  1591. };
  1592. // generate vendor-prefixed configuration
  1593. var vendorPrefixedConfiguration = {};
  1594. function cloneDescriptor(propertyName, prefix) {
  1595. var clonedDescriptor = override(configuration[propertyName], {});
  1596. if ('componentOf' in clonedDescriptor) {
  1597. clonedDescriptor.componentOf = clonedDescriptor.componentOf.map(function(shorthandName) {
  1598. return prefix + shorthandName;
  1599. });
  1600. }
  1601. if ('components' in clonedDescriptor) {
  1602. clonedDescriptor.components = clonedDescriptor.components.map(function(longhandName) {
  1603. return prefix + longhandName;
  1604. });
  1605. }
  1606. if ('keepUnlessDefault' in clonedDescriptor) {
  1607. clonedDescriptor.keepUnlessDefault = prefix + clonedDescriptor.keepUnlessDefault;
  1608. }
  1609. return clonedDescriptor;
  1610. }
  1611. for (var propertyName in configuration) {
  1612. var descriptor = configuration[propertyName];
  1613. if (!('vendorPrefixes' in descriptor)) {
  1614. continue;
  1615. }
  1616. for (var i = 0; i < descriptor.vendorPrefixes.length; i++) {
  1617. var prefix = descriptor.vendorPrefixes[i];
  1618. var clonedDescriptor = cloneDescriptor(propertyName, prefix);
  1619. delete clonedDescriptor.vendorPrefixes;
  1620. vendorPrefixedConfiguration[prefix + propertyName] = clonedDescriptor;
  1621. }
  1622. delete descriptor.vendorPrefixes;
  1623. }
  1624. module.exports = override(configuration, vendorPrefixedConfiguration);