oasis-editor 0.0.95 → 0.0.97
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/{OasisEditorApp-C_Ao4zIF.js → OasisEditorApp-m8k4gBW1.js} +146 -8
- package/dist/assets/{importDocxWorker-DAbfLHtp.js → importDocxWorker-BV6LezJZ.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +47 -0
- package/dist/core/model/types/styles.d.ts +11 -1
- package/dist/export/pdf/writer/pdfTypes.d.ts +4 -0
- package/dist/import/docx/xmlHelpers.d.ts +8 -0
- package/dist/{index-BQEtsRa0.js → index-BiTnt_yD.js} +295 -6
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as getImageFloatingGeometry, aK as textStyleToFontSizePt, aL as PX_PER_POINT, aM as DEFAULT_FONT_SIZE_PX, aN as isDoubleUnderlineStyle, aO as isWavyUnderlineStyle, aP as underlineStyleLineWidthPx, aQ as underlineStyleDashArray, aR as resolveListLabel, aS as getListLabelInset, aT as getAlignedListLabelInset, aU as getParagraphBorderInsets, aV as buildSegmentTable, aW as buildCanvasTableLayout, aX as resolveCanvasTableWidth, aY as resolveFloatingTableRect, aZ as normalizeFamily, a_ as ROBOTO_FONT_FILES, a$ as loadFontAsset, b0 as OFFICE_COMPAT_FONT_FAMILIES, b1 as buildSfnt, b2 as defaultFontDecoderRegistry, b3 as SfntFontProgram, b4 as collectPdfFontFamilies, b5 as projectDocumentLayout, b6 as getPageContentWidth, b7 as getPageHeaderZoneTop, b8 as getPageBodyTop, b9 as getPageColumnRects, ba as findFootnoteReference, bb as FOOTNOTE_MARKER_GUTTER_PX, bc as resolveImporterForFile, bd as getDocumentSectionsCanonical, be as getDocumentParagraphsCanonical, bf as getDocumentParagraphs, bg as getDocumentPageSettings, bh as getTableCellContentWidthForParagraph, bi as on, bj as debounce, bk as unwrap, bl as perfTimer, bm as getRunTextBox, bn as createEditorDocument, bo as resolveResizedDimensions, bp as resolveTextBoxRenderHeight, bq as getToolbarStyleState, br as getCachedCanvasImage, bs as measureParagraphMinContentWidthPx, bt as getEditableBlocksForZone, bu as findParagraphLocation, bv as createSectionBoundaryParagraph, bw as normalizePageSettings, bx as DEFAULT_EDITOR_PAGE_SETTINGS, by as markStart, bz as markEnd, bA as getParagraphEntries, bB as getParagraphById, bC as createEditorFootnote, bD as createFootnoteReferenceRun, bE as renumberFootnotes, bF as getFootnoteDisplayMarker, bG as getHeadingLevel, bH as preciseFontModeVersion, bI as isPreciseFontModeEnabled, bJ as resolveNamedTextStyle, bK as togglePreciseFontMode, bL as nextFontSizePt, bM as previousFontSizePt, bN as fontSizePtToPx, bO as createDefaultToolbarPreset, bP as MenuRegistry, bQ as createToolbarRegistry, bR as Editor, bS as resolveCommandRef, bT as commandRefName, bU as createOasisEditorClient, bV as createEditorZoom, bW as startLongTaskObserver, bX as installGlobalReport, bY as applyStoredPreciseFontPreference, bZ as getWelcomeSeen, b_ as isLocalFontAccessSupported, b$ as EDITOR_SCROLL_PADDING_PX, c0 as Toolbar, c1 as OasisEditorLoading, c2 as I18nProvider, c3 as createTranslator, c4 as createEditorLogger, c5 as registerDomStatsSurface } from "./index-
|
|
4
|
+
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as getImageFloatingGeometry, aK as textStyleToFontSizePt, aL as PX_PER_POINT, aM as DEFAULT_FONT_SIZE_PX, aN as isDoubleUnderlineStyle, aO as isWavyUnderlineStyle, aP as underlineStyleLineWidthPx, aQ as underlineStyleDashArray, aR as resolveListLabel, aS as getListLabelInset, aT as getAlignedListLabelInset, aU as getParagraphBorderInsets, aV as buildSegmentTable, aW as buildCanvasTableLayout, aX as resolveCanvasTableWidth, aY as resolveFloatingTableRect, aZ as normalizeFamily, a_ as ROBOTO_FONT_FILES, a$ as loadFontAsset, b0 as OFFICE_COMPAT_FONT_FAMILIES, b1 as buildSfnt, b2 as defaultFontDecoderRegistry, b3 as SfntFontProgram, b4 as collectPdfFontFamilies, b5 as projectDocumentLayout, b6 as getPageContentWidth, b7 as getPageHeaderZoneTop, b8 as getPageBodyTop, b9 as getPageColumnRects, ba as findFootnoteReference, bb as FOOTNOTE_MARKER_GUTTER_PX, bc as resolveImporterForFile, bd as getDocumentSectionsCanonical, be as getDocumentParagraphsCanonical, bf as getDocumentParagraphs, bg as getDocumentPageSettings, bh as getTableCellContentWidthForParagraph, bi as on, bj as debounce, bk as unwrap, bl as perfTimer, bm as getRunTextBox, bn as createEditorDocument, bo as resolveResizedDimensions, bp as resolveTextBoxRenderHeight, bq as getToolbarStyleState, br as getCachedCanvasImage, bs as measureParagraphMinContentWidthPx, bt as getEditableBlocksForZone, bu as findParagraphLocation, bv as createSectionBoundaryParagraph, bw as normalizePageSettings, bx as DEFAULT_EDITOR_PAGE_SETTINGS, by as markStart, bz as markEnd, bA as getParagraphEntries, bB as getParagraphById, bC as createEditorFootnote, bD as createFootnoteReferenceRun, bE as renumberFootnotes, bF as getFootnoteDisplayMarker, bG as getHeadingLevel, bH as preciseFontModeVersion, bI as isPreciseFontModeEnabled, bJ as resolveNamedTextStyle, bK as togglePreciseFontMode, bL as nextFontSizePt, bM as previousFontSizePt, bN as fontSizePtToPx, bO as createDefaultToolbarPreset, bP as MenuRegistry, bQ as createToolbarRegistry, bR as Editor, bS as resolveCommandRef, bT as commandRefName, bU as createOasisEditorClient, bV as createEditorZoom, bW as startLongTaskObserver, bX as installGlobalReport, bY as applyStoredPreciseFontPreference, bZ as getWelcomeSeen, b_ as isLocalFontAccessSupported, b$ as EDITOR_SCROLL_PADDING_PX, c0 as Toolbar, c1 as OasisEditorLoading, c2 as I18nProvider, c3 as createTranslator, c4 as createEditorLogger, c5 as registerDomStatsSurface } from "./index-BiTnt_yD.js";
|
|
5
5
|
function cloneStyle(style2) {
|
|
6
6
|
return style2 ? { ...style2 } : void 0;
|
|
7
7
|
}
|
|
@@ -29574,6 +29574,48 @@ function textRunStylesToCss(style2) {
|
|
|
29574
29574
|
if (featureSettings) {
|
|
29575
29575
|
parts.push(`font-feature-settings:${featureSettings}`);
|
|
29576
29576
|
}
|
|
29577
|
+
if (style2.textFill) {
|
|
29578
|
+
if (style2.textFill.type === "solid") {
|
|
29579
|
+
parts.push(`color:${style2.textFill.color}`);
|
|
29580
|
+
} else if (style2.textFill.type === "gradient" && style2.textFill.stops.length >= 2) {
|
|
29581
|
+
const cssAngle = ((90 - (style2.textFill.angle ?? 0)) % 360 + 360) % 360;
|
|
29582
|
+
const stopsCss = style2.textFill.stops.map((s) => `${s.color} ${Math.round(s.position * 100)}%`).join(",");
|
|
29583
|
+
parts.push(`background:linear-gradient(${cssAngle}deg,${stopsCss})`);
|
|
29584
|
+
parts.push("-webkit-background-clip:text");
|
|
29585
|
+
parts.push("background-clip:text");
|
|
29586
|
+
parts.push("color:transparent");
|
|
29587
|
+
}
|
|
29588
|
+
}
|
|
29589
|
+
if (style2.textOutline) {
|
|
29590
|
+
const widthPx = style2.textOutline.widthPt * (96 / 72);
|
|
29591
|
+
const color = style2.textOutline.color ?? "#000000";
|
|
29592
|
+
parts.push(`-webkit-text-stroke:${widthPx.toFixed(2)}px ${color}`);
|
|
29593
|
+
}
|
|
29594
|
+
if (style2.textShadow) {
|
|
29595
|
+
const dirRad = style2.textShadow.dirDeg * Math.PI / 180;
|
|
29596
|
+
const px = (pt) => (pt * (96 / 72)).toFixed(2);
|
|
29597
|
+
const ox = (Math.cos(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
|
|
29598
|
+
2
|
|
29599
|
+
);
|
|
29600
|
+
const oy = (Math.sin(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
|
|
29601
|
+
2
|
|
29602
|
+
);
|
|
29603
|
+
const blur = px(style2.textShadow.blurPt);
|
|
29604
|
+
const alpha = style2.textShadow.alpha ?? 1;
|
|
29605
|
+
const r = parseInt(style2.textShadow.color.slice(1, 3), 16);
|
|
29606
|
+
const g = parseInt(style2.textShadow.color.slice(3, 5), 16);
|
|
29607
|
+
const b = parseInt(style2.textShadow.color.slice(5, 7), 16);
|
|
29608
|
+
parts.push(
|
|
29609
|
+
`text-shadow:${ox}px ${oy}px ${blur}px rgba(${r},${g},${b},${alpha})`
|
|
29610
|
+
);
|
|
29611
|
+
} else if (style2.glow) {
|
|
29612
|
+
const blur = (style2.glow.radiusPt * (96 / 72)).toFixed(2);
|
|
29613
|
+
const alpha = style2.glow.alpha ?? 0.7;
|
|
29614
|
+
const r = parseInt(style2.glow.color.slice(1, 3), 16);
|
|
29615
|
+
const g = parseInt(style2.glow.color.slice(3, 5), 16);
|
|
29616
|
+
const b = parseInt(style2.glow.color.slice(5, 7), 16);
|
|
29617
|
+
parts.push(`text-shadow:0 0 ${blur}px rgba(${r},${g},${b},${alpha})`);
|
|
29618
|
+
}
|
|
29577
29619
|
const decorations = [];
|
|
29578
29620
|
if (style2.underline || style2.link) {
|
|
29579
29621
|
decorations.push("underline");
|
|
@@ -33748,6 +33790,11 @@ function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
|
33748
33790
|
fontFamily: effective.fontFamily,
|
|
33749
33791
|
fontSize: effective.fontSize,
|
|
33750
33792
|
color: effective.color,
|
|
33793
|
+
textFill: effective.textFill,
|
|
33794
|
+
textOutline: effective.textOutline,
|
|
33795
|
+
textShadow: effective.textShadow,
|
|
33796
|
+
glow: effective.glow,
|
|
33797
|
+
reflection: effective.reflection,
|
|
33751
33798
|
highlight: effective.highlight,
|
|
33752
33799
|
shading: effective.shading,
|
|
33753
33800
|
language: effective.language
|
|
@@ -33935,6 +33982,60 @@ const DOCX_HIGHLIGHT_HEX_ALIASES = {
|
|
|
33935
33982
|
};
|
|
33936
33983
|
const OOXML_PERCENT_DENOMINATOR = 1e5;
|
|
33937
33984
|
const OOXML_ROTATION_UNITS = 6e4;
|
|
33985
|
+
const MC_NS = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
33986
|
+
function serializeW14SolidFillXml(color) {
|
|
33987
|
+
const hex = normalizeDocxColor(color);
|
|
33988
|
+
return `<w14:solidFill><w14:srgbClr w14:val="${hex}"/></w14:solidFill>`;
|
|
33989
|
+
}
|
|
33990
|
+
function serializeW14FillXml(fill) {
|
|
33991
|
+
if (fill.type === "solid") {
|
|
33992
|
+
return serializeW14SolidFillXml(fill.color);
|
|
33993
|
+
}
|
|
33994
|
+
const gsXml = fill.stops.map((s) => {
|
|
33995
|
+
const hex = normalizeDocxColor(s.color);
|
|
33996
|
+
const pos = Math.round(s.position * 1e5);
|
|
33997
|
+
const alphaXml = s.alpha !== void 0 ? `<w14:alpha w14:val="${Math.round(s.alpha * 1e5)}"/>` : "";
|
|
33998
|
+
return `<w14:gs w14:pos="${pos}"><w14:srgbClr w14:val="${hex}">${alphaXml}</w14:srgbClr></w14:gs>`;
|
|
33999
|
+
}).join("");
|
|
34000
|
+
const angVal = Math.round((fill.angle ?? 0) * 6e4);
|
|
34001
|
+
return `<w14:gradFill><w14:gsLst>${gsXml}</w14:gsLst><w14:lin w14:ang="${angVal}" w14:scaled="0"/></w14:gradFill>`;
|
|
34002
|
+
}
|
|
34003
|
+
function serializeTextFillMC(fill, fallbackColor) {
|
|
34004
|
+
const fillXml = serializeW14FillXml(fill);
|
|
34005
|
+
const fbHex = normalizeDocxColor(fallbackColor ?? "000000");
|
|
34006
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:textFill>${fillXml}</w14:textFill></mc:Choice><mc:Fallback><w:color w:val="${fbHex}"/></mc:Fallback></mc:AlternateContent>`;
|
|
34007
|
+
}
|
|
34008
|
+
function serializeTextOutlineMC(outline) {
|
|
34009
|
+
const widthEmu = Math.round(Math.max(0, outline.widthPt) * 12700);
|
|
34010
|
+
const fillXml = outline.fill ? serializeW14FillXml(outline.fill) : outline.color ? serializeW14SolidFillXml(outline.color) : "";
|
|
34011
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:textOutline w14:w="${widthEmu}" w14:cap="flat" w14:cmpd="sng" w14:algn="ctr">` + fillXml + `</w14:textOutline></mc:Choice><mc:Fallback><w:outline/></mc:Fallback></mc:AlternateContent>`;
|
|
34012
|
+
}
|
|
34013
|
+
function serializeW14ColorEl(color, alpha) {
|
|
34014
|
+
const hex = normalizeDocxColor(color);
|
|
34015
|
+
const alphaXml = alpha !== void 0 ? `<w14:alpha w14:val="${Math.round(alpha * 1e5)}"/>` : "";
|
|
34016
|
+
return `<w14:srgbClr w14:val="${hex}">${alphaXml}</w14:srgbClr>`;
|
|
34017
|
+
}
|
|
34018
|
+
function serializeTextShadowMC(shadow) {
|
|
34019
|
+
const blurEmu = Math.round(Math.max(0, shadow.blurPt) * 12700);
|
|
34020
|
+
const distEmu = Math.round(Math.max(0, shadow.distPt) * 12700);
|
|
34021
|
+
const dirVal = Math.round(shadow.dirDeg * 6e4);
|
|
34022
|
+
const colorXml = serializeW14ColorEl(shadow.color, shadow.alpha);
|
|
34023
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:shadow w14:blurRad="${blurEmu}" w14:dist="${distEmu}" w14:dir="${dirVal}" w14:sx="100000" w14:sy="100000" w14:kx="0" w14:ky="0" w14:algn="ctr">` + colorXml + `</w14:shadow></mc:Choice><mc:Fallback><w:shadow/></mc:Fallback></mc:AlternateContent>`;
|
|
34024
|
+
}
|
|
34025
|
+
function serializeGlowMC(glow) {
|
|
34026
|
+
const radEmu = Math.round(Math.max(0, glow.radiusPt) * 12700);
|
|
34027
|
+
const colorXml = serializeW14ColorEl(glow.color, glow.alpha);
|
|
34028
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:glow w14:rad="${radEmu}">${colorXml}</w14:glow></mc:Choice><mc:Fallback/></mc:AlternateContent>`;
|
|
34029
|
+
}
|
|
34030
|
+
function serializeReflectionMC(reflection) {
|
|
34031
|
+
const blurEmu = Math.round(Math.max(0, reflection.blurPt) * 12700);
|
|
34032
|
+
const stA = Math.round(reflection.startAlpha * 1e5);
|
|
34033
|
+
const stPos = Math.round(reflection.startPos * 1e5);
|
|
34034
|
+
const endA = Math.round(reflection.endAlpha * 1e5);
|
|
34035
|
+
const endPos = Math.round(reflection.endPos * 1e5);
|
|
34036
|
+
const distEmu = Math.round(Math.max(0, reflection.distPt) * 12700);
|
|
34037
|
+
return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14"><w14:reflection w14:blurRad="${blurEmu}" w14:stA="${stA}" w14:stPos="${stPos}" w14:endA="${endA}" w14:endPos="${endPos}" w14:dist="${distEmu}" w14:dir="5400000" w14:fadeDir="5400000" w14:sx="100000" w14:sy="-100000" w14:kx="0" w14:ky="0" w14:algn="bl"/></mc:Choice><mc:Fallback/></mc:AlternateContent>`;
|
|
34038
|
+
}
|
|
33938
34039
|
function pointsToSignedTwips(value) {
|
|
33939
34040
|
if (value === void 0 || value === null || !Number.isFinite(value)) {
|
|
33940
34041
|
return null;
|
|
@@ -34101,11 +34202,26 @@ function serializeRunProperties(styles) {
|
|
|
34101
34202
|
parts.push(`<w:sz w:val="${size}"/>`, `<w:szCs w:val="${size}"/>`);
|
|
34102
34203
|
}
|
|
34103
34204
|
}
|
|
34104
|
-
if (styles.
|
|
34205
|
+
if (styles.textFill) {
|
|
34206
|
+
const fallback = styles.textFill.type === "solid" ? styles.textFill.color : styles.color;
|
|
34207
|
+
parts.push(serializeTextFillMC(styles.textFill, fallback ?? null));
|
|
34208
|
+
} else if (styles.color) {
|
|
34105
34209
|
parts.push(
|
|
34106
34210
|
`<w:color w:val="${escapeXml(styles.color.replace(/^#/, ""))}"/>`
|
|
34107
34211
|
);
|
|
34108
34212
|
}
|
|
34213
|
+
if (styles.textOutline) {
|
|
34214
|
+
parts.push(serializeTextOutlineMC(styles.textOutline));
|
|
34215
|
+
}
|
|
34216
|
+
if (styles.textShadow) {
|
|
34217
|
+
parts.push(serializeTextShadowMC(styles.textShadow));
|
|
34218
|
+
}
|
|
34219
|
+
if (styles.glow) {
|
|
34220
|
+
parts.push(serializeGlowMC(styles.glow));
|
|
34221
|
+
}
|
|
34222
|
+
if (styles.reflection) {
|
|
34223
|
+
parts.push(serializeReflectionMC(styles.reflection));
|
|
34224
|
+
}
|
|
34109
34225
|
if (styles.highlight) {
|
|
34110
34226
|
parts.push(
|
|
34111
34227
|
`<w:highlight w:val="${escapeXml(normalizeHighlightForDocx(styles.highlight))}"/>`
|
|
@@ -36474,7 +36590,7 @@ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, docu
|
|
|
36474
36590
|
);
|
|
36475
36591
|
}
|
|
36476
36592
|
async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
|
|
36477
|
-
var _a;
|
|
36593
|
+
var _a, _b, _c;
|
|
36478
36594
|
if (fragment.image) {
|
|
36479
36595
|
if (fragment.image.floating) {
|
|
36480
36596
|
return;
|
|
@@ -36586,7 +36702,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
36586
36702
|
characterSpacing: styles.characterSpacing ?? 0,
|
|
36587
36703
|
horizontalScale: styles.characterScale ?? 100
|
|
36588
36704
|
};
|
|
36589
|
-
const mainColor = styles.color ?? "#000000";
|
|
36705
|
+
const mainColor = ((_b = styles.textFill) == null ? void 0 : _b.type) === "solid" ? styles.textFill.color : ((_c = styles.textFill) == null ? void 0 : _c.type) === "gradient" && styles.textFill.stops[0] ? styles.textFill.stops[0].color : styles.color ?? "#000000";
|
|
36590
36706
|
const offsetPt = pxToPt$1(1);
|
|
36591
36707
|
const emitChunk = (leftPx, text2) => {
|
|
36592
36708
|
if (styles.emboss || styles.imprint) {
|
|
@@ -36599,7 +36715,18 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
36599
36715
|
color: "#BFBFBF"
|
|
36600
36716
|
});
|
|
36601
36717
|
}
|
|
36602
|
-
if (styles.
|
|
36718
|
+
if (styles.textShadow) {
|
|
36719
|
+
const ts = styles.textShadow;
|
|
36720
|
+
const dirRad = ts.dirDeg * Math.PI / 180;
|
|
36721
|
+
const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
|
|
36722
|
+
writer.drawText(pageIndex, {
|
|
36723
|
+
...baseTextOptions,
|
|
36724
|
+
x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
|
|
36725
|
+
y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
|
|
36726
|
+
text: text2,
|
|
36727
|
+
color: ts.color
|
|
36728
|
+
});
|
|
36729
|
+
} else if (styles.shadow) {
|
|
36603
36730
|
writer.drawText(pageIndex, {
|
|
36604
36731
|
...baseTextOptions,
|
|
36605
36732
|
x: pxToPt$1(leftPx) + offsetPt,
|
|
@@ -36608,13 +36735,18 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
36608
36735
|
color: "#808080"
|
|
36609
36736
|
});
|
|
36610
36737
|
}
|
|
36738
|
+
const textOutline = styles.textOutline;
|
|
36611
36739
|
writer.drawText(pageIndex, {
|
|
36612
36740
|
...baseTextOptions,
|
|
36613
36741
|
x: pxToPt$1(leftPx),
|
|
36614
36742
|
y: pxToPt$1(baselineY),
|
|
36615
36743
|
text: text2,
|
|
36616
36744
|
color: mainColor,
|
|
36617
|
-
|
|
36745
|
+
...textOutline ? {
|
|
36746
|
+
renderMode: 2,
|
|
36747
|
+
strokeColor: textOutline.color ?? mainColor,
|
|
36748
|
+
strokeWidth: textOutline.widthPt
|
|
36749
|
+
} : { renderMode: styles.outline ? 1 : 0 }
|
|
36618
36750
|
});
|
|
36619
36751
|
};
|
|
36620
36752
|
const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
|
|
@@ -37609,8 +37741,14 @@ class PdfContentStream {
|
|
|
37609
37741
|
colorCommand(options.color, "rg", [0, 0, 0]),
|
|
37610
37742
|
`/${fontResourceName} ${formatNumber(options.fontSize ?? 12)} Tf`,
|
|
37611
37743
|
...options.renderMode && options.renderMode !== 0 ? [
|
|
37612
|
-
colorCommand(
|
|
37613
|
-
|
|
37744
|
+
colorCommand(
|
|
37745
|
+
options.strokeColor ?? options.color,
|
|
37746
|
+
"RG",
|
|
37747
|
+
[0, 0, 0]
|
|
37748
|
+
),
|
|
37749
|
+
`${formatNumber(
|
|
37750
|
+
options.strokeWidth ?? Math.max(0.3, (options.fontSize ?? 12) * 0.03)
|
|
37751
|
+
)} w`,
|
|
37614
37752
|
`${options.renderMode} Tr`
|
|
37615
37753
|
] : [],
|
|
37616
37754
|
...options.horizontalScale && options.horizontalScale > 0 && options.horizontalScale !== 100 ? [`${formatNumber(options.horizontalScale)} Tz`] : [],
|