source: trip-planner-front/node_modules/autoprefixer/lib/hacks/writing-mode.js

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

initial commit

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[6a3a178]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 Declaration = require('../declaration');
10
11var WritingMode = /*#__PURE__*/function (_Declaration) {
12 _inheritsLoose(WritingMode, _Declaration);
13
14 function WritingMode() {
15 return _Declaration.apply(this, arguments) || this;
16 }
17
18 var _proto = WritingMode.prototype;
19
20 _proto.insert = function insert(decl, prefix, prefixes) {
21 if (prefix === '-ms-') {
22 var cloned = this.set(this.clone(decl), prefix);
23
24 if (this.needCascade(decl)) {
25 cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
26 }
27
28 var direction = 'ltr';
29 decl.parent.nodes.forEach(function (i) {
30 if (i.prop === 'direction') {
31 if (i.value === 'rtl' || i.value === 'ltr') direction = i.value;
32 }
33 });
34 cloned.value = WritingMode.msValues[direction][decl.value] || decl.value;
35 return decl.parent.insertBefore(decl, cloned);
36 }
37
38 return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
39 };
40
41 return WritingMode;
42}(Declaration);
43
44_defineProperty(WritingMode, "names", ['writing-mode']);
45
46_defineProperty(WritingMode, "msValues", {
47 ltr: {
48 'horizontal-tb': 'lr-tb',
49 'vertical-rl': 'tb-rl',
50 'vertical-lr': 'tb-lr'
51 },
52 rtl: {
53 'horizontal-tb': 'rl-tb',
54 'vertical-rl': 'bt-rl',
55 'vertical-lr': 'bt-lr'
56 }
57});
58
59module.exports = WritingMode;
Note: See TracBrowser for help on using the repository browser.