react-native-web-internals
Version:
React Native for Web
67 lines (66 loc) • 2.46 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function")
for (let key of __getOwnPropNames(from))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var validate_exports = {};
__export(validate_exports, {
validate: () => validate
});
module.exports = __toCommonJS(validate_exports);
const invalidShortforms = {
background: !0,
borderBottom: !0,
borderLeft: !0,
borderRight: !0,
borderTop: !0,
font: !0,
grid: !0,
outline: !0,
textDecoration: !0
}, invalidMultiValueShortforms = {
flex: !0,
margin: !0,
padding: !0,
borderColor: !0,
borderRadius: !0,
borderStyle: !0,
borderWidth: !0,
marginHorizontal: !0,
marginVertical: !0,
paddingHorizontal: !0,
paddingVertical: !0,
overflow: !0,
overscrollBehavior: !0,
backgroundPosition: !0
};
function error(message) {
console.error(message);
}
function validate(obj) {
for (const k in obj) {
const prop = k.trim(), value = obj[prop];
let isInvalid = !1;
if (value !== null) {
if (typeof value == "string" && value.indexOf("!important") > -1)
error(
`Invalid style declaration "${prop}:${value}". Values cannot include "!important"`
), isInvalid = !0;
else {
let suggestion = "";
prop === "animation" || prop === "animationName" ? (suggestion = 'Did you mean "animationKeyframes"?', isInvalid = !0) : prop === "direction" ? (suggestion = 'Did you mean "writingDirection"?', isInvalid = !0) : prop === "verticalAlign" ? (suggestion = 'Did you mean "textAlignVertical"?', isInvalid = !0) : invalidShortforms[prop] ? (suggestion = "Please use long-form properties.", isInvalid = !0) : invalidMultiValueShortforms[prop], suggestion !== "" && error(`Invalid style property of "${prop}". ${suggestion}`);
}
isInvalid && delete obj[k];
}
}
}
//# sourceMappingURL=validate.js.map