PHP Class titanscssc

Author: Leaf Corcoran ([email protected])
Show file Open project: gambitph/titan-framework Class Usage Examples

Public Properties

Property Type Description
$VERSION
$defaultValue
$false
$null
$selfSelector
$true

Protected Properties

Property Type Description
$cssColors CSS Colors
$formatter
$importCache
$importPaths
$lib_abs
$lib_adjust_color
$lib_adjust_hue
$lib_alpha
$lib_append
$lib_blue
$lib_ceil
$lib_change_color
$lib_comparable
$lib_complement
$lib_darken
$lib_desaturate
$lib_fade_in
$lib_fade_out
$lib_floor
$lib_grayscale
$lib_green
$lib_hsl
$lib_hsla
$lib_hue
$lib_ie_hex_str
$lib_if Built in functions
$lib_index
$lib_invert
$lib_join
$lib_length
$lib_lighten
$lib_lightness
$lib_mix mix two colors
$lib_nth
$lib_opacify increases opacity by amount
$lib_opacity
$lib_percentage
$lib_quote
$lib_red
$lib_rgb
$lib_rgba
$lib_round
$lib_saturate
$lib_saturation
$lib_scale_color
$lib_transparentize decreases opacity by amount
$lib_type_of
$lib_unit
$lib_unitless
$lib_unquote
$namespaces
$numberPrecision
$operatorNames
$unitTable
$userFunctions

Public Methods

Method Description
addImportPath ( $path )
assertColor ( $value )
assertList ( $value )
assertNumber ( $value )
compile ( $code, $name = null )
findImport ( $url ) results the file path for an import url if it exists
get ( $name, $defaultValue = null, $env = null )
getParsedFiles ( )
hueToRGB ( $m1, $m2, $h )
normalizeValue ( $value )
registerFunction ( $name, $func )
setFormatter ( $formatterName )
setImportPaths ( $path )
setNumberPrecision ( $numberPrecision )
throwError ( $msg = null )
toBool ( $thing )
toHSL ( $red, $green, $blue )
toRGB ( $hue, $saturation, $lightness ) H from 0 to 360, S and L from 0 to 100
unregisterFunction ( $name )

Protected Methods

Method Description
adjustHsl ( $color, $idx, $amount )
adjust_color_helper ( $base, $alter, $i )
alter_color ( $args, $fn ) helper function for adjust_color, change_color, and scale_color
applyArguments ( $argDef, $argValues )
callBuiltin ( $name, $args, &$returnValue )
change_color_helper ( $base, $alter, $i )
coerceColor ( $value )
coerceForExpression ( $value )
coerceList ( $item, $delim = "," ) convert something to list
coercePercent ( $value )
coerceString ( $value )
coerceUnit ( $number, $unit ) $number should be normalized
combineSelectorSingle ( $base, $other )
compileBlock ( StdClass $block ) Recursively compiles a block.
compileChild ( $child, $out ) return a value to halt execution
compileChildren ( $stms, $out )
compileImport ( $rawPath, $out ) returns true if the value was something that could be imported
compileMedia ( $media )
compileMediaQuery ( $queryList )
compileNestedBlock ( $block, $selectors ) TODO refactor compileNestedBlock and compileMedia into same thing
compileRoot ( $rootBlock )
compileSelector ( $selector ) self(&) should have been replaced by now
compileSelectorPart ( $piece )
compileStringContent ( $string )
compileValue ( array $value ) Compiles a primitive value into a CSS property value.
evalSelector ( $selector ) replaces all the interpolates
evalSelectorPart ( $piece )
expToString ( $exp )
extractInterpolation ( $list ) doesn't need to be recursive, compileValue will handle that
fileExists ( $name )
fixColor ( $c ) make sure a color's components don't go out of bounds
flattenSelectorSingle ( $single ) joins together .classes and #ids
flattenSelectors ( $block, $parentKey = null )
getNormalizedNumbers ( $args )
getStoreEnv ( )
hasSelectorPlaceholder ( $selector )
importFile ( $path, $out )
isSelfExtend ( $target, $origin )
isTruthy ( $value )
joinSelectors ( $parent, $child ) looks for & to replace, or append parent before child
lib_abs ( $args )
lib_adjust_color ( $args )
lib_adjust_hue ( $args )
lib_alpha ( $args )
lib_append ( $args )
lib_blue ( $args )
lib_ceil ( $args )
lib_change_color ( $args )
lib_comparable ( $args )
lib_complement ( $args )
lib_counter ( array $args ) Workaround IE7's content counter bug.
lib_darken ( $args )
lib_desaturate ( $args )
lib_fade_in ( $args )
lib_fade_out ( $args )
lib_floor ( $args )
lib_grayscale ( $args )
lib_green ( $args )
lib_hsl ( $args )
lib_hsla ( $args )
lib_hue ( $args )
lib_ie_hex_str ( $args )
lib_if ( $args )
lib_index ( $args )
lib_invert ( $args )
lib_join ( $args )
lib_length ( $args )
lib_lighten ( $args )
lib_lightness ( $args )
lib_max ( $args )
lib_min ( $args )
lib_mix ( $args )
lib_nth ( $args )
lib_opacify ( $args )
lib_opacity ( $args )
lib_percentage ( $args )
lib_quote ( $args )
lib_red ( $args )
lib_rgb ( $args )
lib_rgba ( $args )
lib_round ( $args )
lib_saturate ( $args )
lib_saturation ( $args )
lib_scale_color ( $args )
lib_transparentize ( $args )
lib_type_of ( $args )
lib_unit ( $args )
lib_unitless ( $args )
lib_unquote ( $args )
lib_zip ( $args )
listSeparatorForJoin ( $list1, $sep )
makeOutputBlock ( $type, $selectors = null )
matchExtends ( $selector, &$out, $from, $initial = true )
matchExtendsSingle ( $single, &$outOrigin )
mediaParent ( $scope )
multiplyMedia ( $env, $childQueries = null )
multiplySelectors ( $env ) find the final set of selectors
normalizeName ( $name )
normalizeNumber ( $number ) just does physical lengths for now
op_add ( $left, $right ) adding strings
op_add_number_number ( $left, $right )
op_and ( $left, $right, $shouldEval )
op_color_color ( $op, $left, $right )
op_color_number ( $op, $left, $right )
op_div_number_number ( $left, $right )
op_eq ( $left, $right )
op_gt_number_number ( $left, $right )
op_gte_number_number ( $left, $right )
op_lt_number_number ( $left, $right )
op_lte_number_number ( $left, $right )
op_mod_number_number ( $left, $right )
op_mul_number_number ( $left, $right )
op_neq ( $left, $right )
op_number_color ( $op, $left, $right )
op_or ( $left, $right, $shouldEval )
op_sub_number_number ( $left, $right )
popEnv ( )
pushEnv ( $block = null )
pushExtends ( $target, $origin )
reduce ( $value, $inExp = false )
scale_color_helper ( $base, $scale, $i )
set ( $name, $value, $shadow = false )
setExisting ( $name, $value, $env = null )
setRaw ( $name, $value )
shouldEval ( $value ) should $value cause its operand to eval
sortArgs ( $prototype, $args ) TODO: merge with apply arguments

Method Details

addImportPath() public method

public addImportPath ( $path )

adjustHsl() protected method

protected adjustHsl ( $color, $idx, $amount )

adjust_color_helper() protected method

protected adjust_color_helper ( $base, $alter, $i )

alter_color() protected method

helper function for adjust_color, change_color, and scale_color
protected alter_color ( $args, $fn )

applyArguments() protected method

protected applyArguments ( $argDef, $argValues )

assertColor() public method

public assertColor ( $value )

assertList() public method

public assertList ( $value )

assertNumber() public method

public assertNumber ( $value )

callBuiltin() protected method

protected callBuiltin ( $name, $args, &$returnValue )

change_color_helper() protected method

protected change_color_helper ( $base, $alter, $i )

coerceColor() protected method

protected coerceColor ( $value )

coerceForExpression() protected method

protected coerceForExpression ( $value )

coerceList() protected method

convert something to list
protected coerceList ( $item, $delim = "," )

coercePercent() protected method

protected coercePercent ( $value )

coerceString() protected method

protected coerceString ( $value )

coerceUnit() protected method

$number should be normalized
protected coerceUnit ( $number, $unit )

combineSelectorSingle() protected method

protected combineSelectorSingle ( $base, $other )

compile() public method

public compile ( $code, $name = null )

compileBlock() protected method

A block is analogous to a CSS block in most cases. A single SCSS document is encapsulated in a block when parsed, but it does not have parent tags so all of its children appear on the root level when compiled. Blocks are made up of selectors and children. The children of a block are just all the blocks that are defined within. Compiling the block involves pushing a fresh environment on the stack, and iterating through the props, compiling each one.
See also: scss::compileChild()
protected compileBlock ( StdClass $block )
$block StdClass

compileChild() protected method

return a value to halt execution
protected compileChild ( $child, $out )

compileChildren() protected method

protected compileChildren ( $stms, $out )

compileImport() protected method

returns true if the value was something that could be imported
protected compileImport ( $rawPath, $out )

compileMedia() protected method

protected compileMedia ( $media )

compileMediaQuery() protected method

protected compileMediaQuery ( $queryList )

compileNestedBlock() protected method

TODO refactor compileNestedBlock and compileMedia into same thing
protected compileNestedBlock ( $block, $selectors )

compileRoot() protected method

protected compileRoot ( $rootBlock )

compileSelector() protected method

self(&) should have been replaced by now
protected compileSelector ( $selector )

compileSelectorPart() protected method

protected compileSelectorPart ( $piece )

compileStringContent() protected method

protected compileStringContent ( $string )

compileValue() protected method

Values in scssphp are typed by being wrapped in arrays, their format is typically: array(type, contents [, additional_contents]*) The input is expected to be reduced. This function will not work on things like expressions and variables.
protected compileValue ( array $value )
$value array

evalSelector() protected method

replaces all the interpolates
protected evalSelector ( $selector )

evalSelectorPart() protected method

protected evalSelectorPart ( $piece )

expToString() protected method

protected expToString ( $exp )

extractInterpolation() protected method

doesn't need to be recursive, compileValue will handle that
protected extractInterpolation ( $list )

fileExists() protected method

protected fileExists ( $name )

findImport() public method

results the file path for an import url if it exists
public findImport ( $url )

fixColor() protected method

make sure a color's components don't go out of bounds
protected fixColor ( $c )

flattenSelectorSingle() protected method

joins together .classes and #ids
protected flattenSelectorSingle ( $single )

flattenSelectors() protected method

protected flattenSelectors ( $block, $parentKey = null )

get() public method

public get ( $name, $defaultValue = null, $env = null )

getNormalizedNumbers() protected method

protected getNormalizedNumbers ( $args )

getParsedFiles() public method

public getParsedFiles ( )

getStoreEnv() protected method

protected getStoreEnv ( )

hasSelectorPlaceholder() protected method

protected hasSelectorPlaceholder ( $selector )

hueToRGB() public method

public hueToRGB ( $m1, $m2, $h )

importFile() protected method

protected importFile ( $path, $out )

isSelfExtend() protected method

protected isSelfExtend ( $target, $origin )

isTruthy() protected method

protected isTruthy ( $value )

joinSelectors() protected method

looks for & to replace, or append parent before child
protected joinSelectors ( $parent, $child )

lib_abs() protected method

protected lib_abs ( $args )

lib_adjust_color() protected method

protected lib_adjust_color ( $args )

lib_adjust_hue() protected method

protected lib_adjust_hue ( $args )

lib_alpha() protected method

protected lib_alpha ( $args )

lib_append() protected method

protected lib_append ( $args )

lib_blue() protected method

protected lib_blue ( $args )

lib_ceil() protected method

protected lib_ceil ( $args )

lib_change_color() protected method

protected lib_change_color ( $args )

lib_comparable() protected method

protected lib_comparable ( $args )

lib_complement() protected method

protected lib_complement ( $args )

lib_counter() protected method

Workaround IE7's content counter bug.
protected lib_counter ( array $args )
$args array

lib_darken() protected method

protected lib_darken ( $args )

lib_desaturate() protected method

protected lib_desaturate ( $args )

lib_fade_in() protected method

protected lib_fade_in ( $args )

lib_fade_out() protected method

protected lib_fade_out ( $args )

lib_floor() protected method

protected lib_floor ( $args )

lib_grayscale() protected method

protected lib_grayscale ( $args )

lib_green() protected method

protected lib_green ( $args )

lib_hsl() protected method

protected lib_hsl ( $args )

lib_hsla() protected method

protected lib_hsla ( $args )

lib_hue() protected method

protected lib_hue ( $args )

lib_ie_hex_str() protected method

protected lib_ie_hex_str ( $args )

lib_if() protected method

protected lib_if ( $args )

lib_index() protected method

protected lib_index ( $args )

lib_invert() protected method

protected lib_invert ( $args )

lib_join() protected method

protected lib_join ( $args )

lib_length() protected method

protected lib_length ( $args )

lib_lighten() protected method

protected lib_lighten ( $args )

lib_lightness() protected method

protected lib_lightness ( $args )

lib_max() protected method

protected lib_max ( $args )

lib_min() protected method

protected lib_min ( $args )

lib_mix() protected method

protected lib_mix ( $args )

lib_nth() protected method

protected lib_nth ( $args )

lib_opacify() protected method

protected lib_opacify ( $args )

lib_opacity() protected method

protected lib_opacity ( $args )

lib_percentage() protected method

protected lib_percentage ( $args )

lib_quote() protected method

protected lib_quote ( $args )

lib_red() protected method

protected lib_red ( $args )

lib_rgb() protected method

protected lib_rgb ( $args )

lib_rgba() protected method

protected lib_rgba ( $args )

lib_round() protected method

protected lib_round ( $args )

lib_saturate() protected method

protected lib_saturate ( $args )

lib_saturation() protected method

protected lib_saturation ( $args )

lib_scale_color() protected method

protected lib_scale_color ( $args )

lib_transparentize() protected method

protected lib_transparentize ( $args )

lib_type_of() protected method

protected lib_type_of ( $args )

lib_unit() protected method

protected lib_unit ( $args )

lib_unitless() protected method

protected lib_unitless ( $args )

lib_unquote() protected method

protected lib_unquote ( $args )

lib_zip() protected method

protected lib_zip ( $args )

listSeparatorForJoin() protected method

protected listSeparatorForJoin ( $list1, $sep )

makeOutputBlock() protected method

protected makeOutputBlock ( $type, $selectors = null )

matchExtends() protected method

protected matchExtends ( $selector, &$out, $from, $initial = true )

matchExtendsSingle() protected method

protected matchExtendsSingle ( $single, &$outOrigin )

mediaParent() protected method

protected mediaParent ( $scope )

multiplyMedia() protected method

protected multiplyMedia ( $env, $childQueries = null )

multiplySelectors() protected method

find the final set of selectors
protected multiplySelectors ( $env )

normalizeName() protected method

protected normalizeName ( $name )

normalizeNumber() protected method

just does physical lengths for now
protected normalizeNumber ( $number )

normalizeValue() public method

public normalizeValue ( $value )

op_add() protected method

adding strings
protected op_add ( $left, $right )

op_add_number_number() protected method

protected op_add_number_number ( $left, $right )

op_and() protected method

protected op_and ( $left, $right, $shouldEval )

op_color_color() protected method

protected op_color_color ( $op, $left, $right )

op_color_number() protected method

protected op_color_number ( $op, $left, $right )

op_div_number_number() protected method

protected op_div_number_number ( $left, $right )

op_eq() protected method

protected op_eq ( $left, $right )

op_gt_number_number() protected method

protected op_gt_number_number ( $left, $right )

op_gte_number_number() protected method

protected op_gte_number_number ( $left, $right )

op_lt_number_number() protected method

protected op_lt_number_number ( $left, $right )

op_lte_number_number() protected method

protected op_lte_number_number ( $left, $right )

op_mod_number_number() protected method

protected op_mod_number_number ( $left, $right )

op_mul_number_number() protected method

protected op_mul_number_number ( $left, $right )

op_neq() protected method

protected op_neq ( $left, $right )

op_number_color() protected method

protected op_number_color ( $op, $left, $right )

op_or() protected method

protected op_or ( $left, $right, $shouldEval )

op_sub_number_number() protected method

protected op_sub_number_number ( $left, $right )

popEnv() protected method

protected popEnv ( )

pushEnv() protected method

protected pushEnv ( $block = null )

pushExtends() protected method

protected pushExtends ( $target, $origin )

reduce() protected method

protected reduce ( $value, $inExp = false )

registerFunction() public method

public registerFunction ( $name, $func )

scale_color_helper() protected method

protected scale_color_helper ( $base, $scale, $i )

set() protected method

protected set ( $name, $value, $shadow = false )

setExisting() protected method

protected setExisting ( $name, $value, $env = null )

setFormatter() public method

public setFormatter ( $formatterName )

setImportPaths() public method

public setImportPaths ( $path )

setNumberPrecision() public method

public setNumberPrecision ( $numberPrecision )

setRaw() protected method

protected setRaw ( $name, $value )

shouldEval() protected method

should $value cause its operand to eval
protected shouldEval ( $value )

sortArgs() protected method

TODO: merge with apply arguments
protected sortArgs ( $prototype, $args )

throwError() public method

public throwError ( $msg = null )

toBool() public method

public toBool ( $thing )

toHSL() public method

public toHSL ( $red, $green, $blue )

toRGB() public method

H from 0 to 360, S and L from 0 to 100
public toRGB ( $hue, $saturation, $lightness )

unregisterFunction() public method

public unregisterFunction ( $name )

Property Details

$VERSION public static property

public static $VERSION

$cssColors protected static property

CSS Colors
See also: http://www.w3.org/TR/css3-color
protected static $cssColors

$defaultValue public static property

public static $defaultValue

$false public static property

public static $false

$formatter protected property

protected $formatter

$importCache protected property

protected $importCache

$importPaths protected property

protected $importPaths

$lib_abs protected static property

protected static $lib_abs

$lib_adjust_color protected static property

protected static $lib_adjust_color

$lib_adjust_hue protected static property

protected static $lib_adjust_hue

$lib_alpha protected static property

protected static $lib_alpha

$lib_append protected static property

protected static $lib_append

$lib_blue protected static property

protected static $lib_blue

$lib_ceil protected static property

protected static $lib_ceil

$lib_change_color protected static property

protected static $lib_change_color

$lib_comparable protected static property

protected static $lib_comparable

$lib_complement protected static property

protected static $lib_complement

$lib_darken protected static property

protected static $lib_darken

$lib_desaturate protected static property

protected static $lib_desaturate

$lib_fade_in protected static property

protected static $lib_fade_in

$lib_fade_out protected static property

protected static $lib_fade_out

$lib_floor protected static property

protected static $lib_floor

$lib_grayscale protected static property

protected static $lib_grayscale

$lib_green protected static property

protected static $lib_green

$lib_hsl protected static property

protected static $lib_hsl

$lib_hsla protected static property

protected static $lib_hsla

$lib_hue protected static property

protected static $lib_hue

$lib_ie_hex_str protected static property

protected static $lib_ie_hex_str

$lib_if protected static property

Built in functions
protected static $lib_if

$lib_index protected static property

protected static $lib_index

$lib_invert protected static property

protected static $lib_invert

$lib_join protected static property

protected static $lib_join

$lib_length protected static property

protected static $lib_length

$lib_lighten protected static property

protected static $lib_lighten

$lib_lightness protected static property

protected static $lib_lightness

$lib_mix protected static property

mix two colors
protected static $lib_mix

$lib_nth protected static property

protected static $lib_nth

$lib_opacify protected static property

increases opacity by amount
protected static $lib_opacify

$lib_opacity protected static property

protected static $lib_opacity

$lib_percentage protected static property

protected static $lib_percentage

$lib_quote protected static property

protected static $lib_quote

$lib_red protected static property

protected static $lib_red

$lib_rgb protected static property

protected static $lib_rgb

$lib_rgba protected static property

protected static $lib_rgba

$lib_round protected static property

protected static $lib_round

$lib_saturate protected static property

protected static $lib_saturate

$lib_saturation protected static property

protected static $lib_saturation

$lib_scale_color protected static property

protected static $lib_scale_color

$lib_transparentize protected static property

decreases opacity by amount
protected static $lib_transparentize

$lib_type_of protected static property

protected static $lib_type_of

$lib_unit protected static property

protected static $lib_unit

$lib_unitless protected static property

protected static $lib_unitless

$lib_unquote protected static property

protected static $lib_unquote

$namespaces protected static property

protected static $namespaces

$null public static property

public static $null

$numberPrecision protected property

protected $numberPrecision

$operatorNames protected static property

protected static $operatorNames

$selfSelector public static property

public static $selfSelector

$true public static property

public static $true

$unitTable protected static property

protected static $unitTable

$userFunctions protected property

protected $userFunctions