source: imaps-frontend/node_modules/clean-css/lib/optimizer/configuration.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

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