@campxdev/pdfme 1.2.0 → 1.2.1
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/cjs/chunks/{helper-DU7Bm8ZQ.js → helper-C2o2tpNj.js} +2 -1
- package/dist/cjs/chunks/{index-Co0Y0KJj.js → index-CXm3doOM.js} +31 -4
- package/dist/cjs/chunks/{index-mgS9yYj7.js → index-dHRmLCnu.js} +4 -4
- package/dist/cjs/chunks/{index-BzWo8eqh.js → index-qB7eb2BC.js} +2 -2
- package/dist/cjs/chunks/{pluginRegistry-DlJQZP6L.js → pluginRegistry-Ba3ANzzx.js} +1 -1
- package/dist/cjs/common.js +3 -3
- package/dist/cjs/converter.js +1 -1
- package/dist/cjs/generator.js +3 -3
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/print-designer-editor.js +223 -128
- package/dist/cjs/schemas.js +3 -3
- package/dist/cjs/ui.js +106 -83
- package/dist/esm/chunks/{helper-C8LqGaF4.js → helper-D7XF1bxK.js} +2 -1
- package/dist/esm/chunks/{index-d0iAk7OA.js → index-D1FuD_XZ.js} +3 -3
- package/dist/esm/chunks/{index-Rwcd_Vzj.js → index-pDt5vVVj.js} +4 -4
- package/dist/esm/chunks/{index-CwqHuiCe.js → index-qTsnfbi7.js} +32 -5
- package/dist/esm/chunks/{pluginRegistry-C0a91XEw.js → pluginRegistry-DEA2P0ud.js} +1 -1
- package/dist/esm/common.js +3 -3
- package/dist/esm/converter.js +1 -1
- package/dist/esm/generator.js +3 -3
- package/dist/esm/index.js +5 -5
- package/dist/esm/print-designer-editor.js +224 -129
- package/dist/esm/schemas.js +5 -5
- package/dist/esm/ui.js +106 -83
- package/dist/types/_vendors/schemas/text/extraFormatter.d.ts +2 -0
- package/dist/types/_vendors/schemas/text/helper.d.ts +1 -0
- package/dist/types/_vendors/schemas/text/icons/index.d.ts +2 -0
- package/dist/types/_vendors/schemas/text/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/schemas.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as propPanel$1, p as pdfRender$2, u as uiRender$2, c as createSvgStr, d as convertForPdfLayoutProps, i as isEditable, a as addAlphaToHex, k as createErrorElm, D as DEFAULT_OPACITY, H as HEX_COLOR_PATTERN, n as getBodyWithRange, o as createSingleTable, q as getBody, f as getDefaultCellStyles, t as getColumnStylesPropPanelSchema, v as getCellPropPanelSchema, w as DEFAULT_FONT_COLOR, x as DEFAULT_CHARACTER_SPACING, y as DEFAULT_FONT_SIZE, z as DEFAULT_ALIGNMENT, A as getExtraFormatterSchema, F as Formatter, B as DEFAULT_LINE_HEIGHT, V as VERTICAL_ALIGN_MIDDLE, C as mapVerticalAlignToFlex } from './chunks/index-
|
|
2
|
-
export { b as builtInPlugins, g as getDynamicHeightsForTable, s as multiVariableText } from './chunks/index-
|
|
3
|
-
import { c as validateBarcodeInput, f as createBarCode, D as DEFAULT_BARCODE_COLOR, g as DEFAULT_BARCODE_BG_COLOR, h as DEFAULT_BARCODE_INCLUDETEXT, B as BARCODE_TYPES, r as rectangle, j as cellSchema } from './chunks/index-
|
|
4
|
-
export { d as dynamicBarcode, a as dynamicQrCode, b as dynamicTable, e as ellipse, i as image, l as line, s as signature, v as variableBarcodes } from './chunks/index-
|
|
1
|
+
import { m as propPanel$1, p as pdfRender$2, u as uiRender$2, c as createSvgStr, d as convertForPdfLayoutProps, i as isEditable, a as addAlphaToHex, k as createErrorElm, D as DEFAULT_OPACITY, H as HEX_COLOR_PATTERN, n as getBodyWithRange, o as createSingleTable, q as getBody, f as getDefaultCellStyles, t as getColumnStylesPropPanelSchema, v as getCellPropPanelSchema, w as DEFAULT_FONT_COLOR, x as DEFAULT_CHARACTER_SPACING, y as DEFAULT_FONT_SIZE, z as DEFAULT_ALIGNMENT, A as getExtraFormatterSchema, F as Formatter, B as DEFAULT_LINE_HEIGHT, V as VERTICAL_ALIGN_MIDDLE, C as mapVerticalAlignToFlex } from './chunks/index-qTsnfbi7.js';
|
|
2
|
+
export { b as builtInPlugins, g as getDynamicHeightsForTable, s as multiVariableText } from './chunks/index-qTsnfbi7.js';
|
|
3
|
+
import { c as validateBarcodeInput, f as createBarCode, D as DEFAULT_BARCODE_COLOR, g as DEFAULT_BARCODE_BG_COLOR, h as DEFAULT_BARCODE_INCLUDETEXT, B as BARCODE_TYPES, r as rectangle, j as cellSchema } from './chunks/index-pDt5vVVj.js';
|
|
4
|
+
export { d as dynamicBarcode, a as dynamicQrCode, b as dynamicTable, e as ellipse, i as image, l as line, s as signature, v as variableBarcodes } from './chunks/index-pDt5vVVj.js';
|
|
5
5
|
import { TextCursorInput, Route, QrCode, Barcode, Table, CalendarClock, Calendar, Clock, ChevronDown, CircleDot, Circle, SquareCheck, Square } from 'lucide';
|
|
6
|
-
import { x as px2mm, Z as ZOOM, q as getFallbackFontName, D as DEFAULT_FONT_NAME } from './chunks/helper-
|
|
6
|
+
import { x as px2mm, Z as ZOOM, q as getFallbackFontName, D as DEFAULT_FONT_NAME } from './chunks/helper-D7XF1bxK.js';
|
|
7
7
|
import AirDatepicker from 'air-datepicker';
|
|
8
8
|
import localeAr from 'air-datepicker/locale/ar';
|
|
9
9
|
import localeBg from 'air-datepicker/locale/bg';
|
package/dist/esm/ui.js
CHANGED
|
@@ -73964,6 +73964,15 @@ const getBrowserVerticalFontAdjustments = (a, s, c, u) => {
|
|
|
73964
73964
|
v instanceof bufferExports.Buffer ? A = v : A = bufferExports.Buffer.from(v);
|
|
73965
73965
|
const x = $d636bc798e7178db$export$185802fd694ee1f5(A);
|
|
73966
73966
|
return c.set(d, x), x;
|
|
73967
|
+
}, resolveFontName = (a, s, c, u) => {
|
|
73968
|
+
const d = a || getFallbackFontName(u);
|
|
73969
|
+
if (!s && !c)
|
|
73970
|
+
return d;
|
|
73971
|
+
const p = s && c ? [" Bold Italic", "BoldItalic", "-BoldItalic"] : s ? [" Bold", "Bold", "-Bold"] : [" Italic", "Italic", "-Italic"];
|
|
73972
|
+
for (const v of p)
|
|
73973
|
+
if (u[d + v])
|
|
73974
|
+
return d + v;
|
|
73975
|
+
return d;
|
|
73967
73976
|
}, calculateDynamicFontSize = ({ textSchema: a, fontKitFont: s, value: c, startingFontSize: u }) => {
|
|
73968
73977
|
const { fontSize: d, dynamicFontSize: p, characterSpacing: v, width: A, height: x, lineHeight: g = DEFAULT_LINE_HEIGHT } = a, b = u || d || DEFAULT_FONT_SIZE;
|
|
73969
73978
|
if (!p || p.max < p.min)
|
|
@@ -74644,84 +74653,84 @@ const DEFAULT_OPACITY = 1, HEX_COLOR_PATTERN = "^#(?:[A-Fa-f0-9]{6})$", getBody$
|
|
|
74644
74653
|
const { value: s, pdfDoc: c, pdfLib: u, page: d, options: p, schema: v, _cache: A } = a;
|
|
74645
74654
|
if (!s)
|
|
74646
74655
|
return;
|
|
74647
|
-
const { font: x = getDefaultFont(), colorType: g } = p,
|
|
74656
|
+
const { font: x = getDefaultFont(), colorType: g } = p, b = resolveFontName(v.fontName, v.bold, v.italic, x), [y, f] = await Promise.all([
|
|
74648
74657
|
embedAndGetFontObj({
|
|
74649
74658
|
pdfDoc: c,
|
|
74650
74659
|
font: x,
|
|
74651
74660
|
_cache: A
|
|
74652
74661
|
}),
|
|
74653
|
-
getFontKitFont(
|
|
74654
|
-
]),
|
|
74662
|
+
getFontKitFont(b, x, A)
|
|
74663
|
+
]), m = getFontProp({ value: s, fontKitFont: f, schema: v, colorType: g }), { fontSize: E, color: w, alignment: S, verticalAlignment: $, lineHeight: R, characterSpacing: _ } = m, C = y && y[b], T = d.getHeight(), { width: B, height: N, rotate: O, position: { x: F, y: k }, opacity: V } = convertForPdfLayoutProps({ schema: v, pageHeight: T, applyRotateTranslate: false }), z = { x: F + B / 2, y: T - mm2pt(v.position.y) - N / 2 };
|
|
74655
74664
|
if (v.backgroundColor) {
|
|
74656
|
-
const
|
|
74657
|
-
if (
|
|
74658
|
-
const
|
|
74659
|
-
d.drawRectangle({ x:
|
|
74665
|
+
const H = hex2PrintingColor(v.backgroundColor, g);
|
|
74666
|
+
if (O.angle !== 0) {
|
|
74667
|
+
const U = rotatePoint({ x: F, y: k }, z, O.angle);
|
|
74668
|
+
d.drawRectangle({ x: U.x, y: U.y, width: B, height: N, rotate: O, color: H });
|
|
74660
74669
|
} else
|
|
74661
|
-
d.drawRectangle({ x:
|
|
74670
|
+
d.drawRectangle({ x: F, y: k, width: B, height: N, rotate: O, color: H });
|
|
74662
74671
|
}
|
|
74663
|
-
const
|
|
74672
|
+
const G = heightOfFontAtSize(f, E), W = getFontDescentInPt(f, E), M = R === 0 ? 0 : (R - 1) * E / 2, L = splitTextToSize({
|
|
74664
74673
|
value: s,
|
|
74665
|
-
characterSpacing:
|
|
74666
|
-
fontSize:
|
|
74667
|
-
fontKitFont:
|
|
74668
|
-
boxWidthInPt:
|
|
74674
|
+
characterSpacing: _,
|
|
74675
|
+
fontSize: E,
|
|
74676
|
+
fontKitFont: f,
|
|
74677
|
+
boxWidthInPt: B
|
|
74669
74678
|
});
|
|
74670
|
-
let
|
|
74671
|
-
if (
|
|
74672
|
-
|
|
74679
|
+
let P = 0;
|
|
74680
|
+
if ($ === VERTICAL_ALIGN_TOP)
|
|
74681
|
+
P = G + M;
|
|
74673
74682
|
else {
|
|
74674
|
-
const
|
|
74675
|
-
|
|
74676
|
-
}
|
|
74677
|
-
const
|
|
74678
|
-
|
|
74679
|
-
const
|
|
74680
|
-
`, ""),
|
|
74681
|
-
|
|
74683
|
+
const H = R * E * (L.length - 1);
|
|
74684
|
+
$ === VERTICAL_ALIGN_BOTTOM ? P = N - H + W - M : $ === VERTICAL_ALIGN_MIDDLE && (P = (N - H - G + W) / 2 + G);
|
|
74685
|
+
}
|
|
74686
|
+
const D = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
74687
|
+
L.forEach((H, U) => {
|
|
74688
|
+
const Y = H.replace(`
|
|
74689
|
+
`, ""), ee = widthOfTextAtSize(Y, f, E, _), Z = heightOfFontAtSize(f, E), re = R * E * U;
|
|
74690
|
+
H === "" && (H = `\r
|
|
74682
74691
|
`);
|
|
74683
|
-
let
|
|
74684
|
-
|
|
74685
|
-
let
|
|
74686
|
-
if (v.strikethrough &&
|
|
74687
|
-
const
|
|
74692
|
+
let K = F;
|
|
74693
|
+
S === "center" ? K += (B - ee) / 2 : S === "right" && (K += B - ee);
|
|
74694
|
+
let te = T - mm2pt(v.position.y) - P - re;
|
|
74695
|
+
if (v.strikethrough && ee > 0) {
|
|
74696
|
+
const J = K + ee + 1, ne = te + Z / 3;
|
|
74688
74697
|
d.drawLine({
|
|
74689
|
-
start: rotatePoint({ x:
|
|
74690
|
-
end: rotatePoint({ x:
|
|
74691
|
-
thickness: 1 / 12 *
|
|
74692
|
-
color:
|
|
74693
|
-
opacity:
|
|
74698
|
+
start: rotatePoint({ x: K, y: ne }, z, O.angle),
|
|
74699
|
+
end: rotatePoint({ x: J, y: ne }, z, O.angle),
|
|
74700
|
+
thickness: 1 / 12 * E,
|
|
74701
|
+
color: w,
|
|
74702
|
+
opacity: V
|
|
74694
74703
|
});
|
|
74695
74704
|
}
|
|
74696
|
-
if (v.underline &&
|
|
74697
|
-
const
|
|
74705
|
+
if (v.underline && ee > 0) {
|
|
74706
|
+
const J = K + ee + 1, ne = te - Z / 12;
|
|
74698
74707
|
d.drawLine({
|
|
74699
|
-
start: rotatePoint({ x:
|
|
74700
|
-
end: rotatePoint({ x:
|
|
74701
|
-
thickness: 1 / 12 *
|
|
74702
|
-
color:
|
|
74703
|
-
opacity:
|
|
74708
|
+
start: rotatePoint({ x: K, y: ne }, z, O.angle),
|
|
74709
|
+
end: rotatePoint({ x: J, y: ne }, z, O.angle),
|
|
74710
|
+
thickness: 1 / 12 * E,
|
|
74711
|
+
color: w,
|
|
74712
|
+
opacity: V
|
|
74704
74713
|
});
|
|
74705
74714
|
}
|
|
74706
|
-
if (
|
|
74707
|
-
const
|
|
74708
|
-
|
|
74715
|
+
if (O.angle !== 0) {
|
|
74716
|
+
const J = rotatePoint({ x: K, y: te }, z, O.angle);
|
|
74717
|
+
K = J.x, te = J.y;
|
|
74709
74718
|
}
|
|
74710
|
-
let
|
|
74711
|
-
if (
|
|
74719
|
+
let q = _;
|
|
74720
|
+
if (S === "justify" && H.slice(-1) !== `
|
|
74712
74721
|
`) {
|
|
74713
|
-
const
|
|
74714
|
-
|
|
74715
|
-
}
|
|
74716
|
-
d.pushOperators(u.setCharacterSpacing(
|
|
74717
|
-
x:
|
|
74718
|
-
y:
|
|
74719
|
-
rotate:
|
|
74720
|
-
size:
|
|
74721
|
-
color:
|
|
74722
|
-
lineHeight:
|
|
74723
|
-
font:
|
|
74724
|
-
opacity:
|
|
74722
|
+
const J = D.segment(Y)[Symbol.iterator](), ne = Array.from(J).length;
|
|
74723
|
+
q += (B - ee) / ne;
|
|
74724
|
+
}
|
|
74725
|
+
d.pushOperators(u.setCharacterSpacing(q)), d.drawText(Y, {
|
|
74726
|
+
x: K,
|
|
74727
|
+
y: te,
|
|
74728
|
+
rotate: O,
|
|
74729
|
+
size: E,
|
|
74730
|
+
color: w,
|
|
74731
|
+
lineHeight: R * E,
|
|
74732
|
+
font: C,
|
|
74733
|
+
opacity: V
|
|
74725
74734
|
});
|
|
74726
74735
|
});
|
|
74727
74736
|
}, substituteVariables = (a, s, c) => {
|
|
@@ -74780,6 +74789,14 @@ const ArrowUpToLine = [
|
|
|
74780
74789
|
["path", { d: "m18 13-6-6-6 6" }],
|
|
74781
74790
|
["path", { d: "M12 7v14" }]
|
|
74782
74791
|
];
|
|
74792
|
+
const Bold = [
|
|
74793
|
+
["path", { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" }]
|
|
74794
|
+
];
|
|
74795
|
+
const Italic = [
|
|
74796
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4" }],
|
|
74797
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20" }],
|
|
74798
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20" }]
|
|
74799
|
+
];
|
|
74783
74800
|
const Strikethrough = [
|
|
74784
74801
|
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }],
|
|
74785
74802
|
["path", { d: "M14 12a4 4 0 0 1 0 8H6" }],
|
|
@@ -74813,13 +74830,15 @@ const Type = [
|
|
|
74813
74830
|
const Underline = [
|
|
74814
74831
|
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }],
|
|
74815
74832
|
["line", { x1: "4", x2: "20", y1: "20", y2: "20" }]
|
|
74816
|
-
], TextStrikethroughIcon = createSvgStr(Strikethrough), TextUnderlineIcon = createSvgStr(Underline), TextAlignLeftIcon = createSvgStr(TextAlignStart), TextAlignCenterIcon = createSvgStr(TextAlignCenter), TextAlignRightIcon = createSvgStr(TextAlignEnd), TextAlignJustifyIcon = createSvgStr(TextAlignJustify), TextVerticalAlignTopIcon = createSvgStr(ArrowUpToLine), TextVerticalAlignMiddleIcon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 19h3v4h2v-4h3l-4-4l-4 4zm8-14h-3V1h-2v4H8l4 4l4-4zM4 11v2h16v-2H4z" fill="currentColor"></path></svg>', TextVerticalAlignBottomIcon = createSvgStr(ArrowDownToLine);
|
|
74833
|
+
], TextBoldIcon = createSvgStr(Bold), TextItalicIcon = createSvgStr(Italic), TextStrikethroughIcon = createSvgStr(Strikethrough), TextUnderlineIcon = createSvgStr(Underline), TextAlignLeftIcon = createSvgStr(TextAlignStart), TextAlignCenterIcon = createSvgStr(TextAlignCenter), TextAlignRightIcon = createSvgStr(TextAlignEnd), TextAlignJustifyIcon = createSvgStr(TextAlignJustify), TextVerticalAlignTopIcon = createSvgStr(ArrowUpToLine), TextVerticalAlignMiddleIcon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 19h3v4h2v-4h3l-4-4l-4 4zm8-14h-3V1h-2v4H8l4 4l4-4zM4 11v2h16v-2H4z" fill="currentColor"></path></svg>', TextVerticalAlignBottomIcon = createSvgStr(ArrowDownToLine);
|
|
74817
74834
|
var Formatter;
|
|
74818
74835
|
(function(a) {
|
|
74819
|
-
a.STRIKETHROUGH = "strikethrough", a.UNDERLINE = "underline", a.ALIGNMENT = "alignment", a.VERTICAL_ALIGNMENT = "verticalAlignment";
|
|
74836
|
+
a.BOLD = "bold", a.ITALIC = "italic", a.STRIKETHROUGH = "strikethrough", a.UNDERLINE = "underline", a.ALIGNMENT = "alignment", a.VERTICAL_ALIGNMENT = "verticalAlignment";
|
|
74820
74837
|
})(Formatter || (Formatter = {}));
|
|
74821
74838
|
function getExtraFormatterSchema(a) {
|
|
74822
74839
|
const s = [
|
|
74840
|
+
{ key: Formatter.BOLD, icon: TextBoldIcon, type: "boolean" },
|
|
74841
|
+
{ key: Formatter.ITALIC, icon: TextItalicIcon, type: "boolean" },
|
|
74823
74842
|
{ key: Formatter.STRIKETHROUGH, icon: TextStrikethroughIcon, type: "boolean" },
|
|
74824
74843
|
{ key: Formatter.UNDERLINE, icon: TextUnderlineIcon, type: "boolean" },
|
|
74825
74844
|
{ key: Formatter.ALIGNMENT, icon: TextAlignLeftIcon, type: "select", value: DEFAULT_ALIGNMENT },
|
|
@@ -74985,6 +75004,8 @@ const UseDynamicFontSize = (a) => {
|
|
|
74985
75004
|
fontName: void 0,
|
|
74986
75005
|
backgroundColor: "",
|
|
74987
75006
|
opacity: DEFAULT_OPACITY,
|
|
75007
|
+
bold: false,
|
|
75008
|
+
italic: false,
|
|
74988
75009
|
strikethrough: false,
|
|
74989
75010
|
underline: false
|
|
74990
75011
|
}
|
|
@@ -75159,42 +75180,42 @@ const UseDynamicFontSize = (a) => {
|
|
|
75159
75180
|
};
|
|
75160
75181
|
return a.split(/(\r\n|\n|\r)/).map((p) => /\r\n|\n|\r/.test(p) ? p : p.split("").map((v) => /\s/.test(v) || v.charCodeAt(0) < 32 || u(v) ? v : "〿").join("")).join("");
|
|
75161
75182
|
}, uiRender$1 = async (a) => {
|
|
75162
|
-
const { value: s, schema: c, mode: u, onChange: d, stopEditing: p, tabIndex: v, placeholder: A, options: x, _cache: g } = a, b = isEditable(u, c) && A && !s, y = (
|
|
75163
|
-
let
|
|
75164
|
-
return
|
|
75165
|
-
`) && (
|
|
75166
|
-
}, f = x?.font || getDefaultFont(), m =
|
|
75183
|
+
const { value: s, schema: c, mode: u, onChange: d, stopEditing: p, tabIndex: v, placeholder: A, options: x, _cache: g } = a, b = isEditable(u, c) && A && !s, y = ($) => {
|
|
75184
|
+
let R = $.innerText;
|
|
75185
|
+
return R.endsWith(`
|
|
75186
|
+
`) && (R = R.slice(0, -1)), R;
|
|
75187
|
+
}, f = x?.font || getDefaultFont(), m = resolveFontName(c.fontName, c.bold, c.italic, f), E = await getFontKitFont(m, f, g), w = buildStyledTextContainer(a, E, b ? A : s), S = replaceUnsupportedChars(s, E);
|
|
75167
75188
|
if (!isEditable(u, c)) {
|
|
75168
|
-
|
|
75189
|
+
w.innerHTML = S.split("").map(($, R) => `<span style="letter-spacing:${String(s).length === R + 1 ? 0 : "inherit"};">${$}</span>`).join("");
|
|
75169
75190
|
return;
|
|
75170
75191
|
}
|
|
75171
|
-
if (makeElementPlainTextContentEditable(
|
|
75172
|
-
d && d({ key: "content", value: y(
|
|
75192
|
+
if (makeElementPlainTextContentEditable(w), w.tabIndex = v || 0, w.innerText = u === "designer" ? s : S, w.addEventListener("blur", ($) => {
|
|
75193
|
+
d && d({ key: "content", value: y($.target) }), p && p();
|
|
75173
75194
|
}), c.dynamicFontSize) {
|
|
75174
|
-
let
|
|
75175
|
-
|
|
75195
|
+
let $;
|
|
75196
|
+
w.addEventListener("keyup", () => {
|
|
75176
75197
|
setTimeout(() => {
|
|
75177
75198
|
(() => {
|
|
75178
|
-
if (!
|
|
75199
|
+
if (!w.textContent)
|
|
75179
75200
|
return;
|
|
75180
|
-
|
|
75201
|
+
$ = calculateDynamicFontSize({
|
|
75181
75202
|
textSchema: c,
|
|
75182
|
-
fontKitFont:
|
|
75183
|
-
value: y(
|
|
75184
|
-
startingFontSize:
|
|
75185
|
-
}),
|
|
75186
|
-
const { topAdj:
|
|
75187
|
-
|
|
75203
|
+
fontKitFont: E,
|
|
75204
|
+
value: y(w),
|
|
75205
|
+
startingFontSize: $
|
|
75206
|
+
}), w.style.fontSize = `${$}pt`;
|
|
75207
|
+
const { topAdj: R, bottomAdj: _ } = getBrowserVerticalFontAdjustments(E, $ ?? c.fontSize ?? DEFAULT_FONT_SIZE, c.lineHeight ?? DEFAULT_LINE_HEIGHT, c.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT);
|
|
75208
|
+
w.style.paddingTop = `${R}px`, w.style.marginBottom = `${_}px`;
|
|
75188
75209
|
})();
|
|
75189
75210
|
}, 0);
|
|
75190
75211
|
});
|
|
75191
75212
|
}
|
|
75192
|
-
b && (
|
|
75193
|
-
|
|
75213
|
+
b && (w.style.color = PLACEHOLDER_FONT_COLOR, w.addEventListener("focus", () => {
|
|
75214
|
+
w.innerText === A && (w.innerText = "", w.style.color = c.fontColor ?? DEFAULT_FONT_COLOR);
|
|
75194
75215
|
})), u === "designer" && setTimeout(() => {
|
|
75195
|
-
|
|
75196
|
-
const
|
|
75197
|
-
|
|
75216
|
+
w.focus();
|
|
75217
|
+
const $ = window.getSelection(), R = document.createRange();
|
|
75218
|
+
$ && R && (R.selectNodeContents(w), R.collapse(false), $?.removeAllRanges(), $?.addRange(R));
|
|
75198
75219
|
});
|
|
75199
75220
|
}, buildStyledTextContainer = (a, s, c) => {
|
|
75200
75221
|
const { schema: u, rootElement: d, mode: p } = a;
|
|
@@ -75223,6 +75244,8 @@ const UseDynamicFontSize = (a) => {
|
|
|
75223
75244
|
const E = {
|
|
75224
75245
|
// Font formatting styles
|
|
75225
75246
|
fontFamily: u.fontName ? `'${u.fontName}'` : "inherit",
|
|
75247
|
+
fontWeight: u.bold ? "bold" : "normal",
|
|
75248
|
+
fontStyle: u.italic ? "italic" : "normal",
|
|
75226
75249
|
color: u.fontColor ? u.fontColor : DEFAULT_FONT_COLOR,
|
|
75227
75250
|
fontSize: `${v ?? u.fontSize ?? DEFAULT_FONT_SIZE}pt`,
|
|
75228
75251
|
letterSpacing: `${u.characterSpacing ?? DEFAULT_CHARACTER_SPACING}pt`,
|
|
@@ -10,6 +10,7 @@ export declare const getFontDescentInPt: (fontKitFont: FontKitFont, fontSize: nu
|
|
|
10
10
|
export declare const heightOfFontAtSize: (fontKitFont: FontKitFont, fontSize: number) => number;
|
|
11
11
|
export declare const widthOfTextAtSize: (text: string, fontKitFont: FontKitFont, fontSize: number, characterSpacing: number) => number;
|
|
12
12
|
export declare const getFontKitFont: (fontName: string | undefined, font: Font, _cache: Map<string | number, fontkit.Font>) => Promise<fontkit.Font>;
|
|
13
|
+
export declare const resolveFontName: (fontName: string | undefined, bold: boolean | undefined, italic: boolean | undefined, font: Font) => string;
|
|
13
14
|
/**
|
|
14
15
|
* Recursively splits the line at getSplitPosition.
|
|
15
16
|
* If there is some leftover, split the rest again in the same manner.
|