fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

316
node_modules/rtlcss/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,316 @@
# 3.5.0 - 02 Nov. 2021
* Update dependencies. **Thanks @XhmikosR**
* Internal code cleanup/formatting. **Thanks @XhmikosR**
# 3.4.0 - 18 Oct. 2021
* Support flipping `object-position`.
* Update dev. dependencies.
# 3.3.0 - 08 Jul. 2021
* Add `processEnv` option to support flipping agent-defined environment variables (`safe-area-inset-left`, `safe-area-inset-right`).
# 3.2.1 - 22 Jun. 2021
* Bump [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
# 3.2.0 - 23 May. 2021
* Add `aliases` option to support processing Custom Properties (CSS Variables). **Thanks @elchininet**
# 3.1.2 - 04 Feb. 2021
* Update `README.md`.
# 3.1.1 - 02 Feb. 2021
* Fixes `TypeError` when placing value directive before `!important`. [#218](https://github.com/MohammadYounes/rtlcss/issues/218)
# 3.1.0 - 30 Jan. 2021
* Use `strict` mode across all files. **Thanks @XhmikosR**
* Decrease package size by around 6%. **Thanks @XhmikosR**
* Add guards against prototype pollution. **Thanks @XhmikosR**
* Allow value directives to be placed any where inside the declaration value.
* Handle value directives placed after `!important`.
* Fix reading config file sources ([#209](https://github.com/MohammadYounes/rtlcss/issues/209)).
# 3.0.0 - 10 Dec. 2020
* Upgrade to [POSTCSS] 8.
* Dropped **Node.js 6.x, 8.x, 11.x, and 13.x** versions.
## 2.6.2 - 01 Dec. 2020
* Set input source to same file in raw directive ([#180](https://github.com/MohammadYounes/rtlcss/issues/180)).
## 2.6.1 - 15 Oct. 2020
* Remove colors dependency from findup ([#177](https://github.com/MohammadYounes/rtlcss/pull/177)).
## 2.6.0 - 15 Aug. 2020
* Support flipping `perspective-origin` ([#167](https://github.com/MohammadYounes/rtlcss/pull/167)).
* CLI: Fix empty output when `--silent` and `--stdin` flags are used together (Fixes [#169](https://github.com/MohammadYounes/rtlcss/issues/169)).
* Enable flipping `rotateY`.
* Fix flipping `rotate3d`.
## 2.5.0 - 08 Feb. 2020
* `useCalc` to flip unit based `transform-origin`.
* CLI: use `console.log` instead of the [deprecated](https://nodejs.org/docs/latest-v10.x/api/util.html#util_util_print_strings) `util.print`(issue #156).
## 2.4.1 - 28 Nov. 2019
* Ignore white spaces before directives prefix.
## 2.4.0 - 20 Jun. 2018
* New Option:
* `useCalc` (default: `false`) to flip unit based `background-position` using `calc`. **Thanks @zoreet**
## 2.3.0 - 9 Jun. 2018
* Skip processing CSS variables. **Thanks @danfooo**
## 2.2.1 - 9 Nov. 2017
* Fixes a bug in flipping `background-position` having keywords only (Fixes [#107](https://github.com/MohammadYounes/rtlcss/issues/107)).
## 2.2.0 - 7 Jun. 2017
* Support for pre/post hooks.
* Upgrade to [POSTCSS] v6.x
## 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*/`.
* Support 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 certain 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.
[POSTCSS]: https://postcss.org/

21
node_modules/rtlcss/LICENSE generated vendored Normal file
View 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.

36
node_modules/rtlcss/README.md generated vendored Normal file
View File

@@ -0,0 +1,36 @@
# RTLCSS
[![Join the chat at https://gitter.im/MohammadYounes/rtlcss](https://img.shields.io/gitter/room/MohammadYounes/rtlcss?color=%2340aa8b)](https://gitter.im/MohammadYounes/rtlcss)
<img src="https://github.com/MohammadYounes/rtlcss/blob/master/.github/logo.svg" alt="" align="right" width="100" height="100" title="RTLCSS">
[![GitHub version](https://img.shields.io/github/v/tag/MohammadYounes/rtlcss)](https://github.com/MohammadYounes/rtlcss/releases)
[![npm version](https://img.shields.io/npm/v/rtlcss)](https://www.npmjs.com/package/rtlcss)
[![Build Status](https://img.shields.io/github/workflow/status/MohammadYounes/rtlcss/CI/master?label=CI&logo=github)](https://github.com/MohammadYounes/rtlcss/actions?query=workflow%3ACI+branch%3Amaster)
[![Dependencies](https://img.shields.io/david/MohammadYounes/rtlcss)](https://david-dm.org/MohammadYounes/rtlcss)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-blue)](https://standardjs.com/)
[![editor](https://img.shields.io/badge/editor-vscode-blue)](https://code.visualstudio.com/)
[![Twitter](https://img.shields.io/badge/follow-%40rtlcss-blue)](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 <https://rtlcss.com/learn/>
## Playground
Visit <https://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 is saving you and your team a tremendous amount of time and effort? [Buy Me a Coffee ☕](https://www.paypal.me/MohammadYounes)

286
node_modules/rtlcss/bin/rtlcss.js generated vendored Executable file
View File

@@ -0,0 +1,286 @@
#!/usr/bin/env node
'use strict'
const path = require('path')
const fs = require('fs')
const picocolors = require('picocolors')
const postcss = require('postcss')
const rtlcss = require('../lib/rtlcss.js')
const configLoader = require('../lib/config-loader.js')
const { version, bugs } = require('../package.json')
const HELP_TEXT = `Usage: rtlcss [option option=parameter ...] [source] [destination]
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,--directory Process all *.css files from input directory (recursive).
-e,--ext Used with -d option to set the output files extension.
Default: ".rtl.css".
-s,--silent Silent mode, no warnings or errors are printed.
*If no destination is specified, output will be written to the same input folder as {source}.rtl.{ext}
`
let input, output, directory, ext, config, currentErrorcode, arg
const args = process.argv.slice(2)
let shouldBreak = false
process.on('exit', () => { process.reallyExit(currentErrorcode) })
function printWarning (...args) {
console.warn(picocolors.yellow(...args))
}
function printInfo (...args) {
console.info(picocolors.green(...args))
}
function printError (...args) {
console.error(picocolors.red(...args))
}
function printHelp () {
console.log(HELP_TEXT)
printInfo(`RTLCSS version: ${version}`)
printInfo(`Report issues to: ${bugs.url}`)
}
while ((arg = args.shift())) {
switch (arg) {
case '-h':
case '--help':
printHelp()
shouldBreak = true
break
case '-v':
case '--version':
printInfo(`rtlcss version: ${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 = () => {}
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 {
let 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) {
const extension = path.extname(input)
output = extension ? input.replace(extension, `.rtl${extension}`) : `${input}.rtl`
} else {
output = input
}
}
const processCSSFile = (error, data, outputName) => {
if (error) {
printError(`rtlcss: ${error.message}`)
return
}
let result
const 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) {
let savePath = outputName
if (directory !== true) {
savePath = output
}
printInfo('Saving:', savePath)
fs.writeFile(savePath, result.css, (err) => {
if (err) printError(err)
})
if (result.map) {
fs.writeFile(`${savePath}.map`, result.map, (err) => {
if (err) printError(err)
})
}
} else {
process.stdout.write(`${result.css}\n`)
}
}
const walk = (dir, done) => {
fs.readdir(dir, (error, list) => {
if (error) {
return done(error)
}
let i = 0;
(function next () {
let file = list[i++]
if (!file) {
return done(null)
}
file = dir + path.sep + file
fs.stat(file, (err, stat) => {
if (err) {
printError(err)
} else if (stat && stat.isDirectory()) {
walk(file, (err) => {
if (err) {
printError(err)
} else {
next()
}
})
} else {
// process only *.css files
if (file.endsWith('.css')) {
// compute output directory
const relativePath = path.relative(input, file).split(path.sep)
relativePath.pop()
relativePath.push(path.basename(file).replace('.css', ext || '.rtl.css'))
// set rtl filename
const rtlFile = path.join(output, relativePath.join(path.sep))
// create output directory if it does not exist
const dirName = path.dirname(rtlFile)
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName, { recursive: true })
}
// read and process the file.
fs.readFile(file, 'utf8', (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, (error, stat) => {
if (error) {
printError(error)
} else if (stat && stat.isDirectory()) {
printError('rtlcss: Input expected to be a file, use the -d option to process a directory.')
} else {
fs.readFile(input, 'utf8', (e, data) => {
try {
processCSSFile(e, data)
} catch (e) {
printError('rtlcss: error processing file', input)
printError(e)
}
})
}
})
} else {
walk(input, (error) => {
if (error) {
printError(`rtlcss: ${error}`)
}
})
}
} else {
process.stdin.resume()
process.stdin.setEncoding('utf8')
let buffer = ''
process.stdin.on('data', (data) => {
buffer += data
})
process.on('SIGINT', () => {
processCSSFile(false, buffer)
process.exit()
})
process.stdin.on('end', () => {
processCSSFile(false, buffer)
})
}
}

92
node_modules/rtlcss/lib/config-loader.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
'use strict'
const fs = require('fs')
const path = require('path')
const findUp = require('find-up')
const stripJSONComments = require('strip-json-comments')
let config = {}
const configSources = ['package.json', '.rtlcssrc', '.rtlcss.json']
const environments = [
process.env.USERPROFILE,
process.env.HOMEPATH,
process.env.HOME
]
const readConfig = (configFilePath) => {
return JSON.parse(stripJSONComments(fs.readFileSync(configFilePath, 'utf-8').trim()))
}
module.exports.load = (configFilePath, cwd, overrides) => {
if (configFilePath) {
return override(readConfig(configFilePath), overrides)
}
const directory = cwd || process.cwd()
config = loadConfig(directory)
if (!config) {
for (const environment of environments) {
if (!environment) {
continue
}
config = loadConfig(environment)
if (config) {
break
}
}
}
if (config) {
override(config, overrides)
}
return config
}
function loadConfig (cwd) {
for (const source of configSources) {
let foundPath
try {
foundPath = findUp.sync(source, { cwd })
} catch (e) {
continue
}
if (foundPath) {
const configFilePath = path.normalize(foundPath)
try {
config = readConfig(configFilePath)
} 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 (const p in from) {
if (Object.prototype.hasOwnProperty.call(from, p)) {
if (Object.prototype.hasOwnProperty.call(to, p) && typeof to[p] === 'object') {
override(to[p], from[p])
} else {
to[p] = from[p]
}
}
}
}
return to
}

103
node_modules/rtlcss/lib/config.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
'use strict'
let options
const config = {}
const corePlugin = require('./plugin.js')
function sort (arr) {
return arr.sort((a, b) => a.priority - b.priority)
}
function optionOrDefault (option, def) {
return option in options ? options[option] : def
}
function addKey (key, def) {
config[key] = optionOrDefault(key, def)
}
function main (opts, plugins, hooks) {
options = opts || {}
hooks = hooks || {}
addKey('autoRename', false)
addKey('autoRenameStrict', false)
addKey('blacklist', {})
addKey('clean', true)
addKey('greedy', false)
addKey('processUrls', false)
addKey('stringMap', [])
addKey('useCalc', false)
addKey('aliases', {})
addKey('processEnv', true)
// default strings map
if (Array.isArray(config.stringMap)) {
let hasLeftRight, hasLtrRtl
for (const map of config.stringMap) {
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 }
})
}
sort(config.stringMap)
}
// plugins
config.plugins = []
if (Array.isArray(plugins)) {
if (!plugins.some((plugin) => plugin.name === 'rtlcss')) {
config.plugins.push(corePlugin)
}
config.plugins = config.plugins.concat(plugins)
} else if (!plugins || plugins.name !== 'rtlcss') {
config.plugins.push(corePlugin)
}
sort(config.plugins)
// hooks
config.hooks = {
pre () {},
post () {}
}
if (typeof hooks.pre === 'function') {
config.hooks.pre = hooks.pre
}
if (typeof hooks.post === 'function') {
config.hooks.post = hooks.post
}
return config
}
module.exports.configure = main

46
node_modules/rtlcss/lib/directive-parser.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict'
module.exports = (comment) => {
let pos = 0
let value = comment.text
const match = value.match(/^\s*!?\s*rtl:/)
let meta
if (match) {
meta = {
source: comment,
name: '',
param: '',
begin: true,
end: true,
blacklist: false,
preserve: false
}
value = value.slice(match[0].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
}

543
node_modules/rtlcss/lib/plugin.js generated vendored Normal file
View File

@@ -0,0 +1,543 @@
'use strict'
const config = require('./config.js')
const 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 (node, metadata, context) {
// find the ending node in case of self closing directive
if (!this.endNode && metadata.begin && metadata.end) {
let n = node
while (n && n.nodes) {
n = n.nodes[n.nodes.length - 1]
}
this.endNode = n
}
let prevent = true
if (node.type === 'comment' && node.text.match(/^\s*!?\s*rtl:end:ignore/)) {
prevent = false
}
return prevent
},
end (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 (node, metadata, context) {
node.selector = context.util.applyStringMap(node.selector, false)
return false
},
end (node, context) {
return true
}
},
raw: {
expect: { self: true },
begin (node, metadata, context) {
const nodes = context.postcss.parse(metadata.param, { from: node.source.input.from })
nodes.walk((node) => {
node[context.symbol] = true
})
node.parent.insertBefore(node, nodes)
return true
},
end (node, context) {
return true
}
},
remove: {
expect: { atrule: true, rule: true, decl: true },
begin (node, metadata, context) {
let prevent = false
switch (node.type) {
case 'atrule':
case 'rule':
case 'decl':
prevent = true
node.remove()
}
return prevent
},
end (node, metadata, context) {
return true
}
},
options: {
expect: { self: true },
stack: [],
begin (node, metadata, context) {
this.stack.push(util.extend({}, context.config))
let options
try {
options = JSON.parse(metadata.param)
} catch (e) {
throw node.error('Invalid options object', { details: e })
}
context.config = config.configure(options, context.config.plugins)
context.util = util.configure(context.config)
return true
},
end (node, metadata, context) {
const config = this.stack.pop()
if (config && !metadata.begin) {
context.config = config
context.util = util.configure(context.config)
}
return true
}
},
config: {
expect: { self: true },
stack: [],
begin (node, metadata, context) {
this.stack.push(util.extend({}, context.config))
let configuration
try {
configuration = eval(`(${metadata.param})`) // eslint-disable-line no-eval
} catch (e) {
throw node.error('Invalid config object', { details: e })
}
context.config = config.configure(configuration.options, configuration.plugins)
context.util = util.configure(context.config)
return true
},
end (node, metadata, context) {
const config = this.stack.pop()
if (config && !metadata.begin) {
context.config = config
context.util = util.configure(context.config)
}
return true
}
}
},
value: [
{
name: 'ignore',
action (decl, expr, context) {
return true
}
},
{
name: 'prepend',
action (decl, expr, context) {
let prefix = ''
const hasRawValue = decl.raws.value && decl.raws.value.raw
const raw = `${decl.raws.between.substr(1).trim()}${hasRawValue ? decl.raws.value.raw : decl.value}${decl.important ? decl.raws.important.substr(9).trim() : ''}`
raw.replace(expr, (m, v) => {
prefix += v
})
decl.value = hasRawValue
? (decl.raws.value.raw = prefix + decl.raws.value.raw)
: prefix + decl.value
return true
}
},
{
name: 'append',
action (decl, expr, context) {
let suffix = ''
const hasRawValue = decl.raws.value && decl.raws.value.raw
const raw = `${decl.raws.between.substr(1).trim()}${hasRawValue ? decl.raws.value.raw : decl.value}${decl.important ? decl.raws.important.substr(9).trim() : ''}`
raw.replace(expr, (m, v) => {
suffix = v + suffix
})
decl.value = hasRawValue ? (decl.raws.value.raw += suffix) : decl.value + suffix
return true
}
},
{
name: 'insert',
action (decl, expr, context) {
const hasRawValue = decl.raws.value && decl.raws.value.raw
const raw = `${decl.raws.between.substr(1).trim()}${hasRawValue ? decl.raws.value.raw : decl.value}${decl.important ? decl.raws.important.substr(9).trim() : ''}`
const result = raw.replace(expr, (match, value) => hasRawValue ? value + match : value)
decl.value = hasRawValue ? (decl.raws.value.raw = result) : result
return true
}
},
{
name: '',
action (decl, expr, context) {
const hasRawValue = decl.raws.value && decl.raws.value.raw
const raw = `${decl.raws.between.substr(1).trim()}${hasRawValue ? decl.raws.value.raw : ''}${decl.important ? decl.raws.important.substr(9).trim() : ''}`
raw.replace(expr, (match, value) => {
decl.value = hasRawValue
? (decl.raws.value.raw = value + match)
: value
})
return true
}
}
]
},
processors: [
{
name: 'variable',
expr: /^--/im,
action (prop, value) {
return { prop, value }
}
},
{
name: 'direction',
expr: /direction/im,
action (prop, value, context) {
return { prop, value: context.util.swapLtrRtl(value) }
}
},
{
name: 'left',
expr: /left/im,
action (prop, value, context) {
return { prop: prop.replace(this.expr, () => 'right'), value }
}
},
{
name: 'right',
expr: /right/im,
action (prop, value, context) {
return { prop: prop.replace(this.expr, () => 'left'), value }
}
},
{
name: 'four-value syntax',
expr: /^(margin|padding|border-(color|style|width))$/ig,
cache: null,
action (prop, value, context) {
if (this.cache === null) {
this.cache = {
match: /[^\s\uFFFD]+/g
}
}
const state = context.util.guardFunctions(value)
const result = state.value.match(this.cache.match)
if (result && result.length === 4 && (state.store.length > 0 || result[1] !== result[3])) {
let i = 0
state.value = state.value.replace(this.cache.match, () => result[(4 - i++) % 4])
}
return { prop, value: context.util.unguardFunctions(state) }
}
},
{
name: 'border radius',
expr: /border-radius/ig,
cache: null,
flip (value) {
const parts = value.match(this.cache.match)
let i
if (parts) {
switch (parts.length) {
case 2:
i = 1
if (parts[0] !== parts[1]) {
value = value.replace(this.cache.match, () => parts[i--])
}
break
case 3:
// preserve leading whitespace.
value = value.replace(this.cache.white, (m) => `${m + parts[1]} `)
break
case 4:
i = 0
if (parts[0] !== parts[1] || parts[2] !== parts[3]) {
value = value.replace(this.cache.match, () => parts[(5 - i++) % 4])
}
break
}
}
return value
},
action (prop, value, context) {
if (this.cache === null) {
this.cache = {
match: /[^\s\uFFFD]+/g,
slash: /[^/]+/g,
white: /(^\s*)/
}
}
const state = context.util.guardFunctions(value)
state.value = state.value.replace(this.cache.slash, (m) => this.flip(m))
return { prop, value: context.util.unguardFunctions(state) }
}
},
{
name: 'shadow',
expr: /shadow/ig,
cache: null,
action (prop, value, context) {
if (this.cache === null) {
this.cache = {
replace: /[^,]+/g
}
}
const colorSafe = context.util.guardHexColors(value)
const funcSafe = context.util.guardFunctions(colorSafe.value)
funcSafe.value = funcSafe.value.replace(this.cache.replace, (m) => context.util.negate(m))
colorSafe.value = context.util.unguardFunctions(funcSafe)
return { prop, value: context.util.unguardHexColors(colorSafe) }
}
},
{
name: 'transform and perspective origin',
expr: /(?:transform|perspective)-origin/ig,
cache: null,
flip (value, context) {
if (value === '0') {
value = '100%'
} else if (value.match(this.cache.percent)) {
value = context.util.complement(value)
} else if (value.match(this.cache.length)) {
value = context.util.flipLength(value)
}
return value
},
action (prop, value, context) {
if (this.cache === null) {
this.cache = {
match: context.util.regex(['calc', 'percent', 'length'], 'g'),
percent: context.util.regex(['calc', 'percent'], 'i'),
length: context.util.regex(['length'], 'gi'),
xKeyword: /(left|right)/i
}
}
if (value.match(this.cache.xKeyword)) {
value = context.util.swapLeftRight(value)
} else {
const state = context.util.guardFunctions(value)
const 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, () => parts.shift())
value = context.util.unguardFunctions(state)
}
}
return { prop, value }
}
},
{
name: 'transform',
expr: /^(?!text-).*?transform$/ig,
cache: null,
flip (value, process, context) {
let i = 0
return value.replace(this.cache.unit, (num) => process(++i, num))
},
flipMatrix (value, context) {
return this.flip(value, (i, num) => {
if (i === 2 || i === 3 || i === 5) {
return context.util.negate(num)
}
return num
}, context)
},
flipMatrix3D (value, context) {
return this.flip(value, (i, num) => {
if (i === 2 || i === 4 || i === 5 || i === 13) {
return context.util.negate(num)
}
return num
}, context)
},
flipRotate3D (value, context) {
return this.flip(value, (i, num) => {
if (i === 1 || i === 4) {
return context.util.negate(num)
}
return num
}, context)
},
action (prop, value, context) {
if (this.cache === null) {
this.cache = {
negatable: /((translate)(x|3d)?|rotate(z|y)?)$/ig,
unit: context.util.regex(['calc', 'number'], 'g'),
matrix: /matrix$/i,
matrix3D: /matrix3d$/i,
skewXY: /skew(x|y)?$/i,
rotate3D: /rotate3d$/i
}
}
const state = context.util.guardFunctions(value)
return {
prop,
value: context.util.unguardFunctions(state, (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
})
}
}
},
{
name: 'transition',
expr: /transition(-property)?$/i,
action (prop, value, context) {
return { prop, value: context.util.swapLeftRight(value) }
}
},
{
name: 'background',
expr: /(background|object)(-position(-x)?|-image)?$/i,
cache: null,
flip (value, context) {
const state = util.saveTokens(value, true)
const parts = state.value.match(this.cache.match)
if (parts && parts.length > 0) {
const keywords = (state.value.match(this.cache.position) || '').length
if (/* edge offsets */ parts.length >= 3 || /* keywords only */ keywords === 2) {
state.value = util.swapLeftRight(state.value)
} else {
parts[0] = parts[0] === '0'
? '100%'
: (parts[0].match(this.cache.percent)
? context.util.complement(parts[0])
: (parts[0].match(this.cache.length)
? context.util.flipLength(parts[0])
: context.util.swapLeftRight(parts[0])))
state.value = state.value.replace(this.cache.match, () => parts.shift())
}
}
return util.restoreTokens(state)
},
update (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 (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'),
position: context.util.regex(['position'], 'g'),
length: context.util.regex(['length'], 'gi'),
gradient: /gradient$/i,
angle: /\d+(deg|g?rad|turn)/i,
url: /^url/i
}
}
const colorSafe = context.util.guardHexColors(value)
const funcSafe = context.util.guardFunctions(colorSafe.value)
const parts = funcSafe.value.split(',')
const lprop = prop.toLowerCase()
if (lprop !== 'background-image') {
for (let x = 0; x < parts.length; x++) {
parts[x] = this.flip(parts[x], context)
}
}
funcSafe.value = parts.join(',')
colorSafe.value = context.util.unguardFunctions(funcSafe, this.update.bind(this, context))
return {
prop,
value: context.util.unguardHexColors(colorSafe)
}
}
},
{
name: 'keyword',
expr: /float|clear|text-align/i,
action (prop, value, context) {
return { prop, value: context.util.swapLeftRight(value) }
}
},
{
name: 'cursor',
expr: /cursor/i,
cache: null,
update (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 (value) {
return value.replace(this.cache.replace, (s, m) => {
return s.replace(m, m.replace(this.cache.e, '*')
.replace(this.cache.w, 'e')
.replace(this.cache.star, 'w'))
})
},
action (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
}
}
const state = context.util.guardFunctions(value)
state.value = state.value.split(',')
.map((part) => this.flip(part))
.join(',')
return {
prop,
value: context.util.unguardFunctions(state, this.update.bind(this, context))
}
}
}
]
}

235
node_modules/rtlcss/lib/rtlcss.js generated vendored Normal file
View File

@@ -0,0 +1,235 @@
/**
* RTLCSS https://github.com/MohammadYounes/rtlcss
* Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL).
* Copyright 2017 Mohammad Younes.
* Licensed under MIT <https://opensource.org/licenses/mit-license.php>
*/
'use strict'
const postcss = require('postcss')
const state = require('./state.js')
const config = require('./config.js')
const util = require('./util.js')
module.exports = (options, plugins, hooks) => {
const processed = Symbol('processed')
const configuration = config.configure(options, plugins, hooks)
const context = {
// provides access to postcss
postcss,
// provides access to the current configuration
config: configuration,
// provides access to utilities object
util: util.configure(configuration),
// processed symbol
symbol: processed
}
let flipped = 0
const toBeRenamed = {}
function shouldProcess (node, result) {
if (!node[processed]) {
let prevent = false
state.walk((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)
}
}
})
node[processed] = true
return !prevent
}
return false
}
return {
postcssPlugin: 'rtlcss',
Once (root, { result }) {
context.config.hooks.pre(root, postcss)
shouldProcess(root, result)
},
Rule (node, { result }) {
if (shouldProcess(node, result)) {
// new rule, reset flipped decl count to zero
flipped = 0
}
},
AtRule (node, { result }) {
if (shouldProcess(node, result) &&
// @rules requires url flipping only
(context.config.processUrls === true || context.config.processUrls.atrule === true)
) {
const params = context.util.applyStringMap(node.params, true)
node.params = params
}
},
Comment (node, { result }) {
if (shouldProcess(node, result)) {
state.parse(node, result, (current) => {
let push = true
if (current.directive === null) {
current.preserve = !context.config.clean
context.util.each(context.config.plugins, (plugin) => {
const 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) &&
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
})
}
},
Declaration (node, { result }) {
if (shouldProcess(node, result)) {
// if broken by a matching value directive .. break
if (!context.util.each(context.config.plugins, (plugin) => {
return context.util.each(plugin.directives.value, (directive) => {
const hasRawValue = node.raws.value && node.raws.value.raw
const expr = context.util.regexDirective(directive.name)
if (expr.test(`${node.raws.between}${hasRawValue ? node.raws.value.raw : ''}${node.important && node.raws.important ? node.raws.important : ''}`)) {
expr.lastIndex = 0
if (directive.action(node, expr, context)) {
if (context.config.clean) {
node.raws.between = context.util.trimDirective(node.raws.between)
if (node.important && node.raws.important) {
node.raws.important = context.util.trimDirective(node.raws.important)
}
if (hasRawValue) {
node.value = node.raws.value.raw = context.util.trimDirective(node.raws.value.raw)
}
}
flipped++
// break
return false
}
}
})
})) return
// loop over all plugins/property processors
context.util.each(context.config.plugins, (plugin) => {
return context.util.each(plugin.processors, (processor) => {
const alias = context.config.aliases[node.prop]
if ((alias || node.prop).match(processor.expr)) {
const raw = node.raws.value && node.raws.value.raw ? node.raws.value.raw : node.value
const state = context.util.saveComments(raw)
if (context.config.processEnv) {
state.value = context.util.swap(state.value, 'safe-area-inset-left', 'safe-area-inset-right', { ignoreCase: false })
}
const pair = processor.action(node.prop, state.value, context)
state.value = pair.value
pair.value = context.util.restoreComments(state)
if ((!alias && 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)) {
const renamed = context.util.applyStringMap(node.parent.selector)
if (context.config.autoRenameStrict === true) {
const 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
}
}
}
},
OnceExit (root, { result }) {
state.walk((item) => {
result.warn(`unclosed directive "${item.metadata.name}".`, { node: item.source })
})
for (const key of Object.keys(toBeRenamed)) {
result.warn('renaming skipped due to lack of a matching pair.', { node: toBeRenamed[key] })
}
context.config.hooks.post(root, postcss)
}
}
}
module.exports.postcss = true
/**
* 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.
* @param {Object} hooks An object containing pre/post hooks.
* @returns {String} A string contining the RTLed css.
*/
module.exports.process = function (css, options, plugins, hooks) {
return postcss([this(options, plugins, hooks)]).process(css).css
}
/**
* Creates a new instance of RTLCSS using the passed configuration object
* @param {Object} config An object containing RTLCSS options, plugins and hooks.
* @returns {Object} A new RTLCSS instance.
*/
module.exports.configure = function (config) {
config = config || {}
return postcss([this(config.options, config.plugins, config.hooks)])
}

50
node_modules/rtlcss/lib/state.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
'use strict'
const directiveParser = require('./directive-parser.js')
module.exports = {
stack: [],
pop (current) {
const index = this.stack.indexOf(current)
if (index !== -1) {
this.stack.splice(index, 1)
}
if (!current.preserve) {
current.source.remove()
}
},
parse (node, lazyResult, callback) {
let current
const metadata = directiveParser(node)
if (metadata) {
if (!metadata.begin && metadata.end) {
this.walk((item) => {
if (metadata.name === item.metadata.name) {
this.pop(item)
current = { metadata, directive: item.directive, source: node, preserve: item.preserve }
return false
}
})
} else {
current = { 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 (callback) {
let len = this.stack.length
while (--len > -1) {
if (!callback(this.stack[len])) {
break
}
}
}
}

289
node_modules/rtlcss/lib/util.js generated vendored Normal file
View File

@@ -0,0 +1,289 @@
'use strict'
let config
let tokenId = 0
const CHAR_COMMENT_REPLACEMENT = '\uFFFD' // <20>
const CHAR_TOKEN_REPLACEMENT = '\u00A4' // ¤
const CHAR_TOKEN_START = '\u00AB' // «
const CHAR_TOKEN_END = '\u00BB' // »
const REGEX_COMMENT_REPLACEMENT = new RegExp(CHAR_COMMENT_REPLACEMENT, 'ig')
const REGEX_TOKEN_REPLACEMENT = new RegExp(CHAR_TOKEN_REPLACEMENT, 'ig')
const PATTERN_NUMBER = '\\-?(\\d*?\\.\\d+|\\d+)'
const PATTERN_NUMBER_WITH_CALC = '(calc' + CHAR_TOKEN_REPLACEMENT + ')|(' + PATTERN_NUMBER + ')(?!d\\()'
const PATTERN_TOKEN = CHAR_TOKEN_START + '\\d+:\\d+' + CHAR_TOKEN_END // «offset:index»
const PATTERN_TOKEN_WITH_NAME = '\\w*?' + CHAR_TOKEN_START + '\\d+:\\d+' + CHAR_TOKEN_END // «offset:index»
const REGEX_COMMENT = /\/\*[^]*?\*\//igm // non-greedy
const REGEX_DIRECTIVE = /\/\*\s*(?:!)?\s*rtl:[^]*?\*\//img
const REGEX_ESCAPE = /[.*+?^${}()|[\]\\]/g
const REGEX_FUNCTION = /\([^()]+\)/i
const REGEX_HEX_COLOR = /#[a-f0-9]{3,6}/ig
const REGEX_CALC = /calc/
const REGEX_TOKENS = new RegExp(PATTERN_TOKEN, 'ig')
const REGEX_TOKENS_WITH_NAME = new RegExp(PATTERN_TOKEN_WITH_NAME, 'ig')
const REGEX_COMPLEMENT = new RegExp(PATTERN_NUMBER_WITH_CALC, 'i')
const REGEX_NEGATE_ALL = new RegExp(PATTERN_NUMBER_WITH_CALC, 'ig')
const REGEX_NEGATE_ONE = new RegExp(PATTERN_NUMBER_WITH_CALC, 'i')
const DEFAULT_STRING_MAP_OPTIONS = { scope: '*', ignoreCase: true }
function compare (what, to, ignoreCase) {
return ignoreCase
? what.toLowerCase() === to.toLowerCase()
: what === to
}
function escapeRegExp (string) {
return string.replace(REGEX_ESCAPE, '\\$&')
}
module.exports = {
extend (dest, src) {
if (typeof dest === 'undefined' || typeof dest !== 'object') {
dest = {}
}
for (const prop in src) {
if (!Object.prototype.hasOwnProperty.call(dest, prop)) {
dest[prop] = src[prop]
}
}
return dest
},
swap (value, a, b, options) {
let expr = `${escapeRegExp(a)}|${escapeRegExp(b)}`
options = options || DEFAULT_STRING_MAP_OPTIONS
const greedy = Object.prototype.hasOwnProperty.call(options, 'greedy') ? options.greedy : config.greedy
if (!greedy) expr = `\\b(${expr})\\b`
const flags = options.ignoreCase ? 'img' : 'mg'
return value.replace(new RegExp(expr, flags), (m) => compare(m, a, options.ignoreCase) ? b : a)
},
swapLeftRight (value) {
return this.swap(value, 'left', 'right')
},
swapLtrRtl (value) {
return this.swap(value, 'ltr', 'rtl')
},
applyStringMap (value, isUrl) {
let result = value
for (const map of config.stringMap) {
const 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 (let 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 (value) {
const state = this.saveTokens(value)
state.value = state.value.replace(REGEX_NEGATE_ONE, (num) => {
return REGEX_TOKEN_REPLACEMENT.test(num)
? num.replace(REGEX_TOKEN_REPLACEMENT, (m) => '(-1*' + m + ')')
: Number.parseFloat(num) * -1
})
return this.restoreTokens(state)
},
negateAll (value) {
const state = this.saveTokens(value)
state.value = state.value.replace(REGEX_NEGATE_ALL, (num) => {
return REGEX_TOKEN_REPLACEMENT.test(num)
? num.replace(REGEX_TOKEN_REPLACEMENT, (m) => '(-1*' + m + ')')
: Number.parseFloat(num) * -1
})
return this.restoreTokens(state)
},
complement (value) {
const state = this.saveTokens(value)
state.value = state.value.replace(REGEX_COMPLEMENT, (num) => {
return REGEX_TOKEN_REPLACEMENT.test(num)
? num.replace(REGEX_TOKEN_REPLACEMENT, (m) => '(100% - ' + m + ')')
: 100 - Number.parseFloat(num)
})
return this.restoreTokens(state)
},
flipLength (value) {
return config.useCalc ? `calc(100% - ${value})` : value
},
save (what, who, replacement, restorer, exclude) {
const state = {
value: who,
store: [],
replacement,
restorer
}
state.value = state.value.replace(what, (c) => {
if (exclude && c.match(exclude)) {
return c
}
state.store.push(c)
return state.replacement
})
return state
},
restore (state) {
let index = 0
const result = state.value.replace(state.restorer, () => {
return state.store[index++]
})
state.store.length = 0
return result
},
saveComments (value) {
return this.save(REGEX_COMMENT, value, CHAR_COMMENT_REPLACEMENT, REGEX_COMMENT_REPLACEMENT)
},
restoreComments (state) {
return this.restore(state)
},
saveTokens (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 (state) {
return this.restore(state)
},
guard (what, who, indexed) {
const state = {
value: who,
store: [],
offset: tokenId++,
token: CHAR_TOKEN_START + tokenId,
indexed: indexed === true
}
if (state.indexed === true) {
while (what.test(state.value)) {
state.value = state.value.replace(what, (m) => {
state.store.push(m)
return `${state.token}:${state.store.length}${CHAR_TOKEN_END}`
})
}
} else {
state.value = state.value.replace(what, (m) => {
state.store.push(m)
return state.token + CHAR_TOKEN_END
})
}
return state
},
unguard (state, callback) {
if (state.indexed === true) {
const detokenizer = new RegExp('(\\w*?)' + state.token + ':(\\d+)' + CHAR_TOKEN_END, 'i')
while (detokenizer.test(state.value)) {
state.value = state.value.replace(detokenizer, (match, name, index) => {
const value = state.store[index - 1]
return typeof callback === 'function'
? name + callback(value, name)
: name + value
})
}
return state.value
}
return state.value.replace(new RegExp('(\\w*?)' + state.token + CHAR_TOKEN_END, 'i'), (match, name) => {
const value = state.store.shift()
return typeof callback === 'function'
? name + callback(value, name)
: name + value
})
},
guardHexColors (value) {
return this.guard(REGEX_HEX_COLOR, value, true)
},
unguardHexColors (state, callback) {
return this.unguard(state, callback)
},
guardFunctions (value) {
return this.guard(REGEX_FUNCTION, value, true)
},
unguardFunctions (state, callback) {
return this.unguard(state, callback)
},
trimDirective (value) {
return value.replace(REGEX_DIRECTIVE, '')
},
regexCache: {},
regexDirective (name) {
// /(?:\/\*(?:!)?rtl:ignore(?::)?)([^]*?)(?:\*\/)/img
this.regexCache[name] = this.regexCache[name] || new RegExp('(?:\\/\\*\\s*(?:!)?\\s*rtl:' + (name ? escapeRegExp(name) + '(?::)?' : '') + ')([^]*?)(?:\\*\\/)', 'img')
return this.regexCache[name]
},
regex (what, options) {
what = what || []
let expression = ''
for (const exp of what) {
switch (exp) {
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 (node) {
let isLast = true
let next = node.next()
while (next) {
if (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 (array, callback) {
for (const element of array) {
if (callback(element) === false) {
return false
}
}
return true
}
}
module.exports.configure = function (configuration) {
config = configuration
return this
}

138
node_modules/rtlcss/node_modules/find-up/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,138 @@
/* eslint-disable @typescript-eslint/unified-signatures */
import {Options as LocatePathOptions} from 'locate-path';
declare const stop: unique symbol;
declare namespace findUp {
interface Options extends LocatePathOptions {}
type StopSymbol = typeof stop;
type Match = string | StopSymbol | undefined;
}
declare const findUp: {
sync: {
/**
Synchronously check if a path exists.
@param path - Path to the file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));
//=> true
```
*/
exists: (path: string) => boolean;
/**
Synchronously find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
*/
(name: string | readonly string[], options?: findUp.Options): string | undefined;
/**
Synchronously find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
console.log(findUp.sync(directory => {
const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
```
*/
(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
};
/**
Check if a path exists.
@param path - Path to a file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
(async () => {
console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));
//=> true
})();
```
*/
exists: (path: string) => Promise<boolean>;
/**
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
*/
readonly stop: findUp.StopSymbol;
/**
Find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
```
*/
(name: string | readonly string[], options?: findUp.Options): Promise<string | undefined>;
/**
Find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
(async () => {
console.log(await findUp(async directory => {
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
})();
```
*/
(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;
};
export = findUp;

89
node_modules/rtlcss/node_modules/find-up/index.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
'use strict';
const path = require('path');
const locatePath = require('locate-path');
const pathExists = require('path-exists');
const stop = Symbol('findUp.stop');
module.exports = async (name, options = {}) => {
let directory = path.resolve(options.cwd || '');
const {root} = path.parse(directory);
const paths = [].concat(name);
const runMatcher = async locateOptions => {
if (typeof name !== 'function') {
return locatePath(paths, locateOptions);
}
const foundPath = await name(locateOptions.cwd);
if (typeof foundPath === 'string') {
return locatePath([foundPath], locateOptions);
}
return foundPath;
};
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-next-line no-await-in-loop
const foundPath = await runMatcher({...options, cwd: directory});
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module.exports.sync = (name, options = {}) => {
let directory = path.resolve(options.cwd || '');
const {root} = path.parse(directory);
const paths = [].concat(name);
const runMatcher = locateOptions => {
if (typeof name !== 'function') {
return locatePath.sync(paths, locateOptions);
}
const foundPath = name(locateOptions.cwd);
if (typeof foundPath === 'string') {
return locatePath.sync([foundPath], locateOptions);
}
return foundPath;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const foundPath = runMatcher({...options, cwd: directory});
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module.exports.exists = pathExists;
module.exports.sync.exists = pathExists.sync;
module.exports.stop = stop;

9
node_modules/rtlcss/node_modules/find-up/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

54
node_modules/rtlcss/node_modules/find-up/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "find-up",
"version": "5.0.0",
"description": "Find a file or directory by walking up parent directories",
"license": "MIT",
"repository": "sindresorhus/find-up",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"walk",
"walking",
"path"
],
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"devDependencies": {
"ava": "^2.1.0",
"is-path-inside": "^2.1.0",
"tempy": "^0.6.0",
"tsd": "^0.13.1",
"xo": "^0.33.0"
}
}

151
node_modules/rtlcss/node_modules/find-up/readme.md generated vendored Normal file
View File

@@ -0,0 +1,151 @@
# find-up [![Build Status](https://travis-ci.com/sindresorhus/find-up.svg?branch=master)](https://travis-ci.com/github/sindresorhus/find-up)
> Find a file or directory by walking up parent directories
## Install
```
$ npm install find-up
```
## Usage
```
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
```
`example.js`
```js
const path = require('path');
const findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(async directory => {
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
})();
```
## API
### findUp(name, options?)
### findUp(matcher, options?)
Returns a `Promise` for either the path or `undefined` if it couldn't be found.
### findUp([...name], options?)
Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found.
### findUp.sync(name, options?)
### findUp.sync(matcher, options?)
Returns a path or `undefined` if it couldn't be found.
### findUp.sync([...name], options?)
Returns the first path found (by respecting the order of the array) or `undefined` if none could be found.
#### name
Type: `string`
Name of the file or directory to find.
#### matcher
Type: `Function`
A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases.
When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path.
#### options
Type: `object`
##### cwd
Type: `string`\
Default: `process.cwd()`
Directory to start from.
##### type
Type: `string`\
Default: `'file'`\
Values: `'file'` `'directory'`
The type of paths that can match.
##### allowSymlinks
Type: `boolean`\
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### findUp.exists(path)
Returns a `Promise<boolean>` of whether the path exists.
### findUp.sync.exists(path)
Returns a `boolean` of whether the path exists.
#### path
Type: `string`
Path to a file or directory.
### findUp.stop
A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
```js
const path = require('path');
const findUp = require('find-up');
(async () => {
await findUp(directory => {
return path.basename(directory) === 'work' ? findUp.stop : 'logo.png';
});
})();
```
## Related
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-find-up?utm_source=npm-find-up&utm_medium=referral&utm_campaign=readme">Get professional support for 'find-up' with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

View File

@@ -0,0 +1,83 @@
declare namespace locatePath {
interface Options {
/**
Current working directory.
@default process.cwd()
*/
readonly cwd?: string;
/**
Type of path to match.
@default 'file'
*/
readonly type?: 'file' | 'directory';
/**
Allow symbolic links to match if they point to the requested path type.
@default true
*/
readonly allowSymlinks?: boolean;
}
interface AsyncOptions extends Options {
/**
Number of concurrently pending promises. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
/**
Preserve `paths` order when searching.
Disable this to improve performance if you don't care about the order.
@default true
*/
readonly preserveOrder?: boolean;
}
}
declare const locatePath: {
/**
Synchronously get the first path that exists on disk of multiple paths.
@param paths - Paths to check.
@returns The first path that exists or `undefined` if none exists.
*/
sync: (
paths: Iterable<string>,
options?: locatePath.Options
) => string | undefined;
/**
Get the first path that exists on disk of multiple paths.
@param paths - Paths to check.
@returns The first path that exists or `undefined` if none exists.
@example
```
import locatePath = require('locate-path');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
console(await locatePath(files));
//=> 'rainbow'
})();
```
*/
(paths: Iterable<string>, options?: locatePath.AsyncOptions): Promise<
string | undefined
>;
};
export = locatePath;

68
node_modules/rtlcss/node_modules/locate-path/index.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
'use strict';
const path = require('path');
const fs = require('fs');
const {promisify} = require('util');
const pLocate = require('p-locate');
const fsStat = promisify(fs.stat);
const fsLStat = promisify(fs.lstat);
const typeMappings = {
directory: 'isDirectory',
file: 'isFile'
};
function checkType({type}) {
if (type in typeMappings) {
return;
}
throw new Error(`Invalid type specified: ${type}`);
}
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
module.exports = async (paths, options) => {
options = {
cwd: process.cwd(),
type: 'file',
allowSymlinks: true,
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fsStat : fsLStat;
return pLocate(paths, async path_ => {
try {
const stat = await statFn(path.resolve(options.cwd, path_));
return matchType(options.type, stat);
} catch {
return false;
}
}, options);
};
module.exports.sync = (paths, options) => {
options = {
cwd: process.cwd(),
allowSymlinks: true,
type: 'file',
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
for (const path_ of paths) {
try {
const stat = statFn(path.resolve(options.cwd, path_));
if (matchType(options.type, stat)) {
return path_;
}
} catch {}
}
};

9
node_modules/rtlcss/node_modules/locate-path/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

View File

@@ -0,0 +1,46 @@
{
"name": "locate-path",
"version": "6.0.0",
"description": "Get the first path that exists on disk of multiple paths",
"license": "MIT",
"repository": "sindresorhus/locate-path",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"locate",
"path",
"paths",
"file",
"files",
"exists",
"find",
"finder",
"search",
"searcher",
"array",
"iterable",
"iterator"
],
"dependencies": {
"p-locate": "^5.0.0"
},
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.13.1",
"xo": "^0.32.1"
}
}

125
node_modules/rtlcss/node_modules/locate-path/readme.md generated vendored Normal file
View File

@@ -0,0 +1,125 @@
# locate-path [![Build Status](https://travis-ci.com/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.com/github/sindresorhus/locate-path)
> Get the first path that exists on disk of multiple paths
## Install
```
$ npm install locate-path
```
## Usage
Here we find the first file that exists on disk, in array order.
```js
const locatePath = require('locate-path');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
console(await locatePath(files));
//=> 'rainbow'
})();
```
## API
### locatePath(paths, options?)
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
#### paths
Type: `Iterable<string>`
Paths to check.
#### options
Type: `object`
##### concurrency
Type: `number`\
Default: `Infinity`\
Minimum: `1`
Number of concurrently pending promises.
##### preserveOrder
Type: `boolean`\
Default: `true`
Preserve `paths` order when searching.
Disable this to improve performance if you don't care about the order.
##### cwd
Type: `string`\
Default: `process.cwd()`
Current working directory.
##### type
Type: `string`\
Default: `'file'`\
Values: `'file' | 'directory'`
The type of paths that can match.
##### allowSymlinks
Type: `boolean`\
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### locatePath.sync(paths, options?)
Returns the first path that exists or `undefined` if none exists.
#### paths
Type: `Iterable<string>`
Paths to check.
#### options
Type: `object`
##### cwd
Same as above.
##### type
Same as above.
##### allowSymlinks
Same as above.
## Related
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-locate-path?utm_source=npm-locate-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

53
node_modules/rtlcss/node_modules/p-locate/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,53 @@
declare namespace pLocate {
interface Options {
/**
Number of concurrently pending promises returned by `tester`. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
/**
Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order.
@default true
*/
readonly preserveOrder?: boolean;
}
}
/**
Get the first fulfilled promise that satisfies the provided testing function.
@param input - An iterable of promises/values to test.
@param tester - This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
@returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
@example
```
import pathExists = require('path-exists');
import pLocate = require('p-locate');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
const foundPath = await pLocate(files, file => pathExists(file));
console.log(foundPath);
//=> 'rainbow'
})();
```
*/
declare function pLocate<ValueType>(
input: Iterable<PromiseLike<ValueType> | ValueType>,
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
options?: pLocate.Options
): Promise<ValueType | undefined>;
export = pLocate;

50
node_modules/rtlcss/node_modules/p-locate/index.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
'use strict';
const pLimit = require('p-limit');
class EndError extends Error {
constructor(value) {
super();
this.value = value;
}
}
// The input can also be a promise, so we await it
const testElement = async (element, tester) => tester(await element);
// The input can also be a promise, so we `Promise.all()` them both
const finder = async element => {
const values = await Promise.all(element);
if (values[1] === true) {
throw new EndError(values[0]);
}
return false;
};
const pLocate = async (iterable, tester, options) => {
options = {
concurrency: Infinity,
preserveOrder: true,
...options
};
const limit = pLimit(options.concurrency);
// Start all the promises concurrently with optional limit
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
// Check the promises either serially or concurrently
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
try {
await Promise.all(items.map(element => checkLimit(finder, element)));
} catch (error) {
if (error instanceof EndError) {
return error.value;
}
throw error;
}
};
module.exports = pLocate;

9
node_modules/rtlcss/node_modules/p-locate/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

54
node_modules/rtlcss/node_modules/p-locate/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "p-locate",
"version": "5.0.0",
"description": "Get the first fulfilled promise that satisfies the provided testing function",
"license": "MIT",
"repository": "sindresorhus/p-locate",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"promise",
"locate",
"find",
"finder",
"search",
"searcher",
"test",
"array",
"collection",
"iterable",
"iterator",
"race",
"fulfilled",
"fastest",
"async",
"await",
"promises",
"bluebird"
],
"dependencies": {
"p-limit": "^3.0.2"
},
"devDependencies": {
"ava": "^2.4.0",
"delay": "^4.1.0",
"in-range": "^2.0.0",
"time-span": "^4.0.0",
"tsd": "^0.13.1",
"xo": "^0.32.1"
}
}

93
node_modules/rtlcss/node_modules/p-locate/readme.md generated vendored Normal file
View File

@@ -0,0 +1,93 @@
# p-locate [![Build Status](https://travis-ci.com/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.com/github/sindresorhus/p-locate)
> Get the first fulfilled promise that satisfies the provided testing function
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
## Install
```
$ npm install p-locate
```
## Usage
Here we find the first file that exists on disk, in array order.
```js
const pathExists = require('path-exists');
const pLocate = require('p-locate');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
const foundPath = await pLocate(files, file => pathExists(file));
console.log(foundPath);
//=> 'rainbow'
})();
```
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
## API
### pLocate(input, tester, options?)
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
#### input
Type: `Iterable<Promise | unknown>`
An iterable of promises/values to test.
#### tester(element)
Type: `Function`
This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
#### options
Type: `object`
##### concurrency
Type: `number`\
Default: `Infinity`\
Minimum: `1`
Number of concurrently pending promises returned by `tester`.
##### preserveOrder
Type: `boolean`\
Default: `true`
Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order.
## Related
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
- [More…](https://github.com/sindresorhus/promise-fun)
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-p-locate?utm_source=npm-p-locate&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

53
node_modules/rtlcss/package.json generated vendored Normal file
View File

@@ -0,0 +1,53 @@
{
"author": "Mohammad Younes",
"name": "rtlcss",
"version": "3.5.0",
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)",
"homepage": "https://rtlcss.com/",
"bugs": {
"url": "https://github.com/MohammadYounes/rtlcss/issues"
},
"license": "MIT",
"keywords": [
"rtl",
"css",
"ltr",
"rtlcss",
"framework",
"style",
"mirror",
"flip",
"convert",
"transform"
],
"repository": {
"type": "git",
"url": "git+https://github.com/MohammadYounes/rtlcss.git"
},
"bin": {
"rtlcss": "./bin/rtlcss.js"
},
"dependencies": {
"find-up": "^5.0.0",
"picocolors": "^1.0.0",
"postcss": "^8.3.11",
"strip-json-comments": "^3.1.1"
},
"devDependencies": {
"mocha": "^9.1.3",
"standard": "^16.0.4"
},
"scripts": {
"main": "node ./lib/rtlcss.js",
"lint": "standard",
"lint:fix": "npm run lint -- --fix",
"mocha": "mocha -R spec",
"mocha:special": "npm run mocha -- --fgrep \"# Special\"",
"test": "npm run lint && npm run main && npm run mocha"
},
"main": "./lib/rtlcss.js",
"files": [
"bin/*.js",
"lib/*.js"
]
}