@pdfme/ui 5.3.11-dev.5 → 5.3.11-dev.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.
package/dist/index.es.js
CHANGED
@@ -81633,9 +81633,11 @@ const getBrowserVerticalFontAdjustments = (a, s, c, u) => {
|
|
81633
81633
|
if (c.has(d))
|
81634
81634
|
return c.get(d);
|
81635
81635
|
let A = (s[u] || getFallbackFont(s) || getDefaultFont()[DEFAULT_FONT_NAME]).data;
|
81636
|
-
typeof A == "string" && (A = A.startsWith("http") ? await fetch(A).then((
|
81637
|
-
|
81638
|
-
|
81636
|
+
typeof A == "string" && (A = A.startsWith("http") ? await fetch(A).then((g) => g.arrayBuffer()) : b64toUint8Array(A));
|
81637
|
+
let v;
|
81638
|
+
A instanceof bufferExports.Buffer ? v = A : v = bufferExports.Buffer.from(A);
|
81639
|
+
const b = $d636bc798e7178db$export$185802fd694ee1f5(v);
|
81640
|
+
return c.set(d, b), b;
|
81639
81641
|
}, calculateDynamicFontSize = ({ textSchema: a, fontKitFont: s, value: c, startingFontSize: u }) => {
|
81640
81642
|
const { fontSize: d, dynamicFontSize: p, characterSpacing: A, width: v, height: b, lineHeight: g = DEFAULT_LINE_HEIGHT } = a, x = u || d || DEFAULT_FONT_SIZE;
|
81641
81643
|
if (!p || p.max < p.min)
|
@@ -81722,25 +81724,33 @@ function containsJapanese(a) {
|
|
81722
81724
|
const filterStartJP = (a) => {
|
81723
81725
|
const s = [];
|
81724
81726
|
let c = null;
|
81725
|
-
|
81727
|
+
if (a.slice().reverse().forEach((u) => {
|
81726
81728
|
if (u.trim().length === 0)
|
81727
81729
|
s.push("");
|
81728
81730
|
else {
|
81729
81731
|
const d = u.charAt(0);
|
81730
81732
|
LINE_START_FORBIDDEN_CHARS.includes(d) ? u.trim().length === 1 ? (s.push(u), c = null) : (c ? s.push(u.slice(1) + c) : s.push(u.slice(1)), c = d) : c ? (s.push(u + c), c = null) : s.push(u);
|
81731
81733
|
}
|
81732
|
-
}), c
|
81734
|
+
}), c) {
|
81735
|
+
const u = s.length > 0 ? s[0] : "";
|
81736
|
+
return [String(c) + String(u), ...s.slice(1)].reverse();
|
81737
|
+
} else
|
81738
|
+
return s.reverse();
|
81733
81739
|
}, filterEndJP = (a) => {
|
81734
81740
|
const s = [];
|
81735
81741
|
let c = null;
|
81736
|
-
|
81742
|
+
if (a.forEach((u) => {
|
81737
81743
|
if (u.trim().length === 0)
|
81738
81744
|
s.push("");
|
81739
81745
|
else {
|
81740
81746
|
const d = u.slice(-1);
|
81741
81747
|
LINE_END_FORBIDDEN_CHARS.includes(d) ? u.trim().length === 1 ? (s.push(u), c = null) : (c ? s.push(c + u.slice(0, -1)) : s.push(u.slice(0, -1)), c = d) : c ? (s.push(c + u), c = null) : s.push(u);
|
81742
81748
|
}
|
81743
|
-
}), c
|
81749
|
+
}), c) {
|
81750
|
+
const u = s.length > 0 ? s[s.length - 1] : "", d = String(u) + String(c);
|
81751
|
+
return [...s.slice(0, -1), d];
|
81752
|
+
} else
|
81753
|
+
return s;
|
81744
81754
|
};
|
81745
81755
|
let Cell$2 = class {
|
81746
81756
|
constructor(s, c, u) {
|
@@ -82258,7 +82268,7 @@ const DEFAULT_OPACITY = 1, HEX_COLOR_PATTERN = "^#(?:[A-Fa-f0-9]{6})$", getBody$
|
|
82258
82268
|
return String(A);
|
82259
82269
|
const [v, b = {}, g = []] = A, x = String(v), y = Object.entries(b).map(([m, C]) => `${m}="${C}"`).join(" ");
|
82260
82270
|
let f = "";
|
82261
|
-
return Array.isArray(g) && g.length > 0 && (f = g.map((m) => d(m)).join("")), f ? `<${x}${y ? " " + y : ""}>${f}</${x}>` : `<${x}${y ? " " + y : ""}/>`;
|
82271
|
+
return Array.isArray(g) && g.length > 0 && (f = g.map((m) => d(m)).join("")), f ? `<${String(x)}${y ? " " + String(y) : ""}>${f}</${String(x)}>` : `<${String(x)}${y ? " " + String(y) : ""}/>`;
|
82262
82272
|
}, p = Array.isArray(a) ? a.map((A) => d(A)).join("") : d(a);
|
82263
82273
|
return `<svg ${u}>${p}</svg>`;
|
82264
82274
|
}, embedAndGetFontObj = async (a) => {
|
@@ -82657,7 +82667,7 @@ const UseDynamicFontSize = (a) => {
|
|
82657
82667
|
let w;
|
82658
82668
|
C.addEventListener("keyup", () => {
|
82659
82669
|
setTimeout(() => {
|
82660
|
-
(
|
82670
|
+
(() => {
|
82661
82671
|
if (!C.textContent)
|
82662
82672
|
return;
|
82663
82673
|
w = calculateDynamicFontSize({
|
@@ -82680,16 +82690,15 @@ const UseDynamicFontSize = (a) => {
|
|
82680
82690
|
w && I && (I.selectNodeContents(C), I.collapse(!1), w == null || w.removeAllRanges(), w == null || w.addRange(I));
|
82681
82691
|
});
|
82682
82692
|
}, buildStyledTextContainer = (a, s, c) => {
|
82683
|
-
const { schema: u, rootElement: d, mode: p
|
82684
|
-
|
82685
|
-
|
82686
|
-
u.dynamicFontSize && c && (b = calculateDynamicFontSize({
|
82693
|
+
const { schema: u, rootElement: d, mode: p } = a;
|
82694
|
+
let A;
|
82695
|
+
u.dynamicFontSize && c && (A = calculateDynamicFontSize({
|
82687
82696
|
textSchema: u,
|
82688
82697
|
fontKitFont: s,
|
82689
82698
|
value: c,
|
82690
|
-
startingFontSize:
|
82699
|
+
startingFontSize: A
|
82691
82700
|
}));
|
82692
|
-
const { topAdj:
|
82701
|
+
const { topAdj: v, bottomAdj: b } = getBrowserVerticalFontAdjustments(s, A ?? u.fontSize ?? DEFAULT_FONT_SIZE, u.lineHeight ?? DEFAULT_LINE_HEIGHT, u.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT), g = v.toString(), x = b.toString(), y = document.createElement("div"), f = {
|
82693
82702
|
padding: 0,
|
82694
82703
|
resize: "none",
|
82695
82704
|
backgroundColor: getBackgroundColor(c, u),
|
@@ -82701,14 +82710,14 @@ const UseDynamicFontSize = (a) => {
|
|
82701
82710
|
height: "100%",
|
82702
82711
|
cursor: isEditable(p, u) ? "text" : "default"
|
82703
82712
|
};
|
82704
|
-
Object.assign(
|
82705
|
-
const
|
82706
|
-
u.strikethrough &&
|
82707
|
-
const
|
82713
|
+
Object.assign(y.style, f), d.innerHTML = "", d.appendChild(y);
|
82714
|
+
const m = [];
|
82715
|
+
u.strikethrough && m.push("line-through"), u.underline && m.push("underline");
|
82716
|
+
const C = {
|
82708
82717
|
// Font formatting styles
|
82709
82718
|
fontFamily: u.fontName ? `'${u.fontName}'` : "inherit",
|
82710
82719
|
color: u.fontColor ? u.fontColor : DEFAULT_FONT_COLOR,
|
82711
|
-
fontSize: `${
|
82720
|
+
fontSize: `${A ?? u.fontSize ?? DEFAULT_FONT_SIZE}pt`,
|
82712
82721
|
letterSpacing: `${u.characterSpacing ?? DEFAULT_CHARACTER_SPACING}pt`,
|
82713
82722
|
lineHeight: `${u.lineHeight ?? DEFAULT_LINE_HEIGHT}em`,
|
82714
82723
|
textAlign: u.alignment ?? DEFAULT_ALIGNMENT,
|
@@ -82718,12 +82727,12 @@ const UseDynamicFontSize = (a) => {
|
|
82718
82727
|
resize: "none",
|
82719
82728
|
border: "none",
|
82720
82729
|
outline: "none",
|
82721
|
-
marginBottom: `${
|
82722
|
-
paddingTop: `${
|
82730
|
+
marginBottom: `${x}px`,
|
82731
|
+
paddingTop: `${g}px`,
|
82723
82732
|
backgroundColor: "transparent",
|
82724
|
-
textDecoration:
|
82725
|
-
},
|
82726
|
-
return
|
82733
|
+
textDecoration: m.join(" ")
|
82734
|
+
}, S = document.createElement("div");
|
82735
|
+
return S.id = "text-" + String(u.id), Object.assign(S.style, C), y.appendChild(S), S;
|
82727
82736
|
}, makeElementPlainTextContentEditable = (a) => {
|
82728
82737
|
if (!isFirefox()) {
|
82729
82738
|
a.contentEditable = "plaintext-only";
|