123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- use('../nodes/vendor-helpers.js')
- @import 'config'
- /*
- * Alias "nowrap" as "no-wrap".
- */
- no-wrap = unquote('nowrap')
- /*
- * Helper to find out if a given value is a width
- */
- is-width(val)
- if auto == val
- return true
- else if val && 'unit' == type(val)
- // Stylus does not short circuit so we need to perform this as a distinct
- // operation to prevent errors
- return '' != unit(val)
- return false
- /*
- * Vendor support for the given prop / arguments, optionally specifying the
- * only prefixes to utilize, or those which should be ignored.
- */
- vendor(prop, args, only = null, ignore = null, vendor-property = true)
- need_normalize = !vendor-property or prop in ('transition' 'transition-property' 'border-image' 'border-image-slice')
- for prefix in vendor-prefixes
- unless (only and !(prefix in only)) or (ignore and prefix in ignore)
- if official == prefix
- if need_normalize
- {prop}: normalize(prop,('%s' % args))
- else
- {prop}: args
- else
- newprop = prop
- newprop = '-' + prefix + '-' + prop if vendor-property
- if need_normalize
- {newprop}: normalize(prop,('%s' % args),prefix)
- else
- {newprop}: args
- /*
- * Vendorize the given value.
- */
- vendor-value(arg, only = null, ignore = null)
- prop = current-property[0]
- for prefix in vendor-prefixes
- unless (only and !(prefix in only)) or (ignore and prefix in ignore) or official == prefix
- add-property(prop, '-%s-%s' % (prefix arg))
- arg
- /*
- * Vendor "box-shadow" support.
- */
- box-shadow()
- vendor('box-shadow', arguments, only: webkit official)
- /*
- * Vendor "user-select" support.
- */
- user-select()
- vendor('user-select', arguments, only: webkit moz ms official)
- /*
- * Vendor "column-count" support.
- */
- column-count()
- vendor('column-count', arguments, only: webkit moz official)
- /*
- * Vendor "column-gap" support.
- */
- column-gap()
- vendor('column-gap', arguments, only: webkit moz official)
- /*
- * Vendor "column-rule" support.
- */
- column-rule()
- vendor('column-rule', arguments, only: webkit moz official)
- /*
- * Vendor "column-rule-color" support.
- */
- column-rule-color()
- vendor('column-rule-color', arguments, only: webkit moz official)
- /*
- * Vendor "column-rule-width" support.
- */
- column-rule-width()
- vendor('column-rule-width', arguments, only: webkit moz official)
- /*
- * Vendor "column-rule-style" support.
- */
- column-rule-style()
- vendor('column-rule-style', arguments, only: webkit moz official)
- /*
- * Vendor "column-width" support.
- */
- column-width()
- vendor('column-width', arguments, only: webkit moz official)
- /*
- * Vendor "column-span" support.
- */
- column-span()
- vendor('column-span', arguments, only: webkit official)
- /*
- * Vendor "column-fill" support.
- */
- column-fill()
- vendor('column-fill', arguments, only: moz official)
- /*
- * Legacy syntax support for background-clip and background-origin
- */
- legacy-bg-values(property, args)
- legacy_args = ()
- importance = unquote('')
- for subargs in args
- for arg in subargs
- if arg in (border-box padding-box content-box)
- arg = unquote('border') if arg == border-box
- arg = unquote('padding') if arg == padding-box
- arg = unquote('content') if arg == content-box
- if arg != '!important'
- push(legacy_args,arg)
- else
- importance = !important
- vendor(property, unquote(join(', ',legacy_args)) importance, only: moz webkit)
- /*
- * Vendor "background-clip" support.
- */
- background-clip()
- if arguments[0] == text
- vendor('background-clip', arguments, only: webkit)
- else
- legacy-bg-values('background-clip', arguments)
- background-clip: arguments
- /*
- * Vendor "background-origin" support.
- */
- background-origin()
- legacy-bg-values('background-origin', arguments)
- background-origin: arguments
- /*
- * Vendor "transform" support.
- */
- transform()
- vendor('transform', arguments)
- /*
- * Vendor "transform-origin" support.
- */
- transform-origin()
- vendor('transform-origin', arguments)
- /*
- * Vendor "transform-style" support.
- */
- transform-style()
- vendor('transform-style', arguments)
- /*
- * Vendor "border-image" support.
- */
- border-image()
- vendor('border-image', arguments, only: webkit moz o official)
- /*
- * Vendor "transition" support.
- */
- transition()
- vendor('transition', arguments)
- /*
- * Vendor "transition-property" support.
- */
- transition-property()
- vendor('transition-property', arguments)
- /*
- * Vendor "transition-duration" support.
- */
- transition-duration()
- vendor('transition-duration', arguments)
- /*
- * Vendor "transition-timing-function" support.
- */
- transition-timing-function()
- vendor('transition-timing-function', arguments)
- /*
- * Vendor "transition-delay" support.
- */
- transition-delay()
- vendor('transition-delay', arguments)
- /*
- * Vendor "backface-visibility" support.
- */
- backface-visibility()
- vendor('backface-visibility', arguments, only: webkit moz ms official)
- /*
- * Vendor "perspective" support.
- */
- perspective()
- if mixin
- vendor('perspective', arguments, only: webkit moz ms official)
- else
- 'perspective(%s)' % arguments
- /*
- * Vendor "perspective-origin" support.
- */
- perspective-origin()
- vendor('perspective-origin', arguments, only: webkit moz ms official)
- /*
- * Opacity with conditional IE support.
- */
- opacity(n, args...)
- opacity: n args
- if support-for-ie
- if n == inherit or n == initial
- -ms-filter: n args
- filter: n args
- else
- val = round(n * 100)
- if val == 100
- -ms-filter: none args
- filter: none args
- else
- -ms-filter: '"progid:DXImageTransform.Microsoft.Alpha(Opacity=%s)"' % val args
- filter: 'alpha(opacity=%s)' % val args
- /*
- * Vendor "text-size-adjust"
- */
- text-size-adjust()
- vendor('text-size-adjust', arguments)
- /*
- * Alias the "white-space" property.
- */
- whitespace()
- white-space: arguments
- /*
- * Vendor "box-sizing" support.
- */
- box-sizing()
- vendor('box-sizing', arguments, only: webkit moz official)
- /*
- * Vendor "box-orient" support.
- */
- box-orient()
- vendor('box-orient', arguments, only: webkit moz official)
- /*
- * Vendor "box-flex-group" support.
- */
- box-flex-group()
- vendor('box-flex-group', arguments, only: webkit moz official)
- /*
- * Vendor "box-ordinal-group" support.
- */
- box-ordinal-group()
- vendor('box-ordinal-group', arguments, only: webkit moz ms official)
- /*
- * Vendor "box-align" support.
- */
- box-align()
- vendor('box-align', arguments, only: webkit moz ms official)
- /*
- * Vendor "box-pack" support.
- */
- box-pack()
- vendor('box-pack', arguments, only: webkit moz ms official)
- /*
- * Vendor "box-direction" support.
- */
- box-direction()
- vendor('box-direction', arguments, only: webkit moz ms official)
- /*
- * Vendor "animation" support.
- */
- animation()
- vendor('animation', arguments)
- /*
- * Vendor "animation-name" support.
- */
- animation-name()
- vendor('animation-name', arguments)
- /*
- * Vendor "animation-duration" support.
- */
- animation-duration()
- vendor('animation-duration', arguments)
- /*
- * Vendor "animation-delay" support.
- */
- animation-delay()
- vendor('animation-delay', arguments)
- /*
- * Vendor "animation-direction" support.
- */
- animation-direction()
- vendor('animation-direction', arguments)
- /*
- * Vendor "animation-iteration-count" support.
- */
- animation-iteration-count()
- vendor('animation-iteration-count', arguments)
- /*
- * Vendor "animation-timing-function" support.
- */
- animation-timing-function()
- vendor('animation-timing-function', arguments)
- /*
- * Vendor "animation-play-state" support.
- */
- animation-play-state()
- vendor('animation-play-state', arguments)
- /*
- * Vendor "animation-fill-mode" support.
- */
- animation-fill-mode()
- vendor('animation-fill-mode', arguments)
- /*
- * Vendor "hyphens" support.
- */
- hyphens()
- vendor('hyphens', arguments, only: webkit moz ms official)
- /*
- * Vendor "appearance" support.
- */
- appearance()
- vendor('appearance', arguments, only: webkit moz official)
- /*
- * Vendor "tab-size" support.
- */
- tab-size()
- vendor('tab-size', arguments, only: moz o official)
- /*
- * Vendor "overflow-scrolling" support.
- */
- overflow-scrolling()
- vendor('overflow-scrolling', arguments, only: webkit official)
- /*
- * Vendor "text-overflow" support, , -o- for opera 9.* - 10.*
- */
- text-overflow()
- vendor('text-overflow', arguments, only: official o)
- /*
- * Vendor "text-size-adjust" support.
- */
- text-size-adjust()
- vendor('text-size-adjust', arguments, only: official webkit ms)
- /*
- * Vendor "font-smoothing" support, webkit only.
- */
- font-smoothing()
- vendor('font-smoothing', arguments, only: webkit)
- /**
- * Vendor input-placeholder/placeholder support.
- *
- * Examples:
- * // Default syntax
- * body
- * placeholder(color #333, font-weight normal)
- *
- * // The comma is important
- * .placeholder-red
- * placeholder(color red,)
- *
- * // We can pass a function
- * green-placeholder()
- * color green
- * .placeholder-green
- * placeholder(green-placeholder)
- *
- * // We can pass a hash
- * textarea
- * placeholder((font-style italic) (font-weight bold) (padding '4px 10px'))
- */
- placeholder()
- for v in ':-webkit-input' '-moz' ':-moz' '-ms-input'
- &:{v}-placeholder
- for pair in arguments
- if typeof(pair) == 'function'
- pair()
- else if pair is not null && pair[0] is not null
- {pair[0]}: type(pair[1]) == 'string' ? s(pair[1]) : pair[1]
- input-placeholder = placeholder
- /*
- * Vendor background support (gradients).
- */
- background()
- if match('-gradient\(', ''+arguments)
- vendor('background', arguments, vendor-property: false)
- else
- background arguments
- background-image()
- if match('-gradient\(', ''+arguments)
- vendor('background-image', arguments, vendor-property: false)
- else
- background-image arguments
- cursor()
- if match('-gradient\(', ''+arguments)
- vendor('cursor', arguments, vendor-property: false)
- else
- cursor arguments
- list-style()
- if match('-gradient\(', ''+arguments)
- vendor('list-style', arguments, vendor-property: false)
- else
- list-style arguments
- list-style-image()
- if match('-gradient\(', ''+arguments)
- vendor('list-style-image', arguments, vendor-property: false)
- else
- list-style-image arguments
|