@amaui/style
Version:
CSS in JS styling solution
52 lines (51 loc) • 1.66 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils");
function rtl(amauiStyle) {
const method = (value_) => {
const value = {
value: {
value: '',
property: '',
},
arguments: {
value: value_,
},
};
if ((0, utils_1.is)('string', value_.value)) {
if (value_.value.indexOf('left') > -1)
value.value.value = value_.value.replace(/left/ig, 'right');
else if (value_.value.indexOf('right') > -1)
value.value.value = value_.value.replace(/right/ig, 'left');
else
value.value.value = value_.value;
}
if ((0, utils_1.is)('string', value_.property)) {
if (value_.property.indexOf('left') > -1)
value.value.property = value_.property.replace(/left/ig, 'right');
else if (value_.property.indexOf('right') > -1)
value.value.property = value_.property.replace(/right/ig, 'left');
else
value.value.property = value_.property;
}
return value;
};
// Add method to subscriptions
if (amauiStyle) {
amauiStyle.subscriptions.rule.rtl.subscribe(method);
}
const remove = () => {
// Remove method from subscriptions
if (amauiStyle) {
amauiStyle.subscriptions.rule.rtl.unsubscribe(method);
}
};
const response = {
methods: {
method,
},
remove,
};
return response;
}
exports.default = rtl;