oasis-editor 0.0.96 → 0.0.98

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.
@@ -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-D0bOD23M.js";
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-DBzN897A.js";
5
5
  function cloneStyle(style2) {
6
6
  return style2 ? { ...style2 } : void 0;
7
7
  }
@@ -29591,6 +29591,31 @@ function textRunStylesToCss(style2) {
29591
29591
  const color = style2.textOutline.color ?? "#000000";
29592
29592
  parts.push(`-webkit-text-stroke:${widthPx.toFixed(2)}px ${color}`);
29593
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
+ }
29594
29619
  const decorations = [];
29595
29620
  if (style2.underline || style2.link) {
29596
29621
  decorations.push("underline");
@@ -33080,6 +33105,7 @@ function serializeBookmarkEvent(event) {
33080
33105
  )}"${col}/>`;
33081
33106
  }
33082
33107
  const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
33108
+ const WORD16DU_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
33083
33109
  function buildCommentExportPlan(document2) {
33084
33110
  const registry = document2.comments;
33085
33111
  if (!registry || registry.order.length === 0) {
@@ -33155,7 +33181,7 @@ function serializeCommentRangeEvent(event) {
33155
33181
  return `<w:r><w:commentReference w:id="${event.wId}"/></w:r>`;
33156
33182
  }
33157
33183
  }
33158
- const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS}"`;
33184
+ const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS}" xmlns:w16du="${WORD16DU_NS}"`;
33159
33185
  function serializeCommentBody(text) {
33160
33186
  const lines = text.split("\n");
33161
33187
  const runs = lines.map((line, i) => {
@@ -33167,8 +33193,9 @@ function serializeCommentBody(text) {
33167
33193
  function buildCommentsPartXml(plan) {
33168
33194
  const body = plan.comments.map(({ comment, wId, paraId }) => {
33169
33195
  const dateAttr = comment.date !== void 0 ? ` w:date="${new Date(comment.date).toISOString().replace(/\.\d{3}Z$/, "Z")}"` : "";
33196
+ const dateUtcAttr = comment.dateUtc !== void 0 ? ` w16du:dateUtc="${new Date(comment.dateUtc).toISOString().replace(/\.\d{3}Z$/, "Z")}"` : "";
33170
33197
  const initialsAttr = comment.initials ? ` w:initials="${escapeXml(comment.initials)}"` : "";
33171
- return `<w:comment w:id="${wId}" w:author="${escapeXml(comment.author)}"${dateAttr}${initialsAttr}><w:p w14:paraId="${paraId}">${serializeCommentBody(comment.text)}</w:p></w:comment>`;
33198
+ return `<w:comment w:id="${wId}" w:author="${escapeXml(comment.author)}"${dateAttr}${dateUtcAttr}${initialsAttr}><w:p w14:paraId="${paraId}">${serializeCommentBody(comment.text)}</w:p></w:comment>`;
33172
33199
  }).join("");
33173
33200
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${COMMENTS_XMLNS}>${body}</w:comments>`;
33174
33201
  }
@@ -33767,6 +33794,11 @@ function materializeRunStyle(run, paragraphStyleId, styles) {
33767
33794
  color: effective.color,
33768
33795
  textFill: effective.textFill,
33769
33796
  textOutline: effective.textOutline,
33797
+ textShadow: effective.textShadow,
33798
+ glow: effective.glow,
33799
+ reflection: effective.reflection,
33800
+ scene3dXml: effective.scene3dXml,
33801
+ props3dXml: effective.props3dXml,
33770
33802
  highlight: effective.highlight,
33771
33803
  shading: effective.shading,
33772
33804
  language: effective.language
@@ -33982,6 +34014,35 @@ function serializeTextOutlineMC(outline) {
33982
34014
  const fillXml = outline.fill ? serializeW14FillXml(outline.fill) : outline.color ? serializeW14SolidFillXml(outline.color) : "";
33983
34015
  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>`;
33984
34016
  }
34017
+ function serializeW14ColorEl(color, alpha) {
34018
+ const hex = normalizeDocxColor(color);
34019
+ const alphaXml = alpha !== void 0 ? `<w14:alpha w14:val="${Math.round(alpha * 1e5)}"/>` : "";
34020
+ return `<w14:srgbClr w14:val="${hex}">${alphaXml}</w14:srgbClr>`;
34021
+ }
34022
+ function serializeTextShadowMC(shadow) {
34023
+ const blurEmu = Math.round(Math.max(0, shadow.blurPt) * 12700);
34024
+ const distEmu = Math.round(Math.max(0, shadow.distPt) * 12700);
34025
+ const dirVal = Math.round(shadow.dirDeg * 6e4);
34026
+ const colorXml = serializeW14ColorEl(shadow.color, shadow.alpha);
34027
+ 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>`;
34028
+ }
34029
+ function serializeGlowMC(glow) {
34030
+ const radEmu = Math.round(Math.max(0, glow.radiusPt) * 12700);
34031
+ const colorXml = serializeW14ColorEl(glow.color, glow.alpha);
34032
+ 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>`;
34033
+ }
34034
+ function serializeReflectionMC(reflection) {
34035
+ const blurEmu = Math.round(Math.max(0, reflection.blurPt) * 12700);
34036
+ const stA = Math.round(reflection.startAlpha * 1e5);
34037
+ const stPos = Math.round(reflection.startPos * 1e5);
34038
+ const endA = Math.round(reflection.endAlpha * 1e5);
34039
+ const endPos = Math.round(reflection.endPos * 1e5);
34040
+ const distEmu = Math.round(Math.max(0, reflection.distPt) * 12700);
34041
+ 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>`;
34042
+ }
34043
+ function serialize3dBlobMC(blob) {
34044
+ return `<mc:AlternateContent xmlns:mc="${MC_NS}"><mc:Choice Requires="w14">${blob}</mc:Choice><mc:Fallback/></mc:AlternateContent>`;
34045
+ }
33985
34046
  function pointsToSignedTwips(value) {
33986
34047
  if (value === void 0 || value === null || !Number.isFinite(value)) {
33987
34048
  return null;
@@ -34159,6 +34220,21 @@ function serializeRunProperties(styles) {
34159
34220
  if (styles.textOutline) {
34160
34221
  parts.push(serializeTextOutlineMC(styles.textOutline));
34161
34222
  }
34223
+ if (styles.textShadow) {
34224
+ parts.push(serializeTextShadowMC(styles.textShadow));
34225
+ }
34226
+ if (styles.glow) {
34227
+ parts.push(serializeGlowMC(styles.glow));
34228
+ }
34229
+ if (styles.reflection) {
34230
+ parts.push(serializeReflectionMC(styles.reflection));
34231
+ }
34232
+ if (styles.scene3dXml) {
34233
+ parts.push(serialize3dBlobMC(styles.scene3dXml));
34234
+ }
34235
+ if (styles.props3dXml) {
34236
+ parts.push(serialize3dBlobMC(styles.props3dXml));
34237
+ }
34162
34238
  if (styles.highlight) {
34163
34239
  parts.push(
34164
34240
  `<w:highlight w:val="${escapeXml(normalizeHighlightForDocx(styles.highlight))}"/>`
@@ -36652,7 +36728,18 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
36652
36728
  color: "#BFBFBF"
36653
36729
  });
36654
36730
  }
36655
- if (styles.shadow) {
36731
+ if (styles.textShadow) {
36732
+ const ts = styles.textShadow;
36733
+ const dirRad = ts.dirDeg * Math.PI / 180;
36734
+ const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
36735
+ writer.drawText(pageIndex, {
36736
+ ...baseTextOptions,
36737
+ x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
36738
+ y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
36739
+ text: text2,
36740
+ color: ts.color
36741
+ });
36742
+ } else if (styles.shadow) {
36656
36743
  writer.drawText(pageIndex, {
36657
36744
  ...baseTextOptions,
36658
36745
  x: pxToPt$1(leftPx) + offsetPt,