@harbour-enterprises/superdoc 1.4.0-next.1 → 1.4.0-next.2

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,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-CFRB4XNw.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-DxlpZQZQ.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -15440,7 +15440,7 @@ const canUseDOM = () => {
15440
15440
  return false;
15441
15441
  }
15442
15442
  };
15443
- const summaryVersion = "1.4.0-next.1";
15443
+ const summaryVersion = "1.4.0-next.2";
15444
15444
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15445
15445
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15446
15446
  function mapAttributes(attrs) {
@@ -18072,7 +18072,7 @@ class Editor extends EventEmitter {
18072
18072
  * Process collaboration migrations
18073
18073
  */
18074
18074
  processCollaborationMigrations() {
18075
- console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.1");
18075
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.2");
18076
18076
  if (!this.options.ydoc) return;
18077
18077
  const metaMap = this.options.ydoc.getMap("meta");
18078
18078
  let docVersion = metaMap.get("version");
@@ -23805,6 +23805,9 @@ const renderTableCell = (deps) => {
23805
23805
  imgEl.style.width = "100%";
23806
23806
  imgEl.style.height = "100%";
23807
23807
  imgEl.style.objectFit = block.objectFit ?? "contain";
23808
+ if (block.objectFit === "cover") {
23809
+ imgEl.style.objectPosition = "left top";
23810
+ }
23808
23811
  imgEl.style.display = "block";
23809
23812
  imageWrapper.appendChild(imgEl);
23810
23813
  content.appendChild(imageWrapper);
@@ -23834,6 +23837,9 @@ const renderTableCell = (deps) => {
23834
23837
  img.style.width = "100%";
23835
23838
  img.style.height = "100%";
23836
23839
  img.style.objectFit = block.objectFit ?? "contain";
23840
+ if (block.objectFit === "cover") {
23841
+ img.style.objectPosition = "left top";
23842
+ }
23837
23843
  drawingInner.appendChild(img);
23838
23844
  } else if (renderDrawingContent) {
23839
23845
  const drawingContent = renderDrawingContent(block);
@@ -26405,7 +26411,7 @@ class DomPainter {
26405
26411
  if (fragment.pmEnd != null) {
26406
26412
  fragmentEl.dataset.pmEnd = String(fragment.pmEnd);
26407
26413
  }
26408
- if (fragment.metadata) {
26414
+ if (fragment.metadata && !block.attrs?.vmlWatermark) {
26409
26415
  fragmentEl.setAttribute("data-image-metadata", JSON.stringify(fragment.metadata));
26410
26416
  }
26411
26417
  const img = this.doc.createElement("img");
@@ -26416,7 +26422,28 @@ class DomPainter {
26416
26422
  img.style.width = "100%";
26417
26423
  img.style.height = "100%";
26418
26424
  img.style.objectFit = block.objectFit ?? "contain";
26425
+ if (block.objectFit === "cover") {
26426
+ img.style.objectPosition = "left top";
26427
+ }
26419
26428
  img.style.display = block.display === "inline" ? "inline-block" : "block";
26429
+ const filters = [];
26430
+ if (block.gain != null || block.blacklevel != null) {
26431
+ if (block.gain && typeof block.gain === "string" && block.gain.endsWith("f")) {
26432
+ const contrast = Math.max(0, parseInt(block.gain) / 65536);
26433
+ if (contrast > 0) {
26434
+ filters.push(`contrast(${contrast})`);
26435
+ }
26436
+ }
26437
+ if (block.blacklevel && typeof block.blacklevel === "string" && block.blacklevel.endsWith("f")) {
26438
+ const brightness = Math.max(0, 1 + parseInt(block.blacklevel) / 327 / 100) + 0.5;
26439
+ if (brightness > 0) {
26440
+ filters.push(`brightness(${brightness})`);
26441
+ }
26442
+ }
26443
+ if (filters.length > 0) {
26444
+ img.style.filter = filters.join(" ");
26445
+ }
26446
+ }
26420
26447
  fragmentEl.appendChild(img);
26421
26448
  return fragmentEl;
26422
26449
  } catch (error) {
@@ -26496,6 +26523,9 @@ class DomPainter {
26496
26523
  img.style.width = "100%";
26497
26524
  img.style.height = "100%";
26498
26525
  img.style.objectFit = drawing.objectFit ?? "contain";
26526
+ if (drawing.objectFit === "cover") {
26527
+ img.style.objectPosition = "left top";
26528
+ }
26499
26529
  img.style.display = "block";
26500
26530
  return img;
26501
26531
  }
@@ -31246,13 +31276,8 @@ function computeAnchorX(anchor, columnIndex, columns, imageWidth, margins, pageW
31246
31276
  let baseX;
31247
31277
  let availableWidth;
31248
31278
  if (relativeFrom === "page") {
31249
- if (columns.count === 1) {
31250
- baseX = contentLeft;
31251
- availableWidth = contentWidth;
31252
- } else {
31253
- baseX = 0;
31254
- availableWidth = pageWidth != null ? pageWidth : contentWidth;
31255
- }
31279
+ baseX = 0;
31280
+ availableWidth = pageWidth != null ? pageWidth : contentWidth + marginLeft + marginRight;
31256
31281
  } else if (relativeFrom === "margin") {
31257
31282
  baseX = contentLeft;
31258
31283
  availableWidth = contentWidth;
@@ -32741,7 +32766,9 @@ function collectPreRegisteredAnchors(blocks, measures) {
32741
32766
  if (!isImage && !isDrawing) continue;
32742
32767
  const drawingBlock = block;
32743
32768
  const drawingMeasure = measure;
32744
- if (!drawingBlock.anchor?.isAnchored) continue;
32769
+ if (!drawingBlock.anchor?.isAnchored) {
32770
+ continue;
32771
+ }
32745
32772
  if (isPageRelativeAnchor(drawingBlock)) {
32746
32773
  result.push({ block: drawingBlock, measure: drawingMeasure });
32747
32774
  }
@@ -45889,8 +45916,9 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
45889
45916
  const isInline2 = normalizedWrap?.type === "Inline" || typeof attrs.inline === "boolean" && attrs.inline;
45890
45917
  const display = explicitDisplay === "inline" || explicitDisplay === "block" ? explicitDisplay : isInline2 ? "inline" : "block";
45891
45918
  const explicitObjectFit = typeof attrs.objectFit === "string" ? attrs.objectFit : void 0;
45919
+ const shouldCover = attrs.shouldCover === true;
45892
45920
  const isAnchor = anchor?.isAnchored ?? (typeof attrs.isAnchor === "boolean" ? attrs.isAnchor : false);
45893
- const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
45921
+ const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
45894
45922
  return {
45895
45923
  kind: "image",
45896
45924
  id: nextBlockId("image"),
@@ -45905,7 +45933,10 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
45905
45933
  margin: toBoxSpacing(attrs.marginOffset),
45906
45934
  anchor,
45907
45935
  wrap: normalizedWrap,
45908
- attrs: attrsWithPm
45936
+ attrs: attrsWithPm,
45937
+ // VML image adjustments for watermark effects
45938
+ gain: typeof attrs.gain === "string" || typeof attrs.gain === "number" ? attrs.gain : void 0,
45939
+ blacklevel: typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number" ? attrs.blacklevel : void 0
45909
45940
  };
45910
45941
  }
45911
45942
  function handleImageNode(node, context) {
@@ -49855,11 +49886,13 @@ async function measureImageBlock(block, constraints) {
49855
49886
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
49856
49887
  const isBlockBehindDoc = block.anchor?.behindDoc;
49857
49888
  const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
49858
- const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc;
49889
+ const isPageRelativeAnchor2 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
49890
+ const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor2;
49859
49891
  const isWidthConstraintBypassed = bypassWidthConstraint || constraints.maxWidth <= 0;
49860
49892
  const maxWidth = isWidthConstraintBypassed ? intrinsic.width : constraints.maxWidth;
49861
49893
  const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
49862
- const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
49894
+ const shouldBypassHeightConstraint = hasNegativeVerticalPosition || block.objectFit === "cover";
49895
+ const maxHeight = shouldBypassHeightConstraint || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
49863
49896
  const widthScale = maxWidth / intrinsic.width;
49864
49897
  const heightScale = maxHeight / intrinsic.height;
49865
49898
  const scale = Math.min(1, widthScale, heightScale);
@@ -64521,18 +64554,18 @@ const Image = Node$1.create({
64521
64554
  // Used during DOCX export to restore the original metafile format.
64522
64555
  originalExtension: { rendered: false },
64523
64556
  originalSrc: { rendered: false },
64524
- shouldStretch: {
64557
+ shouldCover: {
64525
64558
  default: false,
64526
64559
  rendered: false
64527
64560
  },
64528
64561
  size: {
64529
64562
  default: {},
64530
- renderDOM: ({ size: size2, shouldStretch }) => {
64563
+ renderDOM: ({ size: size2, shouldCover }) => {
64531
64564
  let style2 = "";
64532
64565
  let { width, height } = size2 ?? {};
64533
64566
  if (width) style2 += `width: ${width}px;`;
64534
- if (height && shouldStretch) {
64535
- style2 += `height: ${height}px; object-fit: fill;`;
64567
+ if (height && shouldCover) {
64568
+ style2 += `height: ${height}px; object-fit: cover; object-position: left top;`;
64536
64569
  } else if (height) style2 += "height: auto;";
64537
64570
  return { style: style2 };
64538
64571
  }
@@ -72815,6 +72848,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
72815
72848
  if (!node || !nodeNames.includes(node.type.name)) {
72816
72849
  return DecorationSet.empty;
72817
72850
  }
72851
+ if (node.attrs?.vmlWatermark === true) {
72852
+ return DecorationSet.empty;
72853
+ }
72818
72854
  const decorations = [];
72819
72855
  if (nodeNames.includes(selection.node?.type.name)) {
72820
72856
  decorations.push(
@@ -72897,6 +72933,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
72897
72933
  const pos = Number.parseInt(wrapper.getAttribute("data-pos"), 10);
72898
72934
  const node = view.state.doc.nodeAt(pos);
72899
72935
  if (!nodeNames.includes(node?.type.name)) return;
72936
+ if (node?.attrs?.vmlWatermark === true) return;
72900
72937
  currentWrapper = wrapper;
72901
72938
  resizeContainer = document.createElement("div");
72902
72939
  resizeContainer.className = "sd-editor-resize-container";
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-CgY28MJz.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-Dy4wkQEB.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-CFRB4XNw.es.js";
3
+ import { S } from "../chunks/SuperConverter-DxlpZQZQ.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-C3KRKogJ.cjs");
3
+ const index = require("./chunks/index-DJuBZura.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-CgY28MJz.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-Dy4wkQEB.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-CEcYlysg.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-CEcYlysg.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-dnQEKI-e.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-dnQEKI-e.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-CFRB4XNw.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-DxlpZQZQ.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-C3KRKogJ.cjs");
4
- const superdoc = require("./chunks/index-BdaseaBw.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-CgY28MJz.cjs");
3
+ const index = require("./chunks/index-DJuBZura.cjs");
4
+ const superdoc = require("./chunks/index-DpgrTjYC.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-Dy4wkQEB.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-CEcYlysg.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-BP9aFfwI.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-CFRB4XNw.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-dnQEKI-e.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-D246eEeJ.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-DxlpZQZQ.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";