html-react-parser 6.1.3 → 6.1.4
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.
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
var isInstance = false;
|
|
32
32
|
try {
|
|
33
33
|
isInstance = this instanceof a;
|
|
34
|
-
} catch {}
|
|
34
|
+
} catch (e) {}
|
|
35
35
|
if (isInstance) {
|
|
36
36
|
return Reflect.construct(f, arguments, this.constructor);
|
|
37
37
|
}
|
|
@@ -2048,13 +2048,11 @@
|
|
|
2048
2048
|
|
|
2049
2049
|
var utilities = {};
|
|
2050
2050
|
|
|
2051
|
-
var cjs$1
|
|
2052
|
-
|
|
2053
|
-
var cjs;
|
|
2051
|
+
var cjs$1;
|
|
2054
2052
|
var hasRequiredCjs$1;
|
|
2055
2053
|
|
|
2056
2054
|
function requireCjs$1 () {
|
|
2057
|
-
if (hasRequiredCjs$1) return cjs;
|
|
2055
|
+
if (hasRequiredCjs$1) return cjs$1;
|
|
2058
2056
|
hasRequiredCjs$1 = 1;
|
|
2059
2057
|
|
|
2060
2058
|
// http://www.w3.org/TR/CSS21/grammar.html
|
|
@@ -2315,60 +2313,77 @@
|
|
|
2315
2313
|
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
2316
2314
|
}
|
|
2317
2315
|
|
|
2318
|
-
cjs = index;
|
|
2316
|
+
cjs$1 = index;
|
|
2319
2317
|
|
|
2320
|
-
return cjs;
|
|
2318
|
+
return cjs$1;
|
|
2321
2319
|
}
|
|
2322
2320
|
|
|
2321
|
+
var cjs;
|
|
2323
2322
|
var hasRequiredCjs;
|
|
2324
2323
|
|
|
2325
2324
|
function requireCjs () {
|
|
2326
|
-
if (hasRequiredCjs) return cjs
|
|
2325
|
+
if (hasRequiredCjs) return cjs;
|
|
2327
2326
|
hasRequiredCjs = 1;
|
|
2328
|
-
|
|
2329
|
-
|
|
2327
|
+
//#region \0rolldown/runtime.js
|
|
2328
|
+
var __create = Object.create;
|
|
2329
|
+
var __defProp = Object.defineProperty;
|
|
2330
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2331
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2332
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2333
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2334
|
+
var __copyProps = (to, from, except, desc) => {
|
|
2335
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
2336
|
+
key = keys[i];
|
|
2337
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
2338
|
+
get: ((k) => from[k]).bind(null, key),
|
|
2339
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
return to;
|
|
2330
2343
|
};
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2344
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(!mod || !mod.__esModule ? __defProp(target, "default", {
|
|
2345
|
+
value: mod,
|
|
2346
|
+
enumerable: true
|
|
2347
|
+
}) : target, mod));
|
|
2348
|
+
//#endregion
|
|
2349
|
+
let inline_style_parser = requireCjs$1();
|
|
2350
|
+
inline_style_parser = __toESM(inline_style_parser);
|
|
2351
|
+
//#region src/index.ts
|
|
2334
2352
|
/**
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2353
|
+
* Parses inline style to object.
|
|
2354
|
+
*
|
|
2355
|
+
* @param style - Inline style.
|
|
2356
|
+
* @param iterator - Iterator.
|
|
2357
|
+
* @returns - Style object or null.
|
|
2358
|
+
*
|
|
2359
|
+
* @example Parsing inline style to object:
|
|
2360
|
+
*
|
|
2361
|
+
* ```js
|
|
2362
|
+
* import parse from 'style-to-object';
|
|
2363
|
+
* parse('line-height: 42;'); // { 'line-height': '42' }
|
|
2364
|
+
* ```
|
|
2365
|
+
*/
|
|
2348
2366
|
function StyleToObject(style, iterator) {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
else if (value) {
|
|
2364
|
-
styleObject = styleObject || {};
|
|
2365
|
-
styleObject[property] = value;
|
|
2366
|
-
}
|
|
2367
|
-
});
|
|
2368
|
-
return styleObject;
|
|
2367
|
+
let styleObject = null;
|
|
2368
|
+
if (!style || typeof style !== "string") return styleObject;
|
|
2369
|
+
const declarations = (0, inline_style_parser.default)(style);
|
|
2370
|
+
const hasIterator = typeof iterator === "function";
|
|
2371
|
+
declarations.forEach((declaration) => {
|
|
2372
|
+
if (declaration.type !== "declaration") return;
|
|
2373
|
+
const { property, value } = declaration;
|
|
2374
|
+
if (hasIterator) iterator(property, value, declaration);
|
|
2375
|
+
else if (value) {
|
|
2376
|
+
styleObject = styleObject ?? {};
|
|
2377
|
+
styleObject[property] = value;
|
|
2378
|
+
}
|
|
2379
|
+
});
|
|
2380
|
+
return styleObject;
|
|
2369
2381
|
}
|
|
2382
|
+
//#endregion
|
|
2383
|
+
cjs = StyleToObject;
|
|
2384
|
+
|
|
2370
2385
|
|
|
2371
|
-
return cjs
|
|
2386
|
+
return cjs;
|
|
2372
2387
|
}
|
|
2373
2388
|
|
|
2374
2389
|
var dist;
|