--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
2
node_modules/rtlcss/.gitattributes
generated
vendored
Normal file
2
node_modules/rtlcss/.gitattributes
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bin/rtlcss.js text eol=lf
|
||||
test/css/*.css css eol=lf
|
||||
17
node_modules/rtlcss/.npmignore
generated
vendored
Normal file
17
node_modules/rtlcss/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
||||
|
||||
.vscode
|
||||
13
node_modules/rtlcss/.rtlcssrc
generated
vendored
Normal file
13
node_modules/rtlcss/.rtlcssrc
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"options": {
|
||||
"autoRename": false,
|
||||
"autoRenameStrict": false,
|
||||
"blacklist":{},
|
||||
"clean": true,
|
||||
"greedy": false,
|
||||
"processUrls": false,
|
||||
"stringMap":[]
|
||||
},
|
||||
"plugins": [ ],
|
||||
"map": false
|
||||
}
|
||||
5
node_modules/rtlcss/.travis.yml
generated
vendored
Normal file
5
node_modules/rtlcss/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "5"
|
||||
- "4"
|
||||
191
node_modules/rtlcss/CHANGELOG.md
generated
vendored
Normal file
191
node_modules/rtlcss/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
## 2.1.2 - 31 Dec. 2016
|
||||
* Internal code update.
|
||||
|
||||
## 2.1.1 - 28 Dec. 2016
|
||||
* Fixes a bug in self closing ignore directive (Fixes [#88](https://github.com/MohammadYounes/rtlcss/issues/88)).
|
||||
|
||||
## 2.1.0 - 30 Nov. 2016
|
||||
* Support CSS `background-position` edge offsets.
|
||||
|
||||
### 2.0.7 - 16 Nov. 2016
|
||||
* Fixes a bug in flipping backgrounds having url placed first (Fixes [#84](https://github.com/MohammadYounes/rtlcss/issues/84)).
|
||||
* Update `node.value` so changes will be picked up by other processors (Closes [#85](https://github.com/MohammadYounes/rtlcss/issues/85)).
|
||||
|
||||
### 2.0.6 - 12 Jul. 2016
|
||||
* README updates.
|
||||
|
||||
### 2.0.5 - 17 May. 2016
|
||||
* Fixes a bug in complementing calc values (Fixes [#71](https://github.com/MohammadYounes/rtlcss/issues/71)).
|
||||
|
||||
### 2.0.4 - 25 Apr. 2016
|
||||
* Fixes a bug in flipping cursor value (Fixes [#68](https://github.com/MohammadYounes/rtlcss/issues/68)).
|
||||
|
||||
### 2.0.3 - 23 Mar. 2016
|
||||
* Guard against flipping tokens, e.g: [shadows starting with a color function](https://github.com/MohammadYounes/rtlcss/blob/master/test/data/special.js#L2-L7).
|
||||
|
||||
### 2.0.2 - 05 Mar. 2016
|
||||
* Fixes a bug in flipping background with a hex color value (Fixes [#60](https://github.com/MohammadYounes/rtlcss/issues/60)).
|
||||
|
||||
### 2.0.1 - 23 Feb. 2016
|
||||
* Fixes a bug when having `decl` nodes inside `atrule`s and `autoRename` enabled.
|
||||
* Fixes a bug in flipping multi-valued transforms.
|
||||
|
||||
# 2.0.0 - 18 Feb. 2016
|
||||
|
||||
* Support for control directive blocks, e.g. `/*rtl:begin:ignore*/ ... /*rtl:end:ignore*/`.
|
||||
* Suppor for strict auto renaming, Which ensures `autoRename` is applied only when a pair exists.
|
||||
* New directives:
|
||||
* `config`
|
||||
* `options`
|
||||
* `raw`
|
||||
* `remove`
|
||||
* Support for [Plugins](docs/writing-a-plugin.md).
|
||||
|
||||
#### Upgrading from version 1.0
|
||||
|
||||
Options and config settings have changed. However, you need not to worry about your CSS files as all directives are backward-compatible. This is a summary of what's changed:
|
||||
|
||||
* New Options:
|
||||
* `autoRenameStrict` (default: `false`) to apply auto rename only when a pair exists.
|
||||
* `blacklist` to prevent execution of certian directives.
|
||||
* `clean` (default: `true`), to remove directives from output CSS.
|
||||
* `processUrls` (default: `false`) to control URL updates. You can also target specific node types using an object literal. e.g. `{'atrule': true, 'decl': false}`.
|
||||
|
||||
* Updated Options:
|
||||
* `autoRename` new default is `false`.
|
||||
* `stringMap`:
|
||||
* added `priority` attribute to control maps execution order.
|
||||
* added `exclusive` attribute, which determines if a map execution should stop iterating over other maps.
|
||||
* dropped 'west-east' map from the default map collection.
|
||||
|
||||
* Removed Options:
|
||||
* `enableLogging`, still warnings and errors are reported directly to postcss.
|
||||
* `minify`, it wasn't actual minification after all!
|
||||
* `swapLeftRightInUrl`, `swapLtrRtlInUrl` and `swapWestEastInUrl` in favor of `processUrls` option.
|
||||
* `preserveComments`, comments inside declaration values will always be preserved.
|
||||
* `preserveDirectives`, in favor of `clean` option.
|
||||
|
||||
* Constructor arguments `rules`, `declarations` and `properties` are now replaced with `plugins`.
|
||||
|
||||
### v1.7.4 - 23 Feb. 2016
|
||||
* Fixes a bug in flipping multiple transforms.
|
||||
|
||||
### v1.7.3 - 30 Jan. 2016
|
||||
* Fixes a bug in flipping N-Values containing comments.
|
||||
|
||||
### 1.7.2 - 30 Jan. 2016
|
||||
* Fixes a bug in flipping N-Values containing comments.
|
||||
|
||||
### 1.7.2 - 04 Dec. 2015
|
||||
* Fixes a compatibility issue with postcss-js (Fixes [#48](https://github.com/MohammadYounes/rtlcss/issues/48)).
|
||||
|
||||
### 1.7.1 - 10 Nov. 2015
|
||||
* Fixed a bug in flipping backgrounds having functions (Issue [#45](https://github.com/MohammadYounes/rtlcss/issues/45)).
|
||||
|
||||
## 1.7.0 - 19 Sep. 2015
|
||||
* Add `calc` support.
|
||||
* Mark rule as flipped when values are updated by decl. directives.
|
||||
* Allow further processing for rules that uses `rename` directive.
|
||||
|
||||
### 1.6.3 - 28 Aug. 2015
|
||||
* CLI: fix source map option (issue #40).
|
||||
* Upgrade to [POSTCSS] v5.0.x
|
||||
|
||||
### 1.6.2 - 21 Jul. 2015
|
||||
* CLI: fix loading custom configuration file manually via the --config flag. **Thanks @KeyKaKiTO**
|
||||
|
||||
### 1.6.1 - 17 Mar. 2015
|
||||
* Fixed flipping units having more than 1 digit before the decimal point.
|
||||
|
||||
## 1.6.0 - 15 Mar. 2015
|
||||
* Support flipping `matrix3d` transform.
|
||||
|
||||
### 1.5.2 - 28 Feb. 2015
|
||||
* Fix flipping string maps containing regular expressions special characters (Fixes [#24](https://github.com/MohammadYounes/rtlcss/issues/24)).
|
||||
|
||||
### 1.5.1 - 14 Feb. 2015
|
||||
* Fix flipping multiple shadows when a hex color was used. **Thanks @ocean90**
|
||||
|
||||
## 1.5.0 - 30 Jan. 2015
|
||||
* CLI: New option `-e,--ext` to set output files extension when processing a directory.
|
||||
|
||||
### 1.4.3 - 24 Jan. 2015
|
||||
* Upgrade to [POSTCSS] v4.0.x **Thanks @necolas**
|
||||
|
||||
### 1.4.2 - 24 Oct. 2014
|
||||
* CLI: Switch to Unix line endings (Fixes [#14](https://github.com/MohammadYounes/rtlcss/issues/14))
|
||||
|
||||
### 1.4.1 - 24 Oct. 2014
|
||||
* CLI: Print processing errors.
|
||||
|
||||
## 1.4.0 - 10 Oct. 2014
|
||||
* CLI: Support processing a directory. see [CLI documentation](https://github.com/MohammadYounes/rtlcss/blob/master/CLI.md#directory)
|
||||
|
||||
### 1.3.1 - 29 Sep. 2014
|
||||
* Update README.md (typos).
|
||||
|
||||
## 1.3.0 - 28 Sep. 2014
|
||||
* New feature - String Maps. Add your own set of swappable strings, for example (prev/next).
|
||||
* Preserves lowercase, UPPERCASE and Capitalization when swapping ***left***, ***right***, ***ltr***, ***rtl***, ***west*** and ***east***.
|
||||
|
||||
## 1.2.0 - 26 Sep. 2014
|
||||
* Support !important comments for directives (enables flipping minified stylesheets).
|
||||
|
||||
## 1.1.0 - 26 Sep. 2014
|
||||
* Upgrade to [POSTCSS] v2.2.5
|
||||
* Support flipping `border-color`, `border-style` and `background-position-x`
|
||||
|
||||
# 1.0.0 - 24 Aug. 2014
|
||||
* Upgrade to [POSTCSS] v2.2.1
|
||||
* Support flipping urls in '@import' rule.
|
||||
* Fix JSON parse error when configuration file is UTF-8 encoded.
|
||||
* Better minification.
|
||||
|
||||
## 0.9.0 - 10 Aug. 2014
|
||||
* New configuration loader.
|
||||
* CLI configuration can be set using one of the following methods:
|
||||
* Specify the configuration file manually via the --config flag.
|
||||
* Put your config into your projects package.json file under the `rtlcssConfig` property
|
||||
* Use a special file `.rtlcssrc` or `.rtlcssrc.json`
|
||||
|
||||
## 0.8.0 - 8 Aug. 2014
|
||||
* Fix source map generation.
|
||||
|
||||
## 0.7.0 - 4 Jul. 2014
|
||||
* Fix flipping linear-gradient.
|
||||
|
||||
## 0.6.0 - 4 Jul. 2014
|
||||
* Allow additional comments inside `ignore`/`rename` rule level directives.
|
||||
|
||||
## 0.5.0 - 11 Jun. 2014
|
||||
* Add CLI support.
|
||||
|
||||
## 0.4.0 - 5 Apr. 2014
|
||||
* Fix flipping transform-origin.
|
||||
* Update autoRename to search for all swappable words.
|
||||
|
||||
## 0.3.0 - 5 Apr. 2014
|
||||
* Support flipping rotateZ.
|
||||
* Fix flipping rotate3d.
|
||||
* Fix flipping skew, skewX and skewY.
|
||||
* Fix flipping cursor value.
|
||||
* Fix flipping translate3d.
|
||||
* Update flipping background horizontal position to treat 0 as 0%
|
||||
|
||||
### 0.2.1 - 20 Mar. 2014
|
||||
* Upgrade to [POSTCSS] v0.3.4
|
||||
|
||||
## 0.2.0 - 20 Mar. 2014
|
||||
* Support combining with other processors.
|
||||
* Support rad, grad & turn angle units when flipping linear-gradient
|
||||
* Fix typo in config.js
|
||||
|
||||
### 0.1.3 - 7 Mar. 2014
|
||||
* Fix missing include in rules.js
|
||||
|
||||
### 0.1.2 - 5 Mar. 2014
|
||||
* New option: minify output CSS.
|
||||
* Updated README.md
|
||||
|
||||
### 0.1.1 - 4 Mar. 2014
|
||||
* Initial commit.
|
||||
21
node_modules/rtlcss/LICENSE
generated
vendored
Normal file
21
node_modules/rtlcss/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016 Mohammad Younes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
39
node_modules/rtlcss/README.md
generated
vendored
Normal file
39
node_modules/rtlcss/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# RTLCSS
|
||||
|
||||
[](https://gitter.im/MohammadYounes/rtlcss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
<img style="margin:15px" title="RTL CSS" src="https://cloud.githubusercontent.com/assets/4712046/5889219/190f366a-a425-11e4-8ef5-8b5f60a9e903.png" align="right"/>
|
||||
|
||||
[](http://badge.fury.io/gh/MohammadYounes%2Frtlcss)
|
||||
[](http://badge.fury.io/js/rtlcss)
|
||||
[](https://travis-ci.org/MohammadYounes/rtlcss)
|
||||
[](https://david-dm.org/MohammadYounes/rtlcss)
|
||||
|
||||
[](http://standardjs.com/)
|
||||
[](https://code.visualstudio.com/)
|
||||
[](https://twitter.com/rtlcss)
|
||||
|
||||
RTLCSS is a framework for converting Left-To-Right (LTR) Cascading Style Sheets(CSS) to Right-To-Left (RTL).
|
||||
|
||||
## Documentation
|
||||
|
||||
Visit http://rtlcss.com/learn
|
||||
|
||||
## Playground
|
||||
|
||||
Visit http://rtlcss.com/playground
|
||||
|
||||
## Bugs and Issues
|
||||
|
||||
Have a bug or a feature request? please feel free to [open a new issue](https://github.com/MohammadYounes/rtlcss/issues/new) .
|
||||
|
||||
## Release Notes
|
||||
|
||||
To view changes in recent versions, see the [CHANGELOG](CHANGELOG.md).
|
||||
|
||||
## Support RTLCSS Development
|
||||
|
||||
Submit a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YC28CZLKL4LMC) :)
|
||||
|
||||
> If you get a message that I can't accept funds right now or I need to setup my account or something! You can send the donation directly to the email address mentioned in the donations page.
|
||||
|
||||
274
node_modules/rtlcss/bin/rtlcss.js
generated
vendored
Executable file
274
node_modules/rtlcss/bin/rtlcss.js
generated
vendored
Executable file
|
|
@ -0,0 +1,274 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var sys = require('util')
|
||||
var chalk = require('chalk')
|
||||
var mkdirp = require('mkdirp')
|
||||
var postcss = require('postcss')
|
||||
var rtlcss = require('../lib/rtlcss')
|
||||
var configLoader = require('../lib/config-loader')
|
||||
|
||||
var input, output, directory, ext, config, currentErrorcode, arg
|
||||
var args = process.argv.slice(2)
|
||||
var shouldBreak = false
|
||||
|
||||
process.on('exit', function () { process.reallyExit(currentErrorcode) })
|
||||
|
||||
function printWarning () {
|
||||
console.warn(chalk.yellow.apply(this, printWarning.arguments))
|
||||
}
|
||||
|
||||
function printInfo () {
|
||||
console.info(chalk.green.apply(this, printInfo.arguments))
|
||||
}
|
||||
|
||||
function printError () {
|
||||
console.error(chalk.red.apply(this, printError.arguments))
|
||||
}
|
||||
|
||||
function printHelp () {
|
||||
console.log('Usage: rtlcss [option option=parameter ...] [source] [destination]')
|
||||
console.log('')
|
||||
/*eslint-disable*/
|
||||
var options = [
|
||||
'Option ' , 'Description ',
|
||||
'--------------', '----------------------------------------------',
|
||||
'-h,--help' , 'Print help (this message) and exit.',
|
||||
'-v,--version' , 'Print version number and exit.',
|
||||
'-c,--config' , 'Path to configuration settings file.',
|
||||
'- ,--stdin' , 'Read from stdin stream.',
|
||||
'-d,--dirctory' , 'Process all *.css files from input directory (recursive).',
|
||||
'-e,--ext' , 'Used with -d option to set the output files extension.\n\t\t Default: ".rtl.css".',
|
||||
'-s,--silent' , 'Silent mode, no warnings or errors are printed.'
|
||||
]
|
||||
/*eslint-enable */
|
||||
for (var x = 0; x < options.length; x++) {
|
||||
console.log(options[x++], '\t', options[x])
|
||||
}
|
||||
console.log('')
|
||||
console.log('*If no destination is specified, output will be written to the same input folder as {source}.rtl.{ext}')
|
||||
console.log('')
|
||||
printInfo('RTLCSS version: ' + require('../package.json').version)
|
||||
printInfo('Report issues to: https://github.com/MohammadYounes/rtlcss/issues')
|
||||
}
|
||||
while ((arg = args.shift())) {
|
||||
switch (arg) {
|
||||
case '-h':
|
||||
case '--help':
|
||||
printHelp()
|
||||
shouldBreak = true
|
||||
break
|
||||
case '-v':
|
||||
case '--version':
|
||||
printInfo('rtlcss version: ' + require('../package.json').version)
|
||||
shouldBreak = true
|
||||
break
|
||||
case '-c':
|
||||
case '--config':
|
||||
arg = args.shift()
|
||||
try {
|
||||
config = configLoader.load(path.resolve(arg))
|
||||
} catch (e) {
|
||||
printError('rtlcss: invalid config file. ', e)
|
||||
shouldBreak = true
|
||||
currentErrorcode = 1
|
||||
}
|
||||
break
|
||||
case '-d':
|
||||
case '--directory':
|
||||
directory = true
|
||||
break
|
||||
case '-e':
|
||||
case '--ext':
|
||||
ext = args.shift()
|
||||
break
|
||||
case '-s':
|
||||
case '--silent':
|
||||
console.log = console.info = console.warn = function () {}
|
||||
break
|
||||
case '-':
|
||||
case '--stdin':
|
||||
input = '-'
|
||||
break
|
||||
default:
|
||||
if (arg[0] === '-') {
|
||||
printError('rtlcss: unknown option. ' + arg)
|
||||
shouldBreak = true
|
||||
} else {
|
||||
if (!input) {
|
||||
input = path.resolve(arg)
|
||||
} else if (!output) {
|
||||
output = path.resolve(arg)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!shouldBreak) {
|
||||
if (!directory && !input) {
|
||||
printError('rtlcss: no input file')
|
||||
console.log('')
|
||||
printHelp()
|
||||
shouldBreak = true
|
||||
}
|
||||
if (!config && input !== '-') {
|
||||
try {
|
||||
var cwd = input
|
||||
if (directory !== true) {
|
||||
cwd = path.dirname(input)
|
||||
}
|
||||
config = configLoader.load(null, cwd)
|
||||
} catch (e) {
|
||||
printError('rtlcss: invalid config file. ', e)
|
||||
currentErrorcode = 1
|
||||
shouldBreak = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!shouldBreak) {
|
||||
if (!output && input !== '-') {
|
||||
if (directory !== true) {
|
||||
output = path.extname(input) ? input.replace(/\.[^.]*$/, function (ext) { return '.rtl' + ext }) : input + '.rtl'
|
||||
} else {
|
||||
output = input
|
||||
}
|
||||
}
|
||||
|
||||
var processCSSFile = function (e, data, outputName) {
|
||||
if (e) {
|
||||
printError('rtlcss: ' + e.message)
|
||||
return
|
||||
}
|
||||
var result
|
||||
var opt = { map: false }
|
||||
if (input !== '-') {
|
||||
opt.from = input
|
||||
opt.to = output
|
||||
}
|
||||
if (!config) {
|
||||
printWarning('rtlcss: Warning! No config present, using defaults.')
|
||||
result = postcss([rtlcss]).process(data, opt)
|
||||
} else {
|
||||
if ('map' in config === true && input !== '-') {
|
||||
opt.map = config.map
|
||||
}
|
||||
result = postcss([rtlcss.configure(config)]).process(data, opt)
|
||||
}
|
||||
|
||||
if (output) {
|
||||
var savePath = outputName
|
||||
if (directory !== true) {
|
||||
savePath = output
|
||||
}
|
||||
printInfo('Saving:', savePath)
|
||||
fs.writeFile(savePath, result.css, 'utf8', function (err) { err && printError(err) })
|
||||
if (result.map) {
|
||||
fs.writeFile(savePath + '.map', result.map, 'utf8', function (err) { err && printError(err) })
|
||||
}
|
||||
} else {
|
||||
sys.print(result.css)
|
||||
}
|
||||
}
|
||||
|
||||
var walk = function (dir, done) {
|
||||
fs.readdir(dir, function (error, list) {
|
||||
if (error) {
|
||||
return done(error)
|
||||
}
|
||||
var i = 0
|
||||
;(function next () {
|
||||
var file = list[i++]
|
||||
if (!file) {
|
||||
return done(null)
|
||||
}
|
||||
file = dir + path.sep + file
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (err) {
|
||||
printError(err)
|
||||
} else if (stat && stat.isDirectory()) {
|
||||
walk(file, function (err) {
|
||||
if (err) {
|
||||
printError(err)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// process only *.css
|
||||
if (/\.(css)$/.test(file)) {
|
||||
// compute output directory
|
||||
var relativePath = path.relative(input, file).split(path.sep)
|
||||
relativePath.pop()
|
||||
relativePath.push(path.basename(file).replace('.css', ext || '.rtl.css'))
|
||||
|
||||
// set rtl file name
|
||||
var rtlFile = path.join(output, relativePath.join(path.sep))
|
||||
|
||||
// create output directory if it does not exist
|
||||
var dirName = path.dirname(rtlFile)
|
||||
if (!fs.existsSync(dirName)) {
|
||||
mkdirp.sync(dirName)
|
||||
}
|
||||
|
||||
// read and process the file.
|
||||
fs.readFile(file, 'utf8', function (e, data) {
|
||||
try {
|
||||
processCSSFile(e, data, rtlFile)
|
||||
} catch (e) {
|
||||
printError('rtlcss: error processing file', file)
|
||||
printError(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
next()
|
||||
}
|
||||
})
|
||||
})()
|
||||
})
|
||||
}
|
||||
|
||||
if (input !== '-') {
|
||||
if (directory !== true) {
|
||||
fs.stat(input, function (error, stat) {
|
||||
if (error) {
|
||||
printError(error)
|
||||
} else if (stat && stat.isDirectory()) {
|
||||
printError('rtlcss: Input expected to be a file, use -d option to process a directory.')
|
||||
} else {
|
||||
fs.readFile(input, 'utf8', function (e, data) {
|
||||
try {
|
||||
processCSSFile(e, data)
|
||||
} catch (e) {
|
||||
printError('rtlcss: error processing file', input)
|
||||
printError(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
walk(input, function (error) {
|
||||
if (error) {
|
||||
printError('rtlcss: ' + error)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
process.stdin.resume()
|
||||
process.stdin.setEncoding('utf8')
|
||||
|
||||
var buffer = ''
|
||||
process.stdin.on('data', function (data) {
|
||||
buffer += data
|
||||
})
|
||||
process.on('SIGINT', function () {
|
||||
processCSSFile(false, buffer)
|
||||
process.exit()
|
||||
})
|
||||
process.stdin.on('end', function () {
|
||||
processCSSFile(false, buffer)
|
||||
})
|
||||
}
|
||||
}
|
||||
10
node_modules/rtlcss/docs/CLI.md
generated
vendored
Normal file
10
node_modules/rtlcss/docs/CLI.md
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
RTLCSS CLI
|
||||
======
|
||||
|
||||
## Documentation
|
||||
|
||||
Visit http://rtlcss.com/learn/usage-guide/cli/
|
||||
|
||||
## Support RTLCSS Development
|
||||
|
||||
Submit a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YC28CZLKL4LMC) :)
|
||||
10
node_modules/rtlcss/docs/writing-a-plugin.md
generated
vendored
Normal file
10
node_modules/rtlcss/docs/writing-a-plugin.md
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Writing an RTLCSS Plugin
|
||||
=====
|
||||
|
||||
## Documentation
|
||||
|
||||
Visit http://rtlcss.com/learn/extending-rtlcss/writing-a-plugin/
|
||||
|
||||
## Support RTLCSS Development
|
||||
|
||||
Submit a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YC28CZLKL4LMC) :)
|
||||
81
node_modules/rtlcss/lib/config-loader.js
generated
vendored
Normal file
81
node_modules/rtlcss/lib/config-loader.js
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* global process */
|
||||
'use strict'
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var findup = require('findup')
|
||||
var stripJSONComments = require('strip-json-comments')
|
||||
var config = {}
|
||||
var configSources = ['package.json', '.rtlcssrc', '.rtlcss.json']
|
||||
|
||||
module.exports.load = function (configFilePath, cwd, overrides) {
|
||||
if (configFilePath) {
|
||||
return override(
|
||||
JSON.parse(
|
||||
stripJSONComments(
|
||||
fs.readFileSync(configFilePath, 'utf-8').trim())), overrides)
|
||||
}
|
||||
|
||||
var directory = cwd || process.cwd()
|
||||
config = loadConfig(directory)
|
||||
if (!config) {
|
||||
var evns = [process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOME]
|
||||
for (var x = 0; x < evns.length; x++) {
|
||||
if (!evns[x]) {
|
||||
continue
|
||||
}
|
||||
config = loadConfig(evns[x])
|
||||
if (config) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config) {
|
||||
override(config, overrides)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
function loadConfig (dir) {
|
||||
for (var x = 0; x < configSources.length; x++) {
|
||||
var found
|
||||
var source = configSources[x]
|
||||
try {
|
||||
found = findup.sync(dir, source)
|
||||
} catch (e) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (found) {
|
||||
var configFilePath = path.normalize(path.join(found, source))
|
||||
try {
|
||||
config = JSON.parse(
|
||||
stripJSONComments(
|
||||
fs.readFileSync(configFilePath, 'utf-8').trim()))
|
||||
} catch (e) {
|
||||
throw new Error(e + ' ' + configFilePath)
|
||||
}
|
||||
|
||||
if (source === 'package.json') {
|
||||
config = config.rtlcssConfig
|
||||
}
|
||||
|
||||
if (config) {
|
||||
return config
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function override (to, from) {
|
||||
if (to && from) {
|
||||
for (var p in from) {
|
||||
if (typeof to[p] === 'object') {
|
||||
override(to[p], from[p])
|
||||
} else {
|
||||
to[p] = from[p]
|
||||
}
|
||||
}
|
||||
}
|
||||
return to
|
||||
}
|
||||
74
node_modules/rtlcss/lib/config.js
generated
vendored
Normal file
74
node_modules/rtlcss/lib/config.js
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
'use strict'
|
||||
var options
|
||||
var config = {}
|
||||
var corePlugin = require('./plugin.js')
|
||||
|
||||
function optionOrDefault (option, def) {
|
||||
return option in options ? options[option] : def
|
||||
}
|
||||
|
||||
function addKey (key, def) {
|
||||
config[key] = optionOrDefault(key, def)
|
||||
}
|
||||
|
||||
function main (opts, plugins) {
|
||||
options = opts || {}
|
||||
addKey('autoRename', false)
|
||||
addKey('autoRenameStrict', false)
|
||||
addKey('blacklist', {})
|
||||
addKey('clean', true)
|
||||
addKey('greedy', false)
|
||||
addKey('processUrls', false)
|
||||
addKey('stringMap', [])
|
||||
|
||||
// default strings map
|
||||
if (Array.isArray(config.stringMap)) {
|
||||
var hasLeftRight, hasLtrRtl
|
||||
for (var x = 0; x < config.stringMap.length; x++) {
|
||||
var map = config.stringMap[x]
|
||||
if (hasLeftRight && hasLtrRtl) {
|
||||
break
|
||||
} else if (map.name === 'left-right') {
|
||||
hasLeftRight = true
|
||||
} else if (map.name === 'ltr-rtl') {
|
||||
hasLtrRtl = true
|
||||
}
|
||||
}
|
||||
if (!hasLeftRight) {
|
||||
config.stringMap.push({
|
||||
'name': 'left-right',
|
||||
'priority': 100,
|
||||
'exclusive': false,
|
||||
'search': ['left', 'Left', 'LEFT'],
|
||||
'replace': ['right', 'Right', 'RIGHT'],
|
||||
'options': { 'scope': '*', 'ignoreCase': false }
|
||||
})
|
||||
}
|
||||
if (!hasLtrRtl) {
|
||||
config.stringMap.push({
|
||||
'name': 'ltr-rtl',
|
||||
'priority': 100,
|
||||
'exclusive': false,
|
||||
'search': ['ltr', 'Ltr', 'LTR'],
|
||||
'replace': ['rtl', 'Rtl', 'RTL'],
|
||||
'options': { 'scope': '*', 'ignoreCase': false }
|
||||
})
|
||||
}
|
||||
config.stringMap.sort(function (a, b) { return a.priority - b.priority })
|
||||
}
|
||||
|
||||
// plugins
|
||||
config.plugins = []
|
||||
|
||||
if (Array.isArray(plugins)) {
|
||||
if (!plugins.some(function (plugin) { return plugin.name === 'rtlcss' })) {
|
||||
config.plugins.push(corePlugin)
|
||||
}
|
||||
config.plugins = config.plugins.concat(plugins)
|
||||
} else if (!plugins || plugins.name !== 'rtlcss') {
|
||||
config.plugins.push(corePlugin)
|
||||
}
|
||||
config.plugins.sort(function (a, b) { return a.priority - b.priority })
|
||||
return config
|
||||
}
|
||||
module.exports.configure = main
|
||||
43
node_modules/rtlcss/lib/directive-parser.js
generated
vendored
Normal file
43
node_modules/rtlcss/lib/directive-parser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
module.exports = function (comment) {
|
||||
var pos = 0
|
||||
var value = comment.text
|
||||
var prefix = value.charAt(0) === '!' ? '!rtl:' : 'rtl:'
|
||||
var meta
|
||||
|
||||
if (value.indexOf(prefix) === 0) {
|
||||
meta = {
|
||||
'source': comment,
|
||||
'name': '',
|
||||
'param': '',
|
||||
'begin': true,
|
||||
'end': true,
|
||||
'blacklist': false,
|
||||
'preserve': false
|
||||
}
|
||||
value = value.slice(prefix.length)
|
||||
pos = value.indexOf(':')
|
||||
|
||||
if (pos > -1) {
|
||||
meta.name = value.slice(0, pos)
|
||||
// begin/end are always true, unless one of them actually exists.
|
||||
meta.begin = meta.name !== 'end'
|
||||
meta.end = meta.name !== 'begin'
|
||||
if (meta.name === 'begin' || meta.name === 'end') {
|
||||
value = value.slice(meta.name.length + 1)
|
||||
pos = value.indexOf(':')
|
||||
if (pos > -1) {
|
||||
meta.name = value.slice(0, pos)
|
||||
value = value.slice(pos)
|
||||
meta.param = value.slice(1)
|
||||
} else {
|
||||
meta.name = value
|
||||
}
|
||||
} else {
|
||||
meta.param = value.slice(pos + 1)
|
||||
}
|
||||
} else {
|
||||
meta.name = value
|
||||
}
|
||||
}
|
||||
return meta
|
||||
}
|
||||
500
node_modules/rtlcss/lib/plugin.js
generated
vendored
Normal file
500
node_modules/rtlcss/lib/plugin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,500 @@
|
|||
'use strict'
|
||||
var config = require('./config.js')
|
||||
var util = require('./util.js')
|
||||
module.exports = {
|
||||
'name': 'rtlcss',
|
||||
'priority': 100,
|
||||
'directives': {
|
||||
'control': {
|
||||
'ignore': {
|
||||
'expect': { 'atrule': true, 'comment': true, 'decl': true, 'rule': true },
|
||||
'endNode': null,
|
||||
'begin': function (node, metadata, context) {
|
||||
// find the ending node in case of self closing directive
|
||||
if (!this.endNode && metadata.begin && metadata.end) {
|
||||
var n = node
|
||||
while (n && n.nodes) {
|
||||
n = n.nodes[n.nodes.length - 1]
|
||||
}
|
||||
this.endNode = n
|
||||
}
|
||||
var prevent = true
|
||||
if (node.type === 'comment' && (node.text === '!rtl:end:ignore' || node.text === 'rtl:end:ignore')) {
|
||||
prevent = false
|
||||
}
|
||||
return prevent
|
||||
},
|
||||
'end': function (node, metadata, context) {
|
||||
// end if:
|
||||
// 1. block directive and the node is comment
|
||||
// 2. self closing directive and node is endNode
|
||||
if (metadata.begin !== metadata.end && node.type === 'comment' || metadata.begin && metadata.end && node === this.endNode) {
|
||||
// clear ending node
|
||||
this.endNode = null
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
'rename': {
|
||||
'expect': {'rule': true},
|
||||
'begin': function (node, metadata, context) {
|
||||
node.selector = context.util.applyStringMap(node.selector, false)
|
||||
return false
|
||||
},
|
||||
'end': function (node, context) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
'raw': {
|
||||
'expect': {'self': true},
|
||||
'begin': function (node, metadata, context) {
|
||||
var nodes = context.postcss.parse(metadata.param)
|
||||
node.parent.insertBefore(node, nodes)
|
||||
return true
|
||||
},
|
||||
'end': function (node, context) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
'remove': {
|
||||
'expect': {'atrule': true, 'rule': true, 'decl': true},
|
||||
'begin': function (node, metadata, context) {
|
||||
var prevent = false
|
||||
switch (node.type) {
|
||||
case 'atrule':
|
||||
case 'rule':
|
||||
case 'decl':
|
||||
prevent = true
|
||||
node.remove()
|
||||
}
|
||||
return prevent
|
||||
},
|
||||
'end': function (node, metadata, context) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
'options': {
|
||||
'expect': {'self': true},
|
||||
'stack': [],
|
||||
'begin': function (node, metadata, context) {
|
||||
this.stack.push(util.extend({}, context.config))
|
||||
var options
|
||||
try {
|
||||
options = JSON.parse(metadata.param)
|
||||
} catch (e) {
|
||||
throw node.error('Invlaid options object', { 'details': e })
|
||||
}
|
||||
context.config = config.configure(options, context.config.plugins)
|
||||
context.util = util.configure(context.config)
|
||||
return true
|
||||
},
|
||||
'end': function (node, metadata, context) {
|
||||
var config = this.stack.pop()
|
||||
if (config && !metadata.begin) {
|
||||
context.config = config
|
||||
context.util = util.configure(context.config)
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
'config': {
|
||||
'expect': {'self': true},
|
||||
'expr': {
|
||||
'fn': /function([^\(]*)\(([^\(\)]*?)\)[^\{]*\{([^]*)\}/ig,
|
||||
'rx': /\/([^\/]*)\/(.*)/ig
|
||||
},
|
||||
'stack': [],
|
||||
'begin': function (node, metadata, context) {
|
||||
this.stack.push(util.extend({}, context.config))
|
||||
var configuration
|
||||
try {
|
||||
configuration = eval('(' + metadata.param + ')') // eslint-disable-line no-eval
|
||||
} catch (e) {
|
||||
throw node.error('Invlaid config object', { 'details': e })
|
||||
}
|
||||
context.config = config.configure(configuration.options, configuration.plugins)
|
||||
context.util = util.configure(context.config)
|
||||
return true
|
||||
},
|
||||
'end': function (node, metadata, context) {
|
||||
var config = this.stack.pop()
|
||||
if (config && !metadata.begin) {
|
||||
context.config = config
|
||||
context.util = util.configure(context.config)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
'value': [
|
||||
{
|
||||
'name': 'ignore',
|
||||
'action': function (decl, expr, context) {
|
||||
return true
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'prepend',
|
||||
'action': function (decl, expr, context) {
|
||||
var prefix = ''
|
||||
decl.raws.value.raw.replace(expr, function (m, v) {
|
||||
prefix += v
|
||||
})
|
||||
decl.value = decl.raws.value.raw = prefix + decl.raws.value.raw
|
||||
return true
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'append',
|
||||
'action': function (decl, expr, context) {
|
||||
decl.value = decl.raws.value.raw = decl.raws.value.raw.replace(expr, function (match, value) {
|
||||
return match + value
|
||||
})
|
||||
return true
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'insert',
|
||||
'action': function (decl, expr, context) {
|
||||
decl.value = decl.raws.value.raw = decl.raws.value.raw.replace(expr, function (match, value) {
|
||||
return value + match
|
||||
})
|
||||
return true
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': '',
|
||||
'action': function (decl, expr, context) {
|
||||
decl.raws.value.raw.replace(expr, function (match, value) {
|
||||
decl.value = decl.raws.value.raw = value + match
|
||||
})
|
||||
return true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'processors': [
|
||||
{
|
||||
'name': 'direction',
|
||||
'expr': /direction/im,
|
||||
'action': function (prop, value, context) {
|
||||
return { 'prop': prop, 'value': context.util.swapLtrRtl(value) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'left',
|
||||
'expr': /left/im,
|
||||
'action': function (prop, value, context) {
|
||||
return { 'prop': prop.replace(this.expr, function () { return 'right' }), 'value': value }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'right',
|
||||
'expr': /right/im,
|
||||
'action': function (prop, value, context) {
|
||||
return { 'prop': prop.replace(this.expr, function () { return 'left' }), 'value': value }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'four-value syntax',
|
||||
'expr': /^(margin|padding|border-(color|style|width))$/ig,
|
||||
'cache': null,
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'match': /[^\s\uFFFD]+/g
|
||||
}
|
||||
}
|
||||
var state = context.util.guardFunctions(value)
|
||||
var result = state.value.match(this.cache.match)
|
||||
if (result && result.length === 4 && (state.store.length > 0 || result[1] !== result[3])) {
|
||||
var i = 0
|
||||
state.value = state.value.replace(this.cache.match, function () {
|
||||
return result[(4 - i++) % 4]
|
||||
})
|
||||
}
|
||||
return { 'prop': prop, 'value': context.util.unguardFunctions(state) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'border radius',
|
||||
'expr': /border-radius/ig,
|
||||
'cache': null,
|
||||
'flip': function (value) {
|
||||
var parts = value.match(this.cache.match)
|
||||
var i
|
||||
if (parts) {
|
||||
switch (parts.length) {
|
||||
case 2:
|
||||
i = 1
|
||||
if (parts[0] !== parts[1]) {
|
||||
value = value.replace(this.cache.match, function () {
|
||||
return parts[i--]
|
||||
})
|
||||
}
|
||||
break
|
||||
case 3:
|
||||
// preserve leading whitespace.
|
||||
value = value.replace(this.cache.white, function (m) {
|
||||
return m + parts[1] + ' '
|
||||
})
|
||||
break
|
||||
case 4:
|
||||
i = 0
|
||||
if (parts[0] !== parts[1] || parts[2] !== parts[3]) {
|
||||
value = value.replace(this.cache.match, function () {
|
||||
return parts[(5 - i++) % 4]
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return value
|
||||
},
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'match': /[^\s\uFFFD]+/g,
|
||||
'slash': /[^\/]+/g,
|
||||
'white': /(^\s*)/
|
||||
}
|
||||
}
|
||||
var state = context.util.guardFunctions(value)
|
||||
state.value = state.value.replace(this.cache.slash, function (m) {
|
||||
return this.flip(m)
|
||||
}.bind(this))
|
||||
return { 'prop': prop, 'value': context.util.unguardFunctions(state) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'shadow',
|
||||
'expr': /shadow/ig,
|
||||
'cache': null,
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'replace': /[^,]+/g
|
||||
}
|
||||
}
|
||||
var colorSafe = context.util.guardHexColors(value)
|
||||
var funcSafe = context.util.guardFunctions(colorSafe.value)
|
||||
funcSafe.value = funcSafe.value.replace(this.cache.replace, function (m) { return context.util.negate(m) })
|
||||
colorSafe.value = context.util.unguardFunctions(funcSafe)
|
||||
return { 'prop': prop, 'value': context.util.unguardHexColors(colorSafe) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'transform origin',
|
||||
'expr': /transform-origin/ig,
|
||||
'cache': null,
|
||||
'flip': function (value, context) {
|
||||
if (value === '0') {
|
||||
value = '100%'
|
||||
} else if (value.match(this.cache.percent)) {
|
||||
value = context.util.complement(value)
|
||||
}
|
||||
return value
|
||||
},
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'match': context.util.regex(['calc', 'percent', 'length'], 'g'),
|
||||
'percent': context.util.regex(['calc', 'percent'], 'i'),
|
||||
'xKeyword': /(left|right)/i
|
||||
}
|
||||
}
|
||||
if (value.match(this.cache.xKeyword)) {
|
||||
value = context.util.swapLeftRight(value)
|
||||
} else {
|
||||
var state = context.util.guardFunctions(value)
|
||||
var parts = state.value.match(this.cache.match)
|
||||
if (parts && parts.length > 0) {
|
||||
parts[0] = this.flip(parts[0], context)
|
||||
state.value = state.value.replace(this.cache.match, function () { return parts.shift() })
|
||||
value = context.util.unguardFunctions(state)
|
||||
}
|
||||
}
|
||||
return { 'prop': prop, 'value': value }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'transform',
|
||||
'expr': /^(?!text\-).*?transform$/ig,
|
||||
'cache': null,
|
||||
'flip': function (value, process, context) {
|
||||
var i = 0
|
||||
return value.replace(this.cache.unit, function (num) {
|
||||
return process(++i, num)
|
||||
})
|
||||
},
|
||||
'flipMatrix': function (value, context) {
|
||||
return this.flip(value, function (i, num) {
|
||||
if (i === 2 || i === 3 || i === 5) {
|
||||
return context.util.negate(num)
|
||||
}
|
||||
return num
|
||||
}, context)
|
||||
},
|
||||
'flipMatrix3D': function (value, context) {
|
||||
return this.flip(value, function (i, num) {
|
||||
if (i === 2 || i === 4 || i === 5 || i === 13) {
|
||||
return context.util.negate(num)
|
||||
}
|
||||
return num
|
||||
}, context)
|
||||
},
|
||||
'flipRotate3D': function (value, context) {
|
||||
return this.flip(value, function (i, num) {
|
||||
if (i === 2 || i === 4) {
|
||||
return context.util.negate(num)
|
||||
}
|
||||
return num
|
||||
}, context)
|
||||
},
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'negatable': /((translate)(x|3d)?|rotate(z)?)$/ig,
|
||||
'unit': context.util.regex(['calc', 'number'], 'g'),
|
||||
'matrix': /matrix$/i,
|
||||
'matrix3D': /matrix3d$/i,
|
||||
'skewXY': /skew(x|y)?$/i,
|
||||
'rotate3D': /rotate3d$/i
|
||||
}
|
||||
}
|
||||
var state = context.util.guardFunctions(value)
|
||||
return {
|
||||
'prop': prop,
|
||||
'value': context.util.unguardFunctions(state, function (v, n) {
|
||||
if (n.length) {
|
||||
if (n.match(this.cache.matrix3D)) {
|
||||
v = this.flipMatrix3D(v, context)
|
||||
} else if (n.match(this.cache.matrix)) {
|
||||
v = this.flipMatrix(v, context)
|
||||
} else if (n.match(this.cache.rotate3D)) {
|
||||
v = this.flipRotate3D(v, context)
|
||||
} else if (n.match(this.cache.skewXY)) {
|
||||
v = context.util.negateAll(v)
|
||||
} else if (n.match(this.cache.negatable)) {
|
||||
v = context.util.negate(v)
|
||||
}
|
||||
}
|
||||
return v
|
||||
}.bind(this))
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'transition',
|
||||
'expr': /transition(-property)?$/i,
|
||||
'action': function (prop, value, context) {
|
||||
return { 'prop': prop, 'value': context.util.swapLeftRight(value) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'background',
|
||||
'expr': /background(-position(-x)?|-image)?$/i,
|
||||
'cache': null,
|
||||
'flip': function (value, context, isPosition) {
|
||||
var state = util.saveTokens(value, true)
|
||||
var parts = state.value.match(this.cache.match)
|
||||
if (parts && parts.length > 0) {
|
||||
if (isPosition && parts.length >= 3) {
|
||||
state.value = util.swapLeftRight(state.value)
|
||||
} else {
|
||||
parts[0] = parts[0] === '0'
|
||||
? '100%'
|
||||
: (parts[0].match(this.cache.percent)
|
||||
? context.util.complement(parts[0])
|
||||
: context.util.swapLeftRight(parts[0]))
|
||||
state.value = state.value.replace(this.cache.match, function () { return parts.shift() })
|
||||
}
|
||||
}
|
||||
return util.restoreTokens(state)
|
||||
},
|
||||
'update': function (context, value, name) {
|
||||
if (name.match(this.cache.gradient)) {
|
||||
value = context.util.swapLeftRight(value)
|
||||
if (value.match(this.cache.angle)) {
|
||||
value = context.util.negate(value)
|
||||
}
|
||||
} else if (context.config.processUrls === true || context.config.processUrls.decl === true && name.match(this.cache.url)) {
|
||||
value = context.util.applyStringMap(value, true)
|
||||
}
|
||||
return value
|
||||
},
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'match': context.util.regex(['position', 'percent', 'length', 'calc'], 'ig'),
|
||||
'percent': context.util.regex(['calc', 'percent'], 'i'),
|
||||
'gradient': /gradient$/i,
|
||||
'angle': /\d+(deg|g?rad|turn)/i,
|
||||
'url': /^url/i
|
||||
}
|
||||
}
|
||||
var colorSafe = context.util.guardHexColors(value)
|
||||
var funcSafe = context.util.guardFunctions(colorSafe.value)
|
||||
var parts = funcSafe.value.split(',')
|
||||
var lprop = prop.toLowerCase()
|
||||
if (lprop !== 'background-image') {
|
||||
var isPosition = lprop === 'background-position'
|
||||
for (var x = 0; x < parts.length; x++) {
|
||||
parts[x] = this.flip(parts[x], context, isPosition)
|
||||
}
|
||||
}
|
||||
funcSafe.value = parts.join(',')
|
||||
colorSafe.value = context.util.unguardFunctions(funcSafe, this.update.bind(this, context))
|
||||
return {
|
||||
'prop': prop,
|
||||
'value': context.util.unguardHexColors(colorSafe)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'keyword',
|
||||
'expr': /float|clear|text-align/i,
|
||||
'action': function (prop, value, context) {
|
||||
return { 'prop': prop, 'value': context.util.swapLeftRight(value) }
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'cursor',
|
||||
'expr': /cursor/i,
|
||||
'cache': null,
|
||||
'update': function (context, value, name) {
|
||||
if (context.config.processUrls === true || context.config.processUrls.decl === true && name.match(this.cache.url)) {
|
||||
value = context.util.applyStringMap(value, true)
|
||||
}
|
||||
return value
|
||||
},
|
||||
'flip': function (value) {
|
||||
return value.replace(this.cache.replace, function (s, m) {
|
||||
return s.replace(m, m.replace(this.cache.e, '*').replace(this.cache.w, 'e').replace(this.cache.star, 'w'))
|
||||
}.bind(this))
|
||||
},
|
||||
'action': function (prop, value, context) {
|
||||
if (this.cache === null) {
|
||||
this.cache = {
|
||||
'replace': /\b(ne|nw|se|sw|nesw|nwse)-resize/ig,
|
||||
'url': /^url/i,
|
||||
'e': /e/i,
|
||||
'w': /w/i,
|
||||
'star': /\*/i
|
||||
}
|
||||
}
|
||||
var state = context.util.guardFunctions(value)
|
||||
var parts = state.value.split(',')
|
||||
for (var x = 0; x < parts.length; x++) {
|
||||
parts[x] = this.flip(parts[x])
|
||||
}
|
||||
state.value = parts.join(',')
|
||||
return {
|
||||
'prop': prop,
|
||||
'value': context.util.unguardFunctions(state, this.update.bind(this, context))
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
187
node_modules/rtlcss/lib/rtlcss.js
generated
vendored
Normal file
187
node_modules/rtlcss/lib/rtlcss.js
generated
vendored
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* RTLCSS 2.0.5 https://github.com/MohammadYounes/rtlcss
|
||||
* Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL).
|
||||
* Copyright 2016 Mohammad Younes.
|
||||
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>
|
||||
* */
|
||||
'use strict'
|
||||
var postcss = require('postcss')
|
||||
// var directiveParser = require('./directive-parser.js')
|
||||
var state = require('./state.js')
|
||||
var config = require('./config.js')
|
||||
var util = require('./util.js')
|
||||
|
||||
module.exports = postcss.plugin('rtlcss', function (options, plugins) {
|
||||
var configuration = config.configure(options, plugins)
|
||||
var context = {
|
||||
// provides access to postcss
|
||||
'postcss': postcss,
|
||||
// provides access to the current configuration
|
||||
'config': configuration,
|
||||
// provides access to utilities object
|
||||
'util': util.configure(configuration)
|
||||
}
|
||||
return function (css, result) {
|
||||
var flipped = 0
|
||||
var toBeRenamed = {}
|
||||
css.walk(function (node) {
|
||||
var prevent = false
|
||||
state.walk(function (current) {
|
||||
// check if current directive is expecting this node
|
||||
if (!current.metadata.blacklist && current.directive.expect[node.type]) {
|
||||
// perform action and prevent further processing if result equals true
|
||||
if (current.directive.begin(node, current.metadata, context)) {
|
||||
prevent = true
|
||||
}
|
||||
// if should end? end it.
|
||||
if (current.metadata.end && current.directive.end(node, current.metadata, context)) {
|
||||
state.pop(current)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (prevent === false) {
|
||||
switch (node.type) {
|
||||
case 'atrule':
|
||||
// @rules requires url flipping only
|
||||
if (context.config.processUrls === true || context.config.processUrls.atrule === true) {
|
||||
var params = context.util.applyStringMap(node.params, true)
|
||||
node.params = params
|
||||
}
|
||||
break
|
||||
case 'comment':
|
||||
state.parse(node, result, function (current) {
|
||||
var push = true
|
||||
if (current.directive === null) {
|
||||
current.preserve = !context.config.clean
|
||||
context.util.each(context.config.plugins, function (plugin) {
|
||||
var blacklist = context.config.blacklist[plugin.name]
|
||||
if (blacklist && blacklist[current.metadata.name] === true) {
|
||||
current.metadata.blacklist = true
|
||||
if (current.metadata.end) {
|
||||
push = false
|
||||
}
|
||||
if (current.metadata.begin) {
|
||||
result.warn('directive "' + plugin.name + '.' + current.metadata.name + '" is blacklisted.', {node: current.source})
|
||||
}
|
||||
// break each
|
||||
return false
|
||||
}
|
||||
current.directive = plugin.directives.control[current.metadata.name]
|
||||
if (current.directive) {
|
||||
// break each
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
if (current.directive) {
|
||||
if (!current.metadata.begin && current.metadata.end) {
|
||||
if (current.directive.end(node, current.metadata, context)) {
|
||||
state.pop(current)
|
||||
}
|
||||
push = false
|
||||
} else if (current.directive.expect.self && current.directive.begin(node, current.metadata, context)) {
|
||||
if (current.metadata.end && current.directive.end(node, current.metadata, context)) {
|
||||
push = false
|
||||
}
|
||||
}
|
||||
} else if (!current.metadata.blacklist) {
|
||||
push = false
|
||||
result.warn('unsupported directive "' + current.metadata.name + '".', {node: current.source})
|
||||
}
|
||||
return push
|
||||
})
|
||||
break
|
||||
case 'decl':
|
||||
// if broken by a matching value directive .. break
|
||||
if (!context.util.each(context.config.plugins,
|
||||
function (plugin) {
|
||||
return context.util.each(plugin.directives.value, function (directive) {
|
||||
if (node.raws.value && node.raws.value.raw) {
|
||||
var expr = context.util.regexDirective(directive.name)
|
||||
if (expr.test(node.raws.value.raw)) {
|
||||
expr.lastIndex = 0
|
||||
if (directive.action(node, expr, context)) {
|
||||
if (context.config.clean) {
|
||||
node.value = node.raws.value.raw = context.util.trimDirective(node.raws.value.raw)
|
||||
}
|
||||
flipped++
|
||||
// break
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})) break
|
||||
// loop over all plugins/property processors
|
||||
context.util.each(context.config.plugins, function (plugin) {
|
||||
return context.util.each(plugin.processors, function (directive) {
|
||||
if (node.prop.match(directive.expr)) {
|
||||
var raw = node.raws.value && node.raws.value.raw ? node.raws.value.raw : node.value
|
||||
var state = context.util.saveComments(raw)
|
||||
var pair = directive.action(node.prop, state.value, context)
|
||||
state.value = pair.value
|
||||
pair.value = context.util.restoreComments(state)
|
||||
if (pair.prop !== node.prop || pair.value !== raw) {
|
||||
flipped++
|
||||
node.prop = pair.prop
|
||||
node.value = pair.value
|
||||
}
|
||||
// match found, break
|
||||
return false
|
||||
}
|
||||
})
|
||||
})
|
||||
// if last decl, apply auto rename
|
||||
// decl. may be found inside @rules
|
||||
if (context.config.autoRename && !flipped && node.parent.type === 'rule' && context.util.isLastOfType(node)) {
|
||||
var renamed = context.util.applyStringMap(node.parent.selector)
|
||||
if (context.config.autoRenameStrict === true) {
|
||||
var pair = toBeRenamed[renamed]
|
||||
if (pair) {
|
||||
pair.selector = node.parent.selector
|
||||
node.parent.selector = renamed
|
||||
} else {
|
||||
toBeRenamed[node.parent.selector] = node.parent
|
||||
}
|
||||
} else {
|
||||
node.parent.selector = renamed
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'rule':
|
||||
// new rule, reset flipped decl count to zero
|
||||
flipped = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
state.walk(function (item) {
|
||||
result.warn('unclosed directive "' + item.metadata.name + '".', {node: item.source})
|
||||
})
|
||||
Object.keys(toBeRenamed).forEach(function (key) {
|
||||
result.warn('renaming skipped due to lack of a matching pair.', {node: toBeRenamed[key]})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Creates a new RTLCSS instance, process the input and return its result.
|
||||
* @param {String} css A string containing input CSS.
|
||||
* @param {Object} options An object containing RTLCSS settings.
|
||||
* @param {Object|Array} plugins An array containing a list of RTLCSS plugins or a single RTLCSS plugin.
|
||||
* @returns {String} A string contining the RTLed css.
|
||||
*/
|
||||
module.exports.process = function (css, options, plugins) {
|
||||
return postcss([this(options, plugins)]).process(css).css
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of RTLCSS using the passed configuration object
|
||||
* @param {Object} config An object containing RTLCSS options and plugins.
|
||||
* @returns {Object} A new RTLCSS instance.
|
||||
*/
|
||||
module.exports.configure = function (config) {
|
||||
config = config || {}
|
||||
return postcss([this(config.options, config.plugins)])
|
||||
}
|
||||
47
node_modules/rtlcss/lib/state.js
generated
vendored
Normal file
47
node_modules/rtlcss/lib/state.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
'use strict'
|
||||
var directiveParser = require('./directive-parser.js')
|
||||
module.exports = {
|
||||
stack: [],
|
||||
pop: function (current) {
|
||||
var index = this.stack.indexOf(current)
|
||||
if (index !== -1) {
|
||||
this.stack.splice(index, 1)
|
||||
}
|
||||
if (!current.preserve) {
|
||||
current.source.remove()
|
||||
}
|
||||
},
|
||||
parse: function (node, lazyResult, callback) {
|
||||
var current
|
||||
var metadata = directiveParser(node)
|
||||
if (metadata) {
|
||||
if (!metadata.begin && metadata.end) {
|
||||
this.walk(function (item) {
|
||||
if (metadata.name === item.metadata.name) {
|
||||
this.pop(item)
|
||||
current = {'metadata': metadata, 'directive': item.directive, 'source': node, 'preserve': item.preserve}
|
||||
return false
|
||||
}
|
||||
}.bind(this))
|
||||
} else {
|
||||
current = {'metadata': metadata, 'directive': null, 'source': node, 'preserve': null}
|
||||
}
|
||||
|
||||
if (current === undefined) {
|
||||
lazyResult.warn('found end "' + metadata.name + '" without a matching begin.', {node: node})
|
||||
} else if (callback(current)) {
|
||||
this.stack.push(current)
|
||||
} else if (!current.preserve) {
|
||||
current.source.remove()
|
||||
}
|
||||
}
|
||||
},
|
||||
walk: function (callback) {
|
||||
var len = this.stack.length
|
||||
while (--len > -1) {
|
||||
if (!callback(this.stack[len])) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
264
node_modules/rtlcss/lib/util.js
generated
vendored
Normal file
264
node_modules/rtlcss/lib/util.js
generated
vendored
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
'use strict'
|
||||
var config
|
||||
var CHAR_COMMENT_REPLACEMENT = '\uFFFD' // <20>
|
||||
var CHAR_TOKEN_REPLACEMENT = '\u00A4'// ¤
|
||||
var CHAR_TOKEN_START = '\u00AB' // «
|
||||
var CHAR_TOKEN_END = '\u00BB' // »
|
||||
|
||||
var REGEX_COMMENT_REPLACEMENT = new RegExp(CHAR_COMMENT_REPLACEMENT, 'ig')
|
||||
var REGEX_TOKEN_REPLACEMENT = new RegExp(CHAR_TOKEN_REPLACEMENT, 'ig')
|
||||
|
||||
var PATTERN_NUMBER = '\\-?(\\d*?\\.\\d+|\\d+)'
|
||||
var PATTERN_NUMBER_WITH_CALC = '(calc' + CHAR_TOKEN_REPLACEMENT + ')|(' + PATTERN_NUMBER + ')(?!d\\()'
|
||||
var PATTERN_TOKEN = CHAR_TOKEN_START + '\\d+:\\d+' + CHAR_TOKEN_END // «offset:index»
|
||||
var PATTERN_TOKEN_WITH_NAME = '\\w*?' + CHAR_TOKEN_START + '\\d+:\\d+' + CHAR_TOKEN_END // «offset:index»
|
||||
|
||||
var REGEX_COMMENT = /\/\*[^]*?\*\//igm // none-greedy
|
||||
var REGEX_DIRECTIVE = /\/\*(?:!)?rtl:[^]*?\*\//img
|
||||
var REGEX_ESCAPE = /[.*+?^${}()|[\]\\]/g
|
||||
var REGEX_FUNCTION = /\([^\(\)]+\)/i
|
||||
var REGEX_HEX_COLOR = /#[a-f0-9]{3,6}/ig
|
||||
var REGEX_CALC = /calc/
|
||||
var REGEX_TOKENS = new RegExp(PATTERN_TOKEN, 'ig')
|
||||
var REGEX_TOKENS_WITH_NAME = new RegExp(PATTERN_TOKEN_WITH_NAME, 'ig')
|
||||
|
||||
var REGEX_COMPLEMENT = new RegExp(PATTERN_NUMBER_WITH_CALC, 'i')
|
||||
var REGEX_NEGATE_ALL = new RegExp(PATTERN_NUMBER_WITH_CALC, 'ig')
|
||||
var REGEX_NEGATE_ONE = new RegExp(PATTERN_NUMBER_WITH_CALC, 'i')
|
||||
|
||||
var DEFAULT_STRING_MAP_OPTIONS = { scope: '*', ignoreCase: true }
|
||||
var TOKEN_ID = 0
|
||||
|
||||
function compare (what, to, ignoreCase) {
|
||||
if (ignoreCase) {
|
||||
return what.toLowerCase() === to.toLowerCase()
|
||||
}
|
||||
return what === to
|
||||
}
|
||||
|
||||
function escapeRegExp (string) {
|
||||
return string.replace(REGEX_ESCAPE, '\\$&')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
extend: function (dest, src) {
|
||||
if (typeof dest === 'undefined' || typeof dest !== 'object') {
|
||||
dest = {}
|
||||
}
|
||||
for (var prop in src) {
|
||||
if (!dest.hasOwnProperty(prop)) {
|
||||
dest[prop] = src[prop]
|
||||
}
|
||||
}
|
||||
return dest
|
||||
},
|
||||
swap: function (value, a, b, options) {
|
||||
var expr = escapeRegExp(a) + '|' + escapeRegExp(b)
|
||||
options = options || DEFAULT_STRING_MAP_OPTIONS
|
||||
var greedy = options.hasOwnProperty('greedy') ? options.greedy : config.greedy
|
||||
if (!greedy) {
|
||||
expr = '\\b(' + expr + ')\\b'
|
||||
}
|
||||
var flags = options.ignoreCase ? 'img' : 'mg'
|
||||
return value.replace(new RegExp(expr, flags), function (m) { return compare(m, a, options.ignoreCase) ? b : a })
|
||||
},
|
||||
swapLeftRight: function (value) {
|
||||
return this.swap(value, 'left', 'right')
|
||||
},
|
||||
swapLtrRtl: function (value) {
|
||||
return this.swap(value, 'ltr', 'rtl')
|
||||
},
|
||||
applyStringMap: function (value, isUrl) {
|
||||
var result = value
|
||||
for (var x = 0; x < config.stringMap.length; x++) {
|
||||
var map = config.stringMap[x]
|
||||
var options = this.extend(map.options, DEFAULT_STRING_MAP_OPTIONS)
|
||||
if (options.scope === '*' || (isUrl && options.scope === 'url') || (!isUrl && options.scope === 'selector')) {
|
||||
if (Array.isArray(map.search) && Array.isArray(map.replace)) {
|
||||
for (var mapIndex = 0; mapIndex < map.search.length; mapIndex++) {
|
||||
result = this.swap(result, map.search[mapIndex], map.replace[mapIndex % map.search.length], options)
|
||||
}
|
||||
} else {
|
||||
result = this.swap(result, map.search, map.replace, options)
|
||||
}
|
||||
if (map.exclusive === true) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
},
|
||||
negate: function (value) {
|
||||
var state = this.saveTokens(value)
|
||||
state.value = state.value.replace(REGEX_NEGATE_ONE, function (num) {
|
||||
return REGEX_TOKEN_REPLACEMENT.test(num) ? num.replace(REGEX_TOKEN_REPLACEMENT, function (m) { return '(-1*' + m + ')' }) : parseFloat(num, 10) * -1
|
||||
})
|
||||
return this.restoreTokens(state)
|
||||
},
|
||||
negateAll: function (value) {
|
||||
var state = this.saveTokens(value)
|
||||
state.value = state.value.replace(REGEX_NEGATE_ALL, function (num) {
|
||||
return REGEX_TOKEN_REPLACEMENT.test(num) ? num.replace(REGEX_TOKEN_REPLACEMENT, function (m) { return '(-1*' + m + ')' }) : parseFloat(num, 10) * -1
|
||||
})
|
||||
return this.restoreTokens(state)
|
||||
},
|
||||
complement: function (value) {
|
||||
var state = this.saveTokens(value)
|
||||
state.value = state.value.replace(REGEX_COMPLEMENT, function (num) {
|
||||
return REGEX_TOKEN_REPLACEMENT.test(num) ? num.replace(REGEX_TOKEN_REPLACEMENT, function (m) { return '(100% - ' + m + ')' }) : 100 - parseFloat(num, 10)
|
||||
})
|
||||
return this.restoreTokens(state)
|
||||
},
|
||||
save: function (what, who, replacement, restorer, exclude) {
|
||||
var state = {
|
||||
value: who,
|
||||
store: [],
|
||||
replacement: replacement,
|
||||
restorer: restorer
|
||||
}
|
||||
state.value = state.value.replace(what, function (c) {
|
||||
if (exclude && c.match(exclude)) {
|
||||
return c
|
||||
} else {
|
||||
state.store.push(c); return state.replacement
|
||||
}
|
||||
})
|
||||
return state
|
||||
},
|
||||
restore: function (state) {
|
||||
var index = 0
|
||||
var result = state.value.replace(state.restorer, function () {
|
||||
return state.store[index++]
|
||||
})
|
||||
state.store.length = 0
|
||||
return result
|
||||
},
|
||||
saveComments: function (value) {
|
||||
return this.save(REGEX_COMMENT, value, CHAR_COMMENT_REPLACEMENT, REGEX_COMMENT_REPLACEMENT)
|
||||
},
|
||||
restoreComments: function (state) {
|
||||
return this.restore(state)
|
||||
},
|
||||
saveTokens: function (value, excludeCalc) {
|
||||
return excludeCalc === true
|
||||
? this.save(REGEX_TOKENS_WITH_NAME, value, CHAR_TOKEN_REPLACEMENT, REGEX_TOKEN_REPLACEMENT, REGEX_CALC)
|
||||
: this.save(REGEX_TOKENS, value, CHAR_TOKEN_REPLACEMENT, REGEX_TOKEN_REPLACEMENT)
|
||||
},
|
||||
restoreTokens: function (state) {
|
||||
return this.restore(state)
|
||||
},
|
||||
guard: function (what, who, indexed) {
|
||||
var state = {
|
||||
value: who,
|
||||
store: [],
|
||||
offset: TOKEN_ID++,
|
||||
token: CHAR_TOKEN_START + TOKEN_ID,
|
||||
indexed: indexed === true
|
||||
}
|
||||
if (state.indexed === true) {
|
||||
while (what.test(state.value)) {
|
||||
state.value = state.value.replace(what, function (m) { state.store.push(m); return state.token + ':' + state.store.length + CHAR_TOKEN_END })
|
||||
}
|
||||
} else {
|
||||
state.value = state.value.replace(what, function (m) { state.store.push(m); return state.token + CHAR_TOKEN_END })
|
||||
}
|
||||
return state
|
||||
},
|
||||
unguard: function (state, callback) {
|
||||
if (state.indexed === true) {
|
||||
var detokenizer = new RegExp('(\\w*?)' + state.token + ':(\\d+)' + CHAR_TOKEN_END, 'i')
|
||||
while (detokenizer.test(state.value)) {
|
||||
state.value = state.value.replace(detokenizer, function (match, name, index) {
|
||||
var value = state.store[index - 1]
|
||||
if (typeof callback === 'function') {
|
||||
return name + callback(value, name)
|
||||
}
|
||||
return name + value
|
||||
})
|
||||
}
|
||||
return state.value
|
||||
} else {
|
||||
return state.value.replace(new RegExp('(\\w*?)' + state.token + CHAR_TOKEN_END, 'i'), function (match, name) {
|
||||
var value = state.store.shift()
|
||||
if (typeof callback === 'function') {
|
||||
return name + callback(value, name)
|
||||
}
|
||||
return name + value
|
||||
})
|
||||
}
|
||||
},
|
||||
guardHexColors: function (value) {
|
||||
return this.guard(REGEX_HEX_COLOR, value, true)
|
||||
},
|
||||
unguardHexColors: function (state, callback) {
|
||||
return this.unguard(state, callback)
|
||||
},
|
||||
guardFunctions: function (value) {
|
||||
return this.guard(REGEX_FUNCTION, value, true)
|
||||
},
|
||||
unguardFunctions: function (state, callback) {
|
||||
return this.unguard(state, callback)
|
||||
},
|
||||
trimDirective: function (value) {
|
||||
return value.replace(REGEX_DIRECTIVE, '')
|
||||
},
|
||||
regexCache: {},
|
||||
regexDirective: function (name) {
|
||||
// /(?:\/\*(?:!)?rtl:ignore(?::)?)([^]*?)(?:\*\/)/img
|
||||
this.regexCache[name] = this.regexCache[name] || new RegExp('(?:\\/\\*(?:!)?rtl:' + (name ? escapeRegExp(name) + '(?::)?' : '') + ')([^]*?)(?:\\*\\/)', 'img')
|
||||
return this.regexCache[name]
|
||||
},
|
||||
regex: function (what, options) {
|
||||
what = what || []
|
||||
var expression = ''
|
||||
for (var x = 0; x < what.length; x++) {
|
||||
switch (what[x]) {
|
||||
case 'percent':
|
||||
expression += '|(' + PATTERN_NUMBER + '%)'
|
||||
break
|
||||
case 'length':
|
||||
expression += '|(' + PATTERN_NUMBER + ')(?:ex|ch|r?em|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc)?'
|
||||
break
|
||||
case 'number':
|
||||
expression += '|(' + PATTERN_NUMBER + ')'
|
||||
break
|
||||
case 'position':
|
||||
expression += '|(left|center|right|top|bottom)'
|
||||
break
|
||||
case 'calc':
|
||||
expression += '|(calc' + PATTERN_TOKEN + ')'
|
||||
break
|
||||
}
|
||||
}
|
||||
return new RegExp(expression.slice(1), options)
|
||||
},
|
||||
isLastOfType: function (node) {
|
||||
var isLast = true
|
||||
var next = node.next()
|
||||
while (next) {
|
||||
if (next && next.type === node.type) {
|
||||
isLast = false
|
||||
break
|
||||
}
|
||||
next = next.next()
|
||||
}
|
||||
return isLast
|
||||
},
|
||||
/**
|
||||
* Simple breakable each: returning false in the callback will break the loop
|
||||
* returns false if the loop was broken, otherwise true
|
||||
*/
|
||||
each: function (array, callback) {
|
||||
for (var len = 0; len < array.length; len++) {
|
||||
if (callback(array[len]) === false) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.configure = function (configuration) {
|
||||
config = configuration
|
||||
return this
|
||||
}
|
||||
108
node_modules/rtlcss/package.json
generated
vendored
Normal file
108
node_modules/rtlcss/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "rtlcss@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "rtlcss",
|
||||
"name": "rtlcss",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/gulp-rtlcss"
|
||||
]
|
||||
],
|
||||
"_from": "rtlcss@>=2.0.0 <3.0.0",
|
||||
"_id": "rtlcss@2.1.2",
|
||||
"_inCache": true,
|
||||
"_location": "/rtlcss",
|
||||
"_nodeVersion": "5.10.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/rtlcss-2.1.2.tgz_1483214922179_0.505813839379698"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "myounes",
|
||||
"email": "myounes@gmail.com"
|
||||
},
|
||||
"_npmVersion": "4.0.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "rtlcss@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "rtlcss",
|
||||
"name": "rtlcss",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-rtlcss"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rtlcss/-/rtlcss-2.1.2.tgz",
|
||||
"_shasum": "a5626edc9e7f6017f2d8df30c8bf622bd193a8fc",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "rtlcss@^2.0.0",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/gulp-rtlcss",
|
||||
"author": {
|
||||
"name": "Mohammad Younes"
|
||||
},
|
||||
"bin": {
|
||||
"rtlcss": "./bin/rtlcss.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/MohammadYounes/rtlcss/issues?state=open"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^1.0.0",
|
||||
"findup": "^0.1.5",
|
||||
"mkdirp": "^0.5.1",
|
||||
"postcss": "^5.0.0",
|
||||
"strip-json-comments": "^2.0.0"
|
||||
},
|
||||
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.0.0",
|
||||
"standard": "^6.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a5626edc9e7f6017f2d8df30c8bf622bd193a8fc",
|
||||
"tarball": "https://registry.npmjs.org/rtlcss/-/rtlcss-2.1.2.tgz"
|
||||
},
|
||||
"gitHead": "5894fcfb864aabe2b5671a3df9ad195b84df97aa",
|
||||
"homepage": "http://rtlcss.com/",
|
||||
"keywords": [
|
||||
"rtl",
|
||||
"css",
|
||||
"ltr",
|
||||
"rtlcss",
|
||||
"framework",
|
||||
"style",
|
||||
"mirror",
|
||||
"flip",
|
||||
"convert",
|
||||
"transform"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/rtlcss.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "myounes",
|
||||
"email": "myounes@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "rtlcss",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MohammadYounes/rtlcss.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard && node ./lib/rtlcss.js",
|
||||
"test": "npm run lint && mocha -R spec"
|
||||
},
|
||||
"version": "2.1.2"
|
||||
}
|
||||
38
node_modules/rtlcss/test/cli.js
generated
vendored
Normal file
38
node_modules/rtlcss/test/cli.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* global process */
|
||||
/* global describe */
|
||||
/* global it */
|
||||
var assert = require('assert')
|
||||
var spawn = require('child_process').spawn
|
||||
var fs = require('fs')
|
||||
|
||||
function run_cmd (cmd, args, done) {
|
||||
var child = spawn(cmd, args)
|
||||
var resp = ''
|
||||
var err = ''
|
||||
child.stderr.on('data', function (error) { err += error })
|
||||
child.stdout.on('data', function (buffer) { resp += buffer.toString() })
|
||||
child.stdout.on('end', function () { done(err, resp) })
|
||||
}
|
||||
|
||||
var configPath = './test/css/config.json'
|
||||
var inputPath = './test/css/input.css'
|
||||
var expectedPath = './test/css/input.expected.css'
|
||||
var outputPath = './test/css/input.rtl.css'
|
||||
|
||||
describe('# CLI', function () {
|
||||
it('Should succeed', function (done) {
|
||||
run_cmd('node', ['./bin/rtlcss.js', inputPath, '--config', configPath, '--silent', ''], function (err, resp) {
|
||||
if (err) throw new Error(err)
|
||||
fs.readFile(expectedPath, 'utf-8', function (err, expected) {
|
||||
if (err) throw new Error(err)
|
||||
fs.readFile(outputPath, 'utf-8', function (err, output) {
|
||||
if (err) throw new Error(err)
|
||||
assert.equal(expected, output)
|
||||
fs.unlink(outputPath, function () {
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
10
node_modules/rtlcss/test/css/config.json
generated
vendored
Normal file
10
node_modules/rtlcss/test/css/config.json
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"options": {
|
||||
"autoRename": true,
|
||||
"processUrls": true,
|
||||
"greedy": true,
|
||||
"stringMap": []
|
||||
},
|
||||
"plugins": [],
|
||||
"map": true // used by CLI
|
||||
}
|
||||
120
node_modules/rtlcss/test/css/input.css
generated
vendored
Normal file
120
node_modules/rtlcss/test/css/input.css
generated
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
|
||||
Preserves orignal formatting
|
||||
|
||||
*/
|
||||
/* declarations can exist inside atrules */
|
||||
@font-face {
|
||||
font-family: 'Test font';
|
||||
}
|
||||
|
||||
/* comment before rule */
|
||||
body/* comment after rule name */{
|
||||
/* comment before decl */
|
||||
padding /* comment after prop */ : /* comment before val */ 0 /* comment after val */ 1px /* another comment */ 2px /* one more */ 3px /* last one*/;
|
||||
/* comment after decl */
|
||||
|
||||
margin:
|
||||
0 /*top*/
|
||||
1px /*right
|
||||
multi-line
|
||||
comment
|
||||
*/
|
||||
2px /*bottom*/
|
||||
3px /*left*/;
|
||||
|
||||
border-left/* comment after prop */: none;
|
||||
}
|
||||
|
||||
/* empty options forces defaults */
|
||||
/*rtl:begin:options: {}*/
|
||||
/* should not process urls - default */
|
||||
@import url("rtl-right-east.css");
|
||||
/*rtl:end:options*/
|
||||
|
||||
/*rtl:begin:config:
|
||||
{
|
||||
"options":{
|
||||
"autoRename": true,
|
||||
"stringMap":[
|
||||
{
|
||||
"name" : "prev-next",
|
||||
"search" : ["prev", "Prev", "PREV"],
|
||||
"replace" : ["next", "Next", "NEXT"],
|
||||
"options" : {"ignoreCase":false}
|
||||
}
|
||||
]
|
||||
},
|
||||
"plugins":[
|
||||
{
|
||||
"name": "test",
|
||||
"directives":{
|
||||
"control": {},
|
||||
"value": []
|
||||
},
|
||||
"processors": [
|
||||
{
|
||||
"name": "content",
|
||||
"expr": /content/im,
|
||||
"action": function (prop, value, cxt) {
|
||||
if (value === '"A"') {
|
||||
return { 'prop': prop, 'value': '"ABC"' }
|
||||
} else if (value === '"ABC"') {
|
||||
return { 'prop': prop, 'value': '"A"' }
|
||||
}
|
||||
return { 'prop': prop, 'value': value }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}*/
|
||||
div:before { content: "A";} div:after { content: "ABC";}
|
||||
|
||||
.demo-prev, .demo-Prev, .demo-PREV { content: 'p'; }
|
||||
.demo-next, .demo-Next, .demo-NEXT { content: 'n'; }
|
||||
|
||||
/*rtl:end:config*/
|
||||
|
||||
/*!rtl:begin:remove*/
|
||||
@import url(/test.css);
|
||||
i {
|
||||
color: blue;
|
||||
}
|
||||
/*rtl:end:remove*/
|
||||
|
||||
|
||||
div {
|
||||
/*rtl:remove*/
|
||||
direction: rtl;
|
||||
text-align: right;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/*rtl:begin:ignore*/
|
||||
.sample {
|
||||
text-align: left;
|
||||
}
|
||||
/*rtl:end:ignore*/
|
||||
|
||||
|
||||
/*rtl:begin:options:{"autoRename":false, "clean": false}*/
|
||||
.right { display:inline;}
|
||||
/*rtl:begin:options:{"autoRename":true, "greedy": true}*/
|
||||
.bright { display:inline;}
|
||||
/*rtl:end:options*/
|
||||
.brighter { display:inline;}
|
||||
/*rtl:end:options*/
|
||||
|
||||
/* auto rename only if a pair exists */
|
||||
|
||||
/*rtl:begin:options:{"autoRename":true, "autoRenameStrict": true}*/
|
||||
|
||||
/* The following should not be renamed */
|
||||
.ltr{ display: inline-flex;}
|
||||
|
||||
/* But these should */
|
||||
.right{ display: inline-flex;}
|
||||
.left { display: block;}
|
||||
|
||||
/*rtl:end:options*/
|
||||
59
node_modules/rtlcss/test/css/input.expected.css
generated
vendored
Normal file
59
node_modules/rtlcss/test/css/input.expected.css
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
|
||||
Preserves orignal formatting
|
||||
|
||||
*/
|
||||
/* declarations can exist inside atrules */
|
||||
@font-face {
|
||||
font-family: 'Test font';
|
||||
}
|
||||
|
||||
/* comment before rule */
|
||||
body/* comment after rule name */{
|
||||
/* comment before decl */
|
||||
padding /* comment after prop */ : /* comment before val */ 0 /* comment after val */ 3px /* another comment */ 2px /* one more */ 1px /* last one*/;
|
||||
/* comment after decl */
|
||||
|
||||
margin:
|
||||
0 /*top*/
|
||||
3px /*right
|
||||
multi-line
|
||||
comment
|
||||
*/
|
||||
2px /*bottom*/
|
||||
1px /*left*/;
|
||||
|
||||
border-right/* comment after prop */: none;
|
||||
}
|
||||
|
||||
/* empty options forces defaults */
|
||||
/* should not process urls - default */
|
||||
@import url("rtl-right-east.css");
|
||||
div:before { content: "ABC";} div:after { content: "A";}
|
||||
|
||||
.demo-next, .demo-Next, .demo-NEXT { content: 'p'; }
|
||||
.demo-prev, .demo-Prev, .demo-PREV { content: 'n'; }
|
||||
|
||||
|
||||
div {
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
}
|
||||
.sample {
|
||||
text-align: left;
|
||||
}
|
||||
.right { display:inline;}
|
||||
/*rtl:begin:options:{"autoRename":true, "greedy": true}*/
|
||||
.bleft { display:inline;}
|
||||
/*rtl:end:options*/
|
||||
.brighter { display:inline;}
|
||||
|
||||
/* auto rename only if a pair exists */
|
||||
|
||||
/* The following should not be renamed */
|
||||
.ltr{ display: inline-flex;}
|
||||
|
||||
/* But these should */
|
||||
.left{ display: inline-flex;}
|
||||
.right { display: block;}
|
||||
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImlucHV0LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBQ0gsMkNBQTJDO0FBQzNDO0VBQ0UseUJBQXlCO0NBQzFCOztBQUVELHlCQUF5QjtBQUN6QjtJQUNJLHlCQUF5QjtJQUN6Qix3SkFBd0o7SUFDeEosd0JBQXdCOztJQUV4Qjs7Ozs7OztxQkFPaUI7O0lBRWpCLDRDQUEyQztDQUM5Qzs7QUFFRCxtQ0FBbUM7QUFFbkMsdUNBQXVDO0FBQ3ZDLGtDQUFrQztBQXdDbEMsYUFBYSxlQUFhLENBQUMsQ0FBQyxZQUFZLGFBQWUsQ0FBQzs7QUFFeEQscUNBQXFDLGFBQWEsRUFBRTtBQUNwRCxxQ0FBcUMsYUFBYSxFQUFFOzs7QUFZcEQ7RUFHRSxpQkFBa0I7RUFDbEIsY0FBYztDQUNmO0FBR0Q7SUFDSSxpQkFBaUI7Q0FDcEI7QUFLRCxTQUFTLGVBQWUsQ0FBQztBQUN6Qix5REFBeUQ7QUFDekQsU0FBVSxlQUFlLENBQUM7QUFDMUIsbUJBQW1CO0FBQ25CLFlBQVksZUFBZSxDQUFDOztBQUc1Qix1Q0FBdUM7O0FBSXZDLHlDQUF5QztBQUN6QyxNQUFNLHFCQUFxQixDQUFDOztBQUU1QixzQkFBc0I7QUFDdEIsT0FBUSxxQkFBcUIsQ0FBQztBQUM5QixTQUFRLGVBQWUsQ0FBQyIsImZpbGUiOiJpbnB1dC5ydGwuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLypcblxuUHJlc2VydmVzIG9yaWduYWwgZm9ybWF0dGluZ1xuXG4gKi9cbi8qIGRlY2xhcmF0aW9ucyBjYW4gZXhpc3QgaW5zaWRlIGF0cnVsZXMgKi9cbkBmb250LWZhY2Uge1xuICBmb250LWZhbWlseTogJ1Rlc3QgZm9udCc7XG59XG5cbi8qIGNvbW1lbnQgYmVmb3JlIHJ1bGUgKi9cbmJvZHkvKiBjb21tZW50IGFmdGVyIHJ1bGUgbmFtZSAqL3tcbiAgICAvKiBjb21tZW50IGJlZm9yZSBkZWNsICovXG4gICAgcGFkZGluZyAvKiAgY29tbWVudCBhZnRlciBwcm9wICovIDogLyogIGNvbW1lbnQgYmVmb3JlIHZhbCAqLyAwIC8qICBjb21tZW50IGFmdGVyIHZhbCAqLyAxcHggLyogYW5vdGhlciBjb21tZW50ICovIDJweCAvKiBvbmUgbW9yZSAqLyAzcHggLyogbGFzdCBvbmUqLztcbiAgICAvKiBjb21tZW50IGFmdGVyIGRlY2wgKi9cblxuICAgIG1hcmdpbjpcbiAgICAgICAgMCAvKnRvcCovXG4gICAgICAgIDFweCAvKnJpZ2h0XG4gICAgICAgIG11bHRpLWxpbmVcbiAgICAgICAgY29tbWVudFxuICAgICAgICAqL1xuICAgICAgICAycHggLypib3R0b20qL1xuICAgICAgICAzcHggLypsZWZ0Ki87XG5cbiAgICBib3JkZXItbGVmdC8qICBjb21tZW50IGFmdGVyIHByb3AgKi86IG5vbmU7XG59XG5cbi8qIGVtcHR5IG9wdGlvbnMgZm9yY2VzIGRlZmF1bHRzICovXG4vKnJ0bDpiZWdpbjpvcHRpb25zOiB7fSovXG4vKiBzaG91bGQgbm90IHByb2Nlc3MgdXJscyAtIGRlZmF1bHQgKi9cbkBpbXBvcnQgdXJsKFwicnRsLXJpZ2h0LWVhc3QuY3NzXCIpO1xuLypydGw6ZW5kOm9wdGlvbnMqL1xuXG4vKnJ0bDpiZWdpbjpjb25maWc6XG57XG4gICAgXCJvcHRpb25zXCI6e1xuICAgICAgICBcImF1dG9SZW5hbWVcIjogdHJ1ZSxcbiAgICAgICAgXCJzdHJpbmdNYXBcIjpbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICBcIm5hbWVcIiAgICA6IFwicHJldi1uZXh0XCIsXG4gICAgICAgICAgICBcInNlYXJjaFwiICA6IFtcInByZXZcIiwgXCJQcmV2XCIsIFwiUFJFVlwiXSxcbiAgICAgICAgICAgIFwicmVwbGFjZVwiIDogW1wibmV4dFwiLCBcIk5leHRcIiwgXCJORVhUXCJdLFxuICAgICAgICAgICAgXCJvcHRpb25zXCIgOiB7XCJpZ25vcmVDYXNlXCI6ZmFsc2V9XG4gICAgICAgICAgICB9XG4gICAgICAgIF1cbiAgICB9LFxuICAgIFwicGx1Z2luc1wiOltcbiAgICAgIHtcbiAgICAgICAgXCJuYW1lXCI6IFwidGVzdFwiLFxuICAgICAgICBcImRpcmVjdGl2ZXNcIjp7XG4gICAgICAgICAgXCJjb250cm9sXCI6IHt9LFxuICAgICAgICAgIFwidmFsdWVcIjogW11cbiAgICAgICAgfSxcbiAgICAgICAgXCJwcm9jZXNzb3JzXCI6IFtcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIm5hbWVcIjogXCJjb250ZW50XCIsXG4gICAgICAgICAgICBcImV4cHJcIjogL2NvbnRlbnQvaW0sXG4gICAgICAgICAgICBcImFjdGlvblwiOiBmdW5jdGlvbiAocHJvcCwgdmFsdWUsIGN4dCkge1xuICAgICAgICAgICAgICBpZiAodmFsdWUgPT09ICdcIkFcIicpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4geyAncHJvcCc6IHByb3AsICd2YWx1ZSc6ICdcIkFCQ1wiJyB9XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWUgPT09ICdcIkFCQ1wiJykge1xuICAgICAgICAgICAgICAgIHJldHVybiB7ICdwcm9wJzogcHJvcCwgJ3ZhbHVlJzogJ1wiQVwiJyB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIHsgJ3Byb3AnOiBwcm9wLCAndmFsdWUnOiB2YWx1ZSB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICBdXG4gICAgICB9XG4gICAgXVxufSovXG5kaXY6YmVmb3JlIHsgY29udGVudDogXCJBXCI7fSBkaXY6YWZ0ZXIgeyBjb250ZW50OiBcIkFCQ1wiO31cblxuLmRlbW8tcHJldiwgLmRlbW8tUHJldiwgLmRlbW8tUFJFViB7IGNvbnRlbnQ6ICdwJzsgfVxuLmRlbW8tbmV4dCwgLmRlbW8tTmV4dCwgLmRlbW8tTkVYVCB7IGNvbnRlbnQ6ICduJzsgfVxuXG4vKnJ0bDplbmQ6Y29uZmlnKi9cblxuLyohcnRsOmJlZ2luOnJlbW92ZSovXG5AaW1wb3J0IHVybCgvdGVzdC5jc3MpO1xuaSB7XG4gIGNvbG9yOiBibHVlOyAgXG59XG4vKnJ0bDplbmQ6cmVtb3ZlKi9cblxuXG5kaXYge1xuICAvKnJ0bDpyZW1vdmUqL1xuICBkaXJlY3Rpb246IHJ0bDtcbiAgdGV4dC1hbGlnbjogcmlnaHQ7XG4gIHBhZGRpbmc6IDEwcHg7XG59XG5cbi8qcnRsOmJlZ2luOmlnbm9yZSovXG4uc2FtcGxlIHtcbiAgICB0ZXh0LWFsaWduOiBsZWZ0O1xufVxuLypydGw6ZW5kOmlnbm9yZSovXG5cblxuLypydGw6YmVnaW46b3B0aW9uczp7XCJhdXRvUmVuYW1lXCI6ZmFsc2UsIFwiY2xlYW5cIjogZmFsc2V9Ki9cbi5yaWdodCB7IGRpc3BsYXk6aW5saW5lO31cbi8qcnRsOmJlZ2luOm9wdGlvbnM6e1wiYXV0b1JlbmFtZVwiOnRydWUsIFwiZ3JlZWR5XCI6IHRydWV9Ki9cbi5icmlnaHQgeyBkaXNwbGF5OmlubGluZTt9XG4vKnJ0bDplbmQ6b3B0aW9ucyovXG4uYnJpZ2h0ZXIgeyBkaXNwbGF5OmlubGluZTt9XG4vKnJ0bDplbmQ6b3B0aW9ucyovXG5cbi8qIGF1dG8gcmVuYW1lIG9ubHkgaWYgYSBwYWlyIGV4aXN0cyAqL1xuXG4vKnJ0bDpiZWdpbjpvcHRpb25zOntcImF1dG9SZW5hbWVcIjp0cnVlLCBcImF1dG9SZW5hbWVTdHJpY3RcIjogdHJ1ZX0qL1xuXG4vKiBUaGUgZm9sbG93aW5nIHNob3VsZCBub3QgYmUgcmVuYW1lZCAqL1xuLmx0cnsgZGlzcGxheTogaW5saW5lLWZsZXg7fVxuXG4vKiBCdXQgdGhlc2Ugc2hvdWxkICovXG4ucmlnaHR7IGRpc3BsYXk6IGlubGluZS1mbGV4O31cbi5sZWZ0IHsgZGlzcGxheTogYmxvY2s7fVxuXG4vKnJ0bDplbmQ6b3B0aW9ucyovIl19 */
|
||||
27
node_modules/rtlcss/test/data/background-image.js
generated
vendored
Normal file
27
node_modules/rtlcss/test/data/background-image.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should process string map in url (processUrls:true)',
|
||||
'expected': 'div { background-image: url(images/rtl.png), url(images/right.png);}',
|
||||
'input': 'div { background-image: url(images/ltr.png), url(images/left.png);}',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should not negate color value for linear gradient',
|
||||
'expected': 'div { background-image: linear-gradient(rgba(255, 255, 255, 0.3) 0%, #ff8 100%);}',
|
||||
'input': 'div { background-image: linear-gradient(rgba(255, 255, 255, 0.3) 0%, #ff8 100%);}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not negate color value for linear gradient with calc',
|
||||
'expected': 'div { background-image: linear-gradient(rgba(255, 255, calc((125 * 2) + 5), 0.3) 0%, #ff8 100%);}',
|
||||
'input': 'div { background-image: linear-gradient(rgba(255, 255, calc((125 * 2) + 5), 0.3) 0%, #ff8 100%);}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should negate angle value for linear gradient',
|
||||
'expected': 'div { background-image: linear-gradient(13.25deg, rgba(255, 255, 255, .15) 25%, transparent 25%);}',
|
||||
'input': 'div { background-image: linear-gradient(-13.25deg, rgba(255, 255, 255, .15) 25%, transparent 25%);}',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
86
node_modules/rtlcss/test/data/background-position.js
generated
vendored
Normal file
86
node_modules/rtlcss/test/data/background-position.js
generated
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should complement percentage horizontal position ',
|
||||
'expected': 'div {background-position:100% 75%;}',
|
||||
'input': 'div {background-position:0 75%;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage horizontal position with calc',
|
||||
'expected': 'div {background-position:calc(100% - (30% + 50px)) 75%;}',
|
||||
'input': 'div {background-position:calc(30% + 50px) 75%;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage horizontal position ',
|
||||
'expected': 'div {background-position:81.25% 75%, 10.75% top;}',
|
||||
'input': 'div {background-position:18.75% 75%, 89.25% top;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage horizontal position with calc',
|
||||
'expected': 'div {background-position:calc(100% - (30% + 50px)) calc(30% + 50px), 10.75% top;}',
|
||||
'input': 'div {background-position:calc(30% + 50px) calc(30% + 50px), 89.25% top;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror background-position',
|
||||
'expected': 'div {background-position:right 75%, left top;}',
|
||||
'input': 'div {background-position:left 75%, right top;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror background-position (calc)',
|
||||
'expected': 'div {background-position:right -ms-calc(30% + 50px), left top;}',
|
||||
'input': 'div {background-position:left -ms-calc(30% + 50px), right top;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage: position-x (treat 0 as 0%)',
|
||||
'expected': 'div {background-position-x:100%, 0%;}',
|
||||
'input': 'div {background-position-x:0, 100%;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage: position-x',
|
||||
'expected': 'div {background-position-x:81.75%, 11%;}',
|
||||
'input': 'div {background-position-x:18.25%, 89%;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage with calc: position-x',
|
||||
'expected': 'div {background-position-x:calc(100% - (30% + 50px)), -webkit-calc(100% - (30% + 50px));}',
|
||||
'input': 'div {background-position-x:calc(30% + 50px), -webkit-calc(30% + 50px);}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror position-x',
|
||||
'expected': 'div {background-position-x:right, left;}',
|
||||
'input': 'div {background-position-x:left, right;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror position-x (calc)',
|
||||
'expected': 'div {background-position-x:calc(100% - (30% + 50px)), calc(100% - (50px * 5));}',
|
||||
'input': 'div {background-position-x:calc(30% + 50px), calc(50px * 5);}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should keep as is: position-x',
|
||||
'expected': 'div {background-position-x:100px, 0px;}',
|
||||
'input': 'div {background-position-x:100px, 0px;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror background-position edge offsets (4 values)',
|
||||
'expected': 'div {background-position: left 5px bottom 5px, bottom 15px right 15px;}',
|
||||
'input': 'div {background-position: right 5px bottom 5px, bottom 15px left 15px;}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror background-position edge offsets (3 values)',
|
||||
'expected': 'div {background-position: left 5px bottom, top 15px right;}',
|
||||
'input': 'div {background-position: right 5px bottom, top 15px left;}',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
84
node_modules/rtlcss/test/data/background.js
generated
vendored
Normal file
84
node_modules/rtlcss/test/data/background.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should treat 0 as 0%',
|
||||
'expected': '.banner { background: 100% top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 0 top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should complement percentage horizontal position',
|
||||
'expected': '.banner { background: 81% top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 19% top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should complement calc horizontal position',
|
||||
'expected': '.banner { background: calc(100% - (19% + 2px)) top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: calc(19% + 2px) top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror keyword horizontal position',
|
||||
'expected': '.banner { background: right top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: left top url(topbanner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not process string map in url (default)',
|
||||
'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should process string map in url (processUrls:true)',
|
||||
'expected': '.banner { background: 10px top url(rtl-top-left-banner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should process string map in url (processUrls:{decl:true})',
|
||||
'expected': '.banner { background: 10px top url(rtl-top-left-banner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': { 'decl': true } }
|
||||
},
|
||||
{
|
||||
'should': 'Should not process string map in url (processUrls:{atrule:true})',
|
||||
'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': { 'atrule': true } }
|
||||
},
|
||||
{
|
||||
'should': 'Should not swap bright:bleft, ultra:urtla',
|
||||
'expected': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should swap bright:bleft, ultra:urtla (processUrls: true, greedy)',
|
||||
'expected': '.banner { background: 10px top url(urtla/bleft.png) #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true, 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should not flip hex colors ',
|
||||
'expected': '.banner { background: #ff0; }',
|
||||
'input': '.banner { background: #ff0; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should treat 0 as 0% (url first)',
|
||||
'expected': '.banner { background: url(topbanner.png) 100% top #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: url(topbanner.png) 0 top #00D repeat-y fixed; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should complement calc horizontal position (url first)',
|
||||
'expected': '.banner { background: url(topbanner.png) calc(100% - (19% + 2px)) top #00D repeat-y fixed; }',
|
||||
'input': '.banner { background: url(topbanner.png) calc(19% + 2px) top #00D repeat-y fixed; }',
|
||||
'reversable': false
|
||||
}
|
||||
]
|
||||
56
node_modules/rtlcss/test/data/properties.js
generated
vendored
Normal file
56
node_modules/rtlcss/test/data/properties.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should mirror property name: border-top-right-radius',
|
||||
'expected': 'div { border-top-left-radius:15px; }',
|
||||
'input': 'div { border-top-right-radius:15px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: border-bottom-right-radius',
|
||||
'expected': 'div { border-bottom-left-radius:15px; }',
|
||||
'input': 'div { border-bottom-right-radius:15px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: border-left',
|
||||
'expected': 'div { border-right:1px solid black; }',
|
||||
'input': 'div { border-left:1px solid black; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: border-left-color',
|
||||
'expected': 'div { border-right-color:black; }',
|
||||
'input': 'div { border-left-color:black; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: border-left-style',
|
||||
'expected': 'div { border-right-style:solid; }',
|
||||
'input': 'div { border-left-style:solid; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: border-left-width',
|
||||
'expected': 'div { border-right-width:1em; }',
|
||||
'input': 'div { border-left-width:1em; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: left',
|
||||
'expected': 'div { right:auto; }',
|
||||
'input': 'div { left:auto; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: margin-left',
|
||||
'expected': 'div { margin-right:2em; }',
|
||||
'input': 'div { margin-left:2em; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property name: padding-left',
|
||||
'expected': 'div { padding-right:2em; }',
|
||||
'input': 'div { padding-left:2em; }',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
408
node_modules/rtlcss/test/data/rtlcss-directives.js
generated
vendored
Normal file
408
node_modules/rtlcss/test/data/rtlcss-directives.js
generated
vendored
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true, clean: false)',
|
||||
'expected': '/*rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true, 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true, !important comment)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*!rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true, clean:false, !important comment)',
|
||||
'expected': '/*!rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*!rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true, 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true,greedy)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true, 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. unless forced to ignore. (autoRename:true, greedy, !important comment)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '/*!rtl:ignore*/ .right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true, 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (default)',
|
||||
'expected': '.left .ltr .bright .ultra { display:block; }',
|
||||
'input': '/*rtl:rename*/.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (clean:false)',
|
||||
'expected': '/*rtl:rename*/.left .ltr .bright .ultra { display:block; left:0;}',
|
||||
'input': '/*rtl:rename*/.right .rtl .bright .ultra { display:block; right:0;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (!important comment)',
|
||||
'expected': '.left .ltr .bright .ultra { display:block; left:0; }',
|
||||
'input': '/*!rtl:rename*/.right .rtl .bright .ultra { display:block; right:0; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (clean:false, !important comment)',
|
||||
'expected': '/*!rtl:rename*/.left .ltr .bright .ultra { display:block; left:0; }',
|
||||
'input': '/*!rtl:rename*/.right .rtl .bright .ultra { display:block; right:0; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (greedy)',
|
||||
'expected': '.left .ltr .bleft .urtla { display:block; left:0; }',
|
||||
'input': '/*rtl:rename*/.right .rtl .bright .ultra { display:block; right:0; }',
|
||||
'reversable': false,
|
||||
'options': { 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors when forced. (greedy, !important comment)',
|
||||
'expected': '.left .ltr .bleft .urtla { display:block; left:0; }',
|
||||
'input': '/*!rtl:rename*/.right .rtl .bright .ultra { display:block; right:0; }',
|
||||
'reversable': false,
|
||||
'options': { 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should prepend value. (default)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi", "Droid Sans", Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should prepend value. (clean:false)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi", "Droid Sans", Tahoma/*rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should prepend value (!important comment)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi", "Droid Sans", Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should prepend value (clean:false, !important comment)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi", "Droid Sans", Tahoma/*!rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:prepend:"Droid Arabic Kufi", */; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should replace value.',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:"Droid Arabic Kufi"*/; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should replace value.(clean:false)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi"/*rtl:"Droid Arabic Kufi"*/; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:"Droid Arabic Kufi"*/; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should replace value. (!important comment)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:"Droid Arabic Kufi"*/; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should replace value. (clean:false, !important comment)',
|
||||
'expected': 'div { font-family: "Droid Arabic Kufi"/*!rtl:"Droid Arabic Kufi"*/; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:"Droid Arabic Kufi"*/; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should append value. (default)',
|
||||
'expected': 'div { font-family: "Droid Sans", Tahoma, "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:append:, "Droid Arabic Kufi"*/; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should append value. (clean:false)',
|
||||
'expected': 'div { font-family: "Droid Sans", Tahoma/*rtl:append:, "Droid Arabic Kufi"*/, "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*rtl:append:, "Droid Arabic Kufi"*/; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should append value. (!important comment)',
|
||||
'expected': 'div { font-family: "Droid Sans", Tahoma, "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:append:, "Droid Arabic Kufi"*/; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should append value. (clean:false, !important comment)',
|
||||
'expected': 'div { font-family: "Droid Sans", Tahoma/*!rtl:append:, "Droid Arabic Kufi"*/, "Droid Arabic Kufi"; }',
|
||||
'input': 'div { font-family: "Droid Sans", Tahoma/*!rtl:append:, "Droid Arabic Kufi"*/; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should insert value. (default)',
|
||||
'expected': 'div { font-family: "Droid Sans", "Droid Arabic Kufi", Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans"/*rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should insert value. (clean:false)',
|
||||
'expected': 'div { font-family: "Droid Sans", "Droid Arabic Kufi"/*rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans"/*rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should insert value. (!important comment)',
|
||||
'expected': 'div { font-family: "Droid Sans", "Droid Arabic Kufi", Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans"/*!rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should insert value. (clean:false, !important comment)',
|
||||
'expected': 'div { font-family: "Droid Sans", "Droid Arabic Kufi"/*!rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'input': 'div { font-family: "Droid Sans"/*!rtl:insert:, "Droid Arabic Kufi"*/, Tahoma; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - rule level (default)',
|
||||
'expected': 'div { left:10px; text-align:right;}',
|
||||
'input': '/*rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - rule level (clean:false)',
|
||||
'expected': '/*rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'input': '/*rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - rule level (default, !important comment)',
|
||||
'expected': 'div { left:10px; text-align:right;}',
|
||||
'input': '/*!rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - rule level (clean:false , !important comment)',
|
||||
'expected': '/*!rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'input': '/*!rtl:ignore*/div { left:10px; text-align:right;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - decl. level (default)',
|
||||
'expected': 'div { left:10px;text-align:left;}',
|
||||
'input': 'div { left:10px/*rtl:ignore*/;text-align:right;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - decl. level (clean:false)',
|
||||
'expected': 'div { left:10px/*rtl:ignore*/;text-align:left;}',
|
||||
'input': 'div { left:10px/*rtl:ignore*/;text-align:right;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - decl. level (default, !important comment)',
|
||||
'expected': 'div { left:10px;text-align:left;}',
|
||||
'input': 'div { left:10px/*!rtl:ignore*/;text-align:right;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore flipping - decl. level (clean:false, !important comment)',
|
||||
'expected': 'div { left:10px/*!rtl:ignore*/;text-align:left;}',
|
||||
'input': 'div { left:10px/*!rtl:ignore*/;text-align:right;}',
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should add raw css rules',
|
||||
'expected': 'div {left:10px;text-align:right;} a {display:block;}',
|
||||
'input': '/*rtl:raw: div { left:10px;text-align:right;}*/ a {display:block;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should add raw css declarations',
|
||||
'expected': 'div { font-family:"Droid Kufi Arabic"; right:10px;text-align:left;}',
|
||||
'input': 'div { /*rtl:raw: font-family: "Droid Kufi Arabic";*/ left:10px;text-align:right;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should add raw css (clean:false)',
|
||||
'expected': 'div {left:10px;text-align:right;} /*rtl:raw: div { left:10px;text-align:right;}*/ a {display:block;}',
|
||||
'input': '/*rtl:raw: div { left:10px;text-align:right;}*/ a {display:block;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should add raw css declarations (clean:false)',
|
||||
'expected': 'div { font-family:"Droid Kufi Arabic"; /*rtl:raw: font-family: "Droid Kufi Arabic";*/ right:10px;text-align:left;}',
|
||||
'input': 'div { /*rtl:raw: font-family: "Droid Kufi Arabic";*/ left:10px;text-align:right;}',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should support block-style',
|
||||
'expected': ' div {left:10px; text-align:right;}',
|
||||
'input': ' div {/*rtl:begin:ignore*/left:10px;/*rtl:end:ignore*/ text-align:left;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should support none block-style',
|
||||
'expected': ' div {left:10px; text-align:left;}',
|
||||
'input': ' /*rtl:ignore*/div {left:10px; text-align:left;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should remove rules (block-style)',
|
||||
'expected': ' b{float:right;}',
|
||||
'input': ' /*rtl:begin:remove*/div {left:10px; text-align:left;} a { display:block;} /*rtl:end:remove*/ b{float:left;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should remove rules',
|
||||
'expected': ' a { display:block;} b{float:right;}',
|
||||
'input': ' /*rtl:remove*/div {left:10px; text-align:left;} a { display:block;} b{float:left;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should remove declarations',
|
||||
'expected': ' div { text-align:right;}',
|
||||
'input': ' div {/*rtl:remove*/left:10px; text-align:left;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should remove declarations (block-style)',
|
||||
'expected': ' div { display:inline;}',
|
||||
'input': ' div {/*rtl:begin:remove*/left:10px; text-align:left;/*rtl:end:remove*/ display:inline;}',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should override options',
|
||||
'expected': '.right { display:inline;}',
|
||||
'input': '/*rtl:options:{"autoRename":false}*/ .right { display:inline;}',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should support nested options override',
|
||||
'expected': '.right { display:inline;}.bleft { display:inline;}',
|
||||
'input': '/*rtl:begin:options:{"autoRename":false}*/ .right { display:inline;} /*rtl:begin:options:{"autoRename":true, "greedy": true}*/.bright { display:inline;}/*rtl:end:options*//*rtl:end:options*/',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore the target node (decl)',
|
||||
'expected': `
|
||||
.code {
|
||||
direction:ltr;
|
||||
text-align:left;
|
||||
float: right;
|
||||
text-align: left;
|
||||
}
|
||||
`,
|
||||
'input': `
|
||||
.code {
|
||||
/*rtl:ignore*/
|
||||
direction:ltr;
|
||||
/*rtl:ignore*/
|
||||
text-align:left;
|
||||
/*rtl:ignore*/
|
||||
float: right;
|
||||
/*rtl:ignore*/
|
||||
text-align: left;
|
||||
}
|
||||
`,
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore the target node (rule)',
|
||||
'expected': `
|
||||
.example-1 {
|
||||
text-align:right;
|
||||
left:10px;
|
||||
}
|
||||
.example-2 {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
.example-3 {
|
||||
right:10px;
|
||||
text-align:left;
|
||||
}
|
||||
`,
|
||||
'input': `
|
||||
/*rtl:ignore*/
|
||||
.example-1 {
|
||||
text-align:right;
|
||||
left:10px;
|
||||
}
|
||||
/*rtl:ignore*/
|
||||
.example-2 {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
.example-3 {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
`,
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should ignore the target node (atrule)',
|
||||
'expected': `
|
||||
@media screen and (max-width: 568px) {
|
||||
.example {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 568px) {
|
||||
.example {
|
||||
right:10px;
|
||||
text-align:left;
|
||||
}
|
||||
}
|
||||
`,
|
||||
'input': `
|
||||
/*rtl:ignore*/
|
||||
@media screen and (max-width: 568px) {
|
||||
.example {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 568px) {
|
||||
.example {
|
||||
left:10px;
|
||||
text-align:right;
|
||||
}
|
||||
}
|
||||
`,
|
||||
'reversable': false
|
||||
}
|
||||
]
|
||||
123
node_modules/rtlcss/test/data/rtlcss-options.js
generated
vendored
Normal file
123
node_modules/rtlcss/test/data/rtlcss-options.js
generated
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should not rename selectors unless a pair exits (autoRename:true,autoRenameStrict:true )',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'autoRenameStrict': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename selectors only if a pair exits (autoRename:true,autoRenameStrict:true )',
|
||||
'expected': '.left { display:block; } .right { display:none; }',
|
||||
'input': '.right { display:block; } .left { display:none; }',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'autoRenameStrict': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should not rename selectors having directional decl. (default)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; right:0; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; left:0; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not auto rename selectors having no directional decl. (default)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not auto rename selectors having no directional decl. (greedy)',
|
||||
'expected': '.right .rtl .bright .ultra { display:block; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': true,
|
||||
'options': { 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. (autoRename:true)',
|
||||
'expected': '.left .ltr .bright .ultra { display:block; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should auto rename selectors having no directional decl. (autoRename:true,greedy)',
|
||||
'expected': '.left .ltr .bleft .urtla { display:block; }',
|
||||
'input': '.right .rtl .bright .ultra { display:block; }',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should not auto rename when rules are flipped via directives (autoRename:true)',
|
||||
'expected': 'div.right { display:block; font-family: "Droid Sans", Tahoma, "Droid Arabic Kufi"; }',
|
||||
'input': 'div.right { display:block; font-family: "Droid Sans", Tahoma/*!rtl:append:, "Droid Arabic Kufi"*/; }',
|
||||
'reversable': false,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should not preserve processing directive. (default)',
|
||||
'expected': 'div { left:0; }',
|
||||
'input': '/*rtl:ignore*/div { left:0; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should preserve processing directive. (clean:false)',
|
||||
'expected': '/*rtl:ignore*/div { left:0; }',
|
||||
'input': '/*rtl:ignore*/div { left:0; }',
|
||||
'reversable': false,
|
||||
'options': { 'clean': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should not process string map in url (default)',
|
||||
'expected': 'div { background-image: url(ltr/left.png); right:0; }',
|
||||
'input': 'div { background-image: url(ltr/left.png); left:0; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should process urls (processUrls:true)',
|
||||
'expected': 'div { background-image: url(rtl/right.png); right:0; }',
|
||||
'input': 'div { background-image: url(ltr/left.png); left:0; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should process urls in declarations (processUrls:{decl:true})',
|
||||
'expected': 'div { background-image: url(rtl/right.png); right:0; }',
|
||||
'input': 'div { background-image: url(ltr/left.png); left:0; }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': { 'decl': true } }
|
||||
},
|
||||
{
|
||||
'should': 'Should process @import url (processUrls:true)',
|
||||
'expected': 'div{display:none;} @import url("rtl/right.css");',
|
||||
'input': 'div{display:none;} @import url("ltr/left.css");',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should process url in atrule (processUrls:{atrule:true})',
|
||||
'expected': 'div{display:none;} @import url("rtl/right.css");',
|
||||
'input': 'div{display:none;} @import url("ltr/left.css");',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': { 'atrule': true } }
|
||||
},
|
||||
{
|
||||
'should': 'Should respect word boundaries when processing @import url (processUrls:true,greedy:false)',
|
||||
'expected': 'div{display:none;} @import url("ultr/bright.css");',
|
||||
'input': 'div{display:none;} @import url("ultr/bright.css");',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true, 'greedy': false }
|
||||
},
|
||||
{
|
||||
'should': 'Should not respect word boundaries when processing @import url (processUrls:true,greedy:true)',
|
||||
'expected': 'div{display:none;} @import url("urtla/bleft.css");',
|
||||
'input': 'div{display:none;} @import url("ultra/bright.css");',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true, 'greedy': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should preserve comments inside declarations',
|
||||
'expected': 'div { border-radius: 40.25px 10.5px /*comment*/ 10.75px 40.3px; }',
|
||||
'input': 'div { border-radius: 10.5px 40.25px /*comment*/ 40.3px 10.75px; }',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
46
node_modules/rtlcss/test/data/rtlcss-plugins.js
generated
vendored
Normal file
46
node_modules/rtlcss/test/data/rtlcss-plugins.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should support plugins',
|
||||
'expected': 'div:before { content: "ABC";} div:after { content: "B";}',
|
||||
'input': 'div:before { content: "A";} div:after { content: "B";}',
|
||||
'reversable': true,
|
||||
'plugins': [
|
||||
{
|
||||
'name': 'test',
|
||||
'directives': {
|
||||
'control': {},
|
||||
'value': []
|
||||
},
|
||||
'processors': [
|
||||
{
|
||||
'name': 'content',
|
||||
'expr': /content/im,
|
||||
'action': function (prop, value, cxt) {
|
||||
if (value === '"A"') {
|
||||
return { 'prop': prop, 'value': '"ABC"' }
|
||||
} else if (value === '"ABC"') {
|
||||
return { 'prop': prop, 'value': '"A"' }
|
||||
}
|
||||
return { 'prop': prop, 'value': value }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'should': 'Should allow overriding default plugin',
|
||||
'expected': 'div { text-align:right;}',
|
||||
'input': 'div { text-align:right;}',
|
||||
'plugins': [
|
||||
{
|
||||
'name': 'rtlcss',
|
||||
'directives': {
|
||||
'control': {},
|
||||
'value': []
|
||||
},
|
||||
'processors': []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
99
node_modules/rtlcss/test/data/rtlcss-stringMap.js
generated
vendored
Normal file
99
node_modules/rtlcss/test/data/rtlcss-stringMap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should rename "left", "Left", "LEFT" (autoRename:true). ',
|
||||
'expected': 'div.right, div.Right, div.RIGHT, div.respectLeft { width:10px;}',
|
||||
'input': 'div.left, div.Left, div.LEFT, div.respectLeft { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "left", "Left", "LEFT" (autoRename:true, greedy). ',
|
||||
'expected': 'div.right, div.Right, div.RIGHT, div.respectRight { width:10px;}',
|
||||
'input': 'div.left, div.Left, div.LEFT, div.respectLeft { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': {
|
||||
'autoRename': true,
|
||||
'greedy': true
|
||||
}
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "ltr", "Ltr", "LTR" (autoRename:true). ',
|
||||
'expected': 'div.rtl, div.Rtl, div.RTL, div.Ultra { width:10px;}',
|
||||
'input': 'div.ltr, div.Ltr, div.LTR, div.Ultra { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "ltr", "Ltr", "LTR" (autoRename:true, greedy). ',
|
||||
'expected': 'div.rtl, div.Rtl, div.RTL, div.Urtla { width:10px;}',
|
||||
'input': 'div.ltr, div.Ltr, div.LTR, div.Ultra { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': {
|
||||
'autoRename': true,
|
||||
'greedy': true
|
||||
}
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "prev"/"next" (autoRename:true, custom stringMap - *)',
|
||||
'expected': 'div.next, div.Right { width:10px;}',
|
||||
'input': 'div.prev, div.Left { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "prev"/"next" (autoRename:true, custom stringMap - selector)',
|
||||
'expected': 'div.next, div.Right { width:10px;}',
|
||||
'input': 'div.prev, div.Left { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'selector' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should not rename "prev"/"next" (autoRename:true, custom stringMap - url)',
|
||||
'expected': 'div.prev, div.Right { width:10px;}',
|
||||
'input': 'div.prev, div.Left { width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should not swap "prev"/"next" in Url or Selector (autoRename:true, custom stringMap - url)',
|
||||
'expected': 'div.prev { background-image: url(/content/pix/prev.png);}',
|
||||
'input': 'div.prev { background-image: url(/content/pix/prev.png);}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should not swap "prev"/"next" in Url and Rename in selector (autoRename:true, custom stringMap - *)',
|
||||
'expected': 'div.next { display:block }; div.next { background-image: url(/content/pix/next.png);}',
|
||||
'input': 'div.prev { display:block }; div.prev { background-image: url(/content/pix/next.png);}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should swap "prev"/"next" in Url (autoRename:true, processUrls:true)',
|
||||
'expected': 'div.prev { background-image: url(/content/pix/next.png);}',
|
||||
'input': 'div.prev { background-image: url(/content/pix/prev.png);}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'processUrls': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should swap "prev"/"next" in Url and Rename in selector (autoRename:true, processUrls:true)',
|
||||
'expected': 'div.next { display:block }; div.prev { background-image: url(/content/pix/prev.png);}',
|
||||
'input': 'div.prev { display:block }; div.prev { background-image: url(/content/pix/next.png);}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'processUrls': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should rename "previous" to "nextious" (autoRename:true, greedy: true)',
|
||||
'expected': 'div.nextious{ width:10px;}',
|
||||
'input': 'div.previous{ width:10px;}',
|
||||
'reversable': true,
|
||||
'options': { 'autoRename': true, 'stringMap': [{ 'name': 'prev-next', 'search': 'prev', 'replace': 'next', 'options': { 'greedy': true } }] }
|
||||
},
|
||||
{
|
||||
'should': 'Should escape strings used in stringMap (processUrls: true, custom stringMap)',
|
||||
'expected': '@import url("//a.b/c-rtl.css"); @import url("//a.b/css");',
|
||||
'input': '@import url("//a.b/c.css"); @import url("//a.b/css");',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true, 'stringMap': [{ 'name': 'import-stylesheet', 'priority': 1, 'exclusive': true, 'search': ['.css'], 'replace': ['-rtl.css'], 'options': { 'scope': 'url' } }] }
|
||||
}
|
||||
]
|
||||
8
node_modules/rtlcss/test/data/special.js
generated
vendored
Normal file
8
node_modules/rtlcss/test/data/special.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should not negate tokens',
|
||||
'expected': 'div { box-shadow: rgba(0, 128, 128, 0.98) inset -5em 1em 0;}',
|
||||
'input': 'div { box-shadow: rgba(0, 128, 128, 0.98) inset 5em 1em 0;}',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
146
node_modules/rtlcss/test/data/transform-origin.js
generated
vendored
Normal file
146
node_modules/rtlcss/test/data/transform-origin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should mirror (x-offset: 0 means 0%)',
|
||||
'expected': 'div { transform-origin:100%; }',
|
||||
'input': 'div { transform-origin:0; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset)',
|
||||
'expected': 'div { transform-origin:90.25%; }',
|
||||
'input': 'div { transform-origin:9.75%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror calc (x-offset)',
|
||||
'expected': 'div { transform-origin: -moz-calc(100% - (((25%/2) * 10px))); }',
|
||||
'input': 'div { transform-origin: -moz-calc(((25%/2) * 10px)); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror (x-offset: not percent, not calc)',
|
||||
'expected': 'div { transform-origin:10.75px; }',
|
||||
'input': 'div { transform-origin:10.75px; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (offset-keyword)',
|
||||
'expected': 'div { transform-origin:right; }',
|
||||
'input': 'div { transform-origin:left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset y-offset: 0 means 0%)',
|
||||
'expected': 'div { transform-origin:100% 0; }',
|
||||
'input': 'div { transform-origin:0 0; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with y being calc (x-offset y-offset: 0 means 0%)',
|
||||
'expected': 'div { transform-origin:100% -webkit-calc(15% * (3/2)); }',
|
||||
'input': 'div { transform-origin:0 -webkit-calc(15% * (3/2)); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror percent (x-offset y-offset)',
|
||||
'expected': 'div { transform-origin:30.25% 10%; }',
|
||||
'input': 'div { transform-origin:69.75% 10%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with x being calc (x-offset y-offset)',
|
||||
'expected': 'div { transform-origin: -webkit-calc(100% - (15% * (3/2))) 30.25%; }',
|
||||
'input': 'div { transform-origin: -webkit-calc(15% * (3/2)) 30.25%; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with y being calc (x-offset y-offset)',
|
||||
'expected': 'div { transform-origin:30.25% calc(15% * (3/2)); }',
|
||||
'input': 'div { transform-origin:69.75% calc(15% * (3/2)); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (y-offset x-offset-keyword)',
|
||||
'expected': 'div { transform-origin:70% right; }',
|
||||
'input': 'div { transform-origin:70% left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with calc (y-offset x-offset-keyword)',
|
||||
'expected': 'div { transform-origin:-ms-calc(140%/2) right; }',
|
||||
'input': 'div { transform-origin:-ms-calc(140%/2) left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset-keyword y-offset)',
|
||||
'expected': 'div { transform-origin:right 70%; }',
|
||||
'input': 'div { transform-origin:left 70%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with calc (x-offset-keyword y-offset)',
|
||||
'expected': 'div { transform-origin:right -moz-calc(((140%/2))); }',
|
||||
'input': 'div { transform-origin:left -moz-calc(((140%/2))); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (y-offset-keyword x-offset)',
|
||||
'expected': 'div { transform-origin:top 30.25%; }',
|
||||
'input': 'div { transform-origin:top 69.75%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror with x being calc (y-offset-keyword x-offset)',
|
||||
'expected': 'div { transform-origin:top calc(100% - (((140%/2)))); }',
|
||||
'input': 'div { transform-origin:top calc(((140%/2))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset-keyword y-offset-keyword)',
|
||||
'expected': 'div { transform-origin:right top; }',
|
||||
'input': 'div { transform-origin:left top; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (y-offset-keyword x-offset-keyword)',
|
||||
'expected': 'div { transform-origin:top right; }',
|
||||
'input': 'div { transform-origin:top left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset y-offset z-offset)',
|
||||
'expected': 'div { transform-origin:80.25% 30% 10%; }',
|
||||
'input': 'div { transform-origin:19.75% 30% 10%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror with x being calc (x-offset y-offset z-offset)',
|
||||
'expected': 'div { transform-origin: calc(100% - (25% * 3 + 20px)) 30% 10%; }',
|
||||
'input': 'div { transform-origin: calc(25% * 3 + 20px) 30% 10%; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (y-offset x-offset-keyword z-offset)',
|
||||
'expected': 'div { transform-origin:20% right 10%; }',
|
||||
'input': 'div { transform-origin:20% left 10%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset-keyword y-offset z-offset)',
|
||||
'expected': 'div { transform-origin:left 20% 10%; }',
|
||||
'input': 'div { transform-origin:right 20% 10%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (x-offset-keyword y-offset-keyword z-offset)',
|
||||
'expected': 'div { transform-origin:left bottom 10%; }',
|
||||
'input': 'div { transform-origin:right bottom 10%; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror (y-offset-keyword x-offset-keyword z-offset)',
|
||||
'expected': 'div { transform-origin:bottom left 10%; }',
|
||||
'input': 'div { transform-origin:bottom right 10%; }',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
236
node_modules/rtlcss/test/data/transforms.js
generated
vendored
Normal file
236
node_modules/rtlcss/test/data/transforms.js
generated
vendored
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should mirror transform : matrix',
|
||||
'expected': 'div { transform: matrix(2, 0.1, 20.75, 2, 2, 2); }',
|
||||
'input': 'div { transform: matrix(2, -0.1, -20.75, 2, -2, 2); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): matrix',
|
||||
'expected': 'div { transform: matrix(2, 0.1, 0.75, 2, 2, 2); }',
|
||||
'input': 'div { transform: matrix(2, -0.1, -.75, 2, -2, 2); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: matrix',
|
||||
'expected': 'div { transform: matrix( -moz-calc(((25%/2) * 10px)), calc(-1*(((25%/2) * 10px))), 20.75, 2, 2, 2 ); }',
|
||||
'input': 'div { transform: matrix( -moz-calc(((25%/2) * 10px)), calc(((25%/2) * 10px)), -20.75, 2, -2, 2 ); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : matrix3d',
|
||||
'expected': 'div { transform:matrix3d(0.227114470162179, 0.127248412323519, 0, 0.000811630714323203, 0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, -165, 67, 0, 1); }',
|
||||
'input': 'div { transform:matrix3d(0.227114470162179, -0.127248412323519, 0, -0.000811630714323203, -0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, 165, 67, 0, 1); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): matrix3d',
|
||||
'expected': 'div { transform:matrix3d(0.227114470162179, 0.127248412323519, 0, 0.000811630714323203, 0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, -165, 67, 0, 1); }',
|
||||
'input': 'div { transform:matrix3d(0.227114470162179, -.127248412323519, 0, -0.000811630714323203, -0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, 165, 67, 0, 1); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc : matrix3d',
|
||||
'expected': 'div { transform:matrix3d(0.227114470162179, 0.127248412323519, 0, 0.000811630714323203, 0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, calc(-1*(((25%/2) * 10px))), 67, 0, 1); }',
|
||||
'input': 'div { transform:matrix3d(0.227114470162179, -0.127248412323519, 0, -0.000811630714323203, -0.113139853456515, 1.53997196559414, 0, 0.000596368270149729, 0, 0, 1, 0, calc(((25%/2) * 10px)), 67, 0, 1); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : translate',
|
||||
'expected': 'div { transform: translate(-10.75px); }',
|
||||
'input': 'div { transform: translate(10.75px); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): translate',
|
||||
'expected': 'div { transform: translate(-0.75px); }',
|
||||
'input': 'div { transform: translate(.75px); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: translate',
|
||||
'expected': 'div { transform: translate(-moz-calc(-1*(((25%/2) * 10px)))); }',
|
||||
'input': 'div { transform: translate(-moz-calc(((25%/2) * 10px))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : translateX',
|
||||
'expected': 'div { transform: translateX(-50.25px); }',
|
||||
'input': 'div { transform: translateX(50.25px); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): translateX',
|
||||
'expected': 'div { transform: translateX(-0.25px); }',
|
||||
'input': 'div { transform: translateX(.25px); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc : translateX',
|
||||
'expected': 'div { transform: translateX(-ms-calc(-1*(((25%/2) * 10px))))); }',
|
||||
'input': 'div { transform: translateX(-ms-calc(((25%/2) * 10px)))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : translate3d',
|
||||
'expected': 'div { transform: translate3d(-12.75px, 50%, 3em); }',
|
||||
'input': 'div { transform: translate3d(12.75px, 50%, 3em); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): translate3d',
|
||||
'expected': 'div { transform: translate3d(-0.75px, 50%, 3em); }',
|
||||
'input': 'div { transform: translate3d(.75px, 50%, 3em); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: translate3d',
|
||||
'expected': 'div { transform: translate3d(-webkit-calc(-1*(((25%/2) * 10px))))), 50%, calc(((25%/2) * 10px))))); }',
|
||||
'input': 'div { transform: translate3d(-webkit-calc(((25%/2) * 10px)))), 50%, calc(((25%/2) * 10px))))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : rotate',
|
||||
'expected': 'div { transform: rotate(-20.75deg); }',
|
||||
'input': 'div { transform: rotate(20.75deg); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): rotate',
|
||||
'expected': 'div { transform: rotate(-0.75deg); }',
|
||||
'input': 'div { transform: rotate(.75deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: rotate',
|
||||
'expected': 'div { transform: rotate(calc(-1*(((25%/2) * 10deg)))); }',
|
||||
'input': 'div { transform: rotate(calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : rotate3d',
|
||||
'expected': 'div { transform: rotate3d(10, -20.15, 10, -45.14deg); }',
|
||||
'input': 'div { transform: rotate3d(10, 20.15, 10, 45.14deg); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): rotate3d',
|
||||
'expected': 'div { transform: rotate3d(10, -20, 10, -0.14deg); }',
|
||||
'input': 'div { transform: rotate3d(10, 20, 10, .14deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: rotate3d',
|
||||
'expected': 'div { transform: rotate3d(10, -20.15, 10, calc(-1*(((25%/2) * 10deg)))); }',
|
||||
'input': 'div { transform: rotate3d(10, 20.15, 10, calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror transform : rotateX',
|
||||
'expected': 'div { transform: rotateX(45deg); }',
|
||||
'input': 'div { transform: rotateX(45deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror transform with calc: rotateX',
|
||||
'expected': 'div { transform: rotateX(calc(((25%/2) * 10deg))); }',
|
||||
'input': 'div { transform: rotateX(calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror transform : rotateY',
|
||||
'expected': 'div { transform: rotateY(45deg); }',
|
||||
'input': 'div { transform: rotateY(45deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror transform with calc: rotateY',
|
||||
'expected': 'div { transform: rotateY(calc(((25%/2) * 10deg))); }',
|
||||
'input': 'div { transform: rotateY(calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : rotateZ',
|
||||
'expected': 'div { transform: rotateZ(-45.75deg); }',
|
||||
'input': 'div { transform: rotateZ(45.75deg); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): rotateZ',
|
||||
'expected': 'div { transform: rotateZ(-0.75deg); }',
|
||||
'input': 'div { transform: rotateZ(.75deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: rotateZ',
|
||||
'expected': 'div { transform: rotateZ(-ms-calc(-1*(((25%/2) * 10deg)))); }',
|
||||
'input': 'div { transform: rotateZ(-ms-calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : skew',
|
||||
'expected': 'div { transform: skew(-20.25rad,-30deg); }',
|
||||
'input': 'div { transform: skew(20.25rad,30deg); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): skew',
|
||||
'expected': 'div { transform: skew(-0.25rad,-30deg); }',
|
||||
'input': 'div { transform: skew(.25rad,30deg); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: skew',
|
||||
'expected': 'div { transform: skew(calc(-1*(((25%/2) * 10rad))),calc(-1*(((25%/2) * 10deg)))); }',
|
||||
'input': 'div { transform: skew(calc(((25%/2) * 10rad)),calc(((25%/2) * 10deg))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : skewX',
|
||||
'expected': 'div { transform: skewX(-20.75rad); }',
|
||||
'input': 'div { transform: skewX(20.75rad); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): skewX',
|
||||
'expected': 'div { transform: skewX(-0.75rad); }',
|
||||
'input': 'div { transform: skewX(.75rad); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: skewX',
|
||||
'expected': 'div { transform: skewX(-moz-calc(-1*(((25%/2) * 10rad)))); }',
|
||||
'input': 'div { transform: skewX(-moz-calc(((25%/2) * 10rad))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform : skewY',
|
||||
'expected': 'div { transform: skewY(-10.75grad); }',
|
||||
'input': 'div { transform: skewY(10.75grad); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform (with no digits before dot): skewY',
|
||||
'expected': 'div { transform: skewY(-0.75grad); }',
|
||||
'input': 'div { transform: skewY(.75grad); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror transform with calc: skewY',
|
||||
'expected': 'div { transform: skewY(calc(-1*(((25%/2) * 10grad)))); }',
|
||||
'input': 'div { transform: skewY(calc(((25%/2) * 10grad))); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror multiple transforms : translateX translateY Rotate',
|
||||
'expected': 'div { transform: translateX(-50.25px) translateY(50.25px) rotate(-20.75deg); }',
|
||||
'input': 'div { transform: translateX(50.25px) translateY(50.25px) rotate(20.75deg); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror multiple transforms with calc : translateX translateY Rotate',
|
||||
'expected': 'div { transform: translateX(-ms-calc(-1*(((25%/2) * 10px)))) translateY(-moz-calc(((25%/2) * 10rad))) rotate(calc(-1*(((25%/2) * 10grad)))); }',
|
||||
'input': 'div { transform: translateX(-ms-calc(((25%/2) * 10px))) translateY(-moz-calc(((25%/2) * 10rad))) rotate(calc(((25%/2) * 10grad))); }',
|
||||
'reversable': false
|
||||
}
|
||||
]
|
||||
104
node_modules/rtlcss/test/data/values-n-syntax.js
generated
vendored
Normal file
104
node_modules/rtlcss/test/data/values-n-syntax.js
generated
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (4 values)',
|
||||
'expected': 'div { border-radius: 40.25px 10.5px 10.75px 40.3px; }',
|
||||
'input': 'div { border-radius: 10.5px 40.25px 40.3px 10.75px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (3 values)',
|
||||
'expected': 'div { border-radius: 40.75px 10.75px 40.75px 40.3px; }',
|
||||
'input': 'div { border-radius: 10.75px 40.75px 40.3px; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (2 values)',
|
||||
'expected': 'div { border-radius: 40.25px 10.75px; }',
|
||||
'input': 'div { border-radius: 10.75px 40.25px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (4 values - double)',
|
||||
'expected': 'div { border-radius: 40.25px 10.75px .5px 40.75px / .4em 1em 1em 4.5em; }',
|
||||
'input': 'div { border-radius: 10.75px 40.25px 40.75px .5px / 1em .4em 4.5em 1em; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (3 values - double)',
|
||||
'expected': 'div { border-radius: .40px 10.5px .40px 40px / 4em 1em 4em 3em; }',
|
||||
'input': 'div { border-radius: 10.5px .40px 40px / 1em 4em 3em; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-radius (2 values- double)',
|
||||
'expected': 'div { border-radius: 40px 10px / 2.5em .75em; }',
|
||||
'input': 'div { border-radius: 10px 40px / .75em 2.5em; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-width',
|
||||
'expected': 'div { border-width: 1px 4px .3em 2.5em; }',
|
||||
'input': 'div { border-width: 1px 2.5em .3em 4px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-width (none length)',
|
||||
'expected': 'div { border-width: thin medium thick none; }',
|
||||
'input': 'div { border-width: thin none thick medium; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-style (4 values)',
|
||||
'expected': 'div { border-style: none dashed dotted solid; }',
|
||||
'input': 'div { border-style: none solid dotted dashed; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: border-color (4 values)',
|
||||
'expected': 'div { border-color: rgba(255, 255, 255, 1) rgb( 0, 0, 0) #000 hsla(0, 100%, 50%, 1); }',
|
||||
'input': 'div { border-color: rgba(255, 255, 255, 1) hsla(0, 100%, 50%, 1) #000 rgb( 0, 0, 0); }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror property value: border-color (3 values)',
|
||||
'expected': 'div { border-color: #000 rgb( 0, 0, 0) hsla(0, 100%, 50%, 1); }',
|
||||
'input': 'div { border-color: #000 rgb( 0, 0, 0) hsla(0, 100%, 50%, 1); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should not mirror property value: border-color (2 values)',
|
||||
'expected': 'div { border-color:rgb( 0, 0, 0) hsla(0, 100%, 50%, 1); }',
|
||||
'input': 'div { border-color:rgb( 0, 0, 0) hsla(0, 100%, 50%, 1); }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: margin',
|
||||
'expected': 'div { margin: .1em auto 3.5rem 2px; }',
|
||||
'input': 'div { margin: .1em 2px 3.5rem auto; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: padding',
|
||||
'expected': 'div { padding: 1px 4px .3rem 2.5em; }',
|
||||
'input': 'div { padding: 1px 2.5em .3rem 4px; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: box-shadow',
|
||||
'expected': 'div { box-shadow: -60px -16px rgba(0, 128, 128, 0.98), -10.25px 5px 5px #ff0, inset -0.5em 1em 0 white; }',
|
||||
'input': 'div { box-shadow: 60px -16px rgba(0, 128, 128, 0.98), 10.25px 5px 5px #ff0, inset 0.5em 1em 0 white; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: text-shadow',
|
||||
'expected': 'div { text-shadow: -60px -16px rgba(0, 128, 128, 0.98), -10.25px 5px 5px #ff0, inset -0.5em 1em 0 white; }',
|
||||
'input': 'div { text-shadow: 60px -16px rgba(0, 128, 128, 0.98), 10.25px 5px 5px #ff0, inset 0.5em 1em 0 white; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value (no digit before the dot): box-shadow, text-shadow',
|
||||
'expected': 'div { box-shadow: inset -0.5em 1em 0 white; text-shadow: inset -0.5em 1em 0 white; }',
|
||||
'input': 'div { box-shadow: inset .5em 1em 0 white; text-shadow: inset .5em 1em 0 white; }',
|
||||
'reversable': false
|
||||
}
|
||||
]
|
||||
69
node_modules/rtlcss/test/data/values.js
generated
vendored
Normal file
69
node_modules/rtlcss/test/data/values.js
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
module.exports = [
|
||||
{
|
||||
'should': 'Should mirror property value: clear',
|
||||
'expected': 'div { clear:right; }',
|
||||
'input': 'div { clear:left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: direction',
|
||||
'expected': 'div { direction:ltr; }',
|
||||
'input': 'div { direction:rtl; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: float',
|
||||
'expected': 'div { float:right; }',
|
||||
'input': 'div { float:left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: text-align',
|
||||
'expected': 'div { text-align:right; }',
|
||||
'input': 'div { text-align:left; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: cursor nw',
|
||||
'expected': 'div { cursor:nw-resize; }',
|
||||
'input': 'div { cursor:ne-resize; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: cursor sw',
|
||||
'expected': 'div { cursor:sw-resize; }',
|
||||
'input': 'div { cursor:se-resize; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: cursor nesw',
|
||||
'expected': 'div { cursor:nesw-resize; }',
|
||||
'input': 'div { cursor:nwse-resize; }',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should keep property value as is: cursor ew',
|
||||
'expected': 'div { cursor:ew-resize; }',
|
||||
'input': 'div { cursor:ew-resize; }',
|
||||
'reversable': false
|
||||
},
|
||||
{
|
||||
'should': 'Should process string map in url: cursor (processUrls: true)',
|
||||
'expected': '.foo { cursor: url(right.cur), url(rtl.cur), se-resize, auto }',
|
||||
'input': '.foo { cursor: url(left.cur), url(ltr.cur), sw-resize, auto }',
|
||||
'reversable': true,
|
||||
'options': { 'processUrls': true }
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: transition',
|
||||
'expected': '.foo { transition: right .3s ease .1s, left .3s ease .1s, margin-right .3s ease, margin-left .3s ease, padding-right .3s ease, padding-left .3s ease}',
|
||||
'input': '.foo { transition: left .3s ease .1s, right .3s ease .1s, margin-left .3s ease, margin-right .3s ease, padding-left .3s ease, padding-right .3s ease}',
|
||||
'reversable': true
|
||||
},
|
||||
{
|
||||
'should': 'Should mirror property value: transition-property',
|
||||
'expected': '.foo { transition-property: right; }',
|
||||
'input': '.foo { transition-property: left; }',
|
||||
'reversable': true
|
||||
}
|
||||
]
|
||||
42
node_modules/rtlcss/test/test.js
generated
vendored
Normal file
42
node_modules/rtlcss/test/test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/* global describe */
|
||||
/* global it */
|
||||
var assert = require('assert')
|
||||
var rtlcss = require('../lib/rtlcss.js')
|
||||
var tests = {
|
||||
'# Background:': require('./data/background.js'),
|
||||
'# Background Image:': require('./data/background-image.js'),
|
||||
'# Background Position:': require('./data/background-position.js'),
|
||||
'# Properties:': require('./data/properties.js'),
|
||||
'# Values:': require('./data/values.js'),
|
||||
'# Values (N Value Syntax):': require('./data/values-n-syntax.js'),
|
||||
'# Transforms:': require('./data/transforms.js'),
|
||||
'# Transform Origin:': require('./data/transform-origin.js'),
|
||||
'# RTLCSS (Options):': require('./data/rtlcss-options.js'),
|
||||
'# RTLCSS (Directives):': require('./data/rtlcss-directives.js'),
|
||||
'# RTLCSS (String Map):': require('./data/rtlcss-stringMap.js'),
|
||||
'# RTLCSS (Plugins):': require('./data/rtlcss-plugins.js'),
|
||||
'# Special:': require('./data/special.js')
|
||||
}
|
||||
var key
|
||||
for (key in tests) {
|
||||
var group = tests[key]
|
||||
describe(key, function () {
|
||||
for (var i = 0; i < group.length; i++) {
|
||||
var item = group[i]
|
||||
;(function (test) {
|
||||
it(test.should, function (done) {
|
||||
assert.equal(rtlcss.process(test.input, test.options, test.plugins), test.expected)
|
||||
done()
|
||||
})
|
||||
})(item)
|
||||
if (item.reversable) {
|
||||
(function (test) {
|
||||
it(test.should + ' <REVERESE>', function (done) {
|
||||
assert.equal(rtlcss.process(test.expected, test.options, test.plugins), test.input)
|
||||
done()
|
||||
})
|
||||
})(item)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue