less 2.5.1 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +3 -2
- package/CHANGELOG.md +41 -0
- package/Gruntfile.js +5 -10
- package/README.md +3 -3
- package/appveyor.yml +2 -2
- package/bin/lessc +1 -0
- package/bower.json +1 -2
- package/dist/less.js +969 -605
- package/dist/less.min.js +13 -9
- package/gradlew +0 -0
- package/lib/less/contexts.js +0 -1
- package/lib/less/functions/color.js +5 -2
- package/lib/less/functions/math-helper.js +16 -0
- package/lib/less/functions/math.js +4 -16
- package/lib/less/functions/number.js +7 -2
- package/lib/less/index.js +1 -1
- package/lib/less/parser/parser-input.js +68 -68
- package/lib/less/parser/parser.js +159 -75
- package/lib/less/transform-tree.js +1 -0
- package/lib/less/tree/anonymous.js +4 -2
- package/lib/less/tree/color.js +4 -1
- package/lib/less/tree/comment.js +2 -6
- package/lib/less/tree/directive.js +3 -18
- package/lib/less/tree/element.js +9 -2
- package/lib/less/tree/extend.js +10 -5
- package/lib/less/tree/import.js +23 -5
- package/lib/less/tree/media.js +4 -2
- package/lib/less/tree/mixin-call.js +31 -18
- package/lib/less/tree/mixin-definition.js +19 -7
- package/lib/less/tree/node.js +49 -0
- package/lib/less/tree/rule.js +1 -1
- package/lib/less/tree/ruleset.js +107 -125
- package/lib/less/tree/selector.js +4 -9
- package/lib/less/tree/unit.js +2 -2
- package/lib/less/visitors/extend-visitor.js +17 -8
- package/lib/less/visitors/import-visitor.js +5 -0
- package/lib/less/visitors/index.js +1 -0
- package/lib/less/visitors/set-tree-visibility-visitor.js +38 -0
- package/lib/less/visitors/to-css-visitor.js +181 -98
- package/lib/less-browser/bootstrap.js +28 -2
- package/lib/less-browser/cache.js +11 -4
- package/lib/less-browser/error-reporting.js +10 -10
- package/lib/less-browser/file-manager.js +1 -1
- package/lib/less-browser/image-size.js +28 -0
- package/lib/less-browser/index.js +9 -10
- package/package.json +14 -14
- package/test/browser/less/errors/image-height-error.less +3 -0
- package/test/browser/less/errors/image-height-error.txt +4 -0
- package/test/browser/less/errors/image-size-error.less +3 -0
- package/test/browser/less/errors/image-size-error.txt +4 -0
- package/test/browser/less/errors/image-width-error.less +3 -0
- package/test/browser/less/errors/image-width-error.txt +4 -0
- package/test/browser/less.js +23 -19
- package/test/css/comments2.css +7 -1
- package/test/css/compression/compression.css +1 -1
- package/test/css/css-3.css +6 -0
- package/test/css/extend-selector.css +7 -0
- package/test/css/extract-and-length.css +1 -1
- package/test/css/functions.css +3 -3
- package/test/css/import-reference-issues.css +24 -0
- package/test/css/import-reference.css +5 -1
- package/test/css/include-path/include-path.css +1 -1
- package/test/css/include-path-string/include-path-string.css +1 -1
- package/test/css/mixins-args.css +51 -1
- package/test/css/mixins-guards.css +36 -0
- package/test/css/no-strict-math/mixins-guards.css +12 -0
- package/test/css/no-strict-math/no-sm-operations.css +12 -0
- package/test/css/operations.css +1 -0
- package/test/css/scope.css +1 -1
- package/test/css/strings.css +1 -1
- package/test/css/url-args/urls.css +5 -5
- package/test/css/urls.css +8 -8
- package/test/css/variables.css +5 -5
- package/test/data/image.jpg +0 -0
- package/test/data/image.svg +2 -1
- package/test/data/page.html +1 -1
- package/test/index.js +1 -0
- package/test/less/comments2.less +11 -0
- package/test/less/css-3.less +10 -2
- package/test/less/errors/at-rules-undefined-var.txt +4 -4
- package/test/less/errors/css-guard-default-func.txt +4 -4
- package/test/less/errors/javascript-undefined-var.txt +4 -4
- package/test/less/errors/mixins-guards-default-func-1.txt +4 -4
- package/test/less/errors/mixins-guards-default-func-2.txt +4 -4
- package/test/less/errors/mixins-guards-default-func-3.txt +4 -4
- package/test/less/errors/parse-error-media-no-block-1.txt +1 -1
- package/test/less/errors/parse-error-media-no-block-2.txt +1 -1
- package/test/less/errors/parse-error-media-no-block-3.txt +1 -1
- package/test/less/errors/percentage-non-number-argument.less +3 -0
- package/test/less/errors/percentage-non-number-argument.txt +4 -0
- package/test/less/errors/property-interp-not-defined.txt +2 -2
- package/test/less/extend-selector.less +12 -1
- package/test/less/import/import-inline-invalid-css.less +1 -0
- package/test/less/import/import-reference.less +10 -1
- package/test/less/import-reference-issues/appender-reference-1968.less +6 -0
- package/test/less/import-reference-issues/global-scope-import.less +13 -0
- package/test/less/import-reference-issues/global-scope-nested.less +3 -0
- package/test/less/import-reference-issues/mixin-1968.less +8 -0
- package/test/less/import-reference-issues/multiple-import-nested.less +12 -0
- package/test/less/import-reference-issues/multiple-import.less +10 -0
- package/test/less/import-reference-issues/simple-mixin.css +3 -0
- package/test/less/import-reference-issues/simple-ruleset-2162.less +3 -0
- package/test/less/import-reference-issues.less +50 -0
- package/test/less/import-reference.less +2 -0
- package/test/less/mixins-args.less +48 -0
- package/test/less/mixins-guards.less +78 -0
- package/test/less/no-strict-math/mixins-guards.less +25 -0
- package/test/less/no-strict-math/no-sm-operations.less +10 -0
- package/test/less/operations.less +1 -0
- package/test/less-bom/comments2.less +11 -0
- package/test/less-bom/css-3.less +10 -2
- package/test/less-bom/errors/at-rules-undefined-var.txt +4 -4
- package/test/less-bom/errors/css-guard-default-func.txt +4 -4
- package/test/less-bom/errors/javascript-undefined-var.txt +4 -4
- package/test/less-bom/errors/mixins-guards-default-func-1.txt +4 -4
- package/test/less-bom/errors/mixins-guards-default-func-2.txt +4 -4
- package/test/less-bom/errors/mixins-guards-default-func-3.txt +4 -4
- package/test/less-bom/errors/parse-error-media-no-block-1.txt +1 -1
- package/test/less-bom/errors/parse-error-media-no-block-2.txt +1 -1
- package/test/less-bom/errors/parse-error-media-no-block-3.txt +1 -1
- package/test/less-bom/errors/percentage-non-number-argument.less +3 -0
- package/test/less-bom/errors/percentage-non-number-argument.txt +4 -0
- package/test/less-bom/errors/property-interp-not-defined.txt +2 -2
- package/test/less-bom/extend-selector.less +12 -1
- package/test/less-bom/import/import-inline-invalid-css.less +1 -0
- package/test/less-bom/import/import-reference.less +10 -1
- package/test/less-bom/import-reference-issues/appender-reference-1968.less +6 -0
- package/test/less-bom/import-reference-issues/global-scope-import.less +13 -0
- package/test/less-bom/import-reference-issues/global-scope-nested.less +3 -0
- package/test/less-bom/import-reference-issues/mixin-1968.less +8 -0
- package/test/less-bom/import-reference-issues/multiple-import-nested.less +12 -0
- package/test/less-bom/import-reference-issues/multiple-import.less +10 -0
- package/test/less-bom/import-reference-issues/simple-mixin.css +3 -0
- package/test/less-bom/import-reference-issues/simple-ruleset-2162.less +3 -0
- package/test/less-bom/import-reference-issues.less +50 -0
- package/test/less-bom/import-reference.less +2 -0
- package/test/less-bom/mixins-args.less +48 -0
- package/test/less-bom/mixins-guards.less +78 -0
- package/test/less-bom/no-strict-math/mixins-guards.less +25 -0
- package/test/less-bom/no-strict-math/no-sm-operations.less +10 -0
- package/test/less-bom/operations.less +1 -0
- package/test/less-test.js +6 -1
- package/.idea/.name +0 -1
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/less.js.iml +0 -9
- package/.idea/libraries/less_js_node_modules.xml +0 -14
- package/.idea/misc.xml +0 -14
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -281
package/dist/less.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Less - Leaner CSS v2.
|
|
2
|
+
* Less - Leaner CSS v2.6.1
|
|
3
3
|
* http://lesscss.org
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2009-
|
|
6
|
-
* Licensed under the
|
|
5
|
+
* Copyright (c) 2009-2016, Alexis Sellier <self@cloudhead.net>
|
|
6
|
+
* Licensed under the License.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/** * @license
|
|
10
|
+
/** * @license
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.less = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
@@ -58,13 +58,13 @@ module.exports = function(window, options) {
|
|
|
58
58
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
},{"./browser":3,"./utils":
|
|
61
|
+
},{"./browser":3,"./utils":10}],2:[function(require,module,exports){
|
|
62
62
|
/**
|
|
63
63
|
* Kicks off less and compiles any stylesheets
|
|
64
64
|
* used in the browser distributed version of less
|
|
65
65
|
* to kick-start less using the browser api
|
|
66
66
|
*/
|
|
67
|
-
/*global window */
|
|
67
|
+
/*global window, document */
|
|
68
68
|
|
|
69
69
|
// shim Promise if required
|
|
70
70
|
require('promise/polyfill.js');
|
|
@@ -76,16 +76,42 @@ var less = module.exports = require("./index")(window, options);
|
|
|
76
76
|
|
|
77
77
|
window.less = less;
|
|
78
78
|
|
|
79
|
+
var css, head, style;
|
|
80
|
+
|
|
81
|
+
// Always restore page visibility
|
|
82
|
+
function resolveOrReject(data) {
|
|
83
|
+
if (data.filename) {
|
|
84
|
+
console.warn(data);
|
|
85
|
+
}
|
|
86
|
+
if (!options.async) {
|
|
87
|
+
head.removeChild(style);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
if (options.onReady) {
|
|
80
92
|
if (/!watch/.test(window.location.hash)) {
|
|
81
93
|
less.watch();
|
|
82
94
|
}
|
|
95
|
+
// Simulate synchronous stylesheet loading by blocking page rendering
|
|
96
|
+
if (!options.async) {
|
|
97
|
+
css = 'body { display: none !important }';
|
|
98
|
+
head = document.head || document.getElementsByTagName('head')[0];
|
|
99
|
+
style = document.createElement('style');
|
|
100
|
+
|
|
101
|
+
style.type = 'text/css';
|
|
102
|
+
if (style.styleSheet) {
|
|
103
|
+
style.styleSheet.cssText = css;
|
|
104
|
+
} else {
|
|
105
|
+
style.appendChild(document.createTextNode(css));
|
|
106
|
+
}
|
|
83
107
|
|
|
108
|
+
head.appendChild(style);
|
|
109
|
+
}
|
|
84
110
|
less.registerStylesheetsImmediately();
|
|
85
|
-
less.pageLoadFinished = less.refresh(less.env === 'development');
|
|
111
|
+
less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject);
|
|
86
112
|
}
|
|
87
113
|
|
|
88
|
-
},{"./add-default-options":1,"./index":
|
|
114
|
+
},{"./add-default-options":1,"./index":8,"promise/polyfill.js":97}],3:[function(require,module,exports){
|
|
89
115
|
var utils = require("./utils");
|
|
90
116
|
module.exports = {
|
|
91
117
|
createCSS: function (document, styles, sheet) {
|
|
@@ -151,7 +177,7 @@ module.exports = {
|
|
|
151
177
|
}
|
|
152
178
|
};
|
|
153
179
|
|
|
154
|
-
},{"./utils":
|
|
180
|
+
},{"./utils":10}],4:[function(require,module,exports){
|
|
155
181
|
// Cache system is a bit outdated and could do with work
|
|
156
182
|
|
|
157
183
|
module.exports = function(window, options, logger) {
|
|
@@ -162,25 +188,32 @@ module.exports = function(window, options, logger) {
|
|
|
162
188
|
} catch (_) {}
|
|
163
189
|
}
|
|
164
190
|
return {
|
|
165
|
-
setCSS: function(path, lastModified, styles) {
|
|
191
|
+
setCSS: function(path, lastModified, modifyVars, styles) {
|
|
166
192
|
if (cache) {
|
|
167
193
|
logger.info('saving ' + path + ' to cache.');
|
|
168
194
|
try {
|
|
169
195
|
cache.setItem(path, styles);
|
|
170
196
|
cache.setItem(path + ':timestamp', lastModified);
|
|
197
|
+
if (modifyVars) {
|
|
198
|
+
cache.setItem(path + ':vars', JSON.stringify(modifyVars));
|
|
199
|
+
}
|
|
171
200
|
} catch(e) {
|
|
172
201
|
//TODO - could do with adding more robust error handling
|
|
173
202
|
logger.error('failed to save "' + path + '" to local storage for caching.');
|
|
174
203
|
}
|
|
175
204
|
}
|
|
176
205
|
},
|
|
177
|
-
getCSS: function(path, webInfo) {
|
|
206
|
+
getCSS: function(path, webInfo, modifyVars) {
|
|
178
207
|
var css = cache && cache.getItem(path),
|
|
179
|
-
timestamp = cache && cache.getItem(path + ':timestamp')
|
|
208
|
+
timestamp = cache && cache.getItem(path + ':timestamp'),
|
|
209
|
+
vars = cache && cache.getItem(path + ':vars');
|
|
210
|
+
|
|
211
|
+
modifyVars = modifyVars || {};
|
|
180
212
|
|
|
181
213
|
if (timestamp && webInfo.lastModified &&
|
|
182
214
|
(new Date(webInfo.lastModified).valueOf() ===
|
|
183
|
-
new Date(timestamp).valueOf())
|
|
215
|
+
new Date(timestamp).valueOf()) &&
|
|
216
|
+
(!modifyVars && !vars || JSON.stringify(modifyVars) === vars)) {
|
|
184
217
|
// Use local copy
|
|
185
218
|
return css;
|
|
186
219
|
}
|
|
@@ -295,16 +328,6 @@ module.exports = function(window, less, options) {
|
|
|
295
328
|
}
|
|
296
329
|
}
|
|
297
330
|
|
|
298
|
-
function error(e, rootHref) {
|
|
299
|
-
if (!options.errorReporting || options.errorReporting === "html") {
|
|
300
|
-
errorHTML(e, rootHref);
|
|
301
|
-
} else if (options.errorReporting === "console") {
|
|
302
|
-
errorConsole(e, rootHref);
|
|
303
|
-
} else if (typeof options.errorReporting === 'function') {
|
|
304
|
-
options.errorReporting("add", e, rootHref);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
331
|
function removeErrorHTML(path) {
|
|
309
332
|
var node = window.document.getElementById('less-error-message:' + utils.extractId(path));
|
|
310
333
|
if (node) {
|
|
@@ -354,13 +377,23 @@ module.exports = function(window, less, options) {
|
|
|
354
377
|
less.logger.error(content);
|
|
355
378
|
}
|
|
356
379
|
|
|
380
|
+
function error(e, rootHref) {
|
|
381
|
+
if (!options.errorReporting || options.errorReporting === "html") {
|
|
382
|
+
errorHTML(e, rootHref);
|
|
383
|
+
} else if (options.errorReporting === "console") {
|
|
384
|
+
errorConsole(e, rootHref);
|
|
385
|
+
} else if (typeof options.errorReporting === 'function') {
|
|
386
|
+
options.errorReporting("add", e, rootHref);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
357
390
|
return {
|
|
358
391
|
add: error,
|
|
359
392
|
remove: removeError
|
|
360
393
|
};
|
|
361
394
|
};
|
|
362
395
|
|
|
363
|
-
},{"./browser":3,"./utils":
|
|
396
|
+
},{"./browser":3,"./utils":10}],6:[function(require,module,exports){
|
|
364
397
|
/*global window, XMLHttpRequest */
|
|
365
398
|
|
|
366
399
|
module.exports = function(options, logger) {
|
|
@@ -402,7 +435,7 @@ module.exports = function(options, logger) {
|
|
|
402
435
|
FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) {
|
|
403
436
|
|
|
404
437
|
var xhr = getXMLHttpRequest();
|
|
405
|
-
var async = options.isFileProtocol ? options.fileAsync :
|
|
438
|
+
var async = options.isFileProtocol ? options.fileAsync : true;
|
|
406
439
|
|
|
407
440
|
if (typeof xhr.overrideMimeType === 'function') {
|
|
408
441
|
xhr.overrideMimeType('text/css');
|
|
@@ -481,7 +514,37 @@ module.exports = function(options, logger) {
|
|
|
481
514
|
return FileManager;
|
|
482
515
|
};
|
|
483
516
|
|
|
484
|
-
},{"../less/environment/abstract-file-manager.js":
|
|
517
|
+
},{"../less/environment/abstract-file-manager.js":15}],7:[function(require,module,exports){
|
|
518
|
+
module.exports = function() {
|
|
519
|
+
|
|
520
|
+
var functionRegistry = require("./../less/functions/function-registry");
|
|
521
|
+
|
|
522
|
+
function imageSize() {
|
|
523
|
+
throw {
|
|
524
|
+
type: "Runtime",
|
|
525
|
+
message: "Image size functions are not supported in browser version of less"
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var imageFunctions = {
|
|
530
|
+
"image-size": function(filePathNode) {
|
|
531
|
+
imageSize(this, filePathNode);
|
|
532
|
+
return -1;
|
|
533
|
+
},
|
|
534
|
+
"image-width": function(filePathNode) {
|
|
535
|
+
imageSize(this, filePathNode);
|
|
536
|
+
return -1;
|
|
537
|
+
},
|
|
538
|
+
"image-height": function(filePathNode) {
|
|
539
|
+
imageSize(this, filePathNode);
|
|
540
|
+
return -1;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
functionRegistry.addMultiple(imageFunctions);
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
},{"./../less/functions/function-registry":22}],8:[function(require,module,exports){
|
|
485
548
|
//
|
|
486
549
|
// index.js
|
|
487
550
|
// Should expose the additional browser functions on to the less object
|
|
@@ -492,6 +555,7 @@ var addDataAttr = require("./utils").addDataAttr,
|
|
|
492
555
|
module.exports = function(window, options) {
|
|
493
556
|
var document = window.document;
|
|
494
557
|
var less = require('../less')();
|
|
558
|
+
|
|
495
559
|
//module.exports = less;
|
|
496
560
|
less.options = options;
|
|
497
561
|
var environment = less.environment,
|
|
@@ -503,6 +567,7 @@ module.exports = function(window, options) {
|
|
|
503
567
|
require("./log-listener")(less, options);
|
|
504
568
|
var errors = require("./error-reporting")(window, less, options);
|
|
505
569
|
var cache = less.cache = options.cache || require("./cache")(window, options, less.logger);
|
|
570
|
+
require('./image-size')(less.environment);
|
|
506
571
|
|
|
507
572
|
//Setup user functions
|
|
508
573
|
if (options.functions) {
|
|
@@ -596,14 +661,13 @@ module.exports = function(window, options) {
|
|
|
596
661
|
if (webInfo) {
|
|
597
662
|
webInfo.remaining = remaining;
|
|
598
663
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
664
|
+
var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars);
|
|
665
|
+
if (!reload && css) {
|
|
666
|
+
webInfo.local = true;
|
|
667
|
+
callback(null, css, data, sheet, webInfo, path);
|
|
668
|
+
return;
|
|
606
669
|
}
|
|
670
|
+
|
|
607
671
|
}
|
|
608
672
|
|
|
609
673
|
//TODO add tests around how this behaves when reloading
|
|
@@ -616,9 +680,7 @@ module.exports = function(window, options) {
|
|
|
616
680
|
callback(e);
|
|
617
681
|
} else {
|
|
618
682
|
result.css = postProcessCSS(result.css);
|
|
619
|
-
|
|
620
|
-
cache.setCSS(sheet.href, webInfo.lastModified, result.css);
|
|
621
|
-
}
|
|
683
|
+
cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css);
|
|
622
684
|
callback(null, result.css, data, sheet, webInfo, path);
|
|
623
685
|
}
|
|
624
686
|
});
|
|
@@ -747,7 +809,7 @@ module.exports = function(window, options) {
|
|
|
747
809
|
return less;
|
|
748
810
|
};
|
|
749
811
|
|
|
750
|
-
},{"../less":
|
|
812
|
+
},{"../less":31,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./utils":10}],9:[function(require,module,exports){
|
|
751
813
|
module.exports = function(less, options) {
|
|
752
814
|
|
|
753
815
|
var logLevel_debug = 4,
|
|
@@ -792,7 +854,7 @@ module.exports = function(less, options) {
|
|
|
792
854
|
}
|
|
793
855
|
};
|
|
794
856
|
|
|
795
|
-
},{}],
|
|
857
|
+
},{}],10:[function(require,module,exports){
|
|
796
858
|
module.exports = {
|
|
797
859
|
extractId: function(href) {
|
|
798
860
|
return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain
|
|
@@ -818,7 +880,7 @@ module.exports = {
|
|
|
818
880
|
}
|
|
819
881
|
};
|
|
820
882
|
|
|
821
|
-
},{}],
|
|
883
|
+
},{}],11:[function(require,module,exports){
|
|
822
884
|
var contexts = {};
|
|
823
885
|
module.exports = contexts;
|
|
824
886
|
|
|
@@ -851,7 +913,6 @@ var parseCopyProperties = [
|
|
|
851
913
|
// context
|
|
852
914
|
'processImports', // option & context - whether to process imports. if false then imports will not be imported.
|
|
853
915
|
// Used by the import manager to stop multiple import visitors being created.
|
|
854
|
-
'reference', // Used to indicate that the contents are imported by reference
|
|
855
916
|
'pluginManager' // Used as the plugin manager for the session
|
|
856
917
|
];
|
|
857
918
|
|
|
@@ -932,7 +993,7 @@ contexts.Eval.prototype.normalizePath = function( path ) {
|
|
|
932
993
|
|
|
933
994
|
//todo - do the same for the toCSS ?
|
|
934
995
|
|
|
935
|
-
},{}],
|
|
996
|
+
},{}],12:[function(require,module,exports){
|
|
936
997
|
module.exports = {
|
|
937
998
|
'aliceblue':'#f0f8ff',
|
|
938
999
|
'antiquewhite':'#faebd7',
|
|
@@ -1083,13 +1144,13 @@ module.exports = {
|
|
|
1083
1144
|
'yellow':'#ffff00',
|
|
1084
1145
|
'yellowgreen':'#9acd32'
|
|
1085
1146
|
};
|
|
1086
|
-
},{}],
|
|
1147
|
+
},{}],13:[function(require,module,exports){
|
|
1087
1148
|
module.exports = {
|
|
1088
1149
|
colors: require("./colors"),
|
|
1089
1150
|
unitConversions: require("./unit-conversions")
|
|
1090
1151
|
};
|
|
1091
1152
|
|
|
1092
|
-
},{"./colors":
|
|
1153
|
+
},{"./colors":12,"./unit-conversions":14}],14:[function(require,module,exports){
|
|
1093
1154
|
module.exports = {
|
|
1094
1155
|
length: {
|
|
1095
1156
|
'm': 1,
|
|
@@ -1111,7 +1172,7 @@ module.exports = {
|
|
|
1111
1172
|
'turn': 1
|
|
1112
1173
|
}
|
|
1113
1174
|
};
|
|
1114
|
-
},{}],
|
|
1175
|
+
},{}],15:[function(require,module,exports){
|
|
1115
1176
|
var abstractFileManager = function() {
|
|
1116
1177
|
};
|
|
1117
1178
|
|
|
@@ -1236,7 +1297,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
|
|
|
1236
1297
|
|
|
1237
1298
|
module.exports = abstractFileManager;
|
|
1238
1299
|
|
|
1239
|
-
},{}],
|
|
1300
|
+
},{}],16:[function(require,module,exports){
|
|
1240
1301
|
var logger = require("../logger");
|
|
1241
1302
|
var environment = function(externalEnvironment, fileManagers) {
|
|
1242
1303
|
this.fileManagers = fileManagers || [];
|
|
@@ -1289,7 +1350,7 @@ environment.prototype.clearFileManagers = function () {
|
|
|
1289
1350
|
|
|
1290
1351
|
module.exports = environment;
|
|
1291
1352
|
|
|
1292
|
-
},{"../logger":
|
|
1353
|
+
},{"../logger":33}],17:[function(require,module,exports){
|
|
1293
1354
|
var Color = require("../tree/color"),
|
|
1294
1355
|
functionRegistry = require("./function-registry");
|
|
1295
1356
|
|
|
@@ -1365,7 +1426,7 @@ for (var f in colorBlendModeFunctions) {
|
|
|
1365
1426
|
|
|
1366
1427
|
functionRegistry.addMultiple(colorBlend);
|
|
1367
1428
|
|
|
1368
|
-
},{"../tree/color":
|
|
1429
|
+
},{"../tree/color":50,"./function-registry":22}],18:[function(require,module,exports){
|
|
1369
1430
|
var Dimension = require("../tree/dimension"),
|
|
1370
1431
|
Color = require("../tree/color"),
|
|
1371
1432
|
Quoted = require("../tree/quoted"),
|
|
@@ -1411,6 +1472,9 @@ colorFunctions = {
|
|
|
1411
1472
|
return colorFunctions.hsla(h, s, l, 1.0);
|
|
1412
1473
|
},
|
|
1413
1474
|
hsla: function (h, s, l, a) {
|
|
1475
|
+
|
|
1476
|
+
var m1, m2;
|
|
1477
|
+
|
|
1414
1478
|
function hue(h) {
|
|
1415
1479
|
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
|
|
1416
1480
|
if (h * 6 < 1) {
|
|
@@ -1430,8 +1494,8 @@ colorFunctions = {
|
|
|
1430
1494
|
h = (number(h) % 360) / 360;
|
|
1431
1495
|
s = clamp(number(s)); l = clamp(number(l)); a = clamp(number(a));
|
|
1432
1496
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1497
|
+
m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
|
|
1498
|
+
m1 = l * 2 - m2;
|
|
1435
1499
|
|
|
1436
1500
|
return colorFunctions.rgba(hue(h + 1 / 3) * 255,
|
|
1437
1501
|
hue(h) * 255,
|
|
@@ -1686,7 +1750,7 @@ colorFunctions = {
|
|
|
1686
1750
|
};
|
|
1687
1751
|
functionRegistry.addMultiple(colorFunctions);
|
|
1688
1752
|
|
|
1689
|
-
},{"../tree/anonymous":
|
|
1753
|
+
},{"../tree/anonymous":46,"../tree/color":50,"../tree/dimension":56,"../tree/quoted":73,"./function-registry":22}],19:[function(require,module,exports){
|
|
1690
1754
|
module.exports = function(environment) {
|
|
1691
1755
|
var Quoted = require("../tree/quoted"),
|
|
1692
1756
|
URL = require("../tree/url"),
|
|
@@ -1773,7 +1837,7 @@ module.exports = function(environment) {
|
|
|
1773
1837
|
});
|
|
1774
1838
|
};
|
|
1775
1839
|
|
|
1776
|
-
},{"../logger":
|
|
1840
|
+
},{"../logger":33,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],20:[function(require,module,exports){
|
|
1777
1841
|
var Keyword = require("../tree/keyword"),
|
|
1778
1842
|
functionRegistry = require("./function-registry");
|
|
1779
1843
|
|
|
@@ -1802,7 +1866,7 @@ functionRegistry.add("default", defaultFunc.eval.bind(defaultFunc));
|
|
|
1802
1866
|
|
|
1803
1867
|
module.exports = defaultFunc;
|
|
1804
1868
|
|
|
1805
|
-
},{"../tree/keyword":
|
|
1869
|
+
},{"../tree/keyword":65,"./function-registry":22}],21:[function(require,module,exports){
|
|
1806
1870
|
var Expression = require("../tree/expression");
|
|
1807
1871
|
|
|
1808
1872
|
var functionCaller = function(name, context, index, currentFileInfo) {
|
|
@@ -1850,7 +1914,7 @@ functionCaller.prototype.call = function(args) {
|
|
|
1850
1914
|
|
|
1851
1915
|
module.exports = functionCaller;
|
|
1852
1916
|
|
|
1853
|
-
},{"../tree/expression":
|
|
1917
|
+
},{"../tree/expression":59}],22:[function(require,module,exports){
|
|
1854
1918
|
function makeRegistry( base ) {
|
|
1855
1919
|
return {
|
|
1856
1920
|
_data: {},
|
|
@@ -1880,7 +1944,7 @@ function makeRegistry( base ) {
|
|
|
1880
1944
|
}
|
|
1881
1945
|
|
|
1882
1946
|
module.exports = makeRegistry( null );
|
|
1883
|
-
},{}],
|
|
1947
|
+
},{}],23:[function(require,module,exports){
|
|
1884
1948
|
module.exports = function(environment) {
|
|
1885
1949
|
var functions = {
|
|
1886
1950
|
functionRegistry: require("./function-registry"),
|
|
@@ -1901,9 +1965,26 @@ module.exports = function(environment) {
|
|
|
1901
1965
|
return functions;
|
|
1902
1966
|
};
|
|
1903
1967
|
|
|
1904
|
-
},{"./color":
|
|
1905
|
-
var Dimension = require("../tree/dimension")
|
|
1906
|
-
|
|
1968
|
+
},{"./color":18,"./color-blending":17,"./data-uri":19,"./default":20,"./function-caller":21,"./function-registry":22,"./math":25,"./number":26,"./string":27,"./svg":28,"./types":29}],24:[function(require,module,exports){
|
|
1969
|
+
var Dimension = require("../tree/dimension");
|
|
1970
|
+
|
|
1971
|
+
var MathHelper = function() {
|
|
1972
|
+
};
|
|
1973
|
+
MathHelper._math = function (fn, unit, n) {
|
|
1974
|
+
if (!(n instanceof Dimension)) {
|
|
1975
|
+
throw { type: "Argument", message: "argument must be a number" };
|
|
1976
|
+
}
|
|
1977
|
+
if (unit == null) {
|
|
1978
|
+
unit = n.unit;
|
|
1979
|
+
} else {
|
|
1980
|
+
n = n.unify();
|
|
1981
|
+
}
|
|
1982
|
+
return new Dimension(fn(parseFloat(n.value)), unit);
|
|
1983
|
+
};
|
|
1984
|
+
module.exports = MathHelper;
|
|
1985
|
+
},{"../tree/dimension":56}],25:[function(require,module,exports){
|
|
1986
|
+
var functionRegistry = require("./function-registry"),
|
|
1987
|
+
mathHelper = require("./math-helper.js");
|
|
1907
1988
|
|
|
1908
1989
|
var mathFunctions = {
|
|
1909
1990
|
// name, unit
|
|
@@ -1919,35 +2000,24 @@ var mathFunctions = {
|
|
|
1919
2000
|
acos: "rad"
|
|
1920
2001
|
};
|
|
1921
2002
|
|
|
1922
|
-
function _math(fn, unit, n) {
|
|
1923
|
-
if (!(n instanceof Dimension)) {
|
|
1924
|
-
throw { type: "Argument", message: "argument must be a number" };
|
|
1925
|
-
}
|
|
1926
|
-
if (unit == null) {
|
|
1927
|
-
unit = n.unit;
|
|
1928
|
-
} else {
|
|
1929
|
-
n = n.unify();
|
|
1930
|
-
}
|
|
1931
|
-
return new Dimension(fn(parseFloat(n.value)), unit);
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
2003
|
for (var f in mathFunctions) {
|
|
1935
2004
|
if (mathFunctions.hasOwnProperty(f)) {
|
|
1936
|
-
mathFunctions[f] = _math.bind(null, Math[f], mathFunctions[f]);
|
|
2005
|
+
mathFunctions[f] = mathHelper._math.bind(null, Math[f], mathFunctions[f]);
|
|
1937
2006
|
}
|
|
1938
2007
|
}
|
|
1939
2008
|
|
|
1940
2009
|
mathFunctions.round = function (n, f) {
|
|
1941
2010
|
var fraction = typeof f === "undefined" ? 0 : f.value;
|
|
1942
|
-
return _math(function(num) { return num.toFixed(fraction); }, null, n);
|
|
2011
|
+
return mathHelper._math(function(num) { return num.toFixed(fraction); }, null, n);
|
|
1943
2012
|
};
|
|
1944
2013
|
|
|
1945
2014
|
functionRegistry.addMultiple(mathFunctions);
|
|
1946
2015
|
|
|
1947
|
-
},{"
|
|
2016
|
+
},{"./function-registry":22,"./math-helper.js":24}],26:[function(require,module,exports){
|
|
1948
2017
|
var Dimension = require("../tree/dimension"),
|
|
1949
2018
|
Anonymous = require("../tree/anonymous"),
|
|
1950
|
-
functionRegistry = require("./function-registry")
|
|
2019
|
+
functionRegistry = require("./function-registry"),
|
|
2020
|
+
mathHelper = require("./math-helper.js");
|
|
1951
2021
|
|
|
1952
2022
|
var minMax = function (isMin, args) {
|
|
1953
2023
|
args = Array.prototype.slice.call(args);
|
|
@@ -2018,11 +2088,15 @@ functionRegistry.addMultiple({
|
|
|
2018
2088
|
return new Dimension(Math.pow(x.value, y.value), x.unit);
|
|
2019
2089
|
},
|
|
2020
2090
|
percentage: function (n) {
|
|
2021
|
-
|
|
2091
|
+
var result = mathHelper._math(function(num) {
|
|
2092
|
+
return num * 100;
|
|
2093
|
+
}, '%', n);
|
|
2094
|
+
|
|
2095
|
+
return result;
|
|
2022
2096
|
}
|
|
2023
2097
|
});
|
|
2024
2098
|
|
|
2025
|
-
},{"../tree/anonymous":
|
|
2099
|
+
},{"../tree/anonymous":46,"../tree/dimension":56,"./function-registry":22,"./math-helper.js":24}],27:[function(require,module,exports){
|
|
2026
2100
|
var Quoted = require("../tree/quoted"),
|
|
2027
2101
|
Anonymous = require("../tree/anonymous"),
|
|
2028
2102
|
JavaScript = require("../tree/javascript"),
|
|
@@ -2061,7 +2135,7 @@ functionRegistry.addMultiple({
|
|
|
2061
2135
|
}
|
|
2062
2136
|
});
|
|
2063
2137
|
|
|
2064
|
-
},{"../tree/anonymous":
|
|
2138
|
+
},{"../tree/anonymous":46,"../tree/javascript":63,"../tree/quoted":73,"./function-registry":22}],28:[function(require,module,exports){
|
|
2065
2139
|
module.exports = function(environment) {
|
|
2066
2140
|
var Dimension = require("../tree/dimension"),
|
|
2067
2141
|
Color = require("../tree/color"),
|
|
@@ -2151,7 +2225,7 @@ module.exports = function(environment) {
|
|
|
2151
2225
|
});
|
|
2152
2226
|
};
|
|
2153
2227
|
|
|
2154
|
-
},{"../tree/color":
|
|
2228
|
+
},{"../tree/color":50,"../tree/dimension":56,"../tree/expression":59,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],29:[function(require,module,exports){
|
|
2155
2229
|
var Keyword = require("../tree/keyword"),
|
|
2156
2230
|
DetachedRuleset = require("../tree/detached-ruleset"),
|
|
2157
2231
|
Dimension = require("../tree/dimension"),
|
|
@@ -2242,7 +2316,7 @@ functionRegistry.addMultiple({
|
|
|
2242
2316
|
}
|
|
2243
2317
|
});
|
|
2244
2318
|
|
|
2245
|
-
},{"../tree/anonymous":
|
|
2319
|
+
},{"../tree/anonymous":46,"../tree/color":50,"../tree/detached-ruleset":55,"../tree/dimension":56,"../tree/keyword":65,"../tree/operation":71,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],30:[function(require,module,exports){
|
|
2246
2320
|
var contexts = require("./contexts"),
|
|
2247
2321
|
Parser = require('./parser/parser'),
|
|
2248
2322
|
FunctionImporter = require('./plugins/function-importer');
|
|
@@ -2375,12 +2449,12 @@ module.exports = function(environment) {
|
|
|
2375
2449
|
return ImportManager;
|
|
2376
2450
|
};
|
|
2377
2451
|
|
|
2378
|
-
},{"./contexts":
|
|
2452
|
+
},{"./contexts":11,"./parser/parser":38,"./plugins/function-importer":40}],31:[function(require,module,exports){
|
|
2379
2453
|
module.exports = function(environment, fileManagers) {
|
|
2380
2454
|
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
|
2381
2455
|
|
|
2382
2456
|
var less = {
|
|
2383
|
-
version: [2,
|
|
2457
|
+
version: [2, 6, 1],
|
|
2384
2458
|
data: require('./data'),
|
|
2385
2459
|
tree: require('./tree'),
|
|
2386
2460
|
Environment: (Environment = require("./environment/environment")),
|
|
@@ -2406,7 +2480,7 @@ module.exports = function(environment, fileManagers) {
|
|
|
2406
2480
|
return less;
|
|
2407
2481
|
};
|
|
2408
2482
|
|
|
2409
|
-
},{"./contexts":
|
|
2483
|
+
},{"./contexts":11,"./data":13,"./environment/abstract-file-manager":15,"./environment/environment":16,"./functions":23,"./import-manager":30,"./less-error":32,"./logger":33,"./parse":35,"./parse-tree":34,"./parser/parser":38,"./plugin-manager":39,"./render":41,"./source-map-builder":42,"./source-map-output":43,"./transform-tree":44,"./tree":62,"./utils":83,"./visitors":87}],32:[function(require,module,exports){
|
|
2410
2484
|
var utils = require("./utils");
|
|
2411
2485
|
|
|
2412
2486
|
var LessError = module.exports = function LessError(e, importManager, currentFilename) {
|
|
@@ -2450,7 +2524,7 @@ if (typeof Object.create === 'undefined') {
|
|
|
2450
2524
|
|
|
2451
2525
|
LessError.prototype.constructor = LessError;
|
|
2452
2526
|
|
|
2453
|
-
},{"./utils":
|
|
2527
|
+
},{"./utils":83}],33:[function(require,module,exports){
|
|
2454
2528
|
module.exports = {
|
|
2455
2529
|
error: function(msg) {
|
|
2456
2530
|
this._fireEvent("error", msg);
|
|
@@ -2486,7 +2560,7 @@ module.exports = {
|
|
|
2486
2560
|
_listeners: []
|
|
2487
2561
|
};
|
|
2488
2562
|
|
|
2489
|
-
},{}],
|
|
2563
|
+
},{}],34:[function(require,module,exports){
|
|
2490
2564
|
var LessError = require('./less-error'),
|
|
2491
2565
|
transformTree = require("./transform-tree"),
|
|
2492
2566
|
logger = require("./logger");
|
|
@@ -2548,7 +2622,7 @@ module.exports = function(SourceMapBuilder) {
|
|
|
2548
2622
|
return ParseTree;
|
|
2549
2623
|
};
|
|
2550
2624
|
|
|
2551
|
-
},{"./less-error":
|
|
2625
|
+
},{"./less-error":32,"./logger":33,"./transform-tree":44}],35:[function(require,module,exports){
|
|
2552
2626
|
var PromiseConstructor,
|
|
2553
2627
|
contexts = require("./contexts"),
|
|
2554
2628
|
Parser = require('./parser/parser'),
|
|
@@ -2618,7 +2692,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
|
|
|
2618
2692
|
return parse;
|
|
2619
2693
|
};
|
|
2620
2694
|
|
|
2621
|
-
},{"./contexts":
|
|
2695
|
+
},{"./contexts":11,"./parser/parser":38,"./plugin-manager":39,"promise":undefined}],36:[function(require,module,exports){
|
|
2622
2696
|
// Split the input into chunks.
|
|
2623
2697
|
module.exports = function (input, fail) {
|
|
2624
2698
|
var len = input.length, level = 0, parenLevel = 0,
|
|
@@ -2732,7 +2806,7 @@ module.exports = function (input, fail) {
|
|
|
2732
2806
|
return chunks;
|
|
2733
2807
|
};
|
|
2734
2808
|
|
|
2735
|
-
},{}],
|
|
2809
|
+
},{}],37:[function(require,module,exports){
|
|
2736
2810
|
var chunker = require('./chunker');
|
|
2737
2811
|
|
|
2738
2812
|
module.exports = function() {
|
|
@@ -2746,6 +2820,74 @@ module.exports = function() {
|
|
|
2746
2820
|
currentPos, // index of current chunk, in `input`
|
|
2747
2821
|
parserInput = {};
|
|
2748
2822
|
|
|
2823
|
+
var CHARCODE_SPACE = 32,
|
|
2824
|
+
CHARCODE_TAB = 9,
|
|
2825
|
+
CHARCODE_LF = 10,
|
|
2826
|
+
CHARCODE_CR = 13,
|
|
2827
|
+
CHARCODE_PLUS = 43,
|
|
2828
|
+
CHARCODE_COMMA = 44,
|
|
2829
|
+
CHARCODE_FORWARD_SLASH = 47,
|
|
2830
|
+
CHARCODE_9 = 57;
|
|
2831
|
+
|
|
2832
|
+
function skipWhitespace(length) {
|
|
2833
|
+
var oldi = parserInput.i, oldj = j,
|
|
2834
|
+
curr = parserInput.i - currentPos,
|
|
2835
|
+
endIndex = parserInput.i + current.length - curr,
|
|
2836
|
+
mem = (parserInput.i += length),
|
|
2837
|
+
inp = input,
|
|
2838
|
+
c, nextChar, comment;
|
|
2839
|
+
|
|
2840
|
+
for (; parserInput.i < endIndex; parserInput.i++) {
|
|
2841
|
+
c = inp.charCodeAt(parserInput.i);
|
|
2842
|
+
|
|
2843
|
+
if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) {
|
|
2844
|
+
nextChar = inp.charAt(parserInput.i + 1);
|
|
2845
|
+
if (nextChar === '/') {
|
|
2846
|
+
comment = {index: parserInput.i, isLineComment: true};
|
|
2847
|
+
var nextNewLine = inp.indexOf("\n", parserInput.i + 2);
|
|
2848
|
+
if (nextNewLine < 0) {
|
|
2849
|
+
nextNewLine = endIndex;
|
|
2850
|
+
}
|
|
2851
|
+
parserInput.i = nextNewLine;
|
|
2852
|
+
comment.text = inp.substr(comment.i, parserInput.i - comment.i);
|
|
2853
|
+
parserInput.commentStore.push(comment);
|
|
2854
|
+
continue;
|
|
2855
|
+
} else if (nextChar === '*') {
|
|
2856
|
+
var nextStarSlash = inp.indexOf("*/", parserInput.i + 2);
|
|
2857
|
+
if (nextStarSlash >= 0) {
|
|
2858
|
+
comment = {
|
|
2859
|
+
index: parserInput.i,
|
|
2860
|
+
text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i),
|
|
2861
|
+
isLineComment: false
|
|
2862
|
+
};
|
|
2863
|
+
parserInput.i += comment.text.length - 1;
|
|
2864
|
+
parserInput.commentStore.push(comment);
|
|
2865
|
+
continue;
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
break;
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) {
|
|
2872
|
+
break;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
current = current.slice(length + parserInput.i - mem + curr);
|
|
2877
|
+
currentPos = parserInput.i;
|
|
2878
|
+
|
|
2879
|
+
if (!current.length) {
|
|
2880
|
+
if (j < chunks.length - 1) {
|
|
2881
|
+
current = chunks[++j];
|
|
2882
|
+
skipWhitespace(0); // skip space at the beginning of a chunk
|
|
2883
|
+
return true; // things changed
|
|
2884
|
+
}
|
|
2885
|
+
parserInput.finished = true;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
return oldi !== parserInput.i || oldj !== j;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2749
2891
|
parserInput.save = function() {
|
|
2750
2892
|
currentPos = parserInput.i;
|
|
2751
2893
|
saveStack.push( { current: current, i: parserInput.i, j: j });
|
|
@@ -2840,78 +2982,10 @@ module.exports = function() {
|
|
|
2840
2982
|
return null;
|
|
2841
2983
|
};
|
|
2842
2984
|
|
|
2843
|
-
var CHARCODE_SPACE = 32,
|
|
2844
|
-
CHARCODE_TAB = 9,
|
|
2845
|
-
CHARCODE_LF = 10,
|
|
2846
|
-
CHARCODE_CR = 13,
|
|
2847
|
-
CHARCODE_PLUS = 43,
|
|
2848
|
-
CHARCODE_COMMA = 44,
|
|
2849
|
-
CHARCODE_FORWARD_SLASH = 47,
|
|
2850
|
-
CHARCODE_9 = 57;
|
|
2851
|
-
|
|
2852
2985
|
parserInput.autoCommentAbsorb = true;
|
|
2853
2986
|
parserInput.commentStore = [];
|
|
2854
2987
|
parserInput.finished = false;
|
|
2855
2988
|
|
|
2856
|
-
var skipWhitespace = function(length) {
|
|
2857
|
-
var oldi = parserInput.i, oldj = j,
|
|
2858
|
-
curr = parserInput.i - currentPos,
|
|
2859
|
-
endIndex = parserInput.i + current.length - curr,
|
|
2860
|
-
mem = (parserInput.i += length),
|
|
2861
|
-
inp = input,
|
|
2862
|
-
c, nextChar, comment;
|
|
2863
|
-
|
|
2864
|
-
for (; parserInput.i < endIndex; parserInput.i++) {
|
|
2865
|
-
c = inp.charCodeAt(parserInput.i);
|
|
2866
|
-
|
|
2867
|
-
if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) {
|
|
2868
|
-
nextChar = inp.charAt(parserInput.i + 1);
|
|
2869
|
-
if (nextChar === '/') {
|
|
2870
|
-
comment = {index: parserInput.i, isLineComment: true};
|
|
2871
|
-
var nextNewLine = inp.indexOf("\n", parserInput.i + 2);
|
|
2872
|
-
if (nextNewLine < 0) {
|
|
2873
|
-
nextNewLine = endIndex;
|
|
2874
|
-
}
|
|
2875
|
-
parserInput.i = nextNewLine;
|
|
2876
|
-
comment.text = inp.substr(comment.i, parserInput.i - comment.i);
|
|
2877
|
-
parserInput.commentStore.push(comment);
|
|
2878
|
-
continue;
|
|
2879
|
-
} else if (nextChar === '*') {
|
|
2880
|
-
var nextStarSlash = inp.indexOf("*/", parserInput.i + 2);
|
|
2881
|
-
if (nextStarSlash >= 0) {
|
|
2882
|
-
comment = {
|
|
2883
|
-
index: parserInput.i,
|
|
2884
|
-
text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i),
|
|
2885
|
-
isLineComment: false
|
|
2886
|
-
};
|
|
2887
|
-
parserInput.i += comment.text.length - 1;
|
|
2888
|
-
parserInput.commentStore.push(comment);
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
break;
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) {
|
|
2896
|
-
break;
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
|
|
2900
|
-
current = current.slice(length + parserInput.i - mem + curr);
|
|
2901
|
-
currentPos = parserInput.i;
|
|
2902
|
-
|
|
2903
|
-
if (!current.length) {
|
|
2904
|
-
if (j < chunks.length - 1) {
|
|
2905
|
-
current = chunks[++j];
|
|
2906
|
-
skipWhitespace(0); // skip space at the beginning of a chunk
|
|
2907
|
-
return true; // things changed
|
|
2908
|
-
}
|
|
2909
|
-
parserInput.finished = true;
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
return oldi !== parserInput.i || oldj !== j;
|
|
2913
|
-
};
|
|
2914
|
-
|
|
2915
2989
|
// Same as $(), but don't change the state of the parser,
|
|
2916
2990
|
// just return the match.
|
|
2917
2991
|
parserInput.peek = function(tok) {
|
|
@@ -2993,7 +3067,7 @@ module.exports = function() {
|
|
|
2993
3067
|
return parserInput;
|
|
2994
3068
|
};
|
|
2995
3069
|
|
|
2996
|
-
},{"./chunker":
|
|
3070
|
+
},{"./chunker":36}],38:[function(require,module,exports){
|
|
2997
3071
|
var LessError = require('../less-error'),
|
|
2998
3072
|
tree = require("../tree"),
|
|
2999
3073
|
visitors = require("../visitors"),
|
|
@@ -3031,15 +3105,27 @@ var LessError = require('../less-error'),
|
|
|
3031
3105
|
// Token matching is done with the `$` function, which either takes
|
|
3032
3106
|
// a terminal string or regexp, or a non-terminal function to call.
|
|
3033
3107
|
// It also takes care of moving all the indices forwards.
|
|
3034
|
-
|
|
3108
|
+
//`
|
|
3035
3109
|
//
|
|
3036
3110
|
var Parser = function Parser(context, imports, fileInfo) {
|
|
3037
3111
|
var parsers,
|
|
3038
3112
|
parserInput = getParserInput();
|
|
3039
3113
|
|
|
3114
|
+
function error(msg, type) {
|
|
3115
|
+
throw new LessError(
|
|
3116
|
+
{
|
|
3117
|
+
index: parserInput.i,
|
|
3118
|
+
filename: fileInfo.filename,
|
|
3119
|
+
type: type || 'Syntax',
|
|
3120
|
+
message: msg
|
|
3121
|
+
},
|
|
3122
|
+
imports
|
|
3123
|
+
);
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3040
3126
|
function expect(arg, msg, index) {
|
|
3041
3127
|
// some older browsers return typeof 'function' for RegExp
|
|
3042
|
-
var result = (
|
|
3128
|
+
var result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg);
|
|
3043
3129
|
if (result) {
|
|
3044
3130
|
return result;
|
|
3045
3131
|
}
|
|
@@ -3055,18 +3141,6 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3055
3141
|
error(msg || "expected '" + arg + "' got '" + parserInput.currentChar() + "'");
|
|
3056
3142
|
}
|
|
3057
3143
|
|
|
3058
|
-
function error(msg, type) {
|
|
3059
|
-
throw new LessError(
|
|
3060
|
-
{
|
|
3061
|
-
index: parserInput.i,
|
|
3062
|
-
filename: fileInfo.filename,
|
|
3063
|
-
type: type || 'Syntax',
|
|
3064
|
-
message: msg
|
|
3065
|
-
},
|
|
3066
|
-
imports
|
|
3067
|
-
);
|
|
3068
|
-
}
|
|
3069
|
-
|
|
3070
3144
|
function getDebugInfo(index) {
|
|
3071
3145
|
var filename = fileInfo.filename;
|
|
3072
3146
|
|
|
@@ -3485,21 +3559,39 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3485
3559
|
if (!colorCandidateString.match(/^[A-Fa-f0-9]+$/)) { // verify if candidate consists only of allowed HEX characters
|
|
3486
3560
|
error("Invalid HEX color code");
|
|
3487
3561
|
}
|
|
3488
|
-
return new(tree.Color)(rgb[1]);
|
|
3562
|
+
return new(tree.Color)(rgb[1], undefined, '#' + colorCandidateString);
|
|
3489
3563
|
}
|
|
3490
3564
|
},
|
|
3491
3565
|
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
if (
|
|
3566
|
+
colorKeyword: function () {
|
|
3567
|
+
parserInput.save();
|
|
3568
|
+
var autoCommentAbsorb = parserInput.autoCommentAbsorb;
|
|
3569
|
+
parserInput.autoCommentAbsorb = false;
|
|
3570
|
+
var k = parserInput.$re(/^[A-Za-z]+/);
|
|
3571
|
+
parserInput.autoCommentAbsorb = autoCommentAbsorb;
|
|
3572
|
+
if (!k) {
|
|
3573
|
+
parserInput.forget();
|
|
3574
|
+
return;
|
|
3575
|
+
}
|
|
3576
|
+
parserInput.restore();
|
|
3577
|
+
var color = tree.Color.fromKeyword(k);
|
|
3578
|
+
if (color) {
|
|
3579
|
+
parserInput.$str(k);
|
|
3580
|
+
return color;
|
|
3581
|
+
}
|
|
3582
|
+
},
|
|
3583
|
+
|
|
3584
|
+
//
|
|
3585
|
+
// A Dimension, that is, a number and a unit
|
|
3586
|
+
//
|
|
3587
|
+
// 0.5em 95%
|
|
3588
|
+
//
|
|
3589
|
+
dimension: function () {
|
|
3590
|
+
if (parserInput.peekNotNumeric()) {
|
|
3499
3591
|
return;
|
|
3500
3592
|
}
|
|
3501
3593
|
|
|
3502
|
-
var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-
|
|
3594
|
+
var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);
|
|
3503
3595
|
if (value) {
|
|
3504
3596
|
return new(tree.Dimension)(value[1], value[2]);
|
|
3505
3597
|
}
|
|
@@ -3565,7 +3657,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3565
3657
|
rulesetCall: function () {
|
|
3566
3658
|
var name;
|
|
3567
3659
|
|
|
3568
|
-
if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\
|
|
3660
|
+
if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)\s*;/))) {
|
|
3569
3661
|
return new tree.RulesetCall(name[1]);
|
|
3570
3662
|
}
|
|
3571
3663
|
},
|
|
@@ -3599,7 +3691,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3599
3691
|
if (!elements) {
|
|
3600
3692
|
error("Missing target selector for :extend().");
|
|
3601
3693
|
}
|
|
3602
|
-
extend = new(tree.Extend)(new(tree.Selector)(elements), option, index);
|
|
3694
|
+
extend = new(tree.Extend)(new(tree.Selector)(elements), option, index, fileInfo);
|
|
3603
3695
|
if (extendList) {
|
|
3604
3696
|
extendList.push(extend);
|
|
3605
3697
|
} else {
|
|
@@ -3683,7 +3775,8 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3683
3775
|
var entities = parsers.entities,
|
|
3684
3776
|
returner = { args:null, variadic: false },
|
|
3685
3777
|
expressions = [], argsSemiColon = [], argsComma = [],
|
|
3686
|
-
isSemiColonSeparated, expressionContainsNamed, name, nameLoop,
|
|
3778
|
+
isSemiColonSeparated, expressionContainsNamed, name, nameLoop,
|
|
3779
|
+
value, arg, expand;
|
|
3687
3780
|
|
|
3688
3781
|
parserInput.save();
|
|
3689
3782
|
|
|
@@ -3745,14 +3838,18 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3745
3838
|
}
|
|
3746
3839
|
}
|
|
3747
3840
|
nameLoop = (name = val.name);
|
|
3748
|
-
} else if (
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
isSemiColonSeparated
|
|
3841
|
+
} else if (parserInput.$str("...")) {
|
|
3842
|
+
if (!isCall) {
|
|
3843
|
+
returner.variadic = true;
|
|
3844
|
+
if (parserInput.$char(";") && !isSemiColonSeparated) {
|
|
3845
|
+
isSemiColonSeparated = true;
|
|
3846
|
+
}
|
|
3847
|
+
(isSemiColonSeparated ? argsSemiColon : argsComma)
|
|
3848
|
+
.push({ name: arg.name, variadic: true });
|
|
3849
|
+
break;
|
|
3850
|
+
} else {
|
|
3851
|
+
expand = true;
|
|
3752
3852
|
}
|
|
3753
|
-
(isSemiColonSeparated ? argsSemiColon : argsComma)
|
|
3754
|
-
.push({ name: arg.name, variadic: true });
|
|
3755
|
-
break;
|
|
3756
3853
|
} else if (!isCall) {
|
|
3757
3854
|
name = nameLoop = val.name;
|
|
3758
3855
|
value = null;
|
|
@@ -3763,7 +3860,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3763
3860
|
expressions.push(value);
|
|
3764
3861
|
}
|
|
3765
3862
|
|
|
3766
|
-
argsComma.push({ name:nameLoop, value:value });
|
|
3863
|
+
argsComma.push({ name:nameLoop, value:value, expand:expand });
|
|
3767
3864
|
|
|
3768
3865
|
if (parserInput.$char(',')) {
|
|
3769
3866
|
continue;
|
|
@@ -3780,7 +3877,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
3780
3877
|
if (expressions.length > 1) {
|
|
3781
3878
|
value = new(tree.Value)(expressions);
|
|
3782
3879
|
}
|
|
3783
|
-
argsSemiColon.push({ name:name, value:value });
|
|
3880
|
+
argsSemiColon.push({ name:name, value:value, expand:expand });
|
|
3784
3881
|
|
|
3785
3882
|
name = null;
|
|
3786
3883
|
expressions = [];
|
|
@@ -4260,12 +4357,10 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4260
4357
|
} else if (e) {
|
|
4261
4358
|
nodes.push(new(tree.Paren)(e));
|
|
4262
4359
|
} else {
|
|
4263
|
-
|
|
4264
|
-
return null;
|
|
4360
|
+
error("badly formed media feature definition");
|
|
4265
4361
|
}
|
|
4266
4362
|
} else {
|
|
4267
|
-
|
|
4268
|
-
return null;
|
|
4363
|
+
error("Missing closing ')'", "Parse");
|
|
4269
4364
|
}
|
|
4270
4365
|
}
|
|
4271
4366
|
} while (e);
|
|
@@ -4310,8 +4405,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4310
4405
|
rules = this.block();
|
|
4311
4406
|
|
|
4312
4407
|
if (!rules) {
|
|
4313
|
-
|
|
4314
|
-
return;
|
|
4408
|
+
error("media definitions require block statements after any features");
|
|
4315
4409
|
}
|
|
4316
4410
|
|
|
4317
4411
|
parserInput.forget();
|
|
@@ -4389,33 +4483,6 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4389
4483
|
}
|
|
4390
4484
|
|
|
4391
4485
|
switch(nonVendorSpecificName) {
|
|
4392
|
-
/*
|
|
4393
|
-
case "@font-face":
|
|
4394
|
-
case "@viewport":
|
|
4395
|
-
case "@top-left":
|
|
4396
|
-
case "@top-left-corner":
|
|
4397
|
-
case "@top-center":
|
|
4398
|
-
case "@top-right":
|
|
4399
|
-
case "@top-right-corner":
|
|
4400
|
-
case "@bottom-left":
|
|
4401
|
-
case "@bottom-left-corner":
|
|
4402
|
-
case "@bottom-center":
|
|
4403
|
-
case "@bottom-right":
|
|
4404
|
-
case "@bottom-right-corner":
|
|
4405
|
-
case "@left-top":
|
|
4406
|
-
case "@left-middle":
|
|
4407
|
-
case "@left-bottom":
|
|
4408
|
-
case "@right-top":
|
|
4409
|
-
case "@right-middle":
|
|
4410
|
-
case "@right-bottom":
|
|
4411
|
-
hasBlock = true;
|
|
4412
|
-
isRooted = true;
|
|
4413
|
-
break;
|
|
4414
|
-
*/
|
|
4415
|
-
case "@counter-style":
|
|
4416
|
-
hasIdentifier = true;
|
|
4417
|
-
hasBlock = true;
|
|
4418
|
-
break;
|
|
4419
4486
|
case "@charset":
|
|
4420
4487
|
hasIdentifier = true;
|
|
4421
4488
|
hasBlock = false;
|
|
@@ -4425,17 +4492,17 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4425
4492
|
hasBlock = false;
|
|
4426
4493
|
break;
|
|
4427
4494
|
case "@keyframes":
|
|
4495
|
+
case "@counter-style":
|
|
4428
4496
|
hasIdentifier = true;
|
|
4429
4497
|
break;
|
|
4430
|
-
case "@host":
|
|
4431
|
-
case "@page":
|
|
4432
|
-
hasUnknown = true;
|
|
4433
|
-
break;
|
|
4434
4498
|
case "@document":
|
|
4435
4499
|
case "@supports":
|
|
4436
4500
|
hasUnknown = true;
|
|
4437
4501
|
isRooted = false;
|
|
4438
4502
|
break;
|
|
4503
|
+
default:
|
|
4504
|
+
hasUnknown = true;
|
|
4505
|
+
break;
|
|
4439
4506
|
}
|
|
4440
4507
|
|
|
4441
4508
|
parserInput.commentStore.length = 0;
|
|
@@ -4452,6 +4519,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4452
4519
|
}
|
|
4453
4520
|
} else if (hasUnknown) {
|
|
4454
4521
|
value = (parserInput.$re(/^[^{;]+/) || '').trim();
|
|
4522
|
+
hasBlock = (parserInput.currentChar() == '{');
|
|
4455
4523
|
if (value) {
|
|
4456
4524
|
value = new(tree.Anonymous)(value);
|
|
4457
4525
|
}
|
|
@@ -4465,7 +4533,6 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4465
4533
|
parserInput.forget();
|
|
4466
4534
|
return new (tree.Directive)(name, value, rules, index, fileInfo,
|
|
4467
4535
|
context.dumpLineNumbers ? getDebugInfo(index) : null,
|
|
4468
|
-
false,
|
|
4469
4536
|
isRooted
|
|
4470
4537
|
);
|
|
4471
4538
|
}
|
|
@@ -4589,11 +4656,103 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4589
4656
|
}
|
|
4590
4657
|
},
|
|
4591
4658
|
condition: function () {
|
|
4592
|
-
var
|
|
4593
|
-
|
|
4659
|
+
var result, logical, next;
|
|
4660
|
+
function or() {
|
|
4661
|
+
return parserInput.$str("or");
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
result = this.conditionAnd(this);
|
|
4665
|
+
if (!result) {
|
|
4666
|
+
return ;
|
|
4667
|
+
}
|
|
4668
|
+
logical = or();
|
|
4669
|
+
if (logical) {
|
|
4670
|
+
next = this.condition();
|
|
4671
|
+
if (next) {
|
|
4672
|
+
result = new(tree.Condition)(logical, result, next);
|
|
4673
|
+
} else {
|
|
4674
|
+
return ;
|
|
4675
|
+
}
|
|
4676
|
+
}
|
|
4677
|
+
return result;
|
|
4678
|
+
},
|
|
4679
|
+
conditionAnd: function () {
|
|
4680
|
+
var result, logical, next;
|
|
4681
|
+
function insideCondition(me) {
|
|
4682
|
+
return me.negatedCondition() || me.parenthesisCondition();
|
|
4683
|
+
}
|
|
4684
|
+
function and() {
|
|
4685
|
+
return parserInput.$str("and");
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
result = insideCondition(this);
|
|
4689
|
+
if (!result) {
|
|
4690
|
+
return ;
|
|
4691
|
+
}
|
|
4692
|
+
logical = and();
|
|
4693
|
+
if (logical) {
|
|
4694
|
+
next = this.conditionAnd();
|
|
4695
|
+
if (next) {
|
|
4696
|
+
result = new(tree.Condition)(logical, result, next);
|
|
4697
|
+
} else {
|
|
4698
|
+
return ;
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
return result;
|
|
4702
|
+
},
|
|
4703
|
+
negatedCondition: function () {
|
|
4704
|
+
if (parserInput.$str("not")) {
|
|
4705
|
+
var result = this.parenthesisCondition();
|
|
4706
|
+
if (result) {
|
|
4707
|
+
result.negate = !result.negate;
|
|
4708
|
+
}
|
|
4709
|
+
return result;
|
|
4710
|
+
}
|
|
4711
|
+
},
|
|
4712
|
+
parenthesisCondition: function () {
|
|
4713
|
+
function tryConditionFollowedByParenthesis(me) {
|
|
4714
|
+
var body;
|
|
4715
|
+
parserInput.save();
|
|
4716
|
+
body = me.condition();
|
|
4717
|
+
if (!body) {
|
|
4718
|
+
parserInput.restore();
|
|
4719
|
+
return ;
|
|
4720
|
+
}
|
|
4721
|
+
if (!parserInput.$char(')')) {
|
|
4722
|
+
parserInput.restore();
|
|
4723
|
+
return ;
|
|
4724
|
+
}
|
|
4725
|
+
parserInput.forget();
|
|
4726
|
+
return body;
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
var body;
|
|
4730
|
+
parserInput.save();
|
|
4731
|
+
if (!parserInput.$str("(")) {
|
|
4732
|
+
parserInput.restore();
|
|
4733
|
+
return ;
|
|
4734
|
+
}
|
|
4735
|
+
body = tryConditionFollowedByParenthesis(this);
|
|
4736
|
+
if (body) {
|
|
4737
|
+
parserInput.forget();
|
|
4738
|
+
return body;
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
body = this.atomicCondition();
|
|
4742
|
+
if (!body) {
|
|
4743
|
+
parserInput.restore();
|
|
4744
|
+
return ;
|
|
4745
|
+
}
|
|
4746
|
+
if (!parserInput.$char(')')) {
|
|
4747
|
+
parserInput.restore("expected ')' got '" + parserInput.currentChar() + "'");
|
|
4748
|
+
return ;
|
|
4749
|
+
}
|
|
4750
|
+
parserInput.forget();
|
|
4751
|
+
return body;
|
|
4752
|
+
},
|
|
4753
|
+
atomicCondition: function () {
|
|
4754
|
+
var entities = this.entities, index = parserInput.i, a, b, c, op;
|
|
4594
4755
|
|
|
4595
|
-
if (parserInput.$str("not")) { negate = true; }
|
|
4596
|
-
expectChar('(');
|
|
4597
4756
|
a = this.addition() || entities.keyword() || entities.quoted();
|
|
4598
4757
|
if (a) {
|
|
4599
4758
|
if (parserInput.$char('>')) {
|
|
@@ -4622,15 +4781,14 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4622
4781
|
if (op) {
|
|
4623
4782
|
b = this.addition() || entities.keyword() || entities.quoted();
|
|
4624
4783
|
if (b) {
|
|
4625
|
-
c = new(tree.Condition)(op, a, b, index,
|
|
4784
|
+
c = new(tree.Condition)(op, a, b, index, false);
|
|
4626
4785
|
} else {
|
|
4627
4786
|
error('expected expression');
|
|
4628
4787
|
}
|
|
4629
4788
|
} else {
|
|
4630
|
-
c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index,
|
|
4789
|
+
c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index, false);
|
|
4631
4790
|
}
|
|
4632
|
-
|
|
4633
|
-
return parserInput.$str("and") ? new(tree.Condition)('and', c, this.condition()) : c;
|
|
4791
|
+
return c;
|
|
4634
4792
|
}
|
|
4635
4793
|
},
|
|
4636
4794
|
|
|
@@ -4647,7 +4805,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
|
|
4647
4805
|
|
|
4648
4806
|
var o = this.sub() || entities.dimension() ||
|
|
4649
4807
|
entities.color() || entities.variable() ||
|
|
4650
|
-
entities.call();
|
|
4808
|
+
entities.call() || entities.colorKeyword();
|
|
4651
4809
|
|
|
4652
4810
|
if (negate) {
|
|
4653
4811
|
o.parensInOp = true;
|
|
@@ -4762,7 +4920,7 @@ Parser.serializeVars = function(vars) {
|
|
|
4762
4920
|
|
|
4763
4921
|
module.exports = Parser;
|
|
4764
4922
|
|
|
4765
|
-
},{"../less-error":
|
|
4923
|
+
},{"../less-error":32,"../tree":62,"../utils":83,"../visitors":87,"./parser-input":37}],39:[function(require,module,exports){
|
|
4766
4924
|
/**
|
|
4767
4925
|
* Plugin Manager
|
|
4768
4926
|
*/
|
|
@@ -4878,7 +5036,7 @@ PluginManager.prototype.getFileManagers = function() {
|
|
|
4878
5036
|
};
|
|
4879
5037
|
module.exports = PluginManager;
|
|
4880
5038
|
|
|
4881
|
-
},{}],
|
|
5039
|
+
},{}],40:[function(require,module,exports){
|
|
4882
5040
|
var LessError = require('../less-error'),
|
|
4883
5041
|
tree = require("../tree");
|
|
4884
5042
|
|
|
@@ -4915,7 +5073,7 @@ FunctionImporter.prototype.eval = function(contents, callback) {
|
|
|
4915
5073
|
callback(null, { functions: loaded });
|
|
4916
5074
|
};
|
|
4917
5075
|
|
|
4918
|
-
},{"../less-error":
|
|
5076
|
+
},{"../less-error":32,"../tree":62}],41:[function(require,module,exports){
|
|
4919
5077
|
var PromiseConstructor;
|
|
4920
5078
|
|
|
4921
5079
|
module.exports = function(environment, ParseTree, ImportManager) {
|
|
@@ -4958,7 +5116,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
|
|
|
4958
5116
|
return render;
|
|
4959
5117
|
};
|
|
4960
5118
|
|
|
4961
|
-
},{"promise":undefined}],
|
|
5119
|
+
},{"promise":undefined}],42:[function(require,module,exports){
|
|
4962
5120
|
module.exports = function (SourceMapOutput, environment) {
|
|
4963
5121
|
|
|
4964
5122
|
var SourceMapBuilder = function (options) {
|
|
@@ -5029,7 +5187,7 @@ module.exports = function (SourceMapOutput, environment) {
|
|
|
5029
5187
|
return SourceMapBuilder;
|
|
5030
5188
|
};
|
|
5031
5189
|
|
|
5032
|
-
},{}],
|
|
5190
|
+
},{}],43:[function(require,module,exports){
|
|
5033
5191
|
module.exports = function (environment) {
|
|
5034
5192
|
|
|
5035
5193
|
var SourceMapOutput = function (options) {
|
|
@@ -5169,7 +5327,7 @@ module.exports = function (environment) {
|
|
|
5169
5327
|
return SourceMapOutput;
|
|
5170
5328
|
};
|
|
5171
5329
|
|
|
5172
|
-
},{}],
|
|
5330
|
+
},{}],44:[function(require,module,exports){
|
|
5173
5331
|
var contexts = require("./contexts"),
|
|
5174
5332
|
visitor = require("./visitors"),
|
|
5175
5333
|
tree = require("./tree");
|
|
@@ -5211,6 +5369,7 @@ module.exports = function(root, options) {
|
|
|
5211
5369
|
var preEvalVisitors = [],
|
|
5212
5370
|
visitors = [
|
|
5213
5371
|
new visitor.JoinSelectorVisitor(),
|
|
5372
|
+
new visitor.MarkVisibleSelectorsVisitor(true),
|
|
5214
5373
|
new visitor.ExtendVisitor(),
|
|
5215
5374
|
new visitor.ToCSSVisitor({compress: Boolean(options.compress)})
|
|
5216
5375
|
], i;
|
|
@@ -5244,7 +5403,7 @@ module.exports = function(root, options) {
|
|
|
5244
5403
|
return evaldRoot;
|
|
5245
5404
|
};
|
|
5246
5405
|
|
|
5247
|
-
},{"./contexts":
|
|
5406
|
+
},{"./contexts":11,"./tree":62,"./visitors":87}],45:[function(require,module,exports){
|
|
5248
5407
|
var Node = require("./node");
|
|
5249
5408
|
|
|
5250
5409
|
var Alpha = function (val) {
|
|
@@ -5274,20 +5433,22 @@ Alpha.prototype.genCSS = function (context, output) {
|
|
|
5274
5433
|
|
|
5275
5434
|
module.exports = Alpha;
|
|
5276
5435
|
|
|
5277
|
-
},{"./node":
|
|
5436
|
+
},{"./node":70}],46:[function(require,module,exports){
|
|
5278
5437
|
var Node = require("./node");
|
|
5279
5438
|
|
|
5280
|
-
var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike) {
|
|
5439
|
+
var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {
|
|
5281
5440
|
this.value = value;
|
|
5282
5441
|
this.index = index;
|
|
5283
5442
|
this.mapLines = mapLines;
|
|
5284
5443
|
this.currentFileInfo = currentFileInfo;
|
|
5285
5444
|
this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;
|
|
5445
|
+
|
|
5446
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
5286
5447
|
};
|
|
5287
5448
|
Anonymous.prototype = new Node();
|
|
5288
5449
|
Anonymous.prototype.type = "Anonymous";
|
|
5289
5450
|
Anonymous.prototype.eval = function () {
|
|
5290
|
-
return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike);
|
|
5451
|
+
return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
|
|
5291
5452
|
};
|
|
5292
5453
|
Anonymous.prototype.compare = function (other) {
|
|
5293
5454
|
return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
|
|
@@ -5300,7 +5461,7 @@ Anonymous.prototype.genCSS = function (context, output) {
|
|
|
5300
5461
|
};
|
|
5301
5462
|
module.exports = Anonymous;
|
|
5302
5463
|
|
|
5303
|
-
},{"./node":
|
|
5464
|
+
},{"./node":70}],47:[function(require,module,exports){
|
|
5304
5465
|
var Node = require("./node");
|
|
5305
5466
|
|
|
5306
5467
|
var Assignment = function (key, val) {
|
|
@@ -5329,7 +5490,7 @@ Assignment.prototype.genCSS = function (context, output) {
|
|
|
5329
5490
|
};
|
|
5330
5491
|
module.exports = Assignment;
|
|
5331
5492
|
|
|
5332
|
-
},{"./node":
|
|
5493
|
+
},{"./node":70}],48:[function(require,module,exports){
|
|
5333
5494
|
var Node = require("./node");
|
|
5334
5495
|
|
|
5335
5496
|
var Attribute = function (key, op, value) {
|
|
@@ -5358,7 +5519,7 @@ Attribute.prototype.toCSS = function (context) {
|
|
|
5358
5519
|
};
|
|
5359
5520
|
module.exports = Attribute;
|
|
5360
5521
|
|
|
5361
|
-
},{"./node":
|
|
5522
|
+
},{"./node":70}],49:[function(require,module,exports){
|
|
5362
5523
|
var Node = require("./node"),
|
|
5363
5524
|
FunctionCaller = require("../functions/function-caller");
|
|
5364
5525
|
//
|
|
@@ -5422,14 +5583,14 @@ Call.prototype.genCSS = function (context, output) {
|
|
|
5422
5583
|
};
|
|
5423
5584
|
module.exports = Call;
|
|
5424
5585
|
|
|
5425
|
-
},{"../functions/function-caller":
|
|
5586
|
+
},{"../functions/function-caller":21,"./node":70}],50:[function(require,module,exports){
|
|
5426
5587
|
var Node = require("./node"),
|
|
5427
5588
|
colors = require("../data/colors");
|
|
5428
5589
|
|
|
5429
5590
|
//
|
|
5430
5591
|
// RGB Colors - #ff0014, #eee
|
|
5431
5592
|
//
|
|
5432
|
-
var Color = function (rgb, a) {
|
|
5593
|
+
var Color = function (rgb, a, originalForm) {
|
|
5433
5594
|
//
|
|
5434
5595
|
// The end goal here, is to parse the arguments
|
|
5435
5596
|
// into an integer triplet, such as `128, 255, 0`
|
|
@@ -5448,6 +5609,9 @@ var Color = function (rgb, a) {
|
|
|
5448
5609
|
});
|
|
5449
5610
|
}
|
|
5450
5611
|
this.alpha = typeof a === 'number' ? a : 1;
|
|
5612
|
+
if (typeof originalForm !== 'undefined') {
|
|
5613
|
+
this.value = originalForm;
|
|
5614
|
+
}
|
|
5451
5615
|
};
|
|
5452
5616
|
|
|
5453
5617
|
Color.prototype = new Node();
|
|
@@ -5610,7 +5774,7 @@ Color.fromKeyword = function(keyword) {
|
|
|
5610
5774
|
};
|
|
5611
5775
|
module.exports = Color;
|
|
5612
5776
|
|
|
5613
|
-
},{"../data/colors":
|
|
5777
|
+
},{"../data/colors":12,"./node":70}],51:[function(require,module,exports){
|
|
5614
5778
|
var Node = require("./node");
|
|
5615
5779
|
|
|
5616
5780
|
var Combinator = function (value) {
|
|
@@ -5635,7 +5799,7 @@ Combinator.prototype.genCSS = function (context, output) {
|
|
|
5635
5799
|
};
|
|
5636
5800
|
module.exports = Combinator;
|
|
5637
5801
|
|
|
5638
|
-
},{"./node":
|
|
5802
|
+
},{"./node":70}],52:[function(require,module,exports){
|
|
5639
5803
|
var Node = require("./node"),
|
|
5640
5804
|
getDebugInfo = require("./debug-info");
|
|
5641
5805
|
|
|
@@ -5653,16 +5817,12 @@ Comment.prototype.genCSS = function (context, output) {
|
|
|
5653
5817
|
output.add(this.value);
|
|
5654
5818
|
};
|
|
5655
5819
|
Comment.prototype.isSilent = function(context) {
|
|
5656
|
-
var
|
|
5657
|
-
|
|
5658
|
-
return this.isLineComment || isReference || isCompressed;
|
|
5659
|
-
};
|
|
5660
|
-
Comment.prototype.markReferenced = function () {
|
|
5661
|
-
this.isReferenced = true;
|
|
5820
|
+
var isCompressed = context.compress && this.value[2] !== "!";
|
|
5821
|
+
return this.isLineComment || isCompressed;
|
|
5662
5822
|
};
|
|
5663
5823
|
module.exports = Comment;
|
|
5664
5824
|
|
|
5665
|
-
},{"./debug-info":
|
|
5825
|
+
},{"./debug-info":54,"./node":70}],53:[function(require,module,exports){
|
|
5666
5826
|
var Node = require("./node");
|
|
5667
5827
|
|
|
5668
5828
|
var Condition = function (op, l, r, i, negate) {
|
|
@@ -5701,7 +5861,7 @@ Condition.prototype.eval = function (context) {
|
|
|
5701
5861
|
};
|
|
5702
5862
|
module.exports = Condition;
|
|
5703
5863
|
|
|
5704
|
-
},{"./node":
|
|
5864
|
+
},{"./node":70}],54:[function(require,module,exports){
|
|
5705
5865
|
var debugInfo = function(context, ctx, lineSeparator) {
|
|
5706
5866
|
var result = "";
|
|
5707
5867
|
if (context.dumpLineNumbers && !context.compress) {
|
|
@@ -5741,7 +5901,7 @@ debugInfo.asMediaQuery = function(ctx) {
|
|
|
5741
5901
|
|
|
5742
5902
|
module.exports = debugInfo;
|
|
5743
5903
|
|
|
5744
|
-
},{}],
|
|
5904
|
+
},{}],55:[function(require,module,exports){
|
|
5745
5905
|
var Node = require("./node"),
|
|
5746
5906
|
contexts = require("../contexts");
|
|
5747
5907
|
|
|
@@ -5764,7 +5924,7 @@ DetachedRuleset.prototype.callEval = function (context) {
|
|
|
5764
5924
|
};
|
|
5765
5925
|
module.exports = DetachedRuleset;
|
|
5766
5926
|
|
|
5767
|
-
},{"../contexts":
|
|
5927
|
+
},{"../contexts":11,"./node":70}],56:[function(require,module,exports){
|
|
5768
5928
|
var Node = require("./node"),
|
|
5769
5929
|
unitConversions = require("../data/unit-conversions"),
|
|
5770
5930
|
Unit = require("./unit"),
|
|
@@ -5923,12 +6083,12 @@ Dimension.prototype.convertTo = function (conversions) {
|
|
|
5923
6083
|
};
|
|
5924
6084
|
module.exports = Dimension;
|
|
5925
6085
|
|
|
5926
|
-
},{"../data/unit-conversions":
|
|
6086
|
+
},{"../data/unit-conversions":14,"./color":50,"./node":70,"./unit":79}],57:[function(require,module,exports){
|
|
5927
6087
|
var Node = require("./node"),
|
|
5928
6088
|
Selector = require("./selector"),
|
|
5929
6089
|
Ruleset = require("./ruleset");
|
|
5930
6090
|
|
|
5931
|
-
var Directive = function (name, value, rules, index, currentFileInfo, debugInfo,
|
|
6091
|
+
var Directive = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) {
|
|
5932
6092
|
var i;
|
|
5933
6093
|
|
|
5934
6094
|
this.name = name;
|
|
@@ -5947,8 +6107,8 @@ var Directive = function (name, value, rules, index, currentFileInfo, debugInfo,
|
|
|
5947
6107
|
this.index = index;
|
|
5948
6108
|
this.currentFileInfo = currentFileInfo;
|
|
5949
6109
|
this.debugInfo = debugInfo;
|
|
5950
|
-
this.isReferenced = isReferenced;
|
|
5951
6110
|
this.isRooted = isRooted || false;
|
|
6111
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
5952
6112
|
};
|
|
5953
6113
|
|
|
5954
6114
|
Directive.prototype = new Node();
|
|
@@ -6005,7 +6165,7 @@ Directive.prototype.eval = function (context) {
|
|
|
6005
6165
|
context.mediaBlocks = mediaBlocksBackup;
|
|
6006
6166
|
|
|
6007
6167
|
return new Directive(this.name, value, rules,
|
|
6008
|
-
this.index, this.currentFileInfo, this.debugInfo, this.
|
|
6168
|
+
this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo());
|
|
6009
6169
|
};
|
|
6010
6170
|
Directive.prototype.variable = function (name) {
|
|
6011
6171
|
if (this.rules) {
|
|
@@ -6025,21 +6185,6 @@ Directive.prototype.rulesets = function () {
|
|
|
6025
6185
|
return Ruleset.prototype.rulesets.apply(this.rules[0]);
|
|
6026
6186
|
}
|
|
6027
6187
|
};
|
|
6028
|
-
Directive.prototype.markReferenced = function () {
|
|
6029
|
-
var i, rules;
|
|
6030
|
-
this.isReferenced = true;
|
|
6031
|
-
if (this.rules) {
|
|
6032
|
-
rules = this.rules;
|
|
6033
|
-
for (i = 0; i < rules.length; i++) {
|
|
6034
|
-
if (rules[i].markReferenced) {
|
|
6035
|
-
rules[i].markReferenced();
|
|
6036
|
-
}
|
|
6037
|
-
}
|
|
6038
|
-
}
|
|
6039
|
-
};
|
|
6040
|
-
Directive.prototype.getIsReferenced = function () {
|
|
6041
|
-
return !this.currentFileInfo || !this.currentFileInfo.reference || this.isReferenced;
|
|
6042
|
-
};
|
|
6043
6188
|
Directive.prototype.outputRuleset = function (context, output, rules) {
|
|
6044
6189
|
var ruleCnt = rules.length, i;
|
|
6045
6190
|
context.tabLevel = (context.tabLevel | 0) + 1;
|
|
@@ -6073,12 +6218,12 @@ Directive.prototype.outputRuleset = function (context, output, rules) {
|
|
|
6073
6218
|
};
|
|
6074
6219
|
module.exports = Directive;
|
|
6075
6220
|
|
|
6076
|
-
},{"./node":
|
|
6221
|
+
},{"./node":70,"./ruleset":76,"./selector":77}],58:[function(require,module,exports){
|
|
6077
6222
|
var Node = require("./node"),
|
|
6078
6223
|
Paren = require("./paren"),
|
|
6079
6224
|
Combinator = require("./combinator");
|
|
6080
6225
|
|
|
6081
|
-
var Element = function (combinator, value, index, currentFileInfo) {
|
|
6226
|
+
var Element = function (combinator, value, index, currentFileInfo, info) {
|
|
6082
6227
|
this.combinator = combinator instanceof Combinator ?
|
|
6083
6228
|
combinator : new Combinator(combinator);
|
|
6084
6229
|
|
|
@@ -6091,6 +6236,7 @@ var Element = function (combinator, value, index, currentFileInfo) {
|
|
|
6091
6236
|
}
|
|
6092
6237
|
this.index = index;
|
|
6093
6238
|
this.currentFileInfo = currentFileInfo;
|
|
6239
|
+
this.copyVisibilityInfo(info);
|
|
6094
6240
|
};
|
|
6095
6241
|
Element.prototype = new Node();
|
|
6096
6242
|
Element.prototype.type = "Element";
|
|
@@ -6105,7 +6251,13 @@ Element.prototype.eval = function (context) {
|
|
|
6105
6251
|
return new Element(this.combinator,
|
|
6106
6252
|
this.value.eval ? this.value.eval(context) : this.value,
|
|
6107
6253
|
this.index,
|
|
6108
|
-
this.currentFileInfo);
|
|
6254
|
+
this.currentFileInfo, this.visibilityInfo());
|
|
6255
|
+
};
|
|
6256
|
+
Element.prototype.clone = function () {
|
|
6257
|
+
return new Element(this.combinator,
|
|
6258
|
+
this.value,
|
|
6259
|
+
this.index,
|
|
6260
|
+
this.currentFileInfo, this.visibilityInfo());
|
|
6109
6261
|
};
|
|
6110
6262
|
Element.prototype.genCSS = function (context, output) {
|
|
6111
6263
|
output.add(this.toCSS(context), this.currentFileInfo, this.index);
|
|
@@ -6128,7 +6280,7 @@ Element.prototype.toCSS = function (context) {
|
|
|
6128
6280
|
};
|
|
6129
6281
|
module.exports = Element;
|
|
6130
6282
|
|
|
6131
|
-
},{"./combinator":
|
|
6283
|
+
},{"./combinator":51,"./node":70,"./paren":72}],59:[function(require,module,exports){
|
|
6132
6284
|
var Node = require("./node"),
|
|
6133
6285
|
Paren = require("./paren"),
|
|
6134
6286
|
Comment = require("./comment");
|
|
@@ -6186,15 +6338,18 @@ Expression.prototype.throwAwayComments = function () {
|
|
|
6186
6338
|
};
|
|
6187
6339
|
module.exports = Expression;
|
|
6188
6340
|
|
|
6189
|
-
},{"./comment":
|
|
6190
|
-
var Node = require("./node")
|
|
6341
|
+
},{"./comment":52,"./node":70,"./paren":72}],60:[function(require,module,exports){
|
|
6342
|
+
var Node = require("./node"),
|
|
6343
|
+
Selector = require("./selector");
|
|
6191
6344
|
|
|
6192
|
-
var Extend = function Extend(selector, option, index) {
|
|
6345
|
+
var Extend = function Extend(selector, option, index, currentFileInfo, visibilityInfo) {
|
|
6193
6346
|
this.selector = selector;
|
|
6194
6347
|
this.option = option;
|
|
6195
6348
|
this.index = index;
|
|
6196
6349
|
this.object_id = Extend.next_id++;
|
|
6197
6350
|
this.parent_ids = [this.object_id];
|
|
6351
|
+
this.currentFileInfo = currentFileInfo || {};
|
|
6352
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
6198
6353
|
|
|
6199
6354
|
switch(option) {
|
|
6200
6355
|
case "all":
|
|
@@ -6215,11 +6370,12 @@ Extend.prototype.accept = function (visitor) {
|
|
|
6215
6370
|
this.selector = visitor.visit(this.selector);
|
|
6216
6371
|
};
|
|
6217
6372
|
Extend.prototype.eval = function (context) {
|
|
6218
|
-
return new Extend(this.selector.eval(context), this.option, this.index);
|
|
6373
|
+
return new Extend(this.selector.eval(context), this.option, this.index, this.currentFileInfo, this.visibilityInfo());
|
|
6219
6374
|
};
|
|
6220
6375
|
Extend.prototype.clone = function (context) {
|
|
6221
|
-
return new Extend(this.selector, this.option, this.index);
|
|
6376
|
+
return new Extend(this.selector, this.option, this.index, this.currentFileInfo, this.visibilityInfo());
|
|
6222
6377
|
};
|
|
6378
|
+
//it concatenates (joins) all selectors in selector array
|
|
6223
6379
|
Extend.prototype.findSelfSelectors = function (selectors) {
|
|
6224
6380
|
var selfElements = [],
|
|
6225
6381
|
i,
|
|
@@ -6235,11 +6391,12 @@ Extend.prototype.findSelfSelectors = function (selectors) {
|
|
|
6235
6391
|
selfElements = selfElements.concat(selectors[i].elements);
|
|
6236
6392
|
}
|
|
6237
6393
|
|
|
6238
|
-
this.selfSelectors = [
|
|
6394
|
+
this.selfSelectors = [new Selector(selfElements)];
|
|
6395
|
+
this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());
|
|
6239
6396
|
};
|
|
6240
6397
|
module.exports = Extend;
|
|
6241
6398
|
|
|
6242
|
-
},{"./node":
|
|
6399
|
+
},{"./node":70,"./selector":77}],61:[function(require,module,exports){
|
|
6243
6400
|
var Node = require("./node"),
|
|
6244
6401
|
Media = require("./media"),
|
|
6245
6402
|
URL = require("./url"),
|
|
@@ -6259,7 +6416,7 @@ var Node = require("./node"),
|
|
|
6259
6416
|
// `import,push`, we also pass it a callback, which it'll call once
|
|
6260
6417
|
// the file has been fetched, and parsed.
|
|
6261
6418
|
//
|
|
6262
|
-
var Import = function (path, features, options, index, currentFileInfo) {
|
|
6419
|
+
var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) {
|
|
6263
6420
|
this.options = options;
|
|
6264
6421
|
this.index = index;
|
|
6265
6422
|
this.path = path;
|
|
@@ -6274,6 +6431,7 @@ var Import = function (path, features, options, index, currentFileInfo) {
|
|
|
6274
6431
|
this.css = true;
|
|
6275
6432
|
}
|
|
6276
6433
|
}
|
|
6434
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
6277
6435
|
};
|
|
6278
6436
|
|
|
6279
6437
|
//
|
|
@@ -6329,7 +6487,7 @@ Import.prototype.evalForImport = function (context) {
|
|
|
6329
6487
|
path = path.value;
|
|
6330
6488
|
}
|
|
6331
6489
|
|
|
6332
|
-
return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo);
|
|
6490
|
+
return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo, this.visibilityInfo());
|
|
6333
6491
|
};
|
|
6334
6492
|
Import.prototype.evalPath = function (context) {
|
|
6335
6493
|
var path = this.path.eval(context);
|
|
@@ -6349,6 +6507,20 @@ Import.prototype.evalPath = function (context) {
|
|
|
6349
6507
|
return path;
|
|
6350
6508
|
};
|
|
6351
6509
|
Import.prototype.eval = function (context) {
|
|
6510
|
+
var result = this.doEval(context);
|
|
6511
|
+
if (this.options.reference || this.blocksVisibility()) {
|
|
6512
|
+
if (result.length || result.length === 0) {
|
|
6513
|
+
result.forEach(function (node) {
|
|
6514
|
+
node.addVisibilityBlock();
|
|
6515
|
+
}
|
|
6516
|
+
);
|
|
6517
|
+
} else {
|
|
6518
|
+
result.addVisibilityBlock();
|
|
6519
|
+
}
|
|
6520
|
+
}
|
|
6521
|
+
return result;
|
|
6522
|
+
};
|
|
6523
|
+
Import.prototype.doEval = function (context) {
|
|
6352
6524
|
var ruleset, registry,
|
|
6353
6525
|
features = this.features && this.features.eval(context);
|
|
6354
6526
|
|
|
@@ -6368,9 +6540,13 @@ Import.prototype.eval = function (context) {
|
|
|
6368
6540
|
return [];
|
|
6369
6541
|
}
|
|
6370
6542
|
}
|
|
6371
|
-
|
|
6372
6543
|
if (this.options.inline) {
|
|
6373
|
-
var contents = new Anonymous(this.root, 0,
|
|
6544
|
+
var contents = new Anonymous(this.root, 0,
|
|
6545
|
+
{
|
|
6546
|
+
filename: this.importedFilename,
|
|
6547
|
+
reference: this.path.currentFileInfo && this.path.currentFileInfo.reference
|
|
6548
|
+
}, true, true);
|
|
6549
|
+
|
|
6374
6550
|
return this.features ? new Media([contents], this.features.value) : [contents];
|
|
6375
6551
|
} else if (this.css) {
|
|
6376
6552
|
var newImport = new Import(this.evalPath(context), features, this.options, this.index);
|
|
@@ -6380,7 +6556,6 @@ Import.prototype.eval = function (context) {
|
|
|
6380
6556
|
return newImport;
|
|
6381
6557
|
} else {
|
|
6382
6558
|
ruleset = new Ruleset(null, this.root.rules.slice(0));
|
|
6383
|
-
|
|
6384
6559
|
ruleset.evalImports(context);
|
|
6385
6560
|
|
|
6386
6561
|
return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules;
|
|
@@ -6388,7 +6563,7 @@ Import.prototype.eval = function (context) {
|
|
|
6388
6563
|
};
|
|
6389
6564
|
module.exports = Import;
|
|
6390
6565
|
|
|
6391
|
-
},{"./anonymous":
|
|
6566
|
+
},{"./anonymous":46,"./media":66,"./node":70,"./quoted":73,"./ruleset":76,"./url":80}],62:[function(require,module,exports){
|
|
6392
6567
|
var tree = {};
|
|
6393
6568
|
|
|
6394
6569
|
tree.Node = require('./node');
|
|
@@ -6431,7 +6606,7 @@ tree.RulesetCall = require('./ruleset-call');
|
|
|
6431
6606
|
|
|
6432
6607
|
module.exports = tree;
|
|
6433
6608
|
|
|
6434
|
-
},{"./alpha":
|
|
6609
|
+
},{"./alpha":45,"./anonymous":46,"./assignment":47,"./attribute":48,"./call":49,"./color":50,"./combinator":51,"./comment":52,"./condition":53,"./detached-ruleset":55,"./dimension":56,"./directive":57,"./element":58,"./expression":59,"./extend":60,"./import":61,"./javascript":63,"./keyword":65,"./media":66,"./mixin-call":67,"./mixin-definition":68,"./negative":69,"./node":70,"./operation":71,"./paren":72,"./quoted":73,"./rule":74,"./ruleset":76,"./ruleset-call":75,"./selector":77,"./unicode-descriptor":78,"./unit":79,"./url":80,"./value":81,"./variable":82}],63:[function(require,module,exports){
|
|
6435
6610
|
var JsEvalNode = require("./js-eval-node"),
|
|
6436
6611
|
Dimension = require("./dimension"),
|
|
6437
6612
|
Quoted = require("./quoted"),
|
|
@@ -6461,7 +6636,7 @@ JavaScript.prototype.eval = function(context) {
|
|
|
6461
6636
|
|
|
6462
6637
|
module.exports = JavaScript;
|
|
6463
6638
|
|
|
6464
|
-
},{"./anonymous":
|
|
6639
|
+
},{"./anonymous":46,"./dimension":56,"./js-eval-node":64,"./quoted":73}],64:[function(require,module,exports){
|
|
6465
6640
|
var Node = require("./node"),
|
|
6466
6641
|
Variable = require("./variable");
|
|
6467
6642
|
|
|
@@ -6524,7 +6699,7 @@ JsEvalNode.prototype.jsify = function (obj) {
|
|
|
6524
6699
|
|
|
6525
6700
|
module.exports = JsEvalNode;
|
|
6526
6701
|
|
|
6527
|
-
},{"./node":
|
|
6702
|
+
},{"./node":70,"./variable":82}],65:[function(require,module,exports){
|
|
6528
6703
|
var Node = require("./node");
|
|
6529
6704
|
|
|
6530
6705
|
var Keyword = function (value) { this.value = value; };
|
|
@@ -6540,7 +6715,7 @@ Keyword.False = new Keyword('false');
|
|
|
6540
6715
|
|
|
6541
6716
|
module.exports = Keyword;
|
|
6542
6717
|
|
|
6543
|
-
},{"./node":
|
|
6718
|
+
},{"./node":70}],66:[function(require,module,exports){
|
|
6544
6719
|
var Ruleset = require("./ruleset"),
|
|
6545
6720
|
Value = require("./value"),
|
|
6546
6721
|
Selector = require("./selector"),
|
|
@@ -6548,7 +6723,7 @@ var Ruleset = require("./ruleset"),
|
|
|
6548
6723
|
Expression = require("./expression"),
|
|
6549
6724
|
Directive = require("./directive");
|
|
6550
6725
|
|
|
6551
|
-
var Media = function (value, features, index, currentFileInfo) {
|
|
6726
|
+
var Media = function (value, features, index, currentFileInfo, visibilityInfo) {
|
|
6552
6727
|
this.index = index;
|
|
6553
6728
|
this.currentFileInfo = currentFileInfo;
|
|
6554
6729
|
|
|
@@ -6557,6 +6732,7 @@ var Media = function (value, features, index, currentFileInfo) {
|
|
|
6557
6732
|
this.features = new Value(features);
|
|
6558
6733
|
this.rules = [new Ruleset(selectors, value)];
|
|
6559
6734
|
this.rules[0].allowImports = true;
|
|
6735
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
6560
6736
|
};
|
|
6561
6737
|
Media.prototype = new Directive();
|
|
6562
6738
|
Media.prototype.type = "Media";
|
|
@@ -6580,7 +6756,7 @@ Media.prototype.eval = function (context) {
|
|
|
6580
6756
|
context.mediaPath = [];
|
|
6581
6757
|
}
|
|
6582
6758
|
|
|
6583
|
-
var media = new Media(null, [], this.index, this.currentFileInfo);
|
|
6759
|
+
var media = new Media(null, [], this.index, this.currentFileInfo, this.visibilityInfo());
|
|
6584
6760
|
if (this.debugInfo) {
|
|
6585
6761
|
this.rules[0].debugInfo = this.debugInfo;
|
|
6586
6762
|
media.debugInfo = this.debugInfo;
|
|
@@ -6620,6 +6796,7 @@ Media.prototype.evalTop = function (context) {
|
|
|
6620
6796
|
var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors();
|
|
6621
6797
|
result = new Ruleset(selectors, context.mediaBlocks);
|
|
6622
6798
|
result.multiMedia = true;
|
|
6799
|
+
result.copyVisibilityInfo(this.visibilityInfo());
|
|
6623
6800
|
}
|
|
6624
6801
|
|
|
6625
6802
|
delete context.mediaBlocks;
|
|
@@ -6684,7 +6861,7 @@ Media.prototype.bubbleSelectors = function (selectors) {
|
|
|
6684
6861
|
};
|
|
6685
6862
|
module.exports = Media;
|
|
6686
6863
|
|
|
6687
|
-
},{"./anonymous":
|
|
6864
|
+
},{"./anonymous":46,"./directive":57,"./expression":59,"./ruleset":76,"./selector":77,"./value":81}],67:[function(require,module,exports){
|
|
6688
6865
|
var Node = require("./node"),
|
|
6689
6866
|
Selector = require("./selector"),
|
|
6690
6867
|
MixinDefinition = require("./mixin-definition"),
|
|
@@ -6692,7 +6869,7 @@ var Node = require("./node"),
|
|
|
6692
6869
|
|
|
6693
6870
|
var MixinCall = function (elements, args, index, currentFileInfo, important) {
|
|
6694
6871
|
this.selector = new Selector(elements);
|
|
6695
|
-
this.arguments =
|
|
6872
|
+
this.arguments = args || [];
|
|
6696
6873
|
this.index = index;
|
|
6697
6874
|
this.currentFileInfo = currentFileInfo;
|
|
6698
6875
|
this.important = important;
|
|
@@ -6703,17 +6880,18 @@ MixinCall.prototype.accept = function (visitor) {
|
|
|
6703
6880
|
if (this.selector) {
|
|
6704
6881
|
this.selector = visitor.visit(this.selector);
|
|
6705
6882
|
}
|
|
6706
|
-
if (this.arguments) {
|
|
6883
|
+
if (this.arguments.length) {
|
|
6707
6884
|
this.arguments = visitor.visitArray(this.arguments);
|
|
6708
6885
|
}
|
|
6709
6886
|
};
|
|
6710
6887
|
MixinCall.prototype.eval = function (context) {
|
|
6711
|
-
var mixins, mixin, mixinPath, args
|
|
6888
|
+
var mixins, mixin, mixinPath, args = [], arg, argValue,
|
|
6889
|
+
rules = [], match = false, i, m, f, isRecursive, isOneFound,
|
|
6712
6890
|
candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase = -1,
|
|
6713
6891
|
defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset, noArgumentsFilter;
|
|
6714
6892
|
|
|
6715
6893
|
function calcDefGroup(mixin, mixinPath) {
|
|
6716
|
-
var p, namespace;
|
|
6894
|
+
var f, p, namespace;
|
|
6717
6895
|
|
|
6718
6896
|
for (f = 0; f < 2; f++) {
|
|
6719
6897
|
conditionResult[f] = true;
|
|
@@ -6739,9 +6917,18 @@ MixinCall.prototype.eval = function (context) {
|
|
|
6739
6917
|
return defFalseEitherCase;
|
|
6740
6918
|
}
|
|
6741
6919
|
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6920
|
+
for (i = 0; i < this.arguments.length; i++) {
|
|
6921
|
+
arg = this.arguments[i];
|
|
6922
|
+
argValue = arg.value.eval(context);
|
|
6923
|
+
if (arg.expand && Array.isArray(argValue.value)) {
|
|
6924
|
+
argValue = argValue.value;
|
|
6925
|
+
for (m = 0; m < argValue.length; m++) {
|
|
6926
|
+
args.push({value: argValue[m]});
|
|
6927
|
+
}
|
|
6928
|
+
} else {
|
|
6929
|
+
args.push({name: arg.name, value: argValue});
|
|
6930
|
+
}
|
|
6931
|
+
}
|
|
6745
6932
|
|
|
6746
6933
|
noArgumentsFilter = function(rule) {return rule.matchArgs(null, context);};
|
|
6747
6934
|
|
|
@@ -6804,11 +6991,12 @@ MixinCall.prototype.eval = function (context) {
|
|
|
6804
6991
|
mixin = candidates[m].mixin;
|
|
6805
6992
|
if (!(mixin instanceof MixinDefinition)) {
|
|
6806
6993
|
originalRuleset = mixin.originalRuleset || mixin;
|
|
6807
|
-
mixin = new MixinDefinition("", [], mixin.rules, null, false);
|
|
6994
|
+
mixin = new MixinDefinition("", [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());
|
|
6808
6995
|
mixin.originalRuleset = originalRuleset;
|
|
6809
6996
|
}
|
|
6810
|
-
|
|
6811
|
-
|
|
6997
|
+
var newRules = mixin.evalCall(context, args, this.important).rules;
|
|
6998
|
+
this._setVisibilityToReplacement(newRules);
|
|
6999
|
+
Array.prototype.push.apply(rules, newRules);
|
|
6812
7000
|
} catch (e) {
|
|
6813
7001
|
throw { message: e.message, index: this.index, filename: this.currentFileInfo.filename, stack: e.stack };
|
|
6814
7002
|
}
|
|
@@ -6816,14 +7004,6 @@ MixinCall.prototype.eval = function (context) {
|
|
|
6816
7004
|
}
|
|
6817
7005
|
|
|
6818
7006
|
if (match) {
|
|
6819
|
-
if (!this.currentFileInfo || !this.currentFileInfo.reference) {
|
|
6820
|
-
for (i = 0; i < rules.length; i++) {
|
|
6821
|
-
rule = rules[i];
|
|
6822
|
-
if (rule.markReferenced) {
|
|
6823
|
-
rule.markReferenced();
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
}
|
|
6827
7007
|
return rules;
|
|
6828
7008
|
}
|
|
6829
7009
|
}
|
|
@@ -6838,6 +7018,16 @@ MixinCall.prototype.eval = function (context) {
|
|
|
6838
7018
|
index: this.index, filename: this.currentFileInfo.filename };
|
|
6839
7019
|
}
|
|
6840
7020
|
};
|
|
7021
|
+
|
|
7022
|
+
MixinCall.prototype._setVisibilityToReplacement = function (replacement) {
|
|
7023
|
+
var i, rule;
|
|
7024
|
+
if (this.blocksVisibility()) {
|
|
7025
|
+
for (i = 0; i < replacement.length; i++) {
|
|
7026
|
+
rule = replacement[i];
|
|
7027
|
+
rule.addVisibilityBlock();
|
|
7028
|
+
}
|
|
7029
|
+
}
|
|
7030
|
+
};
|
|
6841
7031
|
MixinCall.prototype.format = function (args) {
|
|
6842
7032
|
return this.selector.toCSS().trim() + '(' +
|
|
6843
7033
|
(args ? args.map(function (a) {
|
|
@@ -6855,7 +7045,7 @@ MixinCall.prototype.format = function (args) {
|
|
|
6855
7045
|
};
|
|
6856
7046
|
module.exports = MixinCall;
|
|
6857
7047
|
|
|
6858
|
-
},{"../functions/default":
|
|
7048
|
+
},{"../functions/default":20,"./mixin-definition":68,"./node":70,"./selector":77}],68:[function(require,module,exports){
|
|
6859
7049
|
var Selector = require("./selector"),
|
|
6860
7050
|
Element = require("./element"),
|
|
6861
7051
|
Ruleset = require("./ruleset"),
|
|
@@ -6863,7 +7053,7 @@ var Selector = require("./selector"),
|
|
|
6863
7053
|
Expression = require("./expression"),
|
|
6864
7054
|
contexts = require("../contexts");
|
|
6865
7055
|
|
|
6866
|
-
var Definition = function (name, params, rules, condition, variadic, frames) {
|
|
7056
|
+
var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) {
|
|
6867
7057
|
this.name = name;
|
|
6868
7058
|
this.selectors = [new Selector([new Element(null, name, this.index, this.currentFileInfo)])];
|
|
6869
7059
|
this.params = params;
|
|
@@ -6872,15 +7062,19 @@ var Definition = function (name, params, rules, condition, variadic, frames) {
|
|
|
6872
7062
|
this.arity = params.length;
|
|
6873
7063
|
this.rules = rules;
|
|
6874
7064
|
this._lookups = {};
|
|
7065
|
+
var optionalParameters = [];
|
|
6875
7066
|
this.required = params.reduce(function (count, p) {
|
|
6876
7067
|
if (!p.name || (p.name && !p.value)) {
|
|
6877
7068
|
return count + 1;
|
|
6878
7069
|
}
|
|
6879
7070
|
else {
|
|
7071
|
+
optionalParameters.push(p.name);
|
|
6880
7072
|
return count;
|
|
6881
7073
|
}
|
|
6882
7074
|
}, 0);
|
|
7075
|
+
this.optionalParameters = optionalParameters;
|
|
6883
7076
|
this.frames = frames;
|
|
7077
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
6884
7078
|
};
|
|
6885
7079
|
Definition.prototype = new Ruleset();
|
|
6886
7080
|
Definition.prototype.type = "MixinDefinition";
|
|
@@ -6981,7 +7175,7 @@ Definition.prototype.makeImportant = function() {
|
|
|
6981
7175
|
return r;
|
|
6982
7176
|
}
|
|
6983
7177
|
});
|
|
6984
|
-
var result = new Definition
|
|
7178
|
+
var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);
|
|
6985
7179
|
return result;
|
|
6986
7180
|
};
|
|
6987
7181
|
Definition.prototype.eval = function (context) {
|
|
@@ -7017,22 +7211,30 @@ Definition.prototype.matchCondition = function (args, context) {
|
|
|
7017
7211
|
return true;
|
|
7018
7212
|
};
|
|
7019
7213
|
Definition.prototype.matchArgs = function (args, context) {
|
|
7020
|
-
var
|
|
7214
|
+
var allArgsCnt = (args && args.length) || 0, len, optionalParameters = this.optionalParameters;
|
|
7215
|
+
var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) {
|
|
7216
|
+
if (optionalParameters.indexOf(p.name) < 0) {
|
|
7217
|
+
return count + 1;
|
|
7218
|
+
} else {
|
|
7219
|
+
return count;
|
|
7220
|
+
}
|
|
7221
|
+
}, 0);
|
|
7021
7222
|
|
|
7022
7223
|
if (! this.variadic) {
|
|
7023
|
-
if (
|
|
7224
|
+
if (requiredArgsCnt < this.required) {
|
|
7024
7225
|
return false;
|
|
7025
7226
|
}
|
|
7026
|
-
if (
|
|
7227
|
+
if (allArgsCnt > this.params.length) {
|
|
7027
7228
|
return false;
|
|
7028
7229
|
}
|
|
7029
7230
|
} else {
|
|
7030
|
-
if (
|
|
7231
|
+
if (requiredArgsCnt < (this.required - 1)) {
|
|
7031
7232
|
return false;
|
|
7032
7233
|
}
|
|
7033
7234
|
}
|
|
7034
7235
|
|
|
7035
|
-
|
|
7236
|
+
// check patterns
|
|
7237
|
+
len = Math.min(requiredArgsCnt, this.arity);
|
|
7036
7238
|
|
|
7037
7239
|
for (var i = 0; i < len; i++) {
|
|
7038
7240
|
if (!this.params[i].name && !this.params[i].variadic) {
|
|
@@ -7045,7 +7247,7 @@ Definition.prototype.matchArgs = function (args, context) {
|
|
|
7045
7247
|
};
|
|
7046
7248
|
module.exports = Definition;
|
|
7047
7249
|
|
|
7048
|
-
},{"../contexts":
|
|
7250
|
+
},{"../contexts":11,"./element":58,"./expression":59,"./rule":74,"./ruleset":76,"./selector":77}],69:[function(require,module,exports){
|
|
7049
7251
|
var Node = require("./node"),
|
|
7050
7252
|
Operation = require("./operation"),
|
|
7051
7253
|
Dimension = require("./dimension");
|
|
@@ -7067,7 +7269,7 @@ Negative.prototype.eval = function (context) {
|
|
|
7067
7269
|
};
|
|
7068
7270
|
module.exports = Negative;
|
|
7069
7271
|
|
|
7070
|
-
},{"./dimension":
|
|
7272
|
+
},{"./dimension":56,"./node":70,"./operation":71}],70:[function(require,module,exports){
|
|
7071
7273
|
var Node = function() {
|
|
7072
7274
|
};
|
|
7073
7275
|
Node.prototype.toCSS = function (context) {
|
|
@@ -7141,9 +7343,58 @@ Node.numericCompare = function (a, b) {
|
|
|
7141
7343
|
: a === b ? 0
|
|
7142
7344
|
: a > b ? 1 : undefined;
|
|
7143
7345
|
};
|
|
7346
|
+
// Returns true if this node represents root of ast imported by reference
|
|
7347
|
+
Node.prototype.blocksVisibility = function () {
|
|
7348
|
+
if (this.visibilityBlocks == null) {
|
|
7349
|
+
this.visibilityBlocks = 0;
|
|
7350
|
+
}
|
|
7351
|
+
return this.visibilityBlocks !== 0;
|
|
7352
|
+
};
|
|
7353
|
+
Node.prototype.addVisibilityBlock = function () {
|
|
7354
|
+
if (this.visibilityBlocks == null) {
|
|
7355
|
+
this.visibilityBlocks = 0;
|
|
7356
|
+
}
|
|
7357
|
+
this.visibilityBlocks = this.visibilityBlocks + 1;
|
|
7358
|
+
};
|
|
7359
|
+
Node.prototype.removeVisibilityBlock = function () {
|
|
7360
|
+
if (this.visibilityBlocks == null) {
|
|
7361
|
+
this.visibilityBlocks = 0;
|
|
7362
|
+
}
|
|
7363
|
+
this.visibilityBlocks = this.visibilityBlocks - 1;
|
|
7364
|
+
};
|
|
7365
|
+
//Turns on node visibility - if called node will be shown in output regardless
|
|
7366
|
+
//of whether it comes from import by reference or not
|
|
7367
|
+
Node.prototype.ensureVisibility = function () {
|
|
7368
|
+
this.nodeVisible = true;
|
|
7369
|
+
};
|
|
7370
|
+
//Turns off node visibility - if called node will NOT be shown in output regardless
|
|
7371
|
+
//of whether it comes from import by reference or not
|
|
7372
|
+
Node.prototype.ensureInvisibility = function () {
|
|
7373
|
+
this.nodeVisible = false;
|
|
7374
|
+
};
|
|
7375
|
+
// return values:
|
|
7376
|
+
// false - the node must not be visible
|
|
7377
|
+
// true - the node must be visible
|
|
7378
|
+
// undefined or null - the node has the same visibility as its parent
|
|
7379
|
+
Node.prototype.isVisible = function () {
|
|
7380
|
+
return this.nodeVisible;
|
|
7381
|
+
};
|
|
7382
|
+
Node.prototype.visibilityInfo = function() {
|
|
7383
|
+
return {
|
|
7384
|
+
visibilityBlocks: this.visibilityBlocks,
|
|
7385
|
+
nodeVisible: this.nodeVisible
|
|
7386
|
+
};
|
|
7387
|
+
};
|
|
7388
|
+
Node.prototype.copyVisibilityInfo = function(info) {
|
|
7389
|
+
if (!info) {
|
|
7390
|
+
return;
|
|
7391
|
+
}
|
|
7392
|
+
this.visibilityBlocks = info.visibilityBlocks;
|
|
7393
|
+
this.nodeVisible = info.nodeVisible;
|
|
7394
|
+
};
|
|
7144
7395
|
module.exports = Node;
|
|
7145
7396
|
|
|
7146
|
-
},{}],
|
|
7397
|
+
},{}],71:[function(require,module,exports){
|
|
7147
7398
|
var Node = require("./node"),
|
|
7148
7399
|
Color = require("./color"),
|
|
7149
7400
|
Dimension = require("./dimension");
|
|
@@ -7193,7 +7444,7 @@ Operation.prototype.genCSS = function (context, output) {
|
|
|
7193
7444
|
|
|
7194
7445
|
module.exports = Operation;
|
|
7195
7446
|
|
|
7196
|
-
},{"./color":
|
|
7447
|
+
},{"./color":50,"./dimension":56,"./node":70}],72:[function(require,module,exports){
|
|
7197
7448
|
var Node = require("./node");
|
|
7198
7449
|
|
|
7199
7450
|
var Paren = function (node) {
|
|
@@ -7211,7 +7462,7 @@ Paren.prototype.eval = function (context) {
|
|
|
7211
7462
|
};
|
|
7212
7463
|
module.exports = Paren;
|
|
7213
7464
|
|
|
7214
|
-
},{"./node":
|
|
7465
|
+
},{"./node":70}],73:[function(require,module,exports){
|
|
7215
7466
|
var Node = require("./node"),
|
|
7216
7467
|
JsEvalNode = require("./js-eval-node"),
|
|
7217
7468
|
Variable = require("./variable");
|
|
@@ -7268,7 +7519,7 @@ Quoted.prototype.compare = function (other) {
|
|
|
7268
7519
|
};
|
|
7269
7520
|
module.exports = Quoted;
|
|
7270
7521
|
|
|
7271
|
-
},{"./js-eval-node":
|
|
7522
|
+
},{"./js-eval-node":64,"./node":70,"./variable":82}],74:[function(require,module,exports){
|
|
7272
7523
|
var Node = require("./node"),
|
|
7273
7524
|
Value = require("./value"),
|
|
7274
7525
|
Keyword = require("./keyword");
|
|
@@ -7364,8 +7615,7 @@ Rule.prototype.makeImportant = function () {
|
|
|
7364
7615
|
};
|
|
7365
7616
|
|
|
7366
7617
|
module.exports = Rule;
|
|
7367
|
-
|
|
7368
|
-
},{"./keyword":63,"./node":68,"./value":79}],73:[function(require,module,exports){
|
|
7618
|
+
},{"./keyword":65,"./node":70,"./value":81}],75:[function(require,module,exports){
|
|
7369
7619
|
var Node = require("./node"),
|
|
7370
7620
|
Variable = require("./variable");
|
|
7371
7621
|
|
|
@@ -7380,7 +7630,7 @@ RulesetCall.prototype.eval = function (context) {
|
|
|
7380
7630
|
};
|
|
7381
7631
|
module.exports = RulesetCall;
|
|
7382
7632
|
|
|
7383
|
-
},{"./node":
|
|
7633
|
+
},{"./node":70,"./variable":82}],76:[function(require,module,exports){
|
|
7384
7634
|
var Node = require("./node"),
|
|
7385
7635
|
Rule = require("./rule"),
|
|
7386
7636
|
Selector = require("./selector"),
|
|
@@ -7391,11 +7641,12 @@ var Node = require("./node"),
|
|
|
7391
7641
|
defaultFunc = require("../functions/default"),
|
|
7392
7642
|
getDebugInfo = require("./debug-info");
|
|
7393
7643
|
|
|
7394
|
-
var Ruleset = function (selectors, rules, strictImports) {
|
|
7644
|
+
var Ruleset = function (selectors, rules, strictImports, visibilityInfo) {
|
|
7395
7645
|
this.selectors = selectors;
|
|
7396
7646
|
this.rules = rules;
|
|
7397
7647
|
this._lookups = {};
|
|
7398
7648
|
this.strictImports = strictImports;
|
|
7649
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
7399
7650
|
};
|
|
7400
7651
|
Ruleset.prototype = new Node();
|
|
7401
7652
|
Ruleset.prototype.type = "Ruleset";
|
|
@@ -7403,7 +7654,7 @@ Ruleset.prototype.isRuleset = true;
|
|
|
7403
7654
|
Ruleset.prototype.isRulesetLike = true;
|
|
7404
7655
|
Ruleset.prototype.accept = function (visitor) {
|
|
7405
7656
|
if (this.paths) {
|
|
7406
|
-
visitor.visitArray(this.paths, true);
|
|
7657
|
+
this.paths = visitor.visitArray(this.paths, true);
|
|
7407
7658
|
} else if (this.selectors) {
|
|
7408
7659
|
this.selectors = visitor.visitArray(this.selectors);
|
|
7409
7660
|
}
|
|
@@ -7434,7 +7685,7 @@ Ruleset.prototype.eval = function (context) {
|
|
|
7434
7685
|
}
|
|
7435
7686
|
|
|
7436
7687
|
var rules = this.rules ? this.rules.slice(0) : null,
|
|
7437
|
-
ruleset = new Ruleset(selectors, rules, this.strictImports),
|
|
7688
|
+
ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()),
|
|
7438
7689
|
rule, subRule;
|
|
7439
7690
|
|
|
7440
7691
|
ruleset.originalRuleset = this;
|
|
@@ -7542,6 +7793,7 @@ Ruleset.prototype.eval = function (context) {
|
|
|
7542
7793
|
|
|
7543
7794
|
for (var j = 0; j < rule.rules.length; j++) {
|
|
7544
7795
|
subRule = rule.rules[j];
|
|
7796
|
+
subRule.copyVisibilityInfo(rule.visibilityInfo());
|
|
7545
7797
|
if (!(subRule instanceof Rule) || !subRule.variable) {
|
|
7546
7798
|
rsRules.splice(++i, 0, subRule);
|
|
7547
7799
|
}
|
|
@@ -7569,7 +7821,7 @@ Ruleset.prototype.evalImports = function(context) {
|
|
|
7569
7821
|
for (i = 0; i < rules.length; i++) {
|
|
7570
7822
|
if (rules[i].type === "Import") {
|
|
7571
7823
|
importRules = rules[i].eval(context);
|
|
7572
|
-
if (importRules && importRules.length) {
|
|
7824
|
+
if (importRules && (importRules.length || importRules.length === 0)) {
|
|
7573
7825
|
rules.splice.apply(rules, [i, 1].concat(importRules));
|
|
7574
7826
|
i+= importRules.length - 1;
|
|
7575
7827
|
} else {
|
|
@@ -7586,7 +7838,7 @@ Ruleset.prototype.makeImportant = function() {
|
|
|
7586
7838
|
} else {
|
|
7587
7839
|
return r;
|
|
7588
7840
|
}
|
|
7589
|
-
}), this.strictImports);
|
|
7841
|
+
}), this.strictImports, this.visibilityInfo());
|
|
7590
7842
|
|
|
7591
7843
|
return result;
|
|
7592
7844
|
};
|
|
@@ -7814,46 +8066,6 @@ Ruleset.prototype.genCSS = function (context, output) {
|
|
|
7814
8066
|
output.add('\n');
|
|
7815
8067
|
}
|
|
7816
8068
|
};
|
|
7817
|
-
Ruleset.prototype.markReferenced = function () {
|
|
7818
|
-
var s;
|
|
7819
|
-
if (this.selectors) {
|
|
7820
|
-
for (s = 0; s < this.selectors.length; s++) {
|
|
7821
|
-
this.selectors[s].markReferenced();
|
|
7822
|
-
}
|
|
7823
|
-
}
|
|
7824
|
-
|
|
7825
|
-
if (this.rules) {
|
|
7826
|
-
for (s = 0; s < this.rules.length; s++) {
|
|
7827
|
-
if (this.rules[s].markReferenced) {
|
|
7828
|
-
this.rules[s].markReferenced();
|
|
7829
|
-
}
|
|
7830
|
-
}
|
|
7831
|
-
}
|
|
7832
|
-
};
|
|
7833
|
-
Ruleset.prototype.getIsReferenced = function() {
|
|
7834
|
-
var i, j, path, selector;
|
|
7835
|
-
|
|
7836
|
-
if (this.paths) {
|
|
7837
|
-
for (i = 0; i < this.paths.length; i++) {
|
|
7838
|
-
path = this.paths[i];
|
|
7839
|
-
for (j = 0; j < path.length; j++) {
|
|
7840
|
-
if (path[j].getIsReferenced && path[j].getIsReferenced()) {
|
|
7841
|
-
return true;
|
|
7842
|
-
}
|
|
7843
|
-
}
|
|
7844
|
-
}
|
|
7845
|
-
}
|
|
7846
|
-
|
|
7847
|
-
if (this.selectors) {
|
|
7848
|
-
for (i = 0; i < this.selectors.length; i++) {
|
|
7849
|
-
selector = this.selectors[i];
|
|
7850
|
-
if (selector.getIsReferenced && selector.getIsReferenced()) {
|
|
7851
|
-
return true;
|
|
7852
|
-
}
|
|
7853
|
-
}
|
|
7854
|
-
}
|
|
7855
|
-
return false;
|
|
7856
|
-
};
|
|
7857
8069
|
|
|
7858
8070
|
Ruleset.prototype.joinSelectors = function (paths, context, selectors) {
|
|
7859
8071
|
for (var s = 0; s < selectors.length; s++) {
|
|
@@ -7884,6 +8096,91 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
|
|
7884
8096
|
return selector;
|
|
7885
8097
|
}
|
|
7886
8098
|
|
|
8099
|
+
// joins selector path from `beginningPath` with selector path in `addPath`
|
|
8100
|
+
// `replacedElement` contains element that is being replaced by `addPath`
|
|
8101
|
+
// returns concatenated path
|
|
8102
|
+
function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {
|
|
8103
|
+
var newSelectorPath, lastSelector, newJoinedSelector;
|
|
8104
|
+
// our new selector path
|
|
8105
|
+
newSelectorPath = [];
|
|
8106
|
+
|
|
8107
|
+
//construct the joined selector - if & is the first thing this will be empty,
|
|
8108
|
+
// if not newJoinedSelector will be the last set of elements in the selector
|
|
8109
|
+
if (beginningPath.length > 0) {
|
|
8110
|
+
newSelectorPath = beginningPath.slice(0);
|
|
8111
|
+
lastSelector = newSelectorPath.pop();
|
|
8112
|
+
newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0));
|
|
8113
|
+
}
|
|
8114
|
+
else {
|
|
8115
|
+
newJoinedSelector = originalSelector.createDerived([]);
|
|
8116
|
+
}
|
|
8117
|
+
|
|
8118
|
+
if (addPath.length > 0) {
|
|
8119
|
+
// /deep/ is a combinator that is valid without anything in front of it
|
|
8120
|
+
// so if the & does not have a combinator that is "" or " " then
|
|
8121
|
+
// and there is a combinator on the parent, then grab that.
|
|
8122
|
+
// this also allows + a { & .b { .a & { ... though not sure why you would want to do that
|
|
8123
|
+
var combinator = replacedElement.combinator, parentEl = addPath[0].elements[0];
|
|
8124
|
+
if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
|
|
8125
|
+
combinator = parentEl.combinator;
|
|
8126
|
+
}
|
|
8127
|
+
// join the elements so far with the first part of the parent
|
|
8128
|
+
newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo));
|
|
8129
|
+
newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));
|
|
8130
|
+
}
|
|
8131
|
+
|
|
8132
|
+
// now add the joined selector - but only if it is not empty
|
|
8133
|
+
if (newJoinedSelector.elements.length !== 0) {
|
|
8134
|
+
newSelectorPath.push(newJoinedSelector);
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
//put together the parent selectors after the join (e.g. the rest of the parent)
|
|
8138
|
+
if (addPath.length > 1) {
|
|
8139
|
+
var restOfPath = addPath.slice(1);
|
|
8140
|
+
restOfPath = restOfPath.map(function (selector) {
|
|
8141
|
+
return selector.createDerived(selector.elements, []);
|
|
8142
|
+
});
|
|
8143
|
+
newSelectorPath = newSelectorPath.concat(restOfPath);
|
|
8144
|
+
}
|
|
8145
|
+
return newSelectorPath;
|
|
8146
|
+
}
|
|
8147
|
+
|
|
8148
|
+
// joins selector path from `beginningPath` with every selector path in `addPaths` array
|
|
8149
|
+
// `replacedElement` contains element that is being replaced by `addPath`
|
|
8150
|
+
// returns array with all concatenated paths
|
|
8151
|
+
function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {
|
|
8152
|
+
var j;
|
|
8153
|
+
for (j = 0; j < beginningPath.length; j++) {
|
|
8154
|
+
var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);
|
|
8155
|
+
result.push(newSelectorPath);
|
|
8156
|
+
}
|
|
8157
|
+
return result;
|
|
8158
|
+
}
|
|
8159
|
+
|
|
8160
|
+
function mergeElementsOnToSelectors(elements, selectors) {
|
|
8161
|
+
var i, sel;
|
|
8162
|
+
|
|
8163
|
+
if (elements.length === 0) {
|
|
8164
|
+
return ;
|
|
8165
|
+
}
|
|
8166
|
+
if (selectors.length === 0) {
|
|
8167
|
+
selectors.push([ new Selector(elements) ]);
|
|
8168
|
+
return;
|
|
8169
|
+
}
|
|
8170
|
+
|
|
8171
|
+
for (i = 0; i < selectors.length; i++) {
|
|
8172
|
+
sel = selectors[i];
|
|
8173
|
+
|
|
8174
|
+
// if the previous thing in sel is a parent this needs to join on to it
|
|
8175
|
+
if (sel.length > 0) {
|
|
8176
|
+
sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
|
|
8177
|
+
}
|
|
8178
|
+
else {
|
|
8179
|
+
sel.push(new Selector(elements));
|
|
8180
|
+
}
|
|
8181
|
+
}
|
|
8182
|
+
}
|
|
8183
|
+
|
|
7887
8184
|
// replace all parent selectors inside `inSelector` by content of `context` array
|
|
7888
8185
|
// resulting selectors are returned inside `paths` array
|
|
7889
8186
|
// returns true if `inSelector` contained at least one parent selector
|
|
@@ -7997,91 +8294,17 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
|
|
7997
8294
|
paths.push(newSelectors[i]);
|
|
7998
8295
|
lastSelector = newSelectors[i][length - 1];
|
|
7999
8296
|
newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);
|
|
8297
|
+
//newSelectors[i][length - 1].copyVisibilityInfo(inSelector.visibilityInfo());
|
|
8000
8298
|
}
|
|
8001
8299
|
}
|
|
8002
8300
|
|
|
8003
8301
|
return hadParentSelector;
|
|
8004
8302
|
}
|
|
8005
8303
|
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
var newSelectorPath, lastSelector, newJoinedSelector;
|
|
8011
|
-
// our new selector path
|
|
8012
|
-
newSelectorPath = [];
|
|
8013
|
-
|
|
8014
|
-
//construct the joined selector - if & is the first thing this will be empty,
|
|
8015
|
-
// if not newJoinedSelector will be the last set of elements in the selector
|
|
8016
|
-
if (beginningPath.length > 0) {
|
|
8017
|
-
newSelectorPath = beginningPath.slice(0);
|
|
8018
|
-
lastSelector = newSelectorPath.pop();
|
|
8019
|
-
newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0));
|
|
8020
|
-
}
|
|
8021
|
-
else {
|
|
8022
|
-
newJoinedSelector = originalSelector.createDerived([]);
|
|
8023
|
-
}
|
|
8024
|
-
|
|
8025
|
-
if (addPath.length > 0) {
|
|
8026
|
-
// /deep/ is a combinator that is valid without anything in front of it
|
|
8027
|
-
// so if the & does not have a combinator that is "" or " " then
|
|
8028
|
-
// and there is a combinator on the parent, then grab that.
|
|
8029
|
-
// this also allows + a { & .b { .a & { ... though not sure why you would want to do that
|
|
8030
|
-
var combinator = replacedElement.combinator, parentEl = addPath[0].elements[0];
|
|
8031
|
-
if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
|
|
8032
|
-
combinator = parentEl.combinator;
|
|
8033
|
-
}
|
|
8034
|
-
// join the elements so far with the first part of the parent
|
|
8035
|
-
newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo));
|
|
8036
|
-
newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));
|
|
8037
|
-
}
|
|
8038
|
-
|
|
8039
|
-
// now add the joined selector - but only if it is not empty
|
|
8040
|
-
if (newJoinedSelector.elements.length !== 0) {
|
|
8041
|
-
newSelectorPath.push(newJoinedSelector);
|
|
8042
|
-
}
|
|
8043
|
-
|
|
8044
|
-
//put together the parent selectors after the join (e.g. the rest of the parent)
|
|
8045
|
-
if (addPath.length > 1) {
|
|
8046
|
-
newSelectorPath = newSelectorPath.concat(addPath.slice(1));
|
|
8047
|
-
}
|
|
8048
|
-
return newSelectorPath;
|
|
8049
|
-
}
|
|
8050
|
-
|
|
8051
|
-
// joins selector path from `beginningPath` with every selector path in `addPaths` array
|
|
8052
|
-
// `replacedElement` contains element that is being replaced by `addPath`
|
|
8053
|
-
// returns array with all concatenated paths
|
|
8054
|
-
function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {
|
|
8055
|
-
var j;
|
|
8056
|
-
for (j = 0; j < beginningPath.length; j++) {
|
|
8057
|
-
var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);
|
|
8058
|
-
result.push(newSelectorPath);
|
|
8059
|
-
}
|
|
8060
|
-
return result;
|
|
8061
|
-
}
|
|
8062
|
-
|
|
8063
|
-
function mergeElementsOnToSelectors(elements, selectors) {
|
|
8064
|
-
var i, sel;
|
|
8065
|
-
|
|
8066
|
-
if (elements.length === 0) {
|
|
8067
|
-
return ;
|
|
8068
|
-
}
|
|
8069
|
-
if (selectors.length === 0) {
|
|
8070
|
-
selectors.push([ new Selector(elements) ]);
|
|
8071
|
-
return;
|
|
8072
|
-
}
|
|
8073
|
-
|
|
8074
|
-
for (i = 0; i < selectors.length; i++) {
|
|
8075
|
-
sel = selectors[i];
|
|
8076
|
-
|
|
8077
|
-
// if the previous thing in sel is a parent this needs to join on to it
|
|
8078
|
-
if (sel.length > 0) {
|
|
8079
|
-
sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
|
|
8080
|
-
}
|
|
8081
|
-
else {
|
|
8082
|
-
sel.push(new Selector(elements));
|
|
8083
|
-
}
|
|
8084
|
-
}
|
|
8304
|
+
function deriveSelector(visibilityInfo, deriveFrom) {
|
|
8305
|
+
var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);
|
|
8306
|
+
newSelector.copyVisibilityInfo(visibilityInfo);
|
|
8307
|
+
return newSelector;
|
|
8085
8308
|
}
|
|
8086
8309
|
|
|
8087
8310
|
// joinSelector code follows
|
|
@@ -8094,7 +8317,16 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
|
|
8094
8317
|
if (context.length > 0) {
|
|
8095
8318
|
newPaths = [];
|
|
8096
8319
|
for (i = 0; i < context.length; i++) {
|
|
8097
|
-
|
|
8320
|
+
//var concatenated = [];
|
|
8321
|
+
//context[i].forEach(function(entry) {
|
|
8322
|
+
// var newEntry = entry.createDerived(entry.elements, entry.extendList, entry.evaldCondition);
|
|
8323
|
+
// newEntry.copyVisibilityInfo(selector.visibilityInfo());
|
|
8324
|
+
// concatenated.push(newEntry);
|
|
8325
|
+
//}, this);
|
|
8326
|
+
var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));
|
|
8327
|
+
|
|
8328
|
+
concatenated.push(selector);
|
|
8329
|
+
newPaths.push(concatenated);
|
|
8098
8330
|
}
|
|
8099
8331
|
}
|
|
8100
8332
|
else {
|
|
@@ -8109,19 +8341,19 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
|
|
8109
8341
|
};
|
|
8110
8342
|
module.exports = Ruleset;
|
|
8111
8343
|
|
|
8112
|
-
},{"../contexts":
|
|
8344
|
+
},{"../contexts":11,"../functions/default":20,"../functions/function-registry":22,"./debug-info":54,"./element":58,"./node":70,"./paren":72,"./rule":74,"./selector":77}],77:[function(require,module,exports){
|
|
8113
8345
|
var Node = require("./node"),
|
|
8114
8346
|
Element = require("./element");
|
|
8115
8347
|
|
|
8116
|
-
var Selector = function (elements, extendList, condition, index, currentFileInfo,
|
|
8348
|
+
var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) {
|
|
8117
8349
|
this.elements = elements;
|
|
8118
8350
|
this.extendList = extendList;
|
|
8119
8351
|
this.condition = condition;
|
|
8120
8352
|
this.currentFileInfo = currentFileInfo || {};
|
|
8121
|
-
this.isReferenced = isReferenced;
|
|
8122
8353
|
if (!condition) {
|
|
8123
8354
|
this.evaldCondition = true;
|
|
8124
8355
|
}
|
|
8356
|
+
this.copyVisibilityInfo(visibilityInfo);
|
|
8125
8357
|
};
|
|
8126
8358
|
Selector.prototype = new Node();
|
|
8127
8359
|
Selector.prototype.type = "Selector";
|
|
@@ -8137,8 +8369,9 @@ Selector.prototype.accept = function (visitor) {
|
|
|
8137
8369
|
}
|
|
8138
8370
|
};
|
|
8139
8371
|
Selector.prototype.createDerived = function(elements, extendList, evaldCondition) {
|
|
8372
|
+
var info = this.visibilityInfo();
|
|
8140
8373
|
evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
|
|
8141
|
-
var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo,
|
|
8374
|
+
var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, info);
|
|
8142
8375
|
newSelector.evaldCondition = evaldCondition;
|
|
8143
8376
|
newSelector.mediaEmpty = this.mediaEmpty;
|
|
8144
8377
|
return newSelector;
|
|
@@ -8216,18 +8449,12 @@ Selector.prototype.genCSS = function (context, output) {
|
|
|
8216
8449
|
}
|
|
8217
8450
|
}
|
|
8218
8451
|
};
|
|
8219
|
-
Selector.prototype.markReferenced = function () {
|
|
8220
|
-
this.isReferenced = true;
|
|
8221
|
-
};
|
|
8222
|
-
Selector.prototype.getIsReferenced = function() {
|
|
8223
|
-
return !this.currentFileInfo.reference || this.isReferenced;
|
|
8224
|
-
};
|
|
8225
8452
|
Selector.prototype.getIsOutput = function() {
|
|
8226
8453
|
return this.evaldCondition;
|
|
8227
8454
|
};
|
|
8228
8455
|
module.exports = Selector;
|
|
8229
8456
|
|
|
8230
|
-
},{"./element":
|
|
8457
|
+
},{"./element":58,"./node":70}],78:[function(require,module,exports){
|
|
8231
8458
|
var Node = require("./node");
|
|
8232
8459
|
|
|
8233
8460
|
var UnicodeDescriptor = function (value) {
|
|
@@ -8238,7 +8465,7 @@ UnicodeDescriptor.prototype.type = "UnicodeDescriptor";
|
|
|
8238
8465
|
|
|
8239
8466
|
module.exports = UnicodeDescriptor;
|
|
8240
8467
|
|
|
8241
|
-
},{"./node":
|
|
8468
|
+
},{"./node":70}],79:[function(require,module,exports){
|
|
8242
8469
|
var Node = require("./node"),
|
|
8243
8470
|
unitConversions = require("../data/unit-conversions");
|
|
8244
8471
|
|
|
@@ -8302,7 +8529,7 @@ Unit.prototype.map = function(callback) {
|
|
|
8302
8529
|
}
|
|
8303
8530
|
};
|
|
8304
8531
|
Unit.prototype.usedUnits = function() {
|
|
8305
|
-
var group, result = {}, mapUnit;
|
|
8532
|
+
var group, result = {}, mapUnit, groupName;
|
|
8306
8533
|
|
|
8307
8534
|
mapUnit = function (atomicUnit) {
|
|
8308
8535
|
/*jshint loopfunc:true */
|
|
@@ -8313,7 +8540,7 @@ Unit.prototype.usedUnits = function() {
|
|
|
8313
8540
|
return atomicUnit;
|
|
8314
8541
|
};
|
|
8315
8542
|
|
|
8316
|
-
for (
|
|
8543
|
+
for (groupName in unitConversions) {
|
|
8317
8544
|
if (unitConversions.hasOwnProperty(groupName)) {
|
|
8318
8545
|
group = unitConversions[groupName];
|
|
8319
8546
|
|
|
@@ -8360,7 +8587,7 @@ Unit.prototype.cancel = function () {
|
|
|
8360
8587
|
};
|
|
8361
8588
|
module.exports = Unit;
|
|
8362
8589
|
|
|
8363
|
-
},{"../data/unit-conversions":
|
|
8590
|
+
},{"../data/unit-conversions":14,"./node":70}],80:[function(require,module,exports){
|
|
8364
8591
|
var Node = require("./node");
|
|
8365
8592
|
|
|
8366
8593
|
var URL = function (val, index, currentFileInfo, isEvald) {
|
|
@@ -8416,7 +8643,7 @@ URL.prototype.eval = function (context) {
|
|
|
8416
8643
|
};
|
|
8417
8644
|
module.exports = URL;
|
|
8418
8645
|
|
|
8419
|
-
},{"./node":
|
|
8646
|
+
},{"./node":70}],81:[function(require,module,exports){
|
|
8420
8647
|
var Node = require("./node");
|
|
8421
8648
|
|
|
8422
8649
|
var Value = function (value) {
|
|
@@ -8452,7 +8679,7 @@ Value.prototype.genCSS = function (context, output) {
|
|
|
8452
8679
|
};
|
|
8453
8680
|
module.exports = Value;
|
|
8454
8681
|
|
|
8455
|
-
},{"./node":
|
|
8682
|
+
},{"./node":70}],82:[function(require,module,exports){
|
|
8456
8683
|
var Node = require("./node");
|
|
8457
8684
|
|
|
8458
8685
|
var Variable = function (name, index, currentFileInfo) {
|
|
@@ -8507,7 +8734,7 @@ Variable.prototype.find = function (obj, fun) {
|
|
|
8507
8734
|
};
|
|
8508
8735
|
module.exports = Variable;
|
|
8509
8736
|
|
|
8510
|
-
},{"./node":
|
|
8737
|
+
},{"./node":70}],83:[function(require,module,exports){
|
|
8511
8738
|
module.exports = {
|
|
8512
8739
|
getLocation: function(index, inputStream) {
|
|
8513
8740
|
var n = index + 1,
|
|
@@ -8529,7 +8756,7 @@ module.exports = {
|
|
|
8529
8756
|
}
|
|
8530
8757
|
};
|
|
8531
8758
|
|
|
8532
|
-
},{}],
|
|
8759
|
+
},{}],84:[function(require,module,exports){
|
|
8533
8760
|
var tree = require("../tree"),
|
|
8534
8761
|
Visitor = require("./visitor"),
|
|
8535
8762
|
logger = require("../logger");
|
|
@@ -8688,17 +8915,17 @@ ProcessExtendsVisitor.prototype = {
|
|
|
8688
8915
|
matches = extendVisitor.findMatch(extend, selectorPath);
|
|
8689
8916
|
|
|
8690
8917
|
if (matches.length) {
|
|
8691
|
-
|
|
8692
8918
|
extend.hasFoundMatches = true;
|
|
8693
8919
|
|
|
8694
8920
|
// we found a match, so for each self selector..
|
|
8695
8921
|
extend.selfSelectors.forEach(function(selfSelector) {
|
|
8922
|
+
var info = targetExtend.visibilityInfo();
|
|
8696
8923
|
|
|
8697
8924
|
// process the extend as usual
|
|
8698
|
-
newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector);
|
|
8925
|
+
newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible());
|
|
8699
8926
|
|
|
8700
8927
|
// but now we create a new extend from it
|
|
8701
|
-
newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0);
|
|
8928
|
+
newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.currentFileInfo, info);
|
|
8702
8929
|
newExtend.selfSelectors = newSelector;
|
|
8703
8930
|
|
|
8704
8931
|
// add the extend onto the list of extends for that selector
|
|
@@ -8779,7 +9006,9 @@ ProcessExtendsVisitor.prototype = {
|
|
|
8779
9006
|
allExtends[extendIndex].hasFoundMatches = true;
|
|
8780
9007
|
|
|
8781
9008
|
allExtends[extendIndex].selfSelectors.forEach(function(selfSelector) {
|
|
8782
|
-
|
|
9009
|
+
var extendedSelectors;
|
|
9010
|
+
extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible());
|
|
9011
|
+
selectorsToAdd.push(extendedSelectors);
|
|
8783
9012
|
});
|
|
8784
9013
|
}
|
|
8785
9014
|
}
|
|
@@ -8895,7 +9124,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
8895
9124
|
}
|
|
8896
9125
|
return false;
|
|
8897
9126
|
},
|
|
8898
|
-
extendSelector:function (matches, selectorPath, replacementSelector) {
|
|
9127
|
+
extendSelector:function (matches, selectorPath, replacementSelector, isVisible) {
|
|
8899
9128
|
|
|
8900
9129
|
//for a set of matches, replace each match with the replacement selector
|
|
8901
9130
|
|
|
@@ -8955,11 +9184,18 @@ ProcessExtendsVisitor.prototype = {
|
|
|
8955
9184
|
}
|
|
8956
9185
|
|
|
8957
9186
|
path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length));
|
|
8958
|
-
|
|
9187
|
+
path = path.map(function (currentValue) {
|
|
9188
|
+
// we can re-use elements here, because the visibility property matters only for selectors
|
|
9189
|
+
var derived = currentValue.createDerived(currentValue.elements);
|
|
9190
|
+
if (isVisible) {
|
|
9191
|
+
derived.ensureVisibility();
|
|
9192
|
+
} else {
|
|
9193
|
+
derived.ensureInvisibility();
|
|
9194
|
+
}
|
|
9195
|
+
return derived;
|
|
9196
|
+
});
|
|
8959
9197
|
return path;
|
|
8960
9198
|
},
|
|
8961
|
-
visitRulesetOut: function (rulesetNode) {
|
|
8962
|
-
},
|
|
8963
9199
|
visitMedia: function (mediaNode, visitArgs) {
|
|
8964
9200
|
var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
|
|
8965
9201
|
newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));
|
|
@@ -8982,7 +9218,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
8982
9218
|
|
|
8983
9219
|
module.exports = ProcessExtendsVisitor;
|
|
8984
9220
|
|
|
8985
|
-
},{"../logger":
|
|
9221
|
+
},{"../logger":33,"../tree":62,"./visitor":91}],85:[function(require,module,exports){
|
|
8986
9222
|
function ImportSequencer(onSequencerEmpty) {
|
|
8987
9223
|
this.imports = [];
|
|
8988
9224
|
this.variableImports = [];
|
|
@@ -9038,7 +9274,7 @@ ImportSequencer.prototype.tryRun = function() {
|
|
|
9038
9274
|
|
|
9039
9275
|
module.exports = ImportSequencer;
|
|
9040
9276
|
|
|
9041
|
-
},{}],
|
|
9277
|
+
},{}],86:[function(require,module,exports){
|
|
9042
9278
|
var contexts = require("../contexts"),
|
|
9043
9279
|
Visitor = require("./visitor"),
|
|
9044
9280
|
ImportSequencer = require("./import-sequencer");
|
|
@@ -9145,6 +9381,7 @@ ImportVisitor.prototype = {
|
|
|
9145
9381
|
var importVisitor = this,
|
|
9146
9382
|
inlineCSS = importNode.options.inline,
|
|
9147
9383
|
isPlugin = importNode.options.plugin,
|
|
9384
|
+
isOptional = importNode.options.optional,
|
|
9148
9385
|
duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
|
|
9149
9386
|
|
|
9150
9387
|
if (!context.importMultiple) {
|
|
@@ -9161,6 +9398,10 @@ ImportVisitor.prototype = {
|
|
|
9161
9398
|
}
|
|
9162
9399
|
}
|
|
9163
9400
|
|
|
9401
|
+
if (!fullPath && isOptional) {
|
|
9402
|
+
importNode.skip = true;
|
|
9403
|
+
}
|
|
9404
|
+
|
|
9164
9405
|
if (root) {
|
|
9165
9406
|
importNode.root = root;
|
|
9166
9407
|
importNode.importedFilename = fullPath;
|
|
@@ -9224,10 +9465,11 @@ ImportVisitor.prototype = {
|
|
|
9224
9465
|
};
|
|
9225
9466
|
module.exports = ImportVisitor;
|
|
9226
9467
|
|
|
9227
|
-
},{"../contexts":
|
|
9468
|
+
},{"../contexts":11,"./import-sequencer":85,"./visitor":91}],87:[function(require,module,exports){
|
|
9228
9469
|
var visitors = {
|
|
9229
9470
|
Visitor: require("./visitor"),
|
|
9230
9471
|
ImportVisitor: require('./import-visitor'),
|
|
9472
|
+
MarkVisibleSelectorsVisitor: require("./set-tree-visibility-visitor"),
|
|
9231
9473
|
ExtendVisitor: require('./extend-visitor'),
|
|
9232
9474
|
JoinSelectorVisitor: require('./join-selector-visitor'),
|
|
9233
9475
|
ToCSSVisitor: require('./to-css-visitor')
|
|
@@ -9235,7 +9477,7 @@ var visitors = {
|
|
|
9235
9477
|
|
|
9236
9478
|
module.exports = visitors;
|
|
9237
9479
|
|
|
9238
|
-
},{"./extend-visitor":
|
|
9480
|
+
},{"./extend-visitor":84,"./import-visitor":86,"./join-selector-visitor":88,"./set-tree-visibility-visitor":89,"./to-css-visitor":90,"./visitor":91}],88:[function(require,module,exports){
|
|
9239
9481
|
var Visitor = require("./visitor");
|
|
9240
9482
|
|
|
9241
9483
|
var JoinSelectorVisitor = function() {
|
|
@@ -9288,13 +9530,140 @@ JoinSelectorVisitor.prototype = {
|
|
|
9288
9530
|
|
|
9289
9531
|
module.exports = JoinSelectorVisitor;
|
|
9290
9532
|
|
|
9291
|
-
},{"./visitor":
|
|
9533
|
+
},{"./visitor":91}],89:[function(require,module,exports){
|
|
9534
|
+
var SetTreeVisibilityVisitor = function(visible) {
|
|
9535
|
+
this.visible = visible;
|
|
9536
|
+
};
|
|
9537
|
+
SetTreeVisibilityVisitor.prototype.run = function(root) {
|
|
9538
|
+
this.visit(root);
|
|
9539
|
+
};
|
|
9540
|
+
SetTreeVisibilityVisitor.prototype.visitArray = function(nodes) {
|
|
9541
|
+
if (!nodes) {
|
|
9542
|
+
return nodes;
|
|
9543
|
+
}
|
|
9544
|
+
|
|
9545
|
+
var cnt = nodes.length, i;
|
|
9546
|
+
for (i = 0; i < cnt; i++) {
|
|
9547
|
+
this.visit(nodes[i]);
|
|
9548
|
+
}
|
|
9549
|
+
return nodes;
|
|
9550
|
+
};
|
|
9551
|
+
SetTreeVisibilityVisitor.prototype.visit = function(node) {
|
|
9552
|
+
if (!node) {
|
|
9553
|
+
return node;
|
|
9554
|
+
}
|
|
9555
|
+
if (node.constructor === Array) {
|
|
9556
|
+
return this.visitArray(node);
|
|
9557
|
+
}
|
|
9558
|
+
|
|
9559
|
+
if (!node.blocksVisibility || node.blocksVisibility()) {
|
|
9560
|
+
return node;
|
|
9561
|
+
}
|
|
9562
|
+
if (this.visible) {
|
|
9563
|
+
node.ensureVisibility();
|
|
9564
|
+
} else {
|
|
9565
|
+
node.ensureInvisibility();
|
|
9566
|
+
}
|
|
9567
|
+
|
|
9568
|
+
node.accept(this);
|
|
9569
|
+
return node;
|
|
9570
|
+
};
|
|
9571
|
+
module.exports = SetTreeVisibilityVisitor;
|
|
9572
|
+
},{}],90:[function(require,module,exports){
|
|
9292
9573
|
var tree = require("../tree"),
|
|
9293
9574
|
Visitor = require("./visitor");
|
|
9294
9575
|
|
|
9576
|
+
var CSSVisitorUtils = function(context) {
|
|
9577
|
+
this._visitor = new Visitor(this);
|
|
9578
|
+
this._context = context;
|
|
9579
|
+
};
|
|
9580
|
+
|
|
9581
|
+
CSSVisitorUtils.prototype = {
|
|
9582
|
+
containsSilentNonBlockedChild: function(bodyRules) {
|
|
9583
|
+
var rule;
|
|
9584
|
+
if (bodyRules == null) {
|
|
9585
|
+
return false;
|
|
9586
|
+
}
|
|
9587
|
+
for (var r = 0; r < bodyRules.length; r++) {
|
|
9588
|
+
rule = bodyRules[r];
|
|
9589
|
+
if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) {
|
|
9590
|
+
//the directive contains something that was referenced (likely by extend)
|
|
9591
|
+
//therefore it needs to be shown in output too
|
|
9592
|
+
return true;
|
|
9593
|
+
}
|
|
9594
|
+
}
|
|
9595
|
+
return false;
|
|
9596
|
+
},
|
|
9597
|
+
|
|
9598
|
+
keepOnlyVisibleChilds: function(owner) {
|
|
9599
|
+
if (owner == null || owner.rules == null) {
|
|
9600
|
+
return ;
|
|
9601
|
+
}
|
|
9602
|
+
|
|
9603
|
+
owner.rules = owner.rules.filter(function(thing) {
|
|
9604
|
+
return thing.isVisible();
|
|
9605
|
+
}
|
|
9606
|
+
);
|
|
9607
|
+
},
|
|
9608
|
+
|
|
9609
|
+
isEmpty: function(owner) {
|
|
9610
|
+
if (owner == null || owner.rules == null) {
|
|
9611
|
+
return true;
|
|
9612
|
+
}
|
|
9613
|
+
return owner.rules.length === 0;
|
|
9614
|
+
},
|
|
9615
|
+
|
|
9616
|
+
hasVisibleSelector: function(rulesetNode) {
|
|
9617
|
+
if (rulesetNode == null || rulesetNode.paths == null) {
|
|
9618
|
+
return false;
|
|
9619
|
+
}
|
|
9620
|
+
return rulesetNode.paths.length > 0;
|
|
9621
|
+
},
|
|
9622
|
+
|
|
9623
|
+
resolveVisibility: function (node, originalRules) {
|
|
9624
|
+
if (!node.blocksVisibility()) {
|
|
9625
|
+
if (this.isEmpty(node) && !this.containsSilentNonBlockedChild(originalRules)) {
|
|
9626
|
+
return ;
|
|
9627
|
+
}
|
|
9628
|
+
|
|
9629
|
+
return node;
|
|
9630
|
+
}
|
|
9631
|
+
|
|
9632
|
+
var compiledRulesBody = node.rules[0];
|
|
9633
|
+
this.keepOnlyVisibleChilds(compiledRulesBody);
|
|
9634
|
+
|
|
9635
|
+
if (this.isEmpty(compiledRulesBody)) {
|
|
9636
|
+
return ;
|
|
9637
|
+
}
|
|
9638
|
+
|
|
9639
|
+
node.ensureVisibility();
|
|
9640
|
+
node.removeVisibilityBlock();
|
|
9641
|
+
|
|
9642
|
+
return node;
|
|
9643
|
+
},
|
|
9644
|
+
|
|
9645
|
+
isVisibleRuleset: function(rulesetNode) {
|
|
9646
|
+
if (rulesetNode.firstRoot) {
|
|
9647
|
+
return true;
|
|
9648
|
+
}
|
|
9649
|
+
|
|
9650
|
+
if (this.isEmpty(rulesetNode)) {
|
|
9651
|
+
return false;
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9654
|
+
if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) {
|
|
9655
|
+
return false;
|
|
9656
|
+
}
|
|
9657
|
+
|
|
9658
|
+
return true;
|
|
9659
|
+
}
|
|
9660
|
+
|
|
9661
|
+
};
|
|
9662
|
+
|
|
9295
9663
|
var ToCSSVisitor = function(context) {
|
|
9296
9664
|
this._visitor = new Visitor(this);
|
|
9297
9665
|
this._context = context;
|
|
9666
|
+
this.utils = new CSSVisitorUtils(context);
|
|
9298
9667
|
};
|
|
9299
9668
|
|
|
9300
9669
|
ToCSSVisitor.prototype = {
|
|
@@ -9304,7 +9673,7 @@ ToCSSVisitor.prototype = {
|
|
|
9304
9673
|
},
|
|
9305
9674
|
|
|
9306
9675
|
visitRule: function (ruleNode, visitArgs) {
|
|
9307
|
-
if (ruleNode.variable) {
|
|
9676
|
+
if (ruleNode.blocksVisibility() || ruleNode.variable) {
|
|
9308
9677
|
return;
|
|
9309
9678
|
}
|
|
9310
9679
|
return ruleNode;
|
|
@@ -9320,34 +9689,71 @@ ToCSSVisitor.prototype = {
|
|
|
9320
9689
|
},
|
|
9321
9690
|
|
|
9322
9691
|
visitComment: function (commentNode, visitArgs) {
|
|
9323
|
-
if (commentNode.isSilent(this._context)) {
|
|
9692
|
+
if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) {
|
|
9324
9693
|
return;
|
|
9325
9694
|
}
|
|
9326
9695
|
return commentNode;
|
|
9327
9696
|
},
|
|
9328
9697
|
|
|
9329
9698
|
visitMedia: function(mediaNode, visitArgs) {
|
|
9699
|
+
var originalRules = mediaNode.rules[0].rules;
|
|
9330
9700
|
mediaNode.accept(this._visitor);
|
|
9331
9701
|
visitArgs.visitDeeper = false;
|
|
9332
9702
|
|
|
9333
|
-
|
|
9334
|
-
return;
|
|
9335
|
-
}
|
|
9336
|
-
return mediaNode;
|
|
9703
|
+
return this.utils.resolveVisibility(mediaNode, originalRules);
|
|
9337
9704
|
},
|
|
9338
9705
|
|
|
9339
9706
|
visitImport: function (importNode, visitArgs) {
|
|
9340
|
-
if (importNode.
|
|
9341
|
-
return;
|
|
9707
|
+
if (importNode.blocksVisibility()) {
|
|
9708
|
+
return ;
|
|
9342
9709
|
}
|
|
9343
9710
|
return importNode;
|
|
9344
9711
|
},
|
|
9345
9712
|
|
|
9346
9713
|
visitDirective: function(directiveNode, visitArgs) {
|
|
9347
|
-
if (directiveNode.
|
|
9348
|
-
|
|
9349
|
-
|
|
9714
|
+
if (directiveNode.rules && directiveNode.rules.length) {
|
|
9715
|
+
return this.visitDirectiveWithBody(directiveNode, visitArgs);
|
|
9716
|
+
} else {
|
|
9717
|
+
return this.visitDirectiveWithoutBody(directiveNode, visitArgs);
|
|
9718
|
+
}
|
|
9719
|
+
return directiveNode;
|
|
9720
|
+
},
|
|
9721
|
+
|
|
9722
|
+
visitDirectiveWithBody: function(directiveNode, visitArgs) {
|
|
9723
|
+
//if there is only one nested ruleset and that one has no path, then it is
|
|
9724
|
+
//just fake ruleset
|
|
9725
|
+
function hasFakeRuleset(directiveNode) {
|
|
9726
|
+
var bodyRules = directiveNode.rules;
|
|
9727
|
+
return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0);
|
|
9728
|
+
}
|
|
9729
|
+
function getBodyRules(directiveNode) {
|
|
9730
|
+
var nodeRules = directiveNode.rules;
|
|
9731
|
+
if (hasFakeRuleset(directiveNode)) {
|
|
9732
|
+
return nodeRules[0].rules;
|
|
9350
9733
|
}
|
|
9734
|
+
|
|
9735
|
+
return nodeRules;
|
|
9736
|
+
}
|
|
9737
|
+
//it is still true that it is only one ruleset in array
|
|
9738
|
+
//this is last such moment
|
|
9739
|
+
//process childs
|
|
9740
|
+
var originalRules = getBodyRules(directiveNode);
|
|
9741
|
+
directiveNode.accept(this._visitor);
|
|
9742
|
+
visitArgs.visitDeeper = false;
|
|
9743
|
+
|
|
9744
|
+
if (!this.utils.isEmpty(directiveNode)) {
|
|
9745
|
+
this._mergeRules(directiveNode.rules[0].rules);
|
|
9746
|
+
}
|
|
9747
|
+
|
|
9748
|
+
return this.utils.resolveVisibility(directiveNode, originalRules);
|
|
9749
|
+
},
|
|
9750
|
+
|
|
9751
|
+
visitDirectiveWithoutBody: function(directiveNode, visitArgs) {
|
|
9752
|
+
if (directiveNode.blocksVisibility()) {
|
|
9753
|
+
return;
|
|
9754
|
+
}
|
|
9755
|
+
|
|
9756
|
+
if (directiveNode.name === "@charset") {
|
|
9351
9757
|
// Only output the debug info together with subsequent @charset definitions
|
|
9352
9758
|
// a comment (or @media statement) before the actual @charset directive would
|
|
9353
9759
|
// be considered illegal css as it has to be on the first line
|
|
@@ -9361,59 +9767,7 @@ ToCSSVisitor.prototype = {
|
|
|
9361
9767
|
}
|
|
9362
9768
|
this.charset = true;
|
|
9363
9769
|
}
|
|
9364
|
-
function hasVisibleChild(directiveNode) {
|
|
9365
|
-
//prepare list of childs
|
|
9366
|
-
var rule, bodyRules = directiveNode.rules;
|
|
9367
|
-
//if there is only one nested ruleset and that one has no path, then it is
|
|
9368
|
-
//just fake ruleset that got not replaced and we need to look inside it to
|
|
9369
|
-
//get real childs
|
|
9370
|
-
if (bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0)) {
|
|
9371
|
-
bodyRules = bodyRules[0].rules;
|
|
9372
|
-
}
|
|
9373
|
-
for (var r = 0; r < bodyRules.length; r++) {
|
|
9374
|
-
rule = bodyRules[r];
|
|
9375
|
-
if (rule.getIsReferenced && rule.getIsReferenced()) {
|
|
9376
|
-
//the directive contains something that was referenced (likely by extend)
|
|
9377
|
-
//therefore it needs to be shown in output too
|
|
9378
|
-
return true;
|
|
9379
|
-
}
|
|
9380
|
-
}
|
|
9381
|
-
return false;
|
|
9382
|
-
}
|
|
9383
|
-
|
|
9384
|
-
if (directiveNode.rules && directiveNode.rules.length) {
|
|
9385
|
-
//it is still true that it is only one ruleset in array
|
|
9386
|
-
//this is last such moment
|
|
9387
|
-
this._mergeRules(directiveNode.rules[0].rules);
|
|
9388
|
-
//process childs
|
|
9389
|
-
directiveNode.accept(this._visitor);
|
|
9390
|
-
visitArgs.visitDeeper = false;
|
|
9391
|
-
|
|
9392
|
-
// the directive was directly referenced and therefore needs to be shown in the output
|
|
9393
|
-
if (directiveNode.getIsReferenced()) {
|
|
9394
|
-
return directiveNode;
|
|
9395
|
-
}
|
|
9396
|
-
|
|
9397
|
-
if (!directiveNode.rules || !directiveNode.rules.length) {
|
|
9398
|
-
return ;
|
|
9399
|
-
}
|
|
9400
9770
|
|
|
9401
|
-
//the directive was not directly referenced - we need to check whether some of its childs
|
|
9402
|
-
//was referenced
|
|
9403
|
-
if (hasVisibleChild(directiveNode)) {
|
|
9404
|
-
//marking as referenced in case the directive is stored inside another directive
|
|
9405
|
-
directiveNode.markReferenced();
|
|
9406
|
-
return directiveNode;
|
|
9407
|
-
}
|
|
9408
|
-
|
|
9409
|
-
//The directive was not directly referenced and does not contain anything that
|
|
9410
|
-
//was referenced. Therefore it must not be shown in output.
|
|
9411
|
-
return ;
|
|
9412
|
-
} else {
|
|
9413
|
-
if (!directiveNode.getIsReferenced()) {
|
|
9414
|
-
return;
|
|
9415
|
-
}
|
|
9416
|
-
}
|
|
9417
9771
|
return directiveNode;
|
|
9418
9772
|
},
|
|
9419
9773
|
|
|
@@ -9429,28 +9783,16 @@ ToCSSVisitor.prototype = {
|
|
|
9429
9783
|
},
|
|
9430
9784
|
|
|
9431
9785
|
visitRuleset: function (rulesetNode, visitArgs) {
|
|
9786
|
+
//at this point rulesets are nested into each other
|
|
9432
9787
|
var rule, rulesets = [];
|
|
9433
9788
|
if (rulesetNode.firstRoot) {
|
|
9434
9789
|
this.checkPropertiesInRoot(rulesetNode.rules);
|
|
9435
9790
|
}
|
|
9436
9791
|
if (! rulesetNode.root) {
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
.filter(function(p) {
|
|
9440
|
-
var i;
|
|
9441
|
-
if (p[0].elements[0].combinator.value === ' ') {
|
|
9442
|
-
p[0].elements[0].combinator = new(tree.Combinator)('');
|
|
9443
|
-
}
|
|
9444
|
-
for (i = 0; i < p.length; i++) {
|
|
9445
|
-
if (p[i].getIsReferenced() && p[i].getIsOutput()) {
|
|
9446
|
-
return true;
|
|
9447
|
-
}
|
|
9448
|
-
}
|
|
9449
|
-
return false;
|
|
9450
|
-
});
|
|
9451
|
-
}
|
|
9792
|
+
//remove invisible paths
|
|
9793
|
+
this._compileRulesetPaths(rulesetNode);
|
|
9452
9794
|
|
|
9453
|
-
//
|
|
9795
|
+
// remove rulesets from this ruleset body and compile them separately
|
|
9454
9796
|
var nodeRules = rulesetNode.rules, nodeRuleCnt = nodeRules ? nodeRules.length : 0;
|
|
9455
9797
|
for (var i = 0; i < nodeRuleCnt; ) {
|
|
9456
9798
|
rule = nodeRules[i];
|
|
@@ -9464,7 +9806,8 @@ ToCSSVisitor.prototype = {
|
|
|
9464
9806
|
i++;
|
|
9465
9807
|
}
|
|
9466
9808
|
// accept the visitor to remove rules and refactor itself
|
|
9467
|
-
// then we can decide
|
|
9809
|
+
// then we can decide nogw whether we want it or not
|
|
9810
|
+
// compile body
|
|
9468
9811
|
if (nodeRuleCnt > 0) {
|
|
9469
9812
|
rulesetNode.accept(this._visitor);
|
|
9470
9813
|
} else {
|
|
@@ -9472,33 +9815,46 @@ ToCSSVisitor.prototype = {
|
|
|
9472
9815
|
}
|
|
9473
9816
|
visitArgs.visitDeeper = false;
|
|
9474
9817
|
|
|
9475
|
-
|
|
9476
|
-
if (nodeRules) {
|
|
9477
|
-
this._mergeRules(nodeRules);
|
|
9478
|
-
nodeRules = rulesetNode.rules;
|
|
9479
|
-
}
|
|
9480
|
-
if (nodeRules) {
|
|
9481
|
-
this._removeDuplicateRules(nodeRules);
|
|
9482
|
-
nodeRules = rulesetNode.rules;
|
|
9483
|
-
}
|
|
9484
|
-
|
|
9485
|
-
// now decide whether we keep the ruleset
|
|
9486
|
-
if (nodeRules && nodeRules.length > 0 && rulesetNode.paths.length > 0) {
|
|
9487
|
-
rulesets.splice(0, 0, rulesetNode);
|
|
9488
|
-
}
|
|
9489
|
-
} else {
|
|
9818
|
+
} else { //if (! rulesetNode.root) {
|
|
9490
9819
|
rulesetNode.accept(this._visitor);
|
|
9491
9820
|
visitArgs.visitDeeper = false;
|
|
9492
|
-
if (rulesetNode.firstRoot || (rulesetNode.rules && rulesetNode.rules.length > 0)) {
|
|
9493
|
-
rulesets.splice(0, 0, rulesetNode);
|
|
9494
|
-
}
|
|
9495
9821
|
}
|
|
9822
|
+
|
|
9823
|
+
if (rulesetNode.rules) {
|
|
9824
|
+
this._mergeRules(rulesetNode.rules);
|
|
9825
|
+
this._removeDuplicateRules(rulesetNode.rules);
|
|
9826
|
+
}
|
|
9827
|
+
|
|
9828
|
+
//now decide whether we keep the ruleset
|
|
9829
|
+
if (this.utils.isVisibleRuleset(rulesetNode)) {
|
|
9830
|
+
rulesetNode.ensureVisibility();
|
|
9831
|
+
rulesets.splice(0, 0, rulesetNode);
|
|
9832
|
+
}
|
|
9833
|
+
|
|
9496
9834
|
if (rulesets.length === 1) {
|
|
9497
9835
|
return rulesets[0];
|
|
9498
9836
|
}
|
|
9499
9837
|
return rulesets;
|
|
9500
9838
|
},
|
|
9501
9839
|
|
|
9840
|
+
_compileRulesetPaths: function(rulesetNode) {
|
|
9841
|
+
if (rulesetNode.paths) {
|
|
9842
|
+
rulesetNode.paths = rulesetNode.paths
|
|
9843
|
+
.filter(function(p) {
|
|
9844
|
+
var i;
|
|
9845
|
+
if (p[0].elements[0].combinator.value === ' ') {
|
|
9846
|
+
p[0].elements[0].combinator = new(tree.Combinator)('');
|
|
9847
|
+
}
|
|
9848
|
+
for (i = 0; i < p.length; i++) {
|
|
9849
|
+
if (p[i].isVisible() && p[i].getIsOutput()) {
|
|
9850
|
+
return true;
|
|
9851
|
+
}
|
|
9852
|
+
}
|
|
9853
|
+
return false;
|
|
9854
|
+
});
|
|
9855
|
+
}
|
|
9856
|
+
},
|
|
9857
|
+
|
|
9502
9858
|
_removeDuplicateRules: function(rules) {
|
|
9503
9859
|
if (!rules) { return; }
|
|
9504
9860
|
|
|
@@ -9585,12 +9941,20 @@ ToCSSVisitor.prototype = {
|
|
|
9585
9941
|
rule.value = toValue(spacedGroups);
|
|
9586
9942
|
}
|
|
9587
9943
|
});
|
|
9944
|
+
},
|
|
9945
|
+
|
|
9946
|
+
visitAnonymous: function(anonymousNode, visitArgs) {
|
|
9947
|
+
if (anonymousNode.blocksVisibility()) {
|
|
9948
|
+
return ;
|
|
9949
|
+
}
|
|
9950
|
+
anonymousNode.accept(this._visitor);
|
|
9951
|
+
return anonymousNode;
|
|
9588
9952
|
}
|
|
9589
9953
|
};
|
|
9590
9954
|
|
|
9591
9955
|
module.exports = ToCSSVisitor;
|
|
9592
9956
|
|
|
9593
|
-
},{"../tree":
|
|
9957
|
+
},{"../tree":62,"./visitor":91}],91:[function(require,module,exports){
|
|
9594
9958
|
var tree = require("../tree");
|
|
9595
9959
|
|
|
9596
9960
|
var _visitArgs = { visitDeeper: true },
|
|
@@ -9744,7 +10108,7 @@ Visitor.prototype = {
|
|
|
9744
10108
|
};
|
|
9745
10109
|
module.exports = Visitor;
|
|
9746
10110
|
|
|
9747
|
-
},{"../tree":
|
|
10111
|
+
},{"../tree":62}],92:[function(require,module,exports){
|
|
9748
10112
|
// shim for using process in browser
|
|
9749
10113
|
|
|
9750
10114
|
var process = module.exports = {};
|
|
@@ -9804,7 +10168,7 @@ process.chdir = function (dir) {
|
|
|
9804
10168
|
};
|
|
9805
10169
|
process.umask = function() { return 0; };
|
|
9806
10170
|
|
|
9807
|
-
},{}],
|
|
10171
|
+
},{}],93:[function(require,module,exports){
|
|
9808
10172
|
'use strict';
|
|
9809
10173
|
|
|
9810
10174
|
var asap = require('asap')
|
|
@@ -9911,7 +10275,7 @@ function doResolve(fn, onFulfilled, onRejected) {
|
|
|
9911
10275
|
}
|
|
9912
10276
|
}
|
|
9913
10277
|
|
|
9914
|
-
},{"asap":
|
|
10278
|
+
},{"asap":95}],94:[function(require,module,exports){
|
|
9915
10279
|
'use strict';
|
|
9916
10280
|
|
|
9917
10281
|
//This file contains the ES6 extensions to the core Promises/A+ API
|
|
@@ -10021,7 +10385,7 @@ Promise.prototype['catch'] = function (onRejected) {
|
|
|
10021
10385
|
return this.then(null, onRejected);
|
|
10022
10386
|
}
|
|
10023
10387
|
|
|
10024
|
-
},{"./core.js":
|
|
10388
|
+
},{"./core.js":93,"asap":95}],95:[function(require,module,exports){
|
|
10025
10389
|
(function (process){
|
|
10026
10390
|
|
|
10027
10391
|
// Use the fastest possible means to execute a task in a future turn
|
|
@@ -10138,7 +10502,7 @@ module.exports = asap;
|
|
|
10138
10502
|
|
|
10139
10503
|
|
|
10140
10504
|
}).call(this,require('_process'))
|
|
10141
|
-
},{"_process":
|
|
10505
|
+
},{"_process":92}],96:[function(require,module,exports){
|
|
10142
10506
|
// should work in any browser without browserify
|
|
10143
10507
|
|
|
10144
10508
|
if (typeof Promise.prototype.done !== 'function') {
|
|
@@ -10151,7 +10515,7 @@ if (typeof Promise.prototype.done !== 'function') {
|
|
|
10151
10515
|
})
|
|
10152
10516
|
}
|
|
10153
10517
|
}
|
|
10154
|
-
},{}],
|
|
10518
|
+
},{}],97:[function(require,module,exports){
|
|
10155
10519
|
// not "use strict" so we can declare global "Promise"
|
|
10156
10520
|
|
|
10157
10521
|
var asap = require('asap');
|
|
@@ -10163,5 +10527,5 @@ if (typeof Promise === 'undefined') {
|
|
|
10163
10527
|
|
|
10164
10528
|
require('./polyfill-done.js');
|
|
10165
10529
|
|
|
10166
|
-
},{"./lib/core.js":
|
|
10530
|
+
},{"./lib/core.js":93,"./lib/es6-extensions.js":94,"./polyfill-done.js":96,"asap":95}]},{},[2])(2)
|
|
10167
10531
|
});
|