├── .editorconfig
├── .gitignore
├── README.md
├── bb-code-settings.php
├── classes
└── class-bb-code-settings.php
├── composer.json
├── composer.lock
├── css
└── settings.css
├── js
└── settings.js
└── vendor
├── autoload.php
├── composer
├── ClassLoader.php
├── InstalledVersions.php
├── LICENSE
├── autoload_classmap.php
├── autoload_namespaces.php
├── autoload_psr4.php
├── autoload_real.php
├── autoload_static.php
├── installed.json
├── installed.php
└── platform_check.php
└── scssphp
└── scssphp
├── LICENSE.md
├── composer.json
└── src
├── Base
└── Range.php
├── Block.php
├── Block
├── AtRootBlock.php
├── CallableBlock.php
├── ContentBlock.php
├── DirectiveBlock.php
├── EachBlock.php
├── ElseBlock.php
├── ElseifBlock.php
├── ForBlock.php
├── IfBlock.php
├── MediaBlock.php
├── NestedPropertyBlock.php
└── WhileBlock.php
├── Cache.php
├── Colors.php
├── CompilationResult.php
├── Compiler.php
├── Compiler
├── CachedResult.php
└── Environment.php
├── Exception
├── CompilerException.php
├── ParserException.php
├── RangeException.php
├── SassException.php
├── SassScriptException.php
└── ServerException.php
├── Formatter.php
├── Formatter
├── Compact.php
├── Compressed.php
├── Crunched.php
├── Debug.php
├── Expanded.php
├── Nested.php
└── OutputBlock.php
├── Logger
├── LoggerInterface.php
├── QuietLogger.php
└── StreamLogger.php
├── Node.php
├── Node
└── Number.php
├── OutputStyle.php
├── Parser.php
├── SourceMap
├── Base64.php
├── Base64VLQ.php
└── SourceMapGenerator.php
├── Type.php
├── Util.php
├── Util
└── Path.php
├── ValueConverter.php
├── Version.php
└── Warn.php
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This file is for unifying the coding style for different editors and IDEs
2 | # editorconfig.org
3 |
4 | # WordPress Coding Standards
5 | # https://make.wordpress.org/core/handbook/coding-standards/
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | insert_final_newline = true
13 | trim_trailing_whitespace = true
14 | indent_style = tab
15 |
16 | [{.jshintrc,*.json,*.yml}]
17 | indent_style = space
18 | indent_size = 2
19 |
20 | [{*.txt,wp-config-sample.php}]
21 | end_of_line = crlf
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore all .DS_Store files...
2 | .DS_Store
3 |
4 | # Ignore all Thumbs.db files...
5 | Thumbs.db
6 |
7 | # Ignore the node_modules folder...
8 | node_modules
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | A simple plugin that adds CSS and JS settings to rows, columns, and modules under the Advanced tab.
2 |
3 | All CSS will be automatically scoped to the element you are working on. For example, the following CSS will only affect paragraph tags in a module you are editing...
4 |
5 | ```
6 | p {
7 | color: red;
8 | }
9 | ```
10 |
11 | Behind the scenes, that rule will be rewritten to...
12 |
13 | ```
14 | .fl-node-1d43q3gf56s p {
15 | color: red;
16 | }
17 | ```
18 |
19 | Other than that, this works similarly to the CSS and JS fields in the global and layout settings.
20 |
--------------------------------------------------------------------------------
/bb-code-settings.php:
--------------------------------------------------------------------------------
1 | __( 'CSS' ),
46 | 'fields' => array(
47 | 'bb_css_code' => array(
48 | 'label' => '',
49 | 'type' => 'code',
50 | 'editor' => 'css',
51 | 'rows' => '18',
52 | 'preview' => array(
53 | 'type' => 'none',
54 | ),
55 | ),
56 | ),
57 | );
58 | }
59 |
60 | public static function get_js_field_config() {
61 | return array(
62 | 'title' => __( 'JavaScript' ),
63 | 'fields' => array(
64 | 'bb_js_code' => array(
65 | 'label' => '',
66 | 'type' => 'code',
67 | 'editor' => 'javascript',
68 | 'rows' => '18',
69 | 'preview' => array(
70 | 'type' => 'none',
71 | ),
72 | ),
73 | ),
74 | );
75 | }
76 |
77 | public static function filter_layout_css( $css, $nodes ) {
78 | $all_nodes = array_merge( $nodes['rows'], $nodes['columns'], $nodes['modules'] );
79 |
80 | foreach ( $all_nodes as $node_id => $node ) {
81 | if ( isset( $node->settings ) ) {
82 | if ( isset( $node->settings->bb_css_code ) && ! empty( $node->settings->bb_css_code ) ) {
83 | $code = ".fl-node-$node_id {";
84 | $code .= $node->settings->bb_css_code;
85 | $code .= "}";
86 | $compiler = new ScssPhp\ScssPhp\Compiler();
87 | try {
88 | $css .= $compiler->compileString( $code )->getCSS();
89 | } catch ( Exception $e ) {
90 | $name = isset( $node->name ) ? $node->name : $node->type;
91 | $css .= "\n/*\n!!bb-code-settings compile error!!\nNode: {$node->node}\nType: {$name}\n{$e->getMessage()}\n*/\n";
92 | }
93 | }
94 | }
95 | }
96 |
97 | return $css;
98 | }
99 |
100 | public static function filter_layout_js( $js, $nodes ) {
101 | $all_nodes = array_merge( $nodes['rows'], $nodes['columns'], $nodes['modules'] );
102 | foreach ( $all_nodes as $node ) {
103 | $js .= self::get_node_js( $node );
104 | }
105 | return $js;
106 | }
107 |
108 | public static function filter_ajax_layout_js( $response ) {
109 | if ( $response['partial'] ) {
110 | $node = FLBuilderModel::get_node( $response['nodeId'] );
111 | $response['js'] .= self::get_node_js( $node );
112 | }
113 | return $response;
114 | }
115 |
116 | public static function get_node_js( $node ) {
117 | if ( isset( $node->settings ) ) {
118 | if ( isset( $node->settings->bb_js_code ) && ! empty( $node->settings->bb_js_code ) ) {
119 | return $node->settings->bb_js_code;
120 | }
121 | }
122 | return '';
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bb/code-settings",
3 | "type": "project",
4 | "license": "GPL 2+",
5 | "require": {
6 | "scssphp/scssphp": "^1.0"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "06c7a2fe99b7e6128da841cd5589280c",
8 | "packages": [
9 | {
10 | "name": "scssphp/scssphp",
11 | "version": "v1.8.1",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/scssphp/scssphp.git",
15 | "reference": "5e37759a63caf54392a4b709358a39ac7425a69f"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/scssphp/scssphp/zipball/5e37759a63caf54392a4b709358a39ac7425a69f",
20 | "reference": "5e37759a63caf54392a4b709358a39ac7425a69f",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "ext-ctype": "*",
25 | "ext-json": "*",
26 | "php": ">=5.6.0"
27 | },
28 | "require-dev": {
29 | "bamarni/composer-bin-plugin": "^1.4",
30 | "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4",
31 | "sass/sass-spec": "*",
32 | "squizlabs/php_codesniffer": "~3.5",
33 | "symfony/phpunit-bridge": "^5.1",
34 | "thoughtbot/bourbon": "^7.0",
35 | "twbs/bootstrap": "~5.0",
36 | "twbs/bootstrap4": "4.6.0",
37 | "zurb/foundation": "~6.5"
38 | },
39 | "suggest": {
40 | "ext-iconv": "Can be used as fallback when ext-mbstring is not available",
41 | "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv"
42 | },
43 | "bin": [
44 | "bin/pscss"
45 | ],
46 | "type": "library",
47 | "autoload": {
48 | "psr-4": {
49 | "ScssPhp\\ScssPhp\\": "src/"
50 | }
51 | },
52 | "notification-url": "https://packagist.org/downloads/",
53 | "license": [
54 | "MIT"
55 | ],
56 | "authors": [
57 | {
58 | "name": "Anthon Pang",
59 | "email": "apang@softwaredevelopment.ca",
60 | "homepage": "https://github.com/robocoder"
61 | },
62 | {
63 | "name": "Cédric Morin",
64 | "email": "cedric@yterium.com",
65 | "homepage": "https://github.com/Cerdic"
66 | }
67 | ],
68 | "description": "scssphp is a compiler for SCSS written in PHP.",
69 | "homepage": "http://scssphp.github.io/scssphp/",
70 | "keywords": [
71 | "css",
72 | "less",
73 | "sass",
74 | "scss",
75 | "stylesheet"
76 | ],
77 | "time": "2021-09-18T21:20:53+00:00"
78 | }
79 | ],
80 | "packages-dev": [],
81 | "aliases": [],
82 | "minimum-stability": "stable",
83 | "stability-flags": [],
84 | "prefer-stable": false,
85 | "prefer-lowest": false,
86 | "platform": [],
87 | "platform-dev": []
88 | }
89 |
--------------------------------------------------------------------------------
/css/settings.css:
--------------------------------------------------------------------------------
1 | #fl-builder-settings-section-bb_css_code .ace_editor,
2 | #fl-builder-settings-section-bb_js_code .ace_editor {
3 | height: 250px !important;
4 | }
5 |
--------------------------------------------------------------------------------
/js/settings.js:
--------------------------------------------------------------------------------
1 | ( function( $ ) {
2 |
3 | var CodeSettings = {
4 |
5 | currentNodeId: null,
6 |
7 | init: function() {
8 | FLBuilder.addHook( 'settings-form-init', CodeSettings.settingsFormInit );
9 | FLBuilder.addHook( 'didSaveNodeSettingsComplete', CodeSettings.clearPreview );
10 | },
11 |
12 | clearPreview: function() {
13 | $( 'style.fl-builder-node-preview' ).remove();
14 | },
15 |
16 | settingsFormInit: function() {
17 | var style = $( 'style.fl-builder-node-preview' );
18 | var form = $( '.fl-builder-settings[data-node]' );
19 | var cssInput = $( '#fl-field-bb_css_code textarea' );
20 |
21 | if ( form.length ) {
22 | CodeSettings.currentNodeId = form.attr( 'data-node' );
23 | form.find( '.fl-builder-settings-cancel' ).on( 'click', CodeSettings.clearPreview );
24 | }
25 | if ( ! style.length ) {
26 | $( 'head' ).append( '' );
27 | }
28 | if ( cssInput.length ) {
29 | cssInput.on( 'change', CodeSettings.cssChanged );
30 | }
31 | },
32 |
33 | cssChanged: function( e ) {
34 | var prefix = '.fl-node-' + CodeSettings.currentNodeId;
35 | var css = CSSScoper.scope( $( e.target ).val(), prefix );
36 | $( 'style.fl-builder-node-preview' ).html( css );
37 | },
38 | }
39 |
40 | var CSSScoper = {
41 |
42 | scope: function( rules, className ) {
43 | var classLen = className.length, char, nextChar, isAt, isIn;
44 |
45 | className += ' ';
46 | rules = rules.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '' );
47 | rules = rules.replace( /}(\s*)@/g, '}@' );
48 | rules = rules.replace( /}(\s*)}/g, '}}' );
49 |
50 | for ( var i = 0; i < rules.length - 2; i++ ) {
51 | char = rules[ i ];
52 | nextChar = rules[ i + 1 ];
53 |
54 | if ( char === '@' ) {
55 | isAt = true;
56 | }
57 | if ( ! isAt && char === '{' ) {
58 | isIn = true;
59 | }
60 | if ( isIn && char === '}' ) {
61 | isIn = false;
62 | }
63 | if (
64 | !isIn &&
65 | nextChar !== '@' &&
66 | nextChar !== '}' &&
67 | (
68 | char === '}' ||
69 | char === ',' ||
70 | ( ( char === '{' || char === ';' ) && isAt )
71 | )
72 | ) {
73 | rules = rules.slice( 0, i + 1 ) + className + rules.slice( i + 1 );
74 | i += classLen;
75 | isAt = false;
76 | }
77 | };
78 |
79 | if ( rules.indexOf( className ) !== 0 && rules.indexOf( '@' ) !== 0 ) {
80 | rules = className + rules;
81 | }
82 |
83 | return CSSScoper.fixKeyframes( rules, className );
84 | },
85 |
86 | fixKeyframes: function( rules, className ) {
87 | var toRegex = new RegExp( '\\' + className + '\\s?to\\s?\\{', 'g' );
88 | var fromRegex = new RegExp( '\\' + className + '\\s?from\\s?\\{', 'g' );
89 | rules = rules.replace( toRegex, 'to {' );
90 | rules = rules.replace( fromRegex, 'from {' );
91 | return rules;
92 | }
93 | }
94 |
95 | $( CodeSettings.init );
96 |
97 | } )( jQuery );
98 |
--------------------------------------------------------------------------------
/vendor/autoload.php:
--------------------------------------------------------------------------------
1 |
7 | * Jordi Boggiano
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | namespace Composer\Autoload;
14 |
15 | /**
16 | * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17 | *
18 | * $loader = new \Composer\Autoload\ClassLoader();
19 | *
20 | * // register classes with namespaces
21 | * $loader->add('Symfony\Component', __DIR__.'/component');
22 | * $loader->add('Symfony', __DIR__.'/framework');
23 | *
24 | * // activate the autoloader
25 | * $loader->register();
26 | *
27 | * // to enable searching the include path (eg. for PEAR packages)
28 | * $loader->setUseIncludePath(true);
29 | *
30 | * In this example, if you try to use a class in the Symfony\Component
31 | * namespace or one of its children (Symfony\Component\Console for instance),
32 | * the autoloader will first look for the class under the component/
33 | * directory, and it will then fallback to the framework/ directory if not
34 | * found before giving up.
35 | *
36 | * This class is loosely based on the Symfony UniversalClassLoader.
37 | *
38 | * @author Fabien Potencier
39 | * @author Jordi Boggiano
40 | * @see https://www.php-fig.org/psr/psr-0/
41 | * @see https://www.php-fig.org/psr/psr-4/
42 | */
43 | class ClassLoader
44 | {
45 | private $vendorDir;
46 |
47 | // PSR-4
48 | private $prefixLengthsPsr4 = array();
49 | private $prefixDirsPsr4 = array();
50 | private $fallbackDirsPsr4 = array();
51 |
52 | // PSR-0
53 | private $prefixesPsr0 = array();
54 | private $fallbackDirsPsr0 = array();
55 |
56 | private $useIncludePath = false;
57 | private $classMap = array();
58 | private $classMapAuthoritative = false;
59 | private $missingClasses = array();
60 | private $apcuPrefix;
61 |
62 | private static $registeredLoaders = array();
63 |
64 | public function __construct($vendorDir = null)
65 | {
66 | $this->vendorDir = $vendorDir;
67 | }
68 |
69 | public function getPrefixes()
70 | {
71 | if (!empty($this->prefixesPsr0)) {
72 | return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
73 | }
74 |
75 | return array();
76 | }
77 |
78 | public function getPrefixesPsr4()
79 | {
80 | return $this->prefixDirsPsr4;
81 | }
82 |
83 | public function getFallbackDirs()
84 | {
85 | return $this->fallbackDirsPsr0;
86 | }
87 |
88 | public function getFallbackDirsPsr4()
89 | {
90 | return $this->fallbackDirsPsr4;
91 | }
92 |
93 | public function getClassMap()
94 | {
95 | return $this->classMap;
96 | }
97 |
98 | /**
99 | * @param array $classMap Class to filename map
100 | */
101 | public function addClassMap(array $classMap)
102 | {
103 | if ($this->classMap) {
104 | $this->classMap = array_merge($this->classMap, $classMap);
105 | } else {
106 | $this->classMap = $classMap;
107 | }
108 | }
109 |
110 | /**
111 | * Registers a set of PSR-0 directories for a given prefix, either
112 | * appending or prepending to the ones previously set for this prefix.
113 | *
114 | * @param string $prefix The prefix
115 | * @param array|string $paths The PSR-0 root directories
116 | * @param bool $prepend Whether to prepend the directories
117 | */
118 | public function add($prefix, $paths, $prepend = false)
119 | {
120 | if (!$prefix) {
121 | if ($prepend) {
122 | $this->fallbackDirsPsr0 = array_merge(
123 | (array) $paths,
124 | $this->fallbackDirsPsr0
125 | );
126 | } else {
127 | $this->fallbackDirsPsr0 = array_merge(
128 | $this->fallbackDirsPsr0,
129 | (array) $paths
130 | );
131 | }
132 |
133 | return;
134 | }
135 |
136 | $first = $prefix[0];
137 | if (!isset($this->prefixesPsr0[$first][$prefix])) {
138 | $this->prefixesPsr0[$first][$prefix] = (array) $paths;
139 |
140 | return;
141 | }
142 | if ($prepend) {
143 | $this->prefixesPsr0[$first][$prefix] = array_merge(
144 | (array) $paths,
145 | $this->prefixesPsr0[$first][$prefix]
146 | );
147 | } else {
148 | $this->prefixesPsr0[$first][$prefix] = array_merge(
149 | $this->prefixesPsr0[$first][$prefix],
150 | (array) $paths
151 | );
152 | }
153 | }
154 |
155 | /**
156 | * Registers a set of PSR-4 directories for a given namespace, either
157 | * appending or prepending to the ones previously set for this namespace.
158 | *
159 | * @param string $prefix The prefix/namespace, with trailing '\\'
160 | * @param array|string $paths The PSR-4 base directories
161 | * @param bool $prepend Whether to prepend the directories
162 | *
163 | * @throws \InvalidArgumentException
164 | */
165 | public function addPsr4($prefix, $paths, $prepend = false)
166 | {
167 | if (!$prefix) {
168 | // Register directories for the root namespace.
169 | if ($prepend) {
170 | $this->fallbackDirsPsr4 = array_merge(
171 | (array) $paths,
172 | $this->fallbackDirsPsr4
173 | );
174 | } else {
175 | $this->fallbackDirsPsr4 = array_merge(
176 | $this->fallbackDirsPsr4,
177 | (array) $paths
178 | );
179 | }
180 | } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
181 | // Register directories for a new namespace.
182 | $length = strlen($prefix);
183 | if ('\\' !== $prefix[$length - 1]) {
184 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
185 | }
186 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
187 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
188 | } elseif ($prepend) {
189 | // Prepend directories for an already registered namespace.
190 | $this->prefixDirsPsr4[$prefix] = array_merge(
191 | (array) $paths,
192 | $this->prefixDirsPsr4[$prefix]
193 | );
194 | } else {
195 | // Append directories for an already registered namespace.
196 | $this->prefixDirsPsr4[$prefix] = array_merge(
197 | $this->prefixDirsPsr4[$prefix],
198 | (array) $paths
199 | );
200 | }
201 | }
202 |
203 | /**
204 | * Registers a set of PSR-0 directories for a given prefix,
205 | * replacing any others previously set for this prefix.
206 | *
207 | * @param string $prefix The prefix
208 | * @param array|string $paths The PSR-0 base directories
209 | */
210 | public function set($prefix, $paths)
211 | {
212 | if (!$prefix) {
213 | $this->fallbackDirsPsr0 = (array) $paths;
214 | } else {
215 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
216 | }
217 | }
218 |
219 | /**
220 | * Registers a set of PSR-4 directories for a given namespace,
221 | * replacing any others previously set for this namespace.
222 | *
223 | * @param string $prefix The prefix/namespace, with trailing '\\'
224 | * @param array|string $paths The PSR-4 base directories
225 | *
226 | * @throws \InvalidArgumentException
227 | */
228 | public function setPsr4($prefix, $paths)
229 | {
230 | if (!$prefix) {
231 | $this->fallbackDirsPsr4 = (array) $paths;
232 | } else {
233 | $length = strlen($prefix);
234 | if ('\\' !== $prefix[$length - 1]) {
235 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
236 | }
237 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
238 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
239 | }
240 | }
241 |
242 | /**
243 | * Turns on searching the include path for class files.
244 | *
245 | * @param bool $useIncludePath
246 | */
247 | public function setUseIncludePath($useIncludePath)
248 | {
249 | $this->useIncludePath = $useIncludePath;
250 | }
251 |
252 | /**
253 | * Can be used to check if the autoloader uses the include path to check
254 | * for classes.
255 | *
256 | * @return bool
257 | */
258 | public function getUseIncludePath()
259 | {
260 | return $this->useIncludePath;
261 | }
262 |
263 | /**
264 | * Turns off searching the prefix and fallback directories for classes
265 | * that have not been registered with the class map.
266 | *
267 | * @param bool $classMapAuthoritative
268 | */
269 | public function setClassMapAuthoritative($classMapAuthoritative)
270 | {
271 | $this->classMapAuthoritative = $classMapAuthoritative;
272 | }
273 |
274 | /**
275 | * Should class lookup fail if not found in the current class map?
276 | *
277 | * @return bool
278 | */
279 | public function isClassMapAuthoritative()
280 | {
281 | return $this->classMapAuthoritative;
282 | }
283 |
284 | /**
285 | * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
286 | *
287 | * @param string|null $apcuPrefix
288 | */
289 | public function setApcuPrefix($apcuPrefix)
290 | {
291 | $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
292 | }
293 |
294 | /**
295 | * The APCu prefix in use, or null if APCu caching is not enabled.
296 | *
297 | * @return string|null
298 | */
299 | public function getApcuPrefix()
300 | {
301 | return $this->apcuPrefix;
302 | }
303 |
304 | /**
305 | * Registers this instance as an autoloader.
306 | *
307 | * @param bool $prepend Whether to prepend the autoloader or not
308 | */
309 | public function register($prepend = false)
310 | {
311 | spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312 |
313 | if (null === $this->vendorDir) {
314 | //no-op
315 | } elseif ($prepend) {
316 | self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
317 | } else {
318 | unset(self::$registeredLoaders[$this->vendorDir]);
319 | self::$registeredLoaders[$this->vendorDir] = $this;
320 | }
321 | }
322 |
323 | /**
324 | * Unregisters this instance as an autoloader.
325 | */
326 | public function unregister()
327 | {
328 | spl_autoload_unregister(array($this, 'loadClass'));
329 |
330 | if (null !== $this->vendorDir) {
331 | unset(self::$registeredLoaders[$this->vendorDir]);
332 | }
333 | }
334 |
335 | /**
336 | * Loads the given class or interface.
337 | *
338 | * @param string $class The name of the class
339 | * @return bool|null True if loaded, null otherwise
340 | */
341 | public function loadClass($class)
342 | {
343 | if ($file = $this->findFile($class)) {
344 | includeFile($file);
345 |
346 | return true;
347 | }
348 | }
349 |
350 | /**
351 | * Finds the path to the file where the class is defined.
352 | *
353 | * @param string $class The name of the class
354 | *
355 | * @return string|false The path if found, false otherwise
356 | */
357 | public function findFile($class)
358 | {
359 | // class map lookup
360 | if (isset($this->classMap[$class])) {
361 | return $this->classMap[$class];
362 | }
363 | if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
364 | return false;
365 | }
366 | if (null !== $this->apcuPrefix) {
367 | $file = apcu_fetch($this->apcuPrefix.$class, $hit);
368 | if ($hit) {
369 | return $file;
370 | }
371 | }
372 |
373 | $file = $this->findFileWithExtension($class, '.php');
374 |
375 | // Search for Hack files if we are running on HHVM
376 | if (false === $file && defined('HHVM_VERSION')) {
377 | $file = $this->findFileWithExtension($class, '.hh');
378 | }
379 |
380 | if (null !== $this->apcuPrefix) {
381 | apcu_add($this->apcuPrefix.$class, $file);
382 | }
383 |
384 | if (false === $file) {
385 | // Remember that this class does not exist.
386 | $this->missingClasses[$class] = true;
387 | }
388 |
389 | return $file;
390 | }
391 |
392 | /**
393 | * Returns the currently registered loaders indexed by their corresponding vendor directories.
394 | *
395 | * @return self[]
396 | */
397 | public static function getRegisteredLoaders()
398 | {
399 | return self::$registeredLoaders;
400 | }
401 |
402 | private function findFileWithExtension($class, $ext)
403 | {
404 | // PSR-4 lookup
405 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
406 |
407 | $first = $class[0];
408 | if (isset($this->prefixLengthsPsr4[$first])) {
409 | $subPath = $class;
410 | while (false !== $lastPos = strrpos($subPath, '\\')) {
411 | $subPath = substr($subPath, 0, $lastPos);
412 | $search = $subPath . '\\';
413 | if (isset($this->prefixDirsPsr4[$search])) {
414 | $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
415 | foreach ($this->prefixDirsPsr4[$search] as $dir) {
416 | if (file_exists($file = $dir . $pathEnd)) {
417 | return $file;
418 | }
419 | }
420 | }
421 | }
422 | }
423 |
424 | // PSR-4 fallback dirs
425 | foreach ($this->fallbackDirsPsr4 as $dir) {
426 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
427 | return $file;
428 | }
429 | }
430 |
431 | // PSR-0 lookup
432 | if (false !== $pos = strrpos($class, '\\')) {
433 | // namespaced class name
434 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
435 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
436 | } else {
437 | // PEAR-like class name
438 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
439 | }
440 |
441 | if (isset($this->prefixesPsr0[$first])) {
442 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
443 | if (0 === strpos($class, $prefix)) {
444 | foreach ($dirs as $dir) {
445 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
446 | return $file;
447 | }
448 | }
449 | }
450 | }
451 | }
452 |
453 | // PSR-0 fallback dirs
454 | foreach ($this->fallbackDirsPsr0 as $dir) {
455 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
456 | return $file;
457 | }
458 | }
459 |
460 | // PSR-0 include paths.
461 | if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
462 | return $file;
463 | }
464 |
465 | return false;
466 | }
467 | }
468 |
469 | /**
470 | * Scope isolated include.
471 | *
472 | * Prevents access to $this/self from included files.
473 | */
474 | function includeFile($file)
475 | {
476 | include $file;
477 | }
478 |
--------------------------------------------------------------------------------
/vendor/composer/InstalledVersions.php:
--------------------------------------------------------------------------------
1 |
27 | array (
28 | 'pretty_version' => '1.0.0+no-version-set',
29 | 'version' => '1.0.0.0',
30 | 'aliases' =>
31 | array (
32 | ),
33 | 'reference' => NULL,
34 | 'name' => '__root__',
35 | ),
36 | 'versions' =>
37 | array (
38 | '__root__' =>
39 | array (
40 | 'pretty_version' => '1.0.0+no-version-set',
41 | 'version' => '1.0.0.0',
42 | 'aliases' =>
43 | array (
44 | ),
45 | 'reference' => NULL,
46 | ),
47 | 'scssphp/scssphp' =>
48 | array (
49 | 'pretty_version' => 'v1.11.0',
50 | 'version' => '1.11.0.0',
51 | 'aliases' =>
52 | array (
53 | ),
54 | 'reference' => '33749d12c2569bb24071f94e9af828662dabb068',
55 | ),
56 | ),
57 | );
58 | private static $canGetVendors;
59 | private static $installedByVendor = array();
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | public static function getInstalledPackages()
68 | {
69 | $packages = array();
70 | foreach (self::getInstalled() as $installed) {
71 | $packages[] = array_keys($installed['versions']);
72 | }
73 |
74 |
75 | if (1 === \count($packages)) {
76 | return $packages[0];
77 | }
78 |
79 | return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
80 | }
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | public static function isInstalled($packageName)
91 | {
92 | foreach (self::getInstalled() as $installed) {
93 | if (isset($installed['versions'][$packageName])) {
94 | return true;
95 | }
96 | }
97 |
98 | return false;
99 | }
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | public static function satisfies(VersionParser $parser, $packageName, $constraint)
115 | {
116 | $constraint = $parser->parseConstraints($constraint);
117 | $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
118 |
119 | return $provided->matches($constraint);
120 | }
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | public static function getVersionRanges($packageName)
132 | {
133 | foreach (self::getInstalled() as $installed) {
134 | if (!isset($installed['versions'][$packageName])) {
135 | continue;
136 | }
137 |
138 | $ranges = array();
139 | if (isset($installed['versions'][$packageName]['pretty_version'])) {
140 | $ranges[] = $installed['versions'][$packageName]['pretty_version'];
141 | }
142 | if (array_key_exists('aliases', $installed['versions'][$packageName])) {
143 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
144 | }
145 | if (array_key_exists('replaced', $installed['versions'][$packageName])) {
146 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
147 | }
148 | if (array_key_exists('provided', $installed['versions'][$packageName])) {
149 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
150 | }
151 |
152 | return implode(' || ', $ranges);
153 | }
154 |
155 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
156 | }
157 |
158 |
159 |
160 |
161 |
162 | public static function getVersion($packageName)
163 | {
164 | foreach (self::getInstalled() as $installed) {
165 | if (!isset($installed['versions'][$packageName])) {
166 | continue;
167 | }
168 |
169 | if (!isset($installed['versions'][$packageName]['version'])) {
170 | return null;
171 | }
172 |
173 | return $installed['versions'][$packageName]['version'];
174 | }
175 |
176 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
177 | }
178 |
179 |
180 |
181 |
182 |
183 | public static function getPrettyVersion($packageName)
184 | {
185 | foreach (self::getInstalled() as $installed) {
186 | if (!isset($installed['versions'][$packageName])) {
187 | continue;
188 | }
189 |
190 | if (!isset($installed['versions'][$packageName]['pretty_version'])) {
191 | return null;
192 | }
193 |
194 | return $installed['versions'][$packageName]['pretty_version'];
195 | }
196 |
197 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
198 | }
199 |
200 |
201 |
202 |
203 |
204 | public static function getReference($packageName)
205 | {
206 | foreach (self::getInstalled() as $installed) {
207 | if (!isset($installed['versions'][$packageName])) {
208 | continue;
209 | }
210 |
211 | if (!isset($installed['versions'][$packageName]['reference'])) {
212 | return null;
213 | }
214 |
215 | return $installed['versions'][$packageName]['reference'];
216 | }
217 |
218 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
219 | }
220 |
221 |
222 |
223 |
224 |
225 | public static function getRootPackage()
226 | {
227 | $installed = self::getInstalled();
228 |
229 | return $installed[0]['root'];
230 | }
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 | public static function getRawData()
239 | {
240 | return self::$installed;
241 | }
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 | public static function reload($data)
262 | {
263 | self::$installed = $data;
264 | self::$installedByVendor = array();
265 | }
266 |
267 |
268 |
269 |
270 | private static function getInstalled()
271 | {
272 | if (null === self::$canGetVendors) {
273 | self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
274 | }
275 |
276 | $installed = array();
277 |
278 | if (self::$canGetVendors) {
279 |
280 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
281 | if (isset(self::$installedByVendor[$vendorDir])) {
282 | $installed[] = self::$installedByVendor[$vendorDir];
283 | } elseif (is_file($vendorDir.'/composer/installed.php')) {
284 | $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
285 | }
286 | }
287 | }
288 |
289 | $installed[] = self::$installed;
290 |
291 | return $installed;
292 | }
293 | }
294 |
--------------------------------------------------------------------------------
/vendor/composer/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) Nils Adermann, Jordi Boggiano
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is furnished
9 | to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_classmap.php:
--------------------------------------------------------------------------------
1 | $vendorDir . '/composer/InstalledVersions.php',
10 | );
11 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_namespaces.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/scssphp/scssphp/src'),
10 | );
11 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32 | if ($useStaticLoader) {
33 | require __DIR__ . '/autoload_static.php';
34 |
35 | call_user_func(\Composer\Autoload\ComposerStaticIniteb55ce31eb8107fb4f762e28da7c827f::getInitializer($loader));
36 | } else {
37 | $map = require __DIR__ . '/autoload_namespaces.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->set($namespace, $path);
40 | }
41 |
42 | $map = require __DIR__ . '/autoload_psr4.php';
43 | foreach ($map as $namespace => $path) {
44 | $loader->setPsr4($namespace, $path);
45 | }
46 |
47 | $classMap = require __DIR__ . '/autoload_classmap.php';
48 | if ($classMap) {
49 | $loader->addClassMap($classMap);
50 | }
51 | }
52 |
53 | $loader->register(true);
54 |
55 | return $loader;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 |
11 | array (
12 | 'ScssPhp\\ScssPhp\\' => 16,
13 | ),
14 | );
15 |
16 | public static $prefixDirsPsr4 = array (
17 | 'ScssPhp\\ScssPhp\\' =>
18 | array (
19 | 0 => __DIR__ . '/..' . '/scssphp/scssphp/src',
20 | ),
21 | );
22 |
23 | public static $classMap = array (
24 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25 | );
26 |
27 | public static function getInitializer(ClassLoader $loader)
28 | {
29 | return \Closure::bind(function () use ($loader) {
30 | $loader->prefixLengthsPsr4 = ComposerStaticIniteb55ce31eb8107fb4f762e28da7c827f::$prefixLengthsPsr4;
31 | $loader->prefixDirsPsr4 = ComposerStaticIniteb55ce31eb8107fb4f762e28da7c827f::$prefixDirsPsr4;
32 | $loader->classMap = ComposerStaticIniteb55ce31eb8107fb4f762e28da7c827f::$classMap;
33 |
34 | }, null, ClassLoader::class);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": [
3 | {
4 | "name": "scssphp/scssphp",
5 | "version": "v1.11.0",
6 | "version_normalized": "1.11.0.0",
7 | "source": {
8 | "type": "git",
9 | "url": "https://github.com/scssphp/scssphp.git",
10 | "reference": "33749d12c2569bb24071f94e9af828662dabb068"
11 | },
12 | "dist": {
13 | "type": "zip",
14 | "url": "https://api.github.com/repos/scssphp/scssphp/zipball/33749d12c2569bb24071f94e9af828662dabb068",
15 | "reference": "33749d12c2569bb24071f94e9af828662dabb068",
16 | "shasum": ""
17 | },
18 | "require": {
19 | "ext-ctype": "*",
20 | "ext-json": "*",
21 | "php": ">=5.6.0"
22 | },
23 | "require-dev": {
24 | "bamarni/composer-bin-plugin": "^1.4",
25 | "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4",
26 | "sass/sass-spec": "*",
27 | "squizlabs/php_codesniffer": "~3.5",
28 | "symfony/phpunit-bridge": "^5.1",
29 | "thoughtbot/bourbon": "^7.0",
30 | "twbs/bootstrap": "~5.0",
31 | "twbs/bootstrap4": "4.6.1",
32 | "zurb/foundation": "~6.5"
33 | },
34 | "suggest": {
35 | "ext-iconv": "Can be used as fallback when ext-mbstring is not available",
36 | "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv"
37 | },
38 | "time": "2022-09-02T21:24:55+00:00",
39 | "bin": [
40 | "bin/pscss"
41 | ],
42 | "type": "library",
43 | "extra": {
44 | "bamarni-bin": {
45 | "forward-command": false,
46 | "bin-links": false
47 | }
48 | },
49 | "installation-source": "dist",
50 | "autoload": {
51 | "psr-4": {
52 | "ScssPhp\\ScssPhp\\": "src/"
53 | }
54 | },
55 | "notification-url": "https://packagist.org/downloads/",
56 | "license": [
57 | "MIT"
58 | ],
59 | "authors": [
60 | {
61 | "name": "Anthon Pang",
62 | "email": "apang@softwaredevelopment.ca",
63 | "homepage": "https://github.com/robocoder"
64 | },
65 | {
66 | "name": "Cédric Morin",
67 | "email": "cedric@yterium.com",
68 | "homepage": "https://github.com/Cerdic"
69 | }
70 | ],
71 | "description": "scssphp is a compiler for SCSS written in PHP.",
72 | "homepage": "http://scssphp.github.io/scssphp/",
73 | "keywords": [
74 | "css",
75 | "less",
76 | "sass",
77 | "scss",
78 | "stylesheet"
79 | ],
80 | "support": {
81 | "issues": "https://github.com/scssphp/scssphp/issues",
82 | "source": "https://github.com/scssphp/scssphp/tree/v1.11.0"
83 | },
84 | "install-path": "../scssphp/scssphp"
85 | }
86 | ],
87 | "dev": true,
88 | "dev-package-names": []
89 | }
90 |
--------------------------------------------------------------------------------
/vendor/composer/installed.php:
--------------------------------------------------------------------------------
1 |
3 | array (
4 | 'pretty_version' => '1.0.0+no-version-set',
5 | 'version' => '1.0.0.0',
6 | 'aliases' =>
7 | array (
8 | ),
9 | 'reference' => NULL,
10 | 'name' => '__root__',
11 | ),
12 | 'versions' =>
13 | array (
14 | '__root__' =>
15 | array (
16 | 'pretty_version' => '1.0.0+no-version-set',
17 | 'version' => '1.0.0.0',
18 | 'aliases' =>
19 | array (
20 | ),
21 | 'reference' => NULL,
22 | ),
23 | 'scssphp/scssphp' =>
24 | array (
25 | 'pretty_version' => 'v1.11.0',
26 | 'version' => '1.11.0.0',
27 | 'aliases' =>
28 | array (
29 | ),
30 | 'reference' => '33749d12c2569bb24071f94e9af828662dabb068',
31 | ),
32 | ),
33 | );
34 |
--------------------------------------------------------------------------------
/vendor/composer/platform_check.php:
--------------------------------------------------------------------------------
1 | =5.6.0",
30 | "ext-json": "*",
31 | "ext-ctype": "*"
32 | },
33 | "suggest": {
34 | "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv",
35 | "ext-iconv": "Can be used as fallback when ext-mbstring is not available"
36 | },
37 | "require-dev": {
38 | "bamarni/composer-bin-plugin": "^1.4",
39 | "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4",
40 | "sass/sass-spec": "*",
41 | "squizlabs/php_codesniffer": "~3.5",
42 | "symfony/phpunit-bridge": "^5.1",
43 | "thoughtbot/bourbon": "^7.0",
44 | "twbs/bootstrap": "~5.0",
45 | "twbs/bootstrap4": "4.6.1",
46 | "zurb/foundation": "~6.5"
47 | },
48 | "repositories": [
49 | {
50 | "type": "package",
51 | "package": {
52 | "name": "sass/sass-spec",
53 | "version": "2022.08.19",
54 | "source": {
55 | "type": "git",
56 | "url": "https://github.com/sass/sass-spec.git",
57 | "reference": "2bdc199723a3445d5badac3ac774105698f08861"
58 | },
59 | "dist": {
60 | "type": "zip",
61 | "url": "https://api.github.com/repos/sass/sass-spec/zipball/2bdc199723a3445d5badac3ac774105698f08861",
62 | "reference": "2bdc199723a3445d5badac3ac774105698f08861",
63 | "shasum": ""
64 | }
65 | }
66 | },
67 | {
68 | "type": "package",
69 | "package": {
70 | "name": "thoughtbot/bourbon",
71 | "version": "v7.0.0",
72 | "source": {
73 | "type": "git",
74 | "url": "https://github.com/thoughtbot/bourbon.git",
75 | "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3"
76 | },
77 | "dist": {
78 | "type": "zip",
79 | "url": "https://api.github.com/repos/thoughtbot/bourbon/zipball/fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
80 | "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
81 | "shasum": ""
82 | }
83 | }
84 | },
85 | {
86 | "type": "package",
87 | "package": {
88 | "name": "twbs/bootstrap4",
89 | "version": "v4.6.1",
90 | "source": {
91 | "type": "git",
92 | "url": "https://github.com/twbs/bootstrap.git",
93 | "reference": "043a03c95a2ad6738f85b65e53b9dbdfb03b8d10"
94 | },
95 | "dist": {
96 | "type": "zip",
97 | "url": "https://api.github.com/repos/twbs/bootstrap/zipball/043a03c95a2ad6738f85b65e53b9dbdfb03b8d10",
98 | "reference": "043a03c95a2ad6738f85b65e53b9dbdfb03b8d10",
99 | "shasum": ""
100 | }
101 | }
102 | }
103 | ],
104 | "bin": ["bin/pscss"],
105 | "config": {
106 | "sort-packages": true,
107 | "allow-plugins": {
108 | "bamarni/composer-bin-plugin": true
109 | }
110 | },
111 | "extra": {
112 | "bamarni-bin": {
113 | "forward-command": false,
114 | "bin-links": false
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Base/Range.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class Range
23 | {
24 | /**
25 | * @var float|int
26 | */
27 | public $first;
28 |
29 | /**
30 | * @var float|int
31 | */
32 | public $last;
33 |
34 | /**
35 | * Initialize range
36 | *
37 | * @param int|float $first
38 | * @param int|float $last
39 | */
40 | public function __construct($first, $last)
41 | {
42 | $this->first = $first;
43 | $this->last = $last;
44 | }
45 |
46 | /**
47 | * Test for inclusion in range
48 | *
49 | * @param int|float $value
50 | *
51 | * @return bool
52 | */
53 | public function includes($value)
54 | {
55 | return $value >= $this->first && $value <= $this->last;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class Block
23 | {
24 | /**
25 | * @var string|null
26 | */
27 | public $type;
28 |
29 | /**
30 | * @var Block|null
31 | */
32 | public $parent;
33 |
34 | /**
35 | * @var string
36 | */
37 | public $sourceName;
38 |
39 | /**
40 | * @var int
41 | */
42 | public $sourceIndex;
43 |
44 | /**
45 | * @var int
46 | */
47 | public $sourceLine;
48 |
49 | /**
50 | * @var int
51 | */
52 | public $sourceColumn;
53 |
54 | /**
55 | * @var array|null
56 | */
57 | public $selectors;
58 |
59 | /**
60 | * @var array
61 | */
62 | public $comments;
63 |
64 | /**
65 | * @var array
66 | */
67 | public $children;
68 |
69 | /**
70 | * @var Block|null
71 | */
72 | public $selfParent;
73 | }
74 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/AtRootBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_AT_ROOT;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/CallableBlock.php:
--------------------------------------------------------------------------------
1 | type = $type;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/ContentBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_INCLUDE;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/DirectiveBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_DIRECTIVE;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/EachBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_EACH;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/ElseBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_ELSE;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/ElseifBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_ELSEIF;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/ForBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_FOR;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/IfBlock.php:
--------------------------------------------------------------------------------
1 |
30 | */
31 | public $cases = [];
32 |
33 | public function __construct()
34 | {
35 | $this->type = Type::T_IF;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/MediaBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_MEDIA;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/NestedPropertyBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_NESTED_PROPERTY;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Block/WhileBlock.php:
--------------------------------------------------------------------------------
1 | type = Type::T_WHILE;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Cache.php:
--------------------------------------------------------------------------------
1 |
33 | *
34 | * @internal
35 | */
36 | class Cache
37 | {
38 | const CACHE_VERSION = 1;
39 |
40 | /**
41 | * directory used for storing data
42 | *
43 | * @var string|false
44 | */
45 | public static $cacheDir = false;
46 |
47 | /**
48 | * prefix for the storing data
49 | *
50 | * @var string
51 | */
52 | public static $prefix = 'scssphp_';
53 |
54 | /**
55 | * force a refresh : 'once' for refreshing the first hit on a cache only, true to never use the cache in this hit
56 | *
57 | * @var bool|string
58 | */
59 | public static $forceRefresh = false;
60 |
61 | /**
62 | * specifies the number of seconds after which data cached will be seen as 'garbage' and potentially cleaned up
63 | *
64 | * @var int
65 | */
66 | public static $gcLifetime = 604800;
67 |
68 | /**
69 | * array of already refreshed cache if $forceRefresh==='once'
70 | *
71 | * @var array
72 | */
73 | protected static $refreshed = [];
74 |
75 | /**
76 | * Constructor
77 | *
78 | * @param array $options
79 | *
80 | * @phpstan-param array{cacheDir?: string, prefix?: string, forceRefresh?: string} $options
81 | */
82 | public function __construct($options)
83 | {
84 | // check $cacheDir
85 | if (isset($options['cacheDir'])) {
86 | self::$cacheDir = $options['cacheDir'];
87 | }
88 |
89 | if (empty(self::$cacheDir)) {
90 | throw new Exception('cacheDir not set');
91 | }
92 |
93 | if (isset($options['prefix'])) {
94 | self::$prefix = $options['prefix'];
95 | }
96 |
97 | if (empty(self::$prefix)) {
98 | throw new Exception('prefix not set');
99 | }
100 |
101 | if (isset($options['forceRefresh'])) {
102 | self::$forceRefresh = $options['forceRefresh'];
103 | }
104 |
105 | self::checkCacheDir();
106 | }
107 |
108 | /**
109 | * Get the cached result of $operation on $what,
110 | * which is known as dependant from the content of $options
111 | *
112 | * @param string $operation parse, compile...
113 | * @param mixed $what content key (e.g., filename to be treated)
114 | * @param array $options any option that affect the operation result on the content
115 | * @param int|null $lastModified last modified timestamp
116 | *
117 | * @return mixed
118 | *
119 | * @throws \Exception
120 | */
121 | public function getCache($operation, $what, $options = [], $lastModified = null)
122 | {
123 | $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
124 |
125 | if (
126 | ((self::$forceRefresh === false) || (self::$forceRefresh === 'once' &&
127 | isset(self::$refreshed[$fileCache]))) && file_exists($fileCache)
128 | ) {
129 | $cacheTime = filemtime($fileCache);
130 |
131 | if (
132 | (\is_null($lastModified) || $cacheTime > $lastModified) &&
133 | $cacheTime + self::$gcLifetime > time()
134 | ) {
135 | $c = file_get_contents($fileCache);
136 | $c = unserialize($c);
137 |
138 | if (\is_array($c) && isset($c['value'])) {
139 | return $c['value'];
140 | }
141 | }
142 | }
143 |
144 | return null;
145 | }
146 |
147 | /**
148 | * Put in cache the result of $operation on $what,
149 | * which is known as dependant from the content of $options
150 | *
151 | * @param string $operation
152 | * @param mixed $what
153 | * @param mixed $value
154 | * @param array $options
155 | *
156 | * @return void
157 | */
158 | public function setCache($operation, $what, $value, $options = [])
159 | {
160 | $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
161 |
162 | $c = ['value' => $value];
163 | $c = serialize($c);
164 |
165 | file_put_contents($fileCache, $c);
166 |
167 | if (self::$forceRefresh === 'once') {
168 | self::$refreshed[$fileCache] = true;
169 | }
170 | }
171 |
172 | /**
173 | * Get the cache name for the caching of $operation on $what,
174 | * which is known as dependant from the content of $options
175 | *
176 | * @param string $operation
177 | * @param mixed $what
178 | * @param array $options
179 | *
180 | * @return string
181 | */
182 | private static function cacheName($operation, $what, $options = [])
183 | {
184 | $t = [
185 | 'version' => self::CACHE_VERSION,
186 | 'scssphpVersion' => Version::VERSION,
187 | 'operation' => $operation,
188 | 'what' => $what,
189 | 'options' => $options
190 | ];
191 |
192 | $t = self::$prefix
193 | . sha1(json_encode($t))
194 | . ".$operation"
195 | . ".scsscache";
196 |
197 | return $t;
198 | }
199 |
200 | /**
201 | * Check that the cache dir exists and is writeable
202 | *
203 | * @return void
204 | *
205 | * @throws \Exception
206 | */
207 | public static function checkCacheDir()
208 | {
209 | self::$cacheDir = str_replace('\\', '/', self::$cacheDir);
210 | self::$cacheDir = rtrim(self::$cacheDir, '/') . '/';
211 |
212 | if (! is_dir(self::$cacheDir)) {
213 | throw new Exception('Cache directory doesn\'t exist: ' . self::$cacheDir);
214 | }
215 |
216 | if (! is_writable(self::$cacheDir)) {
217 | throw new Exception('Cache directory isn\'t writable: ' . self::$cacheDir);
218 | }
219 | }
220 |
221 | /**
222 | * Delete unused cached files
223 | *
224 | * @return void
225 | */
226 | public static function cleanCache()
227 | {
228 | static $clean = false;
229 |
230 | if ($clean || empty(self::$cacheDir)) {
231 | return;
232 | }
233 |
234 | $clean = true;
235 |
236 | // only remove files with extensions created by SCSSPHP Cache
237 | // css files removed based on the list files
238 | $removeTypes = ['scsscache' => 1];
239 |
240 | $files = scandir(self::$cacheDir);
241 |
242 | if (! $files) {
243 | return;
244 | }
245 |
246 | $checkTime = time() - self::$gcLifetime;
247 |
248 | foreach ($files as $file) {
249 | // don't delete if the file wasn't created with SCSSPHP Cache
250 | if (strpos($file, self::$prefix) !== 0) {
251 | continue;
252 | }
253 |
254 | $parts = explode('.', $file);
255 | $type = array_pop($parts);
256 |
257 | if (! isset($removeTypes[$type])) {
258 | continue;
259 | }
260 |
261 | $fullPath = self::$cacheDir . $file;
262 | $mtime = filemtime($fullPath);
263 |
264 | // don't delete if it's a relatively new file
265 | if ($mtime > $checkTime) {
266 | continue;
267 | }
268 |
269 | unlink($fullPath);
270 | }
271 | }
272 | }
273 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Colors.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class Colors
23 | {
24 | /**
25 | * CSS Colors
26 | *
27 | * @see http://www.w3.org/TR/css3-color
28 | *
29 | * @var array
30 | */
31 | protected static $cssColors = [
32 | 'aliceblue' => '240,248,255',
33 | 'antiquewhite' => '250,235,215',
34 | 'aqua' => '0,255,255',
35 | 'cyan' => '0,255,255',
36 | 'aquamarine' => '127,255,212',
37 | 'azure' => '240,255,255',
38 | 'beige' => '245,245,220',
39 | 'bisque' => '255,228,196',
40 | 'black' => '0,0,0',
41 | 'blanchedalmond' => '255,235,205',
42 | 'blue' => '0,0,255',
43 | 'blueviolet' => '138,43,226',
44 | 'brown' => '165,42,42',
45 | 'burlywood' => '222,184,135',
46 | 'cadetblue' => '95,158,160',
47 | 'chartreuse' => '127,255,0',
48 | 'chocolate' => '210,105,30',
49 | 'coral' => '255,127,80',
50 | 'cornflowerblue' => '100,149,237',
51 | 'cornsilk' => '255,248,220',
52 | 'crimson' => '220,20,60',
53 | 'darkblue' => '0,0,139',
54 | 'darkcyan' => '0,139,139',
55 | 'darkgoldenrod' => '184,134,11',
56 | 'darkgray' => '169,169,169',
57 | 'darkgrey' => '169,169,169',
58 | 'darkgreen' => '0,100,0',
59 | 'darkkhaki' => '189,183,107',
60 | 'darkmagenta' => '139,0,139',
61 | 'darkolivegreen' => '85,107,47',
62 | 'darkorange' => '255,140,0',
63 | 'darkorchid' => '153,50,204',
64 | 'darkred' => '139,0,0',
65 | 'darksalmon' => '233,150,122',
66 | 'darkseagreen' => '143,188,143',
67 | 'darkslateblue' => '72,61,139',
68 | 'darkslategray' => '47,79,79',
69 | 'darkslategrey' => '47,79,79',
70 | 'darkturquoise' => '0,206,209',
71 | 'darkviolet' => '148,0,211',
72 | 'deeppink' => '255,20,147',
73 | 'deepskyblue' => '0,191,255',
74 | 'dimgray' => '105,105,105',
75 | 'dimgrey' => '105,105,105',
76 | 'dodgerblue' => '30,144,255',
77 | 'firebrick' => '178,34,34',
78 | 'floralwhite' => '255,250,240',
79 | 'forestgreen' => '34,139,34',
80 | 'fuchsia' => '255,0,255',
81 | 'magenta' => '255,0,255',
82 | 'gainsboro' => '220,220,220',
83 | 'ghostwhite' => '248,248,255',
84 | 'gold' => '255,215,0',
85 | 'goldenrod' => '218,165,32',
86 | 'gray' => '128,128,128',
87 | 'grey' => '128,128,128',
88 | 'green' => '0,128,0',
89 | 'greenyellow' => '173,255,47',
90 | 'honeydew' => '240,255,240',
91 | 'hotpink' => '255,105,180',
92 | 'indianred' => '205,92,92',
93 | 'indigo' => '75,0,130',
94 | 'ivory' => '255,255,240',
95 | 'khaki' => '240,230,140',
96 | 'lavender' => '230,230,250',
97 | 'lavenderblush' => '255,240,245',
98 | 'lawngreen' => '124,252,0',
99 | 'lemonchiffon' => '255,250,205',
100 | 'lightblue' => '173,216,230',
101 | 'lightcoral' => '240,128,128',
102 | 'lightcyan' => '224,255,255',
103 | 'lightgoldenrodyellow' => '250,250,210',
104 | 'lightgray' => '211,211,211',
105 | 'lightgrey' => '211,211,211',
106 | 'lightgreen' => '144,238,144',
107 | 'lightpink' => '255,182,193',
108 | 'lightsalmon' => '255,160,122',
109 | 'lightseagreen' => '32,178,170',
110 | 'lightskyblue' => '135,206,250',
111 | 'lightslategray' => '119,136,153',
112 | 'lightslategrey' => '119,136,153',
113 | 'lightsteelblue' => '176,196,222',
114 | 'lightyellow' => '255,255,224',
115 | 'lime' => '0,255,0',
116 | 'limegreen' => '50,205,50',
117 | 'linen' => '250,240,230',
118 | 'maroon' => '128,0,0',
119 | 'mediumaquamarine' => '102,205,170',
120 | 'mediumblue' => '0,0,205',
121 | 'mediumorchid' => '186,85,211',
122 | 'mediumpurple' => '147,112,219',
123 | 'mediumseagreen' => '60,179,113',
124 | 'mediumslateblue' => '123,104,238',
125 | 'mediumspringgreen' => '0,250,154',
126 | 'mediumturquoise' => '72,209,204',
127 | 'mediumvioletred' => '199,21,133',
128 | 'midnightblue' => '25,25,112',
129 | 'mintcream' => '245,255,250',
130 | 'mistyrose' => '255,228,225',
131 | 'moccasin' => '255,228,181',
132 | 'navajowhite' => '255,222,173',
133 | 'navy' => '0,0,128',
134 | 'oldlace' => '253,245,230',
135 | 'olive' => '128,128,0',
136 | 'olivedrab' => '107,142,35',
137 | 'orange' => '255,165,0',
138 | 'orangered' => '255,69,0',
139 | 'orchid' => '218,112,214',
140 | 'palegoldenrod' => '238,232,170',
141 | 'palegreen' => '152,251,152',
142 | 'paleturquoise' => '175,238,238',
143 | 'palevioletred' => '219,112,147',
144 | 'papayawhip' => '255,239,213',
145 | 'peachpuff' => '255,218,185',
146 | 'peru' => '205,133,63',
147 | 'pink' => '255,192,203',
148 | 'plum' => '221,160,221',
149 | 'powderblue' => '176,224,230',
150 | 'purple' => '128,0,128',
151 | 'red' => '255,0,0',
152 | 'rosybrown' => '188,143,143',
153 | 'royalblue' => '65,105,225',
154 | 'saddlebrown' => '139,69,19',
155 | 'salmon' => '250,128,114',
156 | 'sandybrown' => '244,164,96',
157 | 'seagreen' => '46,139,87',
158 | 'seashell' => '255,245,238',
159 | 'sienna' => '160,82,45',
160 | 'silver' => '192,192,192',
161 | 'skyblue' => '135,206,235',
162 | 'slateblue' => '106,90,205',
163 | 'slategray' => '112,128,144',
164 | 'slategrey' => '112,128,144',
165 | 'snow' => '255,250,250',
166 | 'springgreen' => '0,255,127',
167 | 'steelblue' => '70,130,180',
168 | 'tan' => '210,180,140',
169 | 'teal' => '0,128,128',
170 | 'thistle' => '216,191,216',
171 | 'tomato' => '255,99,71',
172 | 'turquoise' => '64,224,208',
173 | 'violet' => '238,130,238',
174 | 'wheat' => '245,222,179',
175 | 'white' => '255,255,255',
176 | 'whitesmoke' => '245,245,245',
177 | 'yellow' => '255,255,0',
178 | 'yellowgreen' => '154,205,50',
179 | 'rebeccapurple' => '102,51,153',
180 | 'transparent' => '0,0,0,0',
181 | ];
182 |
183 | /**
184 | * Convert named color in a [r,g,b[,a]] array
185 | *
186 | * @param string $colorName
187 | *
188 | * @return int[]|null
189 | */
190 | public static function colorNameToRGBa($colorName)
191 | {
192 | if (\is_string($colorName) && isset(static::$cssColors[$colorName])) {
193 | $rgba = explode(',', static::$cssColors[$colorName]);
194 |
195 | // only case with opacity is transparent, with opacity=0, so we can intval on opacity also
196 | $rgba = array_map('intval', $rgba);
197 |
198 | return $rgba;
199 | }
200 |
201 | return null;
202 | }
203 |
204 | /**
205 | * Reverse conversion : from RGBA to a color name if possible
206 | *
207 | * @param int $r
208 | * @param int $g
209 | * @param int $b
210 | * @param int|float $a
211 | *
212 | * @return string|null
213 | */
214 | public static function RGBaToColorName($r, $g, $b, $a = 1)
215 | {
216 | static $reverseColorTable = null;
217 |
218 | if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b) || ! is_numeric($a)) {
219 | return null;
220 | }
221 |
222 | if ($a < 1) {
223 | return null;
224 | }
225 |
226 | if (\is_null($reverseColorTable)) {
227 | $reverseColorTable = [];
228 |
229 | foreach (static::$cssColors as $name => $rgb_str) {
230 | $rgb_str = explode(',', $rgb_str);
231 |
232 | if (
233 | \count($rgb_str) == 3 &&
234 | ! isset($reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])])
235 | ) {
236 | $reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])] = $name;
237 | }
238 | }
239 | }
240 |
241 | if (isset($reverseColorTable[\intval($r)][\intval($g)][\intval($b)])) {
242 | return $reverseColorTable[\intval($r)][\intval($g)][\intval($b)];
243 | }
244 |
245 | return null;
246 | }
247 | }
248 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/CompilationResult.php:
--------------------------------------------------------------------------------
1 | css = $css;
40 | $this->sourceMap = $sourceMap;
41 | $this->includedFiles = $includedFiles;
42 | }
43 |
44 | /**
45 | * @return string
46 | */
47 | public function getCss()
48 | {
49 | return $this->css;
50 | }
51 |
52 | /**
53 | * @return string[]
54 | */
55 | public function getIncludedFiles()
56 | {
57 | return $this->includedFiles;
58 | }
59 |
60 | /**
61 | * The sourceMap content, if it was generated
62 | *
63 | * @return null|string
64 | */
65 | public function getSourceMap()
66 | {
67 | return $this->sourceMap;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Compiler/CachedResult.php:
--------------------------------------------------------------------------------
1 |
29 | */
30 | private $parsedFiles;
31 |
32 | /**
33 | * @var array
34 | * @phpstan-var list
35 | */
36 | private $resolvedImports;
37 |
38 | /**
39 | * @param CompilationResult $result
40 | * @param array $parsedFiles
41 | * @param array $resolvedImports
42 | *
43 | * @phpstan-param list $resolvedImports
44 | */
45 | public function __construct(CompilationResult $result, array $parsedFiles, array $resolvedImports)
46 | {
47 | $this->result = $result;
48 | $this->parsedFiles = $parsedFiles;
49 | $this->resolvedImports = $resolvedImports;
50 | }
51 |
52 | /**
53 | * @return CompilationResult
54 | */
55 | public function getResult()
56 | {
57 | return $this->result;
58 | }
59 |
60 | /**
61 | * @return array
62 | */
63 | public function getParsedFiles()
64 | {
65 | return $this->parsedFiles;
66 | }
67 |
68 | /**
69 | * @return array
70 | *
71 | * @phpstan-return list
72 | */
73 | public function getResolvedImports()
74 | {
75 | return $this->resolvedImports;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Compiler/Environment.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class Environment
23 | {
24 | /**
25 | * @var \ScssPhp\ScssPhp\Block|null
26 | */
27 | public $block;
28 |
29 | /**
30 | * @var \ScssPhp\ScssPhp\Compiler\Environment|null
31 | */
32 | public $parent;
33 |
34 | /**
35 | * @var Environment|null
36 | */
37 | public $declarationScopeParent;
38 |
39 | /**
40 | * @var Environment|null
41 | */
42 | public $parentStore;
43 |
44 | /**
45 | * @var array|null
46 | */
47 | public $selectors;
48 |
49 | /**
50 | * @var string|null
51 | */
52 | public $marker;
53 |
54 | /**
55 | * @var array
56 | */
57 | public $store;
58 |
59 | /**
60 | * @var array
61 | */
62 | public $storeUnreduced;
63 |
64 | /**
65 | * @var int
66 | */
67 | public $depth;
68 | }
69 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Exception/CompilerException.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class CompilerException extends \Exception implements SassException
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Exception/ParserException.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class ParserException extends \Exception implements SassException
23 | {
24 | /**
25 | * @var array|null
26 | * @phpstan-var array{string, int, int}|null
27 | */
28 | private $sourcePosition;
29 |
30 | /**
31 | * Get source position
32 | *
33 | * @api
34 | *
35 | * @return array|null
36 | * @phpstan-return array{string, int, int}|null
37 | */
38 | public function getSourcePosition()
39 | {
40 | return $this->sourcePosition;
41 | }
42 |
43 | /**
44 | * Set source position
45 | *
46 | * @api
47 | *
48 | * @param array $sourcePosition
49 | *
50 | * @return void
51 | *
52 | * @phpstan-param array{string, int, int} $sourcePosition
53 | */
54 | public function setSourcePosition($sourcePosition)
55 | {
56 | $this->sourcePosition = $sourcePosition;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Exception/RangeException.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class RangeException extends \Exception implements SassException
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Exception/SassException.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @deprecated The Scssphp server should define its own exception instead.
23 | */
24 | class ServerException extends \Exception implements SassException
25 | {
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter.php:
--------------------------------------------------------------------------------
1 |
22 | *
23 | * @internal
24 | */
25 | abstract class Formatter
26 | {
27 | /**
28 | * @var int
29 | */
30 | public $indentLevel;
31 |
32 | /**
33 | * @var string
34 | */
35 | public $indentChar;
36 |
37 | /**
38 | * @var string
39 | */
40 | public $break;
41 |
42 | /**
43 | * @var string
44 | */
45 | public $open;
46 |
47 | /**
48 | * @var string
49 | */
50 | public $close;
51 |
52 | /**
53 | * @var string
54 | */
55 | public $tagSeparator;
56 |
57 | /**
58 | * @var string
59 | */
60 | public $assignSeparator;
61 |
62 | /**
63 | * @var bool
64 | */
65 | public $keepSemicolons;
66 |
67 | /**
68 | * @var \ScssPhp\ScssPhp\Formatter\OutputBlock
69 | */
70 | protected $currentBlock;
71 |
72 | /**
73 | * @var int
74 | */
75 | protected $currentLine;
76 |
77 | /**
78 | * @var int
79 | */
80 | protected $currentColumn;
81 |
82 | /**
83 | * @var \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null
84 | */
85 | protected $sourceMapGenerator;
86 |
87 | /**
88 | * @var string
89 | */
90 | protected $strippedSemicolon;
91 |
92 | /**
93 | * Initialize formatter
94 | *
95 | * @api
96 | */
97 | abstract public function __construct();
98 |
99 | /**
100 | * Return indentation (whitespace)
101 | *
102 | * @return string
103 | */
104 | protected function indentStr()
105 | {
106 | return '';
107 | }
108 |
109 | /**
110 | * Return property assignment
111 | *
112 | * @api
113 | *
114 | * @param string $name
115 | * @param mixed $value
116 | *
117 | * @return string
118 | */
119 | public function property($name, $value)
120 | {
121 | return rtrim($name) . $this->assignSeparator . $value . ';';
122 | }
123 |
124 | /**
125 | * Return custom property assignment
126 | * differs in that you have to keep spaces in the value as is
127 | *
128 | * @api
129 | *
130 | * @param string $name
131 | * @param mixed $value
132 | *
133 | * @return string
134 | */
135 | public function customProperty($name, $value)
136 | {
137 | return rtrim($name) . trim($this->assignSeparator) . $value . ';';
138 | }
139 |
140 | /**
141 | * Output lines inside a block
142 | *
143 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
144 | *
145 | * @return void
146 | */
147 | protected function blockLines(OutputBlock $block)
148 | {
149 | $inner = $this->indentStr();
150 | $glue = $this->break . $inner;
151 |
152 | $this->write($inner . implode($glue, $block->lines));
153 |
154 | if (! empty($block->children)) {
155 | $this->write($this->break);
156 | }
157 | }
158 |
159 | /**
160 | * Output block selectors
161 | *
162 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
163 | *
164 | * @return void
165 | */
166 | protected function blockSelectors(OutputBlock $block)
167 | {
168 | assert(! empty($block->selectors));
169 |
170 | $inner = $this->indentStr();
171 |
172 | $this->write($inner
173 | . implode($this->tagSeparator, $block->selectors)
174 | . $this->open . $this->break);
175 | }
176 |
177 | /**
178 | * Output block children
179 | *
180 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
181 | *
182 | * @return void
183 | */
184 | protected function blockChildren(OutputBlock $block)
185 | {
186 | foreach ($block->children as $child) {
187 | $this->block($child);
188 | }
189 | }
190 |
191 | /**
192 | * Output non-empty block
193 | *
194 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
195 | *
196 | * @return void
197 | */
198 | protected function block(OutputBlock $block)
199 | {
200 | if (empty($block->lines) && empty($block->children)) {
201 | return;
202 | }
203 |
204 | $this->currentBlock = $block;
205 |
206 | $pre = $this->indentStr();
207 |
208 | if (! empty($block->selectors)) {
209 | $this->blockSelectors($block);
210 |
211 | $this->indentLevel++;
212 | }
213 |
214 | if (! empty($block->lines)) {
215 | $this->blockLines($block);
216 | }
217 |
218 | if (! empty($block->children)) {
219 | $this->blockChildren($block);
220 | }
221 |
222 | if (! empty($block->selectors)) {
223 | $this->indentLevel--;
224 |
225 | if (! $this->keepSemicolons) {
226 | $this->strippedSemicolon = '';
227 | }
228 |
229 | if (empty($block->children)) {
230 | $this->write($this->break);
231 | }
232 |
233 | $this->write($pre . $this->close . $this->break);
234 | }
235 | }
236 |
237 | /**
238 | * Test and clean safely empty children
239 | *
240 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
241 | *
242 | * @return bool
243 | */
244 | protected function testEmptyChildren($block)
245 | {
246 | $isEmpty = empty($block->lines);
247 |
248 | if ($block->children) {
249 | foreach ($block->children as $k => &$child) {
250 | if (! $this->testEmptyChildren($child)) {
251 | $isEmpty = false;
252 | continue;
253 | }
254 |
255 | if ($child->type === Type::T_MEDIA || $child->type === Type::T_DIRECTIVE) {
256 | $child->children = [];
257 | $child->selectors = null;
258 | }
259 | }
260 | }
261 |
262 | return $isEmpty;
263 | }
264 |
265 | /**
266 | * Entry point to formatting a block
267 | *
268 | * @api
269 | *
270 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
271 | * @param \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
272 | *
273 | * @return string
274 | */
275 | public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
276 | {
277 | $this->sourceMapGenerator = null;
278 |
279 | if ($sourceMapGenerator) {
280 | $this->currentLine = 1;
281 | $this->currentColumn = 0;
282 | $this->sourceMapGenerator = $sourceMapGenerator;
283 | }
284 |
285 | $this->testEmptyChildren($block);
286 |
287 | ob_start();
288 |
289 | try {
290 | $this->block($block);
291 | } catch (\Exception $e) {
292 | ob_end_clean();
293 | throw $e;
294 | } catch (\Throwable $e) {
295 | ob_end_clean();
296 | throw $e;
297 | }
298 |
299 | $out = ob_get_clean();
300 | assert($out !== false);
301 |
302 | return $out;
303 | }
304 |
305 | /**
306 | * Output content
307 | *
308 | * @param string $str
309 | *
310 | * @return void
311 | */
312 | protected function write($str)
313 | {
314 | if (! empty($this->strippedSemicolon)) {
315 | echo $this->strippedSemicolon;
316 |
317 | $this->strippedSemicolon = '';
318 | }
319 |
320 | /*
321 | * Maybe Strip semi-colon appended by property(); it's a separator, not a terminator
322 | * will be striped for real before a closing, otherwise displayed unchanged starting the next write
323 | */
324 | if (
325 | ! $this->keepSemicolons &&
326 | $str &&
327 | (strpos($str, ';') !== false) &&
328 | (substr($str, -1) === ';')
329 | ) {
330 | $str = substr($str, 0, -1);
331 |
332 | $this->strippedSemicolon = ';';
333 | }
334 |
335 | if ($this->sourceMapGenerator) {
336 | $lines = explode("\n", $str);
337 | $lastLine = array_pop($lines);
338 |
339 | foreach ($lines as $line) {
340 | // If the written line starts is empty, adding a mapping would add it for
341 | // a non-existent column as we are at the end of the line
342 | if ($line !== '') {
343 | assert($this->currentBlock->sourceLine !== null);
344 | assert($this->currentBlock->sourceName !== null);
345 | $this->sourceMapGenerator->addMapping(
346 | $this->currentLine,
347 | $this->currentColumn,
348 | $this->currentBlock->sourceLine,
349 | //columns from parser are off by one
350 | $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
351 | $this->currentBlock->sourceName
352 | );
353 | }
354 |
355 | $this->currentLine++;
356 | $this->currentColumn = 0;
357 | }
358 |
359 | if ($lastLine !== '') {
360 | assert($this->currentBlock->sourceLine !== null);
361 | assert($this->currentBlock->sourceName !== null);
362 | $this->sourceMapGenerator->addMapping(
363 | $this->currentLine,
364 | $this->currentColumn,
365 | $this->currentBlock->sourceLine,
366 | //columns from parser are off by one
367 | $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
368 | $this->currentBlock->sourceName
369 | );
370 | }
371 |
372 | $this->currentColumn += \strlen($lastLine);
373 | }
374 |
375 | echo $str;
376 | }
377 | }
378 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Compact.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @deprecated since 1.4.0. Use the Compressed formatter instead.
23 | *
24 | * @internal
25 | */
26 | class Compact extends Formatter
27 | {
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function __construct()
32 | {
33 | @trigger_error('The Compact formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
34 |
35 | $this->indentLevel = 0;
36 | $this->indentChar = '';
37 | $this->break = '';
38 | $this->open = ' {';
39 | $this->close = "}\n\n";
40 | $this->tagSeparator = ',';
41 | $this->assignSeparator = ':';
42 | $this->keepSemicolons = true;
43 | }
44 |
45 | /**
46 | * {@inheritdoc}
47 | */
48 | public function indentStr()
49 | {
50 | return ' ';
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Compressed.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @internal
23 | */
24 | class Compressed extends Formatter
25 | {
26 | /**
27 | * {@inheritdoc}
28 | */
29 | public function __construct()
30 | {
31 | $this->indentLevel = 0;
32 | $this->indentChar = ' ';
33 | $this->break = '';
34 | $this->open = '{';
35 | $this->close = '}';
36 | $this->tagSeparator = ',';
37 | $this->assignSeparator = ':';
38 | $this->keepSemicolons = false;
39 | }
40 |
41 | /**
42 | * {@inheritdoc}
43 | */
44 | public function blockLines(OutputBlock $block)
45 | {
46 | $inner = $this->indentStr();
47 |
48 | $glue = $this->break . $inner;
49 |
50 | foreach ($block->lines as $index => $line) {
51 | if (substr($line, 0, 2) === '/*' && substr($line, 2, 1) !== '!') {
52 | unset($block->lines[$index]);
53 | }
54 | }
55 |
56 | $this->write($inner . implode($glue, $block->lines));
57 |
58 | if (! empty($block->children)) {
59 | $this->write($this->break);
60 | }
61 | }
62 |
63 | /**
64 | * Output block selectors
65 | *
66 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
67 | */
68 | protected function blockSelectors(OutputBlock $block)
69 | {
70 | assert(! empty($block->selectors));
71 |
72 | $inner = $this->indentStr();
73 |
74 | $this->write(
75 | $inner
76 | . implode(
77 | $this->tagSeparator,
78 | str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
79 | )
80 | . $this->open . $this->break
81 | );
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Crunched.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @deprecated since 1.4.0. Use the Compressed formatter instead.
23 | *
24 | * @internal
25 | */
26 | class Crunched extends Formatter
27 | {
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function __construct()
32 | {
33 | @trigger_error('The Crunched formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
34 |
35 | $this->indentLevel = 0;
36 | $this->indentChar = ' ';
37 | $this->break = '';
38 | $this->open = '{';
39 | $this->close = '}';
40 | $this->tagSeparator = ',';
41 | $this->assignSeparator = ':';
42 | $this->keepSemicolons = false;
43 | }
44 |
45 | /**
46 | * {@inheritdoc}
47 | */
48 | public function blockLines(OutputBlock $block)
49 | {
50 | $inner = $this->indentStr();
51 |
52 | $glue = $this->break . $inner;
53 |
54 | foreach ($block->lines as $index => $line) {
55 | if (substr($line, 0, 2) === '/*') {
56 | unset($block->lines[$index]);
57 | }
58 | }
59 |
60 | $this->write($inner . implode($glue, $block->lines));
61 |
62 | if (! empty($block->children)) {
63 | $this->write($this->break);
64 | }
65 | }
66 |
67 | /**
68 | * Output block selectors
69 | *
70 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
71 | */
72 | protected function blockSelectors(OutputBlock $block)
73 | {
74 | assert(! empty($block->selectors));
75 |
76 | $inner = $this->indentStr();
77 |
78 | $this->write(
79 | $inner
80 | . implode(
81 | $this->tagSeparator,
82 | str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
83 | )
84 | . $this->open . $this->break
85 | );
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Debug.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @deprecated since 1.4.0.
23 | *
24 | * @internal
25 | */
26 | class Debug extends Formatter
27 | {
28 | /**
29 | * {@inheritdoc}
30 | */
31 | public function __construct()
32 | {
33 | @trigger_error('The Debug formatter is deprecated since 1.4.0.', E_USER_DEPRECATED);
34 |
35 | $this->indentLevel = 0;
36 | $this->indentChar = '';
37 | $this->break = "\n";
38 | $this->open = ' {';
39 | $this->close = ' }';
40 | $this->tagSeparator = ', ';
41 | $this->assignSeparator = ': ';
42 | $this->keepSemicolons = true;
43 | }
44 |
45 | /**
46 | * {@inheritdoc}
47 | */
48 | protected function indentStr()
49 | {
50 | return str_repeat(' ', $this->indentLevel);
51 | }
52 |
53 | /**
54 | * {@inheritdoc}
55 | */
56 | protected function blockLines(OutputBlock $block)
57 | {
58 | $indent = $this->indentStr();
59 |
60 | if (empty($block->lines)) {
61 | $this->write("{$indent}block->lines: []\n");
62 |
63 | return;
64 | }
65 |
66 | foreach ($block->lines as $index => $line) {
67 | $this->write("{$indent}block->lines[{$index}]: $line\n");
68 | }
69 | }
70 |
71 | /**
72 | * {@inheritdoc}
73 | */
74 | protected function blockSelectors(OutputBlock $block)
75 | {
76 | $indent = $this->indentStr();
77 |
78 | if (empty($block->selectors)) {
79 | $this->write("{$indent}block->selectors: []\n");
80 |
81 | return;
82 | }
83 |
84 | foreach ($block->selectors as $index => $selector) {
85 | $this->write("{$indent}block->selectors[{$index}]: $selector\n");
86 | }
87 | }
88 |
89 | /**
90 | * {@inheritdoc}
91 | */
92 | protected function blockChildren(OutputBlock $block)
93 | {
94 | $indent = $this->indentStr();
95 |
96 | if (empty($block->children)) {
97 | $this->write("{$indent}block->children: []\n");
98 |
99 | return;
100 | }
101 |
102 | $this->indentLevel++;
103 |
104 | foreach ($block->children as $i => $child) {
105 | $this->block($child);
106 | }
107 |
108 | $this->indentLevel--;
109 | }
110 |
111 | /**
112 | * {@inheritdoc}
113 | */
114 | protected function block(OutputBlock $block)
115 | {
116 | $indent = $this->indentStr();
117 |
118 | $this->write("{$indent}block->type: {$block->type}\n" .
119 | "{$indent}block->depth: {$block->depth}\n");
120 |
121 | $this->currentBlock = $block;
122 |
123 | $this->blockSelectors($block);
124 | $this->blockLines($block);
125 | $this->blockChildren($block);
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Expanded.php:
--------------------------------------------------------------------------------
1 |
21 | *
22 | * @internal
23 | */
24 | class Expanded extends Formatter
25 | {
26 | /**
27 | * {@inheritdoc}
28 | */
29 | public function __construct()
30 | {
31 | $this->indentLevel = 0;
32 | $this->indentChar = ' ';
33 | $this->break = "\n";
34 | $this->open = ' {';
35 | $this->close = '}';
36 | $this->tagSeparator = ', ';
37 | $this->assignSeparator = ': ';
38 | $this->keepSemicolons = true;
39 | }
40 |
41 | /**
42 | * {@inheritdoc}
43 | */
44 | protected function indentStr()
45 | {
46 | return str_repeat($this->indentChar, $this->indentLevel);
47 | }
48 |
49 | /**
50 | * {@inheritdoc}
51 | */
52 | protected function blockLines(OutputBlock $block)
53 | {
54 | $inner = $this->indentStr();
55 |
56 | $glue = $this->break . $inner;
57 |
58 | foreach ($block->lines as $index => $line) {
59 | if (substr($line, 0, 2) === '/*') {
60 | $replacedLine = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
61 | assert($replacedLine !== null);
62 | $block->lines[$index] = $replacedLine;
63 | }
64 | }
65 |
66 | $this->write($inner . implode($glue, $block->lines));
67 |
68 | if (empty($block->selectors) || ! empty($block->children)) {
69 | $this->write($this->break);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/Nested.php:
--------------------------------------------------------------------------------
1 |
22 | *
23 | * @deprecated since 1.4.0. Use the Expanded formatter instead.
24 | *
25 | * @internal
26 | */
27 | class Nested extends Formatter
28 | {
29 | /**
30 | * @var int
31 | */
32 | private $depth;
33 |
34 | /**
35 | * {@inheritdoc}
36 | */
37 | public function __construct()
38 | {
39 | @trigger_error('The Nested formatter is deprecated since 1.4.0. Use the Expanded formatter instead.', E_USER_DEPRECATED);
40 |
41 | $this->indentLevel = 0;
42 | $this->indentChar = ' ';
43 | $this->break = "\n";
44 | $this->open = ' {';
45 | $this->close = ' }';
46 | $this->tagSeparator = ', ';
47 | $this->assignSeparator = ': ';
48 | $this->keepSemicolons = true;
49 | }
50 |
51 | /**
52 | * {@inheritdoc}
53 | */
54 | protected function indentStr()
55 | {
56 | $n = $this->depth - 1;
57 |
58 | return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
59 | }
60 |
61 | /**
62 | * {@inheritdoc}
63 | */
64 | protected function blockLines(OutputBlock $block)
65 | {
66 | $inner = $this->indentStr();
67 | $glue = $this->break . $inner;
68 |
69 | foreach ($block->lines as $index => $line) {
70 | if (substr($line, 0, 2) === '/*') {
71 | $replacedLine = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
72 | assert($replacedLine !== null);
73 | $block->lines[$index] = $replacedLine;
74 | }
75 | }
76 |
77 | $this->write($inner . implode($glue, $block->lines));
78 | }
79 |
80 | /**
81 | * {@inheritdoc}
82 | */
83 | protected function block(OutputBlock $block)
84 | {
85 | static $depths;
86 | static $downLevel;
87 | static $closeBlock;
88 | static $previousEmpty;
89 | static $previousHasSelector;
90 |
91 | if ($block->type === 'root') {
92 | $depths = [ 0 ];
93 | $downLevel = '';
94 | $closeBlock = '';
95 | $this->depth = 0;
96 | $previousEmpty = false;
97 | $previousHasSelector = false;
98 | }
99 |
100 | $isMediaOrDirective = \in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
101 | $isSupport = ($block->type === Type::T_DIRECTIVE
102 | && $block->selectors && strpos(implode('', $block->selectors), '@supports') !== false);
103 |
104 | while ($block->depth < end($depths) || ($block->depth == 1 && end($depths) == 1)) {
105 | array_pop($depths);
106 | $this->depth--;
107 |
108 | if (
109 | ! $this->depth && ($block->depth <= 1 || (! $this->indentLevel && $block->type === Type::T_COMMENT)) &&
110 | (($block->selectors && ! $isMediaOrDirective) || $previousHasSelector)
111 | ) {
112 | $downLevel = $this->break;
113 | }
114 |
115 | if (empty($block->lines) && empty($block->children)) {
116 | $previousEmpty = true;
117 | }
118 | }
119 |
120 | if (empty($block->lines) && empty($block->children)) {
121 | return;
122 | }
123 |
124 | $this->currentBlock = $block;
125 |
126 | if (! empty($block->lines) || (! empty($block->children) && ($this->depth < 1 || $isSupport))) {
127 | if ($block->depth > end($depths)) {
128 | if (! $previousEmpty || $this->depth < 1) {
129 | $this->depth++;
130 |
131 | $depths[] = $block->depth;
132 | } else {
133 | // keep the current depth unchanged but take the block depth as a new reference for following blocks
134 | array_pop($depths);
135 |
136 | $depths[] = $block->depth;
137 | }
138 | }
139 | }
140 |
141 | $previousEmpty = ($block->type === Type::T_COMMENT);
142 | $previousHasSelector = false;
143 |
144 | if (! empty($block->selectors)) {
145 | if ($closeBlock) {
146 | $this->write($closeBlock);
147 | $closeBlock = '';
148 | }
149 |
150 | if ($downLevel) {
151 | $this->write($downLevel);
152 | $downLevel = '';
153 | }
154 |
155 | $this->blockSelectors($block);
156 |
157 | $this->indentLevel++;
158 | }
159 |
160 | if (! empty($block->lines)) {
161 | if ($closeBlock) {
162 | $this->write($closeBlock);
163 | $closeBlock = '';
164 | }
165 |
166 | if ($downLevel) {
167 | $this->write($downLevel);
168 | $downLevel = '';
169 | }
170 |
171 | $this->blockLines($block);
172 |
173 | $closeBlock = $this->break;
174 | }
175 |
176 | if (! empty($block->children)) {
177 | if ($this->depth > 0 && ($isMediaOrDirective || ! $this->hasFlatChild($block))) {
178 | array_pop($depths);
179 |
180 | $this->depth--;
181 | $this->blockChildren($block);
182 | $this->depth++;
183 |
184 | $depths[] = $block->depth;
185 | } else {
186 | $this->blockChildren($block);
187 | }
188 | }
189 |
190 | // reclear to not be spoiled by children if T_DIRECTIVE
191 | if ($block->type === Type::T_DIRECTIVE) {
192 | $previousHasSelector = false;
193 | }
194 |
195 | if (! empty($block->selectors)) {
196 | $this->indentLevel--;
197 |
198 | if (! $this->keepSemicolons) {
199 | $this->strippedSemicolon = '';
200 | }
201 |
202 | $this->write($this->close);
203 |
204 | $closeBlock = $this->break;
205 |
206 | if ($this->depth > 1 && ! empty($block->children)) {
207 | array_pop($depths);
208 | $this->depth--;
209 | }
210 |
211 | if (! $isMediaOrDirective) {
212 | $previousHasSelector = true;
213 | }
214 | }
215 |
216 | if ($block->type === 'root') {
217 | $this->write($this->break);
218 | }
219 | }
220 |
221 | /**
222 | * Block has flat child
223 | *
224 | * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
225 | *
226 | * @return bool
227 | */
228 | private function hasFlatChild($block)
229 | {
230 | foreach ($block->children as $child) {
231 | if (empty($child->selectors)) {
232 | return true;
233 | }
234 | }
235 |
236 | return false;
237 | }
238 | }
239 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Formatter/OutputBlock.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class OutputBlock
23 | {
24 | /**
25 | * @var string|null
26 | */
27 | public $type;
28 |
29 | /**
30 | * @var int
31 | */
32 | public $depth;
33 |
34 | /**
35 | * @var array|null
36 | */
37 | public $selectors;
38 |
39 | /**
40 | * @var string[]
41 | */
42 | public $lines;
43 |
44 | /**
45 | * @var OutputBlock[]
46 | */
47 | public $children;
48 |
49 | /**
50 | * @var OutputBlock|null
51 | */
52 | public $parent;
53 |
54 | /**
55 | * @var string|null
56 | */
57 | public $sourceName;
58 |
59 | /**
60 | * @var int|null
61 | */
62 | public $sourceLine;
63 |
64 | /**
65 | * @var int|null
66 | */
67 | public $sourceColumn;
68 | }
69 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Logger/LoggerInterface.php:
--------------------------------------------------------------------------------
1 | stream = $stream;
32 | $this->closeOnDestruct = $closeOnDestruct;
33 | }
34 |
35 | /**
36 | * @internal
37 | */
38 | public function __destruct()
39 | {
40 | if ($this->closeOnDestruct) {
41 | fclose($this->stream);
42 | }
43 | }
44 |
45 | /**
46 | * @inheritDoc
47 | */
48 | public function warn($message, $deprecation = false)
49 | {
50 | $prefix = ($deprecation ? 'DEPRECATION ' : '') . 'WARNING: ';
51 |
52 | fwrite($this->stream, $prefix . $message . "\n\n");
53 | }
54 |
55 | /**
56 | * @inheritDoc
57 | */
58 | public function debug($message)
59 | {
60 | fwrite($this->stream, $message . "\n");
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Node.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | abstract class Node
23 | {
24 | /**
25 | * @var string
26 | */
27 | public $type;
28 |
29 | /**
30 | * @var int
31 | */
32 | public $sourceIndex;
33 |
34 | /**
35 | * @var int|null
36 | */
37 | public $sourceLine;
38 |
39 | /**
40 | * @var int|null
41 | */
42 | public $sourceColumn;
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Node/Number.php:
--------------------------------------------------------------------------------
1 |
33 | *
34 | * @template-implements \ArrayAccess
35 | */
36 | class Number extends Node implements \ArrayAccess
37 | {
38 | const PRECISION = 10;
39 |
40 | /**
41 | * @var int
42 | * @deprecated use {Number::PRECISION} instead to read the precision. Configuring it is not supported anymore.
43 | */
44 | public static $precision = self::PRECISION;
45 |
46 | /**
47 | * @see http://www.w3.org/TR/2012/WD-css3-values-20120308/
48 | *
49 | * @var array
50 | * @phpstan-var array>
51 | */
52 | protected static $unitTable = [
53 | 'in' => [
54 | 'in' => 1,
55 | 'pc' => 6,
56 | 'pt' => 72,
57 | 'px' => 96,
58 | 'cm' => 2.54,
59 | 'mm' => 25.4,
60 | 'q' => 101.6,
61 | ],
62 | 'turn' => [
63 | 'deg' => 360,
64 | 'grad' => 400,
65 | 'rad' => 6.28318530717958647692528676, // 2 * M_PI
66 | 'turn' => 1,
67 | ],
68 | 's' => [
69 | 's' => 1,
70 | 'ms' => 1000,
71 | ],
72 | 'Hz' => [
73 | 'Hz' => 1,
74 | 'kHz' => 0.001,
75 | ],
76 | 'dpi' => [
77 | 'dpi' => 1,
78 | 'dpcm' => 1 / 2.54,
79 | 'dppx' => 1 / 96,
80 | ],
81 | ];
82 |
83 | /**
84 | * @var int|float
85 | */
86 | private $dimension;
87 |
88 | /**
89 | * @var string[]
90 | * @phpstan-var list
91 | */
92 | private $numeratorUnits;
93 |
94 | /**
95 | * @var string[]
96 | * @phpstan-var list
97 | */
98 | private $denominatorUnits;
99 |
100 | /**
101 | * Initialize number
102 | *
103 | * @param int|float $dimension
104 | * @param string[]|string $numeratorUnits
105 | * @param string[] $denominatorUnits
106 | *
107 | * @phpstan-param list|string $numeratorUnits
108 | * @phpstan-param list $denominatorUnits
109 | */
110 | public function __construct($dimension, $numeratorUnits, array $denominatorUnits = [])
111 | {
112 | if (is_string($numeratorUnits)) {
113 | $numeratorUnits = $numeratorUnits ? [$numeratorUnits] : [];
114 | } elseif (isset($numeratorUnits['numerator_units'], $numeratorUnits['denominator_units'])) {
115 | // TODO get rid of this once `$number[2]` is not used anymore
116 | $denominatorUnits = $numeratorUnits['denominator_units'];
117 | $numeratorUnits = $numeratorUnits['numerator_units'];
118 | }
119 |
120 | $this->dimension = $dimension;
121 | $this->numeratorUnits = $numeratorUnits;
122 | $this->denominatorUnits = $denominatorUnits;
123 | }
124 |
125 | /**
126 | * @return float|int
127 | */
128 | public function getDimension()
129 | {
130 | return $this->dimension;
131 | }
132 |
133 | /**
134 | * @return string[]
135 | */
136 | public function getNumeratorUnits()
137 | {
138 | return $this->numeratorUnits;
139 | }
140 |
141 | /**
142 | * @return string[]
143 | */
144 | public function getDenominatorUnits()
145 | {
146 | return $this->denominatorUnits;
147 | }
148 |
149 | /**
150 | * @return bool
151 | */
152 | #[\ReturnTypeWillChange]
153 | public function offsetExists($offset)
154 | {
155 | if ($offset === -3) {
156 | return ! \is_null($this->sourceColumn);
157 | }
158 |
159 | if ($offset === -2) {
160 | return ! \is_null($this->sourceLine);
161 | }
162 |
163 | if (
164 | $offset === -1 ||
165 | $offset === 0 ||
166 | $offset === 1 ||
167 | $offset === 2
168 | ) {
169 | return true;
170 | }
171 |
172 | return false;
173 | }
174 |
175 | /**
176 | * @return mixed
177 | */
178 | #[\ReturnTypeWillChange]
179 | public function offsetGet($offset)
180 | {
181 | switch ($offset) {
182 | case -3:
183 | return $this->sourceColumn;
184 |
185 | case -2:
186 | return $this->sourceLine;
187 |
188 | case -1:
189 | return $this->sourceIndex;
190 |
191 | case 0:
192 | return Type::T_NUMBER;
193 |
194 | case 1:
195 | return $this->dimension;
196 |
197 | case 2:
198 | return array('numerator_units' => $this->numeratorUnits, 'denominator_units' => $this->denominatorUnits);
199 | }
200 | }
201 |
202 | /**
203 | * @return void
204 | */
205 | #[\ReturnTypeWillChange]
206 | public function offsetSet($offset, $value)
207 | {
208 | throw new \BadMethodCallException('Number is immutable');
209 | }
210 |
211 | /**
212 | * @return void
213 | */
214 | #[\ReturnTypeWillChange]
215 | public function offsetUnset($offset)
216 | {
217 | throw new \BadMethodCallException('Number is immutable');
218 | }
219 |
220 | /**
221 | * Returns true if the number is unitless
222 | *
223 | * @return bool
224 | */
225 | public function unitless()
226 | {
227 | return \count($this->numeratorUnits) === 0 && \count($this->denominatorUnits) === 0;
228 | }
229 |
230 | /**
231 | * Returns true if the number has any units
232 | *
233 | * @return bool
234 | */
235 | public function hasUnits()
236 | {
237 | return !$this->unitless();
238 | }
239 |
240 | /**
241 | * Checks whether the number has exactly this unit
242 | *
243 | * @param string $unit
244 | *
245 | * @return bool
246 | */
247 | public function hasUnit($unit)
248 | {
249 | return \count($this->numeratorUnits) === 1 && \count($this->denominatorUnits) === 0 && $this->numeratorUnits[0] === $unit;
250 | }
251 |
252 | /**
253 | * Returns unit(s) as the product of numerator units divided by the product of denominator units
254 | *
255 | * @return string
256 | */
257 | public function unitStr()
258 | {
259 | if ($this->unitless()) {
260 | return '';
261 | }
262 |
263 | return self::getUnitString($this->numeratorUnits, $this->denominatorUnits);
264 | }
265 |
266 | /**
267 | * @param float|int $min
268 | * @param float|int $max
269 | * @param string|null $name
270 | *
271 | * @return float|int
272 | * @throws SassScriptException
273 | */
274 | public function valueInRange($min, $max, $name = null)
275 | {
276 | try {
277 | return Util::checkRange('', new Range($min, $max), $this);
278 | } catch (RangeException $e) {
279 | throw SassScriptException::forArgument(sprintf('Expected %s to be within %s%s and %s%3$s.', $this, $min, $this->unitStr(), $max), $name);
280 | }
281 | }
282 |
283 | /**
284 | * @param float|int $min
285 | * @param float|int $max
286 | * @param string $name
287 | * @param string $unit
288 | *
289 | * @return float|int
290 | * @throws SassScriptException
291 | *
292 | * @internal
293 | */
294 | public function valueInRangeWithUnit($min, $max, $name, $unit)
295 | {
296 | try {
297 | return Util::checkRange('', new Range($min, $max), $this);
298 | } catch (RangeException $e) {
299 | throw SassScriptException::forArgument(sprintf('Expected %s to be within %s%s and %s%3$s.', $this, $min, $unit, $max), $name);
300 | }
301 | }
302 |
303 | /**
304 | * @param string|null $varName
305 | *
306 | * @return void
307 | */
308 | public function assertNoUnits($varName = null)
309 | {
310 | if ($this->unitless()) {
311 | return;
312 | }
313 |
314 | throw SassScriptException::forArgument(sprintf('Expected %s to have no units.', $this), $varName);
315 | }
316 |
317 | /**
318 | * @param string $unit
319 | * @param string|null $varName
320 | *
321 | * @return void
322 | */
323 | public function assertUnit($unit, $varName = null)
324 | {
325 | if ($this->hasUnit($unit)) {
326 | return;
327 | }
328 |
329 | throw SassScriptException::forArgument(sprintf('Expected %s to have unit "%s".', $this, $unit), $varName);
330 | }
331 |
332 | /**
333 | * @param Number $other
334 | *
335 | * @return void
336 | */
337 | public function assertSameUnitOrUnitless(Number $other)
338 | {
339 | if ($other->unitless()) {
340 | return;
341 | }
342 |
343 | if ($this->numeratorUnits === $other->numeratorUnits && $this->denominatorUnits === $other->denominatorUnits) {
344 | return;
345 | }
346 |
347 | throw new SassScriptException(sprintf(
348 | 'Incompatible units %s and %s.',
349 | self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
350 | self::getUnitString($other->numeratorUnits, $other->denominatorUnits)
351 | ));
352 | }
353 |
354 | /**
355 | * Returns a copy of this number, converted to the units represented by $newNumeratorUnits and $newDenominatorUnits.
356 | *
357 | * This does not throw an error if this number is unitless and
358 | * $newNumeratorUnits/$newDenominatorUnits are not empty, or vice versa. Instead,
359 | * it treats all unitless numbers as convertible to and from all units without
360 | * changing the value.
361 | *
362 | * @param string[] $newNumeratorUnits
363 | * @param string[] $newDenominatorUnits
364 | *
365 | * @return Number
366 | *
367 | * @phpstan-param list $newNumeratorUnits
368 | * @phpstan-param list $newDenominatorUnits
369 | *
370 | * @throws SassScriptException if this number's units are not compatible with $newNumeratorUnits and $newDenominatorUnits
371 | */
372 | public function coerce(array $newNumeratorUnits, array $newDenominatorUnits)
373 | {
374 | return new Number($this->valueInUnits($newNumeratorUnits, $newDenominatorUnits), $newNumeratorUnits, $newDenominatorUnits);
375 | }
376 |
377 | /**
378 | * @param Number $other
379 | *
380 | * @return bool
381 | */
382 | public function isComparableTo(Number $other)
383 | {
384 | if ($this->unitless() || $other->unitless()) {
385 | return true;
386 | }
387 |
388 | try {
389 | $this->greaterThan($other);
390 | return true;
391 | } catch (SassScriptException $e) {
392 | return false;
393 | }
394 | }
395 |
396 | /**
397 | * @param Number $other
398 | *
399 | * @return bool
400 | */
401 | public function lessThan(Number $other)
402 | {
403 | return $this->coerceUnits($other, function ($num1, $num2) {
404 | return $num1 < $num2;
405 | });
406 | }
407 |
408 | /**
409 | * @param Number $other
410 | *
411 | * @return bool
412 | */
413 | public function lessThanOrEqual(Number $other)
414 | {
415 | return $this->coerceUnits($other, function ($num1, $num2) {
416 | return $num1 <= $num2;
417 | });
418 | }
419 |
420 | /**
421 | * @param Number $other
422 | *
423 | * @return bool
424 | */
425 | public function greaterThan(Number $other)
426 | {
427 | return $this->coerceUnits($other, function ($num1, $num2) {
428 | return $num1 > $num2;
429 | });
430 | }
431 |
432 | /**
433 | * @param Number $other
434 | *
435 | * @return bool
436 | */
437 | public function greaterThanOrEqual(Number $other)
438 | {
439 | return $this->coerceUnits($other, function ($num1, $num2) {
440 | return $num1 >= $num2;
441 | });
442 | }
443 |
444 | /**
445 | * @param Number $other
446 | *
447 | * @return Number
448 | */
449 | public function plus(Number $other)
450 | {
451 | return $this->coerceNumber($other, function ($num1, $num2) {
452 | return $num1 + $num2;
453 | });
454 | }
455 |
456 | /**
457 | * @param Number $other
458 | *
459 | * @return Number
460 | */
461 | public function minus(Number $other)
462 | {
463 | return $this->coerceNumber($other, function ($num1, $num2) {
464 | return $num1 - $num2;
465 | });
466 | }
467 |
468 | /**
469 | * @return Number
470 | */
471 | public function unaryMinus()
472 | {
473 | return new Number(-$this->dimension, $this->numeratorUnits, $this->denominatorUnits);
474 | }
475 |
476 | /**
477 | * @param Number $other
478 | *
479 | * @return Number
480 | */
481 | public function modulo(Number $other)
482 | {
483 | return $this->coerceNumber($other, function ($num1, $num2) {
484 | if ($num2 == 0) {
485 | return NAN;
486 | }
487 |
488 | $result = fmod($num1, $num2);
489 |
490 | if ($result == 0) {
491 | return 0;
492 | }
493 |
494 | if ($num2 < 0 xor $num1 < 0) {
495 | $result += $num2;
496 | }
497 |
498 | return $result;
499 | });
500 | }
501 |
502 | /**
503 | * @param Number $other
504 | *
505 | * @return Number
506 | */
507 | public function times(Number $other)
508 | {
509 | return $this->multiplyUnits($this->dimension * $other->dimension, $this->numeratorUnits, $this->denominatorUnits, $other->numeratorUnits, $other->denominatorUnits);
510 | }
511 |
512 | /**
513 | * @param Number $other
514 | *
515 | * @return Number
516 | */
517 | public function dividedBy(Number $other)
518 | {
519 | if ($other->dimension == 0) {
520 | if ($this->dimension == 0) {
521 | $value = NAN;
522 | } elseif ($this->dimension > 0) {
523 | $value = INF;
524 | } else {
525 | $value = -INF;
526 | }
527 | } else {
528 | $value = $this->dimension / $other->dimension;
529 | }
530 |
531 | return $this->multiplyUnits($value, $this->numeratorUnits, $this->denominatorUnits, $other->denominatorUnits, $other->numeratorUnits);
532 | }
533 |
534 | /**
535 | * @param Number $other
536 | *
537 | * @return bool
538 | */
539 | public function equals(Number $other)
540 | {
541 | // Unitless numbers are convertable to unit numbers, but not equal, so we special-case unitless here.
542 | if ($this->unitless() !== $other->unitless()) {
543 | return false;
544 | }
545 |
546 | // In Sass, neither NaN nor Infinity are equal to themselves, while PHP defines INF==INF
547 | if (is_nan($this->dimension) || is_nan($other->dimension) || !is_finite($this->dimension) || !is_finite($other->dimension)) {
548 | return false;
549 | }
550 |
551 | if ($this->unitless()) {
552 | return round($this->dimension, self::PRECISION) == round($other->dimension, self::PRECISION);
553 | }
554 |
555 | try {
556 | return $this->coerceUnits($other, function ($num1, $num2) {
557 | return round($num1,self::PRECISION) == round($num2, self::PRECISION);
558 | });
559 | } catch (SassScriptException $e) {
560 | return false;
561 | }
562 | }
563 |
564 | /**
565 | * Output number
566 | *
567 | * @param \ScssPhp\ScssPhp\Compiler $compiler
568 | *
569 | * @return string
570 | */
571 | public function output(Compiler $compiler = null)
572 | {
573 | $dimension = round($this->dimension, self::PRECISION);
574 |
575 | if (is_nan($dimension)) {
576 | return 'NaN';
577 | }
578 |
579 | if ($dimension === INF) {
580 | return 'Infinity';
581 | }
582 |
583 | if ($dimension === -INF) {
584 | return '-Infinity';
585 | }
586 |
587 | if ($compiler) {
588 | $unit = $this->unitStr();
589 | } elseif (isset($this->numeratorUnits[0])) {
590 | $unit = $this->numeratorUnits[0];
591 | } else {
592 | $unit = '';
593 | }
594 |
595 | $dimension = number_format($dimension, self::PRECISION, '.', '');
596 |
597 | return rtrim(rtrim($dimension, '0'), '.') . $unit;
598 | }
599 |
600 | /**
601 | * {@inheritdoc}
602 | */
603 | public function __toString()
604 | {
605 | return $this->output();
606 | }
607 |
608 | /**
609 | * @param Number $other
610 | * @param callable $operation
611 | *
612 | * @return Number
613 | *
614 | * @phpstan-param callable(int|float, int|float): (int|float) $operation
615 | */
616 | private function coerceNumber(Number $other, $operation)
617 | {
618 | $result = $this->coerceUnits($other, $operation);
619 |
620 | if (!$this->unitless()) {
621 | return new Number($result, $this->numeratorUnits, $this->denominatorUnits);
622 | }
623 |
624 | return new Number($result, $other->numeratorUnits, $other->denominatorUnits);
625 | }
626 |
627 | /**
628 | * @param Number $other
629 | * @param callable $operation
630 | *
631 | * @return mixed
632 | *
633 | * @phpstan-template T
634 | * @phpstan-param callable(int|float, int|float): T $operation
635 | * @phpstan-return T
636 | */
637 | private function coerceUnits(Number $other, $operation)
638 | {
639 | if (!$this->unitless()) {
640 | $num1 = $this->dimension;
641 | $num2 = $other->valueInUnits($this->numeratorUnits, $this->denominatorUnits);
642 | } else {
643 | $num1 = $this->valueInUnits($other->numeratorUnits, $other->denominatorUnits);
644 | $num2 = $other->dimension;
645 | }
646 |
647 | return \call_user_func($operation, $num1, $num2);
648 | }
649 |
650 | /**
651 | * @param string[] $numeratorUnits
652 | * @param string[] $denominatorUnits
653 | *
654 | * @return int|float
655 | *
656 | * @phpstan-param list $numeratorUnits
657 | * @phpstan-param list $denominatorUnits
658 | *
659 | * @throws SassScriptException if this number's units are not compatible with $numeratorUnits and $denominatorUnits
660 | */
661 | private function valueInUnits(array $numeratorUnits, array $denominatorUnits)
662 | {
663 | if (
664 | $this->unitless()
665 | || (\count($numeratorUnits) === 0 && \count($denominatorUnits) === 0)
666 | || ($this->numeratorUnits === $numeratorUnits && $this->denominatorUnits === $denominatorUnits)
667 | ) {
668 | return $this->dimension;
669 | }
670 |
671 | $value = $this->dimension;
672 | $oldNumerators = $this->numeratorUnits;
673 |
674 | foreach ($numeratorUnits as $newNumerator) {
675 | foreach ($oldNumerators as $key => $oldNumerator) {
676 | $conversionFactor = self::getConversionFactor($newNumerator, $oldNumerator);
677 |
678 | if (\is_null($conversionFactor)) {
679 | continue;
680 | }
681 |
682 | $value *= $conversionFactor;
683 | unset($oldNumerators[$key]);
684 | continue 2;
685 | }
686 |
687 | throw new SassScriptException(sprintf(
688 | 'Incompatible units %s and %s.',
689 | self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
690 | self::getUnitString($numeratorUnits, $denominatorUnits)
691 | ));
692 | }
693 |
694 | $oldDenominators = $this->denominatorUnits;
695 |
696 | foreach ($denominatorUnits as $newDenominator) {
697 | foreach ($oldDenominators as $key => $oldDenominator) {
698 | $conversionFactor = self::getConversionFactor($newDenominator, $oldDenominator);
699 |
700 | if (\is_null($conversionFactor)) {
701 | continue;
702 | }
703 |
704 | $value /= $conversionFactor;
705 | unset($oldDenominators[$key]);
706 | continue 2;
707 | }
708 |
709 | throw new SassScriptException(sprintf(
710 | 'Incompatible units %s and %s.',
711 | self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
712 | self::getUnitString($numeratorUnits, $denominatorUnits)
713 | ));
714 | }
715 |
716 | if (\count($oldNumerators) || \count($oldDenominators)) {
717 | throw new SassScriptException(sprintf(
718 | 'Incompatible units %s and %s.',
719 | self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
720 | self::getUnitString($numeratorUnits, $denominatorUnits)
721 | ));
722 | }
723 |
724 | return $value;
725 | }
726 |
727 | /**
728 | * @param int|float $value
729 | * @param string[] $numerators1
730 | * @param string[] $denominators1
731 | * @param string[] $numerators2
732 | * @param string[] $denominators2
733 | *
734 | * @return Number
735 | *
736 | * @phpstan-param list $numerators1
737 | * @phpstan-param list $denominators1
738 | * @phpstan-param list $numerators2
739 | * @phpstan-param list $denominators2
740 | */
741 | private function multiplyUnits($value, array $numerators1, array $denominators1, array $numerators2, array $denominators2)
742 | {
743 | $newNumerators = array();
744 |
745 | foreach ($numerators1 as $numerator) {
746 | foreach ($denominators2 as $key => $denominator) {
747 | $conversionFactor = self::getConversionFactor($numerator, $denominator);
748 |
749 | if (\is_null($conversionFactor)) {
750 | continue;
751 | }
752 |
753 | $value /= $conversionFactor;
754 | unset($denominators2[$key]);
755 | continue 2;
756 | }
757 |
758 | $newNumerators[] = $numerator;
759 | }
760 |
761 | foreach ($numerators2 as $numerator) {
762 | foreach ($denominators1 as $key => $denominator) {
763 | $conversionFactor = self::getConversionFactor($numerator, $denominator);
764 |
765 | if (\is_null($conversionFactor)) {
766 | continue;
767 | }
768 |
769 | $value /= $conversionFactor;
770 | unset($denominators1[$key]);
771 | continue 2;
772 | }
773 |
774 | $newNumerators[] = $numerator;
775 | }
776 |
777 | $newDenominators = array_values(array_merge($denominators1, $denominators2));
778 |
779 | return new Number($value, $newNumerators, $newDenominators);
780 | }
781 |
782 | /**
783 | * Returns the number of [unit1]s per [unit2].
784 | *
785 | * Equivalently, `1unit1 * conversionFactor(unit1, unit2) = 1unit2`.
786 | *
787 | * @param string $unit1
788 | * @param string $unit2
789 | *
790 | * @return float|int|null
791 | */
792 | private static function getConversionFactor($unit1, $unit2)
793 | {
794 | if ($unit1 === $unit2) {
795 | return 1;
796 | }
797 |
798 | foreach (static::$unitTable as $unitVariants) {
799 | if (isset($unitVariants[$unit1]) && isset($unitVariants[$unit2])) {
800 | return $unitVariants[$unit1] / $unitVariants[$unit2];
801 | }
802 | }
803 |
804 | return null;
805 | }
806 |
807 | /**
808 | * Returns unit(s) as the product of numerator units divided by the product of denominator units
809 | *
810 | * @param string[] $numerators
811 | * @param string[] $denominators
812 | *
813 | * @phpstan-param list $numerators
814 | * @phpstan-param list $denominators
815 | *
816 | * @return string
817 | */
818 | private static function getUnitString(array $numerators, array $denominators)
819 | {
820 | if (!\count($numerators)) {
821 | if (\count($denominators) === 0) {
822 | return 'no units';
823 | }
824 |
825 | if (\count($denominators) === 1) {
826 | return $denominators[0] . '^-1';
827 | }
828 |
829 | return '(' . implode('*', $denominators) . ')^-1';
830 | }
831 |
832 | return implode('*', $numerators) . (\count($denominators) ? '/' . implode('*', $denominators) : '');
833 | }
834 | }
835 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/OutputStyle.php:
--------------------------------------------------------------------------------
1 |
19 | *
20 | * @internal
21 | */
22 | class Base64
23 | {
24 | /**
25 | * @var array
26 | */
27 | private static $encodingMap = [
28 | 0 => 'A',
29 | 1 => 'B',
30 | 2 => 'C',
31 | 3 => 'D',
32 | 4 => 'E',
33 | 5 => 'F',
34 | 6 => 'G',
35 | 7 => 'H',
36 | 8 => 'I',
37 | 9 => 'J',
38 | 10 => 'K',
39 | 11 => 'L',
40 | 12 => 'M',
41 | 13 => 'N',
42 | 14 => 'O',
43 | 15 => 'P',
44 | 16 => 'Q',
45 | 17 => 'R',
46 | 18 => 'S',
47 | 19 => 'T',
48 | 20 => 'U',
49 | 21 => 'V',
50 | 22 => 'W',
51 | 23 => 'X',
52 | 24 => 'Y',
53 | 25 => 'Z',
54 | 26 => 'a',
55 | 27 => 'b',
56 | 28 => 'c',
57 | 29 => 'd',
58 | 30 => 'e',
59 | 31 => 'f',
60 | 32 => 'g',
61 | 33 => 'h',
62 | 34 => 'i',
63 | 35 => 'j',
64 | 36 => 'k',
65 | 37 => 'l',
66 | 38 => 'm',
67 | 39 => 'n',
68 | 40 => 'o',
69 | 41 => 'p',
70 | 42 => 'q',
71 | 43 => 'r',
72 | 44 => 's',
73 | 45 => 't',
74 | 46 => 'u',
75 | 47 => 'v',
76 | 48 => 'w',
77 | 49 => 'x',
78 | 50 => 'y',
79 | 51 => 'z',
80 | 52 => '0',
81 | 53 => '1',
82 | 54 => '2',
83 | 55 => '3',
84 | 56 => '4',
85 | 57 => '5',
86 | 58 => '6',
87 | 59 => '7',
88 | 60 => '8',
89 | 61 => '9',
90 | 62 => '+',
91 | 63 => '/',
92 | ];
93 |
94 | /**
95 | * @var array
96 | */
97 | private static $decodingMap = [
98 | 'A' => 0,
99 | 'B' => 1,
100 | 'C' => 2,
101 | 'D' => 3,
102 | 'E' => 4,
103 | 'F' => 5,
104 | 'G' => 6,
105 | 'H' => 7,
106 | 'I' => 8,
107 | 'J' => 9,
108 | 'K' => 10,
109 | 'L' => 11,
110 | 'M' => 12,
111 | 'N' => 13,
112 | 'O' => 14,
113 | 'P' => 15,
114 | 'Q' => 16,
115 | 'R' => 17,
116 | 'S' => 18,
117 | 'T' => 19,
118 | 'U' => 20,
119 | 'V' => 21,
120 | 'W' => 22,
121 | 'X' => 23,
122 | 'Y' => 24,
123 | 'Z' => 25,
124 | 'a' => 26,
125 | 'b' => 27,
126 | 'c' => 28,
127 | 'd' => 29,
128 | 'e' => 30,
129 | 'f' => 31,
130 | 'g' => 32,
131 | 'h' => 33,
132 | 'i' => 34,
133 | 'j' => 35,
134 | 'k' => 36,
135 | 'l' => 37,
136 | 'm' => 38,
137 | 'n' => 39,
138 | 'o' => 40,
139 | 'p' => 41,
140 | 'q' => 42,
141 | 'r' => 43,
142 | 's' => 44,
143 | 't' => 45,
144 | 'u' => 46,
145 | 'v' => 47,
146 | 'w' => 48,
147 | 'x' => 49,
148 | 'y' => 50,
149 | 'z' => 51,
150 | 0 => 52,
151 | 1 => 53,
152 | 2 => 54,
153 | 3 => 55,
154 | 4 => 56,
155 | 5 => 57,
156 | 6 => 58,
157 | 7 => 59,
158 | 8 => 60,
159 | 9 => 61,
160 | '+' => 62,
161 | '/' => 63,
162 | ];
163 |
164 | /**
165 | * Convert to base64
166 | *
167 | * @param int $value
168 | *
169 | * @return string
170 | */
171 | public static function encode($value)
172 | {
173 | return self::$encodingMap[$value];
174 | }
175 |
176 | /**
177 | * Convert from base64
178 | *
179 | * @param string $value
180 | *
181 | * @return int
182 | */
183 | public static function decode($value)
184 | {
185 | return self::$decodingMap[$value];
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/SourceMap/Base64VLQ.php:
--------------------------------------------------------------------------------
1 |
36 | * @author Anthon Pang
37 | *
38 | * @internal
39 | */
40 | class Base64VLQ
41 | {
42 | // A Base64 VLQ digit can represent 5 bits, so it is base-32.
43 | const VLQ_BASE_SHIFT = 5;
44 |
45 | // A mask of bits for a VLQ digit (11111), 31 decimal.
46 | const VLQ_BASE_MASK = 31;
47 |
48 | // The continuation bit is the 6th bit.
49 | const VLQ_CONTINUATION_BIT = 32;
50 |
51 | /**
52 | * Returns the VLQ encoded value.
53 | *
54 | * @param int $value
55 | *
56 | * @return string
57 | */
58 | public static function encode($value)
59 | {
60 | $encoded = '';
61 | $vlq = self::toVLQSigned($value);
62 |
63 | do {
64 | $digit = $vlq & self::VLQ_BASE_MASK;
65 |
66 | //$vlq >>>= self::VLQ_BASE_SHIFT; // unsigned right shift
67 | $vlq = (($vlq >> 1) & PHP_INT_MAX) >> (self::VLQ_BASE_SHIFT - 1);
68 |
69 | if ($vlq > 0) {
70 | $digit |= self::VLQ_CONTINUATION_BIT;
71 | }
72 |
73 | $encoded .= Base64::encode($digit);
74 | } while ($vlq > 0);
75 |
76 | return $encoded;
77 | }
78 |
79 | /**
80 | * Decodes VLQValue.
81 | *
82 | * @param string $str
83 | * @param int $index
84 | *
85 | * @return int
86 | */
87 | public static function decode($str, &$index)
88 | {
89 | $result = 0;
90 | $shift = 0;
91 |
92 | do {
93 | $c = $str[$index++];
94 | $digit = Base64::decode($c);
95 | $continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
96 | $digit &= self::VLQ_BASE_MASK;
97 | $result = $result + ($digit << $shift);
98 | $shift = $shift + self::VLQ_BASE_SHIFT;
99 | } while ($continuation);
100 |
101 | return self::fromVLQSigned($result);
102 | }
103 |
104 | /**
105 | * Converts from a two-complement value to a value where the sign bit is
106 | * is placed in the least significant bit. For example, as decimals:
107 | * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
108 | * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
109 | *
110 | * @param int $value
111 | *
112 | * @return int
113 | */
114 | private static function toVLQSigned($value)
115 | {
116 | if ($value < 0) {
117 | return ((-$value) << 1) + 1;
118 | }
119 |
120 | return ($value << 1) + 0;
121 | }
122 |
123 | /**
124 | * Converts to a two-complement value from a value where the sign bit is
125 | * is placed in the least significant bit. For example, as decimals:
126 | * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
127 | * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
128 | *
129 | * @param int $value
130 | *
131 | * @return int
132 | */
133 | private static function fromVLQSigned($value)
134 | {
135 | $negate = ($value & 1) === 1;
136 |
137 | //$value >>>= 1; // unsigned right shift
138 | $value = ($value >> 1) & PHP_INT_MAX;
139 |
140 | if (! $negate) {
141 | return $value;
142 | }
143 |
144 | // We need to OR 0x80000000 here to ensure the 32nd bit (the sign bit) is
145 | // always set for negative numbers. If `value` were 1, (meaning `negate` is
146 | // true and all other bits were zeros), `value` would now be 0. -0 is just
147 | // 0, and doesn't flip the 32nd bit as intended. All positive numbers will
148 | // successfully flip the 32nd bit without issue, so it's a noop for them.
149 | return -$value | 0x80000000;
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/SourceMap/SourceMapGenerator.php:
--------------------------------------------------------------------------------
1 |
23 | * @author Nicolas FRANÇOIS
24 | *
25 | * @internal
26 | */
27 | class SourceMapGenerator
28 | {
29 | /**
30 | * What version of source map does the generator generate?
31 | */
32 | const VERSION = 3;
33 |
34 | /**
35 | * Array of default options
36 | *
37 | * @var array
38 | * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
39 | */
40 | protected $defaultOptions = [
41 | // an optional source root, useful for relocating source files
42 | // on a server or removing repeated values in the 'sources' entry.
43 | // This value is prepended to the individual entries in the 'source' field.
44 | 'sourceRoot' => '',
45 |
46 | // an optional name of the generated code that this source map is associated with.
47 | 'sourceMapFilename' => null,
48 |
49 | // url of the map
50 | 'sourceMapURL' => null,
51 |
52 | // absolute path to a file to write the map to
53 | 'sourceMapWriteTo' => null,
54 |
55 | // output source contents?
56 | 'outputSourceFiles' => false,
57 |
58 | // base path for filename normalization
59 | 'sourceMapRootpath' => '',
60 |
61 | // base path for filename normalization
62 | 'sourceMapBasepath' => ''
63 | ];
64 |
65 | /**
66 | * The base64 VLQ encoder
67 | *
68 | * @var \ScssPhp\ScssPhp\SourceMap\Base64VLQ
69 | */
70 | protected $encoder;
71 |
72 | /**
73 | * Array of mappings
74 | *
75 | * @var array
76 | * @phpstan-var list
77 | */
78 | protected $mappings = [];
79 |
80 | /**
81 | * Array of contents map
82 | *
83 | * @var array
84 | */
85 | protected $contentsMap = [];
86 |
87 | /**
88 | * File to content map
89 | *
90 | * @var array
91 | */
92 | protected $sources = [];
93 |
94 | /**
95 | * @var array
96 | */
97 | protected $sourceKeys = [];
98 |
99 | /**
100 | * @var array
101 | * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
102 | */
103 | private $options;
104 |
105 | /**
106 | * @phpstan-param array{sourceRoot?: string, sourceMapFilename?: string|null, sourceMapURL?: string|null, sourceMapWriteTo?: string|null, outputSourceFiles?: bool, sourceMapRootpath?: string, sourceMapBasepath?: string} $options
107 | */
108 | public function __construct(array $options = [])
109 | {
110 | $this->options = array_replace($this->defaultOptions, $options);
111 | $this->encoder = new Base64VLQ();
112 | }
113 |
114 | /**
115 | * Adds a mapping
116 | *
117 | * @param int $generatedLine The line number in generated file
118 | * @param int $generatedColumn The column number in generated file
119 | * @param int $originalLine The line number in original file
120 | * @param int $originalColumn The column number in original file
121 | * @param string $sourceFile The original source file
122 | *
123 | * @return void
124 | */
125 | public function addMapping($generatedLine, $generatedColumn, $originalLine, $originalColumn, $sourceFile)
126 | {
127 | $this->mappings[] = [
128 | 'generated_line' => $generatedLine,
129 | 'generated_column' => $generatedColumn,
130 | 'original_line' => $originalLine,
131 | 'original_column' => $originalColumn,
132 | 'source_file' => $sourceFile
133 | ];
134 |
135 | $this->sources[$sourceFile] = $sourceFile;
136 | }
137 |
138 | /**
139 | * Saves the source map to a file
140 | *
141 | * @param string $content The content to write
142 | *
143 | * @return string|null
144 | *
145 | * @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
146 | * @deprecated
147 | */
148 | public function saveMap($content)
149 | {
150 | $file = $this->options['sourceMapWriteTo'];
151 | assert($file !== null);
152 | $dir = \dirname($file);
153 |
154 | // directory does not exist
155 | if (! is_dir($dir)) {
156 | // FIXME: create the dir automatically?
157 | throw new CompilerException(
158 | sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir)
159 | );
160 | }
161 |
162 | // FIXME: proper saving, with dir write check!
163 | if (file_put_contents($file, $content) === false) {
164 | throw new CompilerException(sprintf('Cannot save the source map to "%s"', $file));
165 | }
166 |
167 | return $this->options['sourceMapURL'];
168 | }
169 |
170 | /**
171 | * Generates the JSON source map
172 | *
173 | * @param string $prefix A prefix added in the output file, which needs to shift mappings
174 | *
175 | * @return string
176 | *
177 | * @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#
178 | */
179 | public function generateJson($prefix = '')
180 | {
181 | $sourceMap = [];
182 | $mappings = $this->generateMappings($prefix);
183 |
184 | // File version (always the first entry in the object) and must be a positive integer.
185 | $sourceMap['version'] = self::VERSION;
186 |
187 | // An optional name of the generated code that this source map is associated with.
188 | $file = $this->options['sourceMapFilename'];
189 |
190 | if ($file) {
191 | $sourceMap['file'] = $file;
192 | }
193 |
194 | // An optional source root, useful for relocating source files on a server or removing repeated values in the
195 | // 'sources' entry. This value is prepended to the individual entries in the 'source' field.
196 | $root = $this->options['sourceRoot'];
197 |
198 | if ($root) {
199 | $sourceMap['sourceRoot'] = $root;
200 | }
201 |
202 | // A list of original sources used by the 'mappings' entry.
203 | $sourceMap['sources'] = [];
204 |
205 | foreach ($this->sources as $sourceFilename) {
206 | $sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
207 | }
208 |
209 | // A list of symbol names used by the 'mappings' entry.
210 | $sourceMap['names'] = [];
211 |
212 | // A string with the encoded mapping data.
213 | $sourceMap['mappings'] = $mappings;
214 |
215 | if ($this->options['outputSourceFiles']) {
216 | // An optional list of source content, useful when the 'source' can't be hosted.
217 | // The contents are listed in the same order as the sources above.
218 | // 'null' may be used if some original sources should be retrieved by name.
219 | $sourceMap['sourcesContent'] = $this->getSourcesContent();
220 | }
221 |
222 | // less.js compat fixes
223 | if (\count($sourceMap['sources']) && empty($sourceMap['sourceRoot'])) {
224 | unset($sourceMap['sourceRoot']);
225 | }
226 |
227 | $jsonSourceMap = json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
228 |
229 | if (json_last_error() !== JSON_ERROR_NONE) {
230 | throw new \RuntimeException(json_last_error_msg());
231 | }
232 |
233 | assert($jsonSourceMap !== false);
234 |
235 | return $jsonSourceMap;
236 | }
237 |
238 | /**
239 | * Returns the sources contents
240 | *
241 | * @return string[]|null
242 | */
243 | protected function getSourcesContent()
244 | {
245 | if (empty($this->sources)) {
246 | return null;
247 | }
248 |
249 | $content = [];
250 |
251 | foreach ($this->sources as $sourceFile) {
252 | $content[] = file_get_contents($sourceFile);
253 | }
254 |
255 | return $content;
256 | }
257 |
258 | /**
259 | * Generates the mappings string
260 | *
261 | * @param string $prefix A prefix added in the output file, which needs to shift mappings
262 | *
263 | * @return string
264 | */
265 | public function generateMappings($prefix = '')
266 | {
267 | if (! \count($this->mappings)) {
268 | return '';
269 | }
270 |
271 | $prefixLines = substr_count($prefix, "\n");
272 | $lastPrefixNewLine = strrpos($prefix, "\n");
273 | $lastPrefixLineStart = false === $lastPrefixNewLine ? 0 : $lastPrefixNewLine + 1;
274 | $prefixColumn = strlen($prefix) - $lastPrefixLineStart;
275 |
276 | $this->sourceKeys = array_flip(array_keys($this->sources));
277 |
278 | // group mappings by generated line number.
279 | $groupedMap = $groupedMapEncoded = [];
280 |
281 | foreach ($this->mappings as $m) {
282 | $groupedMap[$m['generated_line']][] = $m;
283 | }
284 |
285 | ksort($groupedMap);
286 |
287 | $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
288 |
289 | foreach ($groupedMap as $lineNumber => $lineMap) {
290 | if ($lineNumber > 1) {
291 | // The prefix only impacts the column for the first line of the original output
292 | $prefixColumn = 0;
293 | }
294 | $lineNumber += $prefixLines;
295 |
296 | while (++$lastGeneratedLine < $lineNumber) {
297 | $groupedMapEncoded[] = ';';
298 | }
299 |
300 | $lineMapEncoded = [];
301 | $lastGeneratedColumn = 0;
302 |
303 | foreach ($lineMap as $m) {
304 | $generatedColumn = $m['generated_column'] + $prefixColumn;
305 |
306 | $mapEncoded = $this->encoder->encode($generatedColumn - $lastGeneratedColumn);
307 | $lastGeneratedColumn = $generatedColumn;
308 |
309 | // find the index
310 | if ($m['source_file']) {
311 | $index = $this->findFileIndex($m['source_file']);
312 |
313 | if ($index !== false) {
314 | $mapEncoded .= $this->encoder->encode($index - $lastOriginalIndex);
315 | $lastOriginalIndex = $index;
316 | // lines are stored 0-based in SourceMap spec version 3
317 | $mapEncoded .= $this->encoder->encode($m['original_line'] - 1 - $lastOriginalLine);
318 | $lastOriginalLine = $m['original_line'] - 1;
319 | $mapEncoded .= $this->encoder->encode($m['original_column'] - $lastOriginalColumn);
320 | $lastOriginalColumn = $m['original_column'];
321 | }
322 | }
323 |
324 | $lineMapEncoded[] = $mapEncoded;
325 | }
326 |
327 | $groupedMapEncoded[] = implode(',', $lineMapEncoded) . ';';
328 | }
329 |
330 | return rtrim(implode($groupedMapEncoded), ';');
331 | }
332 |
333 | /**
334 | * Finds the index for the filename
335 | *
336 | * @param string $filename
337 | *
338 | * @return int|false
339 | */
340 | protected function findFileIndex($filename)
341 | {
342 | return $this->sourceKeys[$filename];
343 | }
344 |
345 | /**
346 | * Normalize filename
347 | *
348 | * @param string $filename
349 | *
350 | * @return string
351 | */
352 | protected function normalizeFilename($filename)
353 | {
354 | $filename = $this->fixWindowsPath($filename);
355 | $rootpath = $this->options['sourceMapRootpath'];
356 | $basePath = $this->options['sourceMapBasepath'];
357 |
358 | // "Trim" the 'sourceMapBasepath' from the output filename.
359 | if (\strlen($basePath) && strpos($filename, $basePath) === 0) {
360 | $filename = substr($filename, \strlen($basePath));
361 | }
362 |
363 | // Remove extra leading path separators.
364 | if (strpos($filename, '\\') === 0 || strpos($filename, '/') === 0) {
365 | $filename = substr($filename, 1);
366 | }
367 |
368 | return $rootpath . $filename;
369 | }
370 |
371 | /**
372 | * Fix windows paths
373 | *
374 | * @param string $path
375 | * @param bool $addEndSlash
376 | *
377 | * @return string
378 | */
379 | public function fixWindowsPath($path, $addEndSlash = false)
380 | {
381 | $slash = ($addEndSlash) ? '/' : '';
382 |
383 | if (! empty($path)) {
384 | $path = str_replace('\\', '/', $path);
385 | $path = rtrim($path, '/') . $slash;
386 | }
387 |
388 | return $path;
389 | }
390 | }
391 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Type.php:
--------------------------------------------------------------------------------
1 |
19 | */
20 | class Type
21 | {
22 | /**
23 | * @internal
24 | */
25 | const T_ASSIGN = 'assign';
26 | /**
27 | * @internal
28 | */
29 | const T_AT_ROOT = 'at-root';
30 | /**
31 | * @internal
32 | */
33 | const T_BLOCK = 'block';
34 | /**
35 | * @deprecated
36 | * @internal
37 | */
38 | const T_BREAK = 'break';
39 | /**
40 | * @internal
41 | */
42 | const T_CHARSET = 'charset';
43 | const T_COLOR = 'color';
44 | /**
45 | * @internal
46 | */
47 | const T_COMMENT = 'comment';
48 | /**
49 | * @deprecated
50 | * @internal
51 | */
52 | const T_CONTINUE = 'continue';
53 | /**
54 | * @deprecated
55 | * @internal
56 | */
57 | const T_CONTROL = 'control';
58 | /**
59 | * @internal
60 | */
61 | const T_CUSTOM_PROPERTY = 'custom';
62 | /**
63 | * @internal
64 | */
65 | const T_DEBUG = 'debug';
66 | /**
67 | * @internal
68 | */
69 | const T_DIRECTIVE = 'directive';
70 | /**
71 | * @internal
72 | */
73 | const T_EACH = 'each';
74 | /**
75 | * @internal
76 | */
77 | const T_ELSE = 'else';
78 | /**
79 | * @internal
80 | */
81 | const T_ELSEIF = 'elseif';
82 | /**
83 | * @internal
84 | */
85 | const T_ERROR = 'error';
86 | /**
87 | * @internal
88 | */
89 | const T_EXPRESSION = 'exp';
90 | /**
91 | * @internal
92 | */
93 | const T_EXTEND = 'extend';
94 | /**
95 | * @internal
96 | */
97 | const T_FOR = 'for';
98 | const T_FUNCTION = 'function';
99 | /**
100 | * @internal
101 | */
102 | const T_FUNCTION_REFERENCE = 'function-reference';
103 | /**
104 | * @internal
105 | */
106 | const T_FUNCTION_CALL = 'fncall';
107 | /**
108 | * @internal
109 | */
110 | const T_HSL = 'hsl';
111 | /**
112 | * @internal
113 | */
114 | const T_HWB = 'hwb';
115 | /**
116 | * @internal
117 | */
118 | const T_IF = 'if';
119 | /**
120 | * @internal
121 | */
122 | const T_IMPORT = 'import';
123 | /**
124 | * @internal
125 | */
126 | const T_INCLUDE = 'include';
127 | /**
128 | * @internal
129 | */
130 | const T_INTERPOLATE = 'interpolate';
131 | /**
132 | * @internal
133 | */
134 | const T_INTERPOLATED = 'interpolated';
135 | /**
136 | * @internal
137 | */
138 | const T_KEYWORD = 'keyword';
139 | const T_LIST = 'list';
140 | const T_MAP = 'map';
141 | /**
142 | * @internal
143 | */
144 | const T_MEDIA = 'media';
145 | /**
146 | * @internal
147 | */
148 | const T_MEDIA_EXPRESSION = 'mediaExp';
149 | /**
150 | * @internal
151 | */
152 | const T_MEDIA_TYPE = 'mediaType';
153 | /**
154 | * @internal
155 | */
156 | const T_MEDIA_VALUE = 'mediaValue';
157 | /**
158 | * @internal
159 | */
160 | const T_MIXIN = 'mixin';
161 | /**
162 | * @internal
163 | */
164 | const T_MIXIN_CONTENT = 'mixin_content';
165 | /**
166 | * @internal
167 | */
168 | const T_NESTED_PROPERTY = 'nestedprop';
169 | /**
170 | * @internal
171 | */
172 | const T_NOT = 'not';
173 | const T_NULL = 'null';
174 | const T_NUMBER = 'number';
175 | /**
176 | * @internal
177 | */
178 | const T_RETURN = 'return';
179 | /**
180 | * @internal
181 | */
182 | const T_ROOT = 'root';
183 | /**
184 | * @internal
185 | */
186 | const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
187 | /**
188 | * @internal
189 | */
190 | const T_SELF = 'self';
191 | const T_STRING = 'string';
192 | /**
193 | * @internal
194 | */
195 | const T_UNARY = 'unary';
196 | /**
197 | * @internal
198 | */
199 | const T_VARIABLE = 'var';
200 | /**
201 | * @internal
202 | */
203 | const T_WARN = 'warn';
204 | /**
205 | * @internal
206 | */
207 | const T_WHILE = 'while';
208 | }
209 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Util.php:
--------------------------------------------------------------------------------
1 |
23 | *
24 | * @internal
25 | */
26 | class Util
27 | {
28 | /**
29 | * Asserts that `value` falls within `range` (inclusive), leaving
30 | * room for slight floating-point errors.
31 | *
32 | * @param string $name The name of the value. Used in the error message.
33 | * @param Range $range Range of values.
34 | * @param array|Number $value The value to check.
35 | * @param string $unit The unit of the value. Used in error reporting.
36 | *
37 | * @return mixed `value` adjusted to fall within range, if it was outside by a floating-point margin.
38 | *
39 | * @throws \ScssPhp\ScssPhp\Exception\RangeException
40 | */
41 | public static function checkRange($name, Range $range, $value, $unit = '')
42 | {
43 | $val = $value[1];
44 | $grace = new Range(-0.00001, 0.00001);
45 |
46 | if (! \is_numeric($val)) {
47 | throw new RangeException("$name {$val} is not a number.");
48 | }
49 |
50 | if ($range->includes($val)) {
51 | return $val;
52 | }
53 |
54 | if ($grace->includes($val - $range->first)) {
55 | return $range->first;
56 | }
57 |
58 | if ($grace->includes($val - $range->last)) {
59 | return $range->last;
60 | }
61 |
62 | throw new RangeException("$name {$val} must be between {$range->first} and {$range->last}$unit");
63 | }
64 |
65 | /**
66 | * Encode URI component
67 | *
68 | * @param string $string
69 | *
70 | * @return string
71 | */
72 | public static function encodeURIComponent($string)
73 | {
74 | $revert = ['%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'];
75 |
76 | return strtr(rawurlencode($string), $revert);
77 | }
78 |
79 | /**
80 | * mb_chr() wrapper
81 | *
82 | * @param int $code
83 | *
84 | * @return string
85 | */
86 | public static function mbChr($code)
87 | {
88 | // Use the native implementation if available, but not on PHP 7.2 as mb_chr(0) is buggy there
89 | if (\PHP_VERSION_ID > 70300 && \function_exists('mb_chr')) {
90 | return mb_chr($code, 'UTF-8');
91 | }
92 |
93 | if (0x80 > $code %= 0x200000) {
94 | $s = \chr($code);
95 | } elseif (0x800 > $code) {
96 | $s = \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F);
97 | } elseif (0x10000 > $code) {
98 | $s = \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
99 | } else {
100 | $s = \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F)
101 | . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
102 | }
103 |
104 | return $s;
105 | }
106 |
107 | /**
108 | * mb_strlen() wrapper
109 | *
110 | * @param string $string
111 | * @return int
112 | */
113 | public static function mbStrlen($string)
114 | {
115 | // Use the native implementation if available.
116 | if (\function_exists('mb_strlen')) {
117 | return mb_strlen($string, 'UTF-8');
118 | }
119 |
120 | if (\function_exists('iconv_strlen')) {
121 | return (int) @iconv_strlen($string, 'UTF-8');
122 | }
123 |
124 | throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
125 | }
126 |
127 | /**
128 | * mb_substr() wrapper
129 | * @param string $string
130 | * @param int $start
131 | * @param null|int $length
132 | * @return string
133 | */
134 | public static function mbSubstr($string, $start, $length = null)
135 | {
136 | // Use the native implementation if available.
137 | if (\function_exists('mb_substr')) {
138 | return mb_substr($string, $start, $length, 'UTF-8');
139 | }
140 |
141 | if (\function_exists('iconv_substr')) {
142 | if ($start < 0) {
143 | $start = static::mbStrlen($string) + $start;
144 | if ($start < 0) {
145 | $start = 0;
146 | }
147 | }
148 |
149 | if (null === $length) {
150 | $length = 2147483647;
151 | } elseif ($length < 0) {
152 | $length = static::mbStrlen($string) + $length - $start;
153 | if ($length < 0) {
154 | return '';
155 | }
156 | }
157 |
158 | return (string)iconv_substr($string, $start, $length, 'UTF-8');
159 | }
160 |
161 | throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
162 | }
163 |
164 | /**
165 | * mb_strpos wrapper
166 | * @param string $haystack
167 | * @param string $needle
168 | * @param int $offset
169 | *
170 | * @return int|false
171 | */
172 | public static function mbStrpos($haystack, $needle, $offset = 0)
173 | {
174 | if (\function_exists('mb_strpos')) {
175 | return mb_strpos($haystack, $needle, $offset, 'UTF-8');
176 | }
177 |
178 | if (\function_exists('iconv_strpos')) {
179 | return iconv_strpos($haystack, $needle, $offset, 'UTF-8');
180 | }
181 |
182 | throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
183 | }
184 | }
185 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Util/Path.php:
--------------------------------------------------------------------------------
1 | parseValue($source, $value)) {
41 | throw new \InvalidArgumentException(sprintf('Invalid value source "%s".', $source));
42 | }
43 |
44 | return $value;
45 | }
46 |
47 | /**
48 | * Converts a PHP value to a Sass value
49 | *
50 | * The returned value is guaranteed to be supported by the
51 | * Compiler methods for registering custom variables. No other
52 | * guarantee about it is provided. It should be considered
53 | * opaque values by the caller.
54 | *
55 | * @param mixed $value
56 | *
57 | * @return mixed
58 | */
59 | public static function fromPhp($value)
60 | {
61 | if ($value instanceof Number) {
62 | return $value;
63 | }
64 |
65 | if (is_array($value) && isset($value[0]) && \in_array($value[0], [Type::T_NULL, Type::T_COLOR, Type::T_KEYWORD, Type::T_LIST, Type::T_MAP, Type::T_STRING])) {
66 | return $value;
67 | }
68 |
69 | if ($value === null) {
70 | return Compiler::$null;
71 | }
72 |
73 | if ($value === true) {
74 | return Compiler::$true;
75 | }
76 |
77 | if ($value === false) {
78 | return Compiler::$false;
79 | }
80 |
81 | if ($value === '') {
82 | return Compiler::$emptyString;
83 | }
84 |
85 | if (\is_int($value) || \is_float($value)) {
86 | return new Number($value, '');
87 | }
88 |
89 | if (\is_string($value)) {
90 | return [Type::T_STRING, '"', [$value]];
91 | }
92 |
93 | throw new \InvalidArgumentException(sprintf('Cannot convert the value of type "%s" to a Sass value.', gettype($value)));
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Version.php:
--------------------------------------------------------------------------------
1 |
19 | */
20 | class Version
21 | {
22 | const VERSION = '1.11.0';
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/scssphp/scssphp/src/Warn.php:
--------------------------------------------------------------------------------
1 |