source: trip-planner-front/node_modules/autoprefixer/lib/hacks/intrinsic.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.5 KB
Line 
1"use strict";
2
3function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
4
5function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
6
7function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
9var OldValue = require('../old-value');
10
11var Value = require('../value');
12
13function _regexp(name) {
14 return new RegExp("(^|[\\s,(])(" + name + "($|[\\s),]))", 'gi');
15}
16
17var Intrinsic = /*#__PURE__*/function (_Value) {
18 _inheritsLoose(Intrinsic, _Value);
19
20 function Intrinsic() {
21 return _Value.apply(this, arguments) || this;
22 }
23
24 var _proto = Intrinsic.prototype;
25
26 _proto.regexp = function regexp() {
27 if (!this.regexpCache) this.regexpCache = _regexp(this.name);
28 return this.regexpCache;
29 };
30
31 _proto.isStretch = function isStretch() {
32 return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
33 };
34
35 _proto.replace = function replace(string, prefix) {
36 if (prefix === '-moz-' && this.isStretch()) {
37 return string.replace(this.regexp(), '$1-moz-available$3');
38 }
39
40 if (prefix === '-webkit-' && this.isStretch()) {
41 return string.replace(this.regexp(), '$1-webkit-fill-available$3');
42 }
43
44 return _Value.prototype.replace.call(this, string, prefix);
45 };
46
47 _proto.old = function old(prefix) {
48 var prefixed = prefix + this.name;
49
50 if (this.isStretch()) {
51 if (prefix === '-moz-') {
52 prefixed = '-moz-available';
53 } else if (prefix === '-webkit-') {
54 prefixed = '-webkit-fill-available';
55 }
56 }
57
58 return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
59 };
60
61 _proto.add = function add(decl, prefix) {
62 if (decl.prop.includes('grid') && prefix !== '-webkit-') {
63 return undefined;
64 }
65
66 return _Value.prototype.add.call(this, decl, prefix);
67 };
68
69 return Intrinsic;
70}(Value);
71
72_defineProperty(Intrinsic, "names", ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']);
73
74module.exports = Intrinsic;
Note: See TracBrowser for help on using the repository browser.