html-react-parser 4.2.6 → 4.2.7
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.
|
@@ -2169,15 +2169,27 @@
|
|
|
2169
2169
|
var NO_HYPHEN_REGEX = /^[^-]+$/;
|
|
2170
2170
|
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
|
|
2171
2171
|
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
|
|
2172
|
+
/**
|
|
2173
|
+
* Checks whether to skip camelCase.
|
|
2174
|
+
*/
|
|
2172
2175
|
var skipCamelCase = function (property) {
|
|
2173
2176
|
return !property ||
|
|
2174
2177
|
NO_HYPHEN_REGEX.test(property) ||
|
|
2175
2178
|
CUSTOM_PROPERTY_REGEX.test(property);
|
|
2176
2179
|
};
|
|
2180
|
+
/**
|
|
2181
|
+
* Replacer that capitalizes first character.
|
|
2182
|
+
*/
|
|
2177
2183
|
var capitalize = function (match, character) {
|
|
2178
2184
|
return character.toUpperCase();
|
|
2179
2185
|
};
|
|
2186
|
+
/**
|
|
2187
|
+
* Replacer that removes beginning hyphen of vendor prefix property.
|
|
2188
|
+
*/
|
|
2180
2189
|
var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
|
|
2190
|
+
/**
|
|
2191
|
+
* CamelCases a CSS property.
|
|
2192
|
+
*/
|
|
2181
2193
|
var camelCase = function (property, options) {
|
|
2182
2194
|
if (options === void 0) { options = {}; }
|
|
2183
2195
|
if (skipCamelCase(property)) {
|
|
@@ -2185,9 +2197,11 @@
|
|
|
2185
2197
|
}
|
|
2186
2198
|
property = property.toLowerCase();
|
|
2187
2199
|
if (options.reactCompat) {
|
|
2200
|
+
// `-ms` vendor prefix should not be capitalized
|
|
2188
2201
|
property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
|
|
2189
2202
|
}
|
|
2190
2203
|
else {
|
|
2204
|
+
// for non-React, remove first hyphen so vendor prefix is not capitalized
|
|
2191
2205
|
property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
|
|
2192
2206
|
}
|
|
2193
2207
|
return property.replace(HYPHEN_REGEX, capitalize);
|
|
@@ -2200,12 +2214,16 @@
|
|
|
2200
2214
|
Object.defineProperty(cjs$1, "__esModule", { value: true });
|
|
2201
2215
|
var style_to_object_1 = __importDefault(cjs);
|
|
2202
2216
|
var utilities_1 = utilities$3;
|
|
2217
|
+
/**
|
|
2218
|
+
* Parses CSS inline style to JavaScript object (camelCased).
|
|
2219
|
+
*/
|
|
2203
2220
|
function StyleToJS(style, options) {
|
|
2204
2221
|
var output = {};
|
|
2205
2222
|
if (!style || typeof style !== 'string') {
|
|
2206
2223
|
return output;
|
|
2207
2224
|
}
|
|
2208
2225
|
(0, style_to_object_1.default)(style, function (property, value) {
|
|
2226
|
+
// skip CSS comment
|
|
2209
2227
|
if (property && value) {
|
|
2210
2228
|
output[(0, utilities_1.camelCase)(property, options)] = value;
|
|
2211
2229
|
}
|