@embedpdf/models 1.0.17 → 1.0.19
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.
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/logger.d.ts +24 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -3
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +108 -61
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -386,15 +386,15 @@ class PerfLogger {
|
|
|
386
386
|
perf(source, category, event, phase, identifier, ...args) {
|
|
387
387
|
switch (phase) {
|
|
388
388
|
case "Begin":
|
|
389
|
-
|
|
389
|
+
globalThis.performance.mark(`${source}.${category}.${event}.${phase}.${identifier}`, {
|
|
390
390
|
detail: args
|
|
391
391
|
});
|
|
392
392
|
break;
|
|
393
393
|
case "End":
|
|
394
|
-
|
|
394
|
+
globalThis.performance.mark(`${source}.${category}.${event}.${phase}.${identifier}`, {
|
|
395
395
|
detail: args
|
|
396
396
|
});
|
|
397
|
-
|
|
397
|
+
globalThis.performance.measure(
|
|
398
398
|
`${source}.${category}.${event}.Measure.${identifier}`,
|
|
399
399
|
`${source}.${category}.${event}.Begin.${identifier}`,
|
|
400
400
|
`${source}.${category}.${event}.End.${identifier}`
|
|
@@ -1673,6 +1673,60 @@ const blendModeSelectOptions = BLEND_MODE_INFOS.map((info) => ({
|
|
|
1673
1673
|
function uiBlendModeDisplay(value) {
|
|
1674
1674
|
return value === MixedBlendMode ? "(mixed)" : blendModeLabel(value);
|
|
1675
1675
|
}
|
|
1676
|
+
function serializeLogger(logger) {
|
|
1677
|
+
if (logger instanceof NoopLogger) {
|
|
1678
|
+
return { type: "noop" };
|
|
1679
|
+
}
|
|
1680
|
+
if (logger instanceof ConsoleLogger) {
|
|
1681
|
+
return { type: "console" };
|
|
1682
|
+
}
|
|
1683
|
+
if (logger instanceof PerfLogger) {
|
|
1684
|
+
return { type: "perf" };
|
|
1685
|
+
}
|
|
1686
|
+
if (logger instanceof LevelLogger) {
|
|
1687
|
+
const levelLogger = logger;
|
|
1688
|
+
return {
|
|
1689
|
+
type: "level",
|
|
1690
|
+
config: {
|
|
1691
|
+
level: levelLogger.level,
|
|
1692
|
+
logger: serializeLogger(levelLogger.logger)
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
if (logger instanceof AllLogger) {
|
|
1697
|
+
const allLogger = logger;
|
|
1698
|
+
return {
|
|
1699
|
+
type: "all",
|
|
1700
|
+
config: {
|
|
1701
|
+
loggers: allLogger.loggers.map(serializeLogger)
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
return { type: "noop" };
|
|
1706
|
+
}
|
|
1707
|
+
function deserializeLogger(serialized) {
|
|
1708
|
+
var _a, _b, _c;
|
|
1709
|
+
switch (serialized.type) {
|
|
1710
|
+
case "noop":
|
|
1711
|
+
return new NoopLogger();
|
|
1712
|
+
case "console":
|
|
1713
|
+
return new ConsoleLogger();
|
|
1714
|
+
case "perf":
|
|
1715
|
+
return new PerfLogger();
|
|
1716
|
+
case "level":
|
|
1717
|
+
if (!((_a = serialized.config) == null ? void 0 : _a.logger) || ((_b = serialized.config) == null ? void 0 : _b.level) === void 0) {
|
|
1718
|
+
throw new Error("LevelLogger requires logger and level in config");
|
|
1719
|
+
}
|
|
1720
|
+
return new LevelLogger(deserializeLogger(serialized.config.logger), serialized.config.level);
|
|
1721
|
+
case "all":
|
|
1722
|
+
if (!((_c = serialized.config) == null ? void 0 : _c.loggers)) {
|
|
1723
|
+
throw new Error("AllLogger requires loggers array in config");
|
|
1724
|
+
}
|
|
1725
|
+
return new AllLogger(serialized.config.loggers.map(deserializeLogger));
|
|
1726
|
+
default:
|
|
1727
|
+
return new NoopLogger();
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1676
1730
|
const V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1677
1731
|
function isUuidV4(str) {
|
|
1678
1732
|
return V4_REGEX.test(str);
|
|
@@ -1773,6 +1827,7 @@ export {
|
|
|
1773
1827
|
cssToBlendMode,
|
|
1774
1828
|
cssToTextAlignment,
|
|
1775
1829
|
dateToPdfDate,
|
|
1830
|
+
deserializeLogger,
|
|
1776
1831
|
expandRect,
|
|
1777
1832
|
extractPdfColor,
|
|
1778
1833
|
extractWebOpacity,
|
|
@@ -1804,6 +1859,7 @@ export {
|
|
|
1804
1859
|
rotateRect,
|
|
1805
1860
|
scalePosition,
|
|
1806
1861
|
scaleRect,
|
|
1862
|
+
serializeLogger,
|
|
1807
1863
|
standardFontCss,
|
|
1808
1864
|
standardFontFamily,
|
|
1809
1865
|
standardFontFamilyLabel,
|