superdoc 1.8.2-next.2 → 1.8.2-next.4

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,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-CmcLCoAA.cjs");
5
- const index = require("./index-DT0-49y4.cjs");
4
+ const superdoc = require("./index-BDt0SMPG.cjs");
5
+ const index = require("./index-Cm1X7-Lz.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-BpO3FO9M.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-DXRy_ln-.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-BCicU4sm.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-Cq-aFnBK.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { B as Buffer, c as commonjsGlobal, g as getDefaultExportFromCjs$1 } from "./jszip-B1fkPkPJ.es.js";
2
- import { j as getDocxHighlightKeywordFromHex, n as normalizeHexColor, p as ptToTwips, k as isValidHexColor, m as getHexColorFromDocxSystem, h as halfPointToPoints, o as twipsToPt, c as twipsToPixels, q as eighthPointsToPixels, l as linesToTwips, a as twipsToLines, t as twipsToInches, b as pixelsToTwips, i as inchesToTwips, s as pixelsToEightPoints, u as emuToPixels, v as polygonToObj, w as rotToDegrees, x as pointsToTwips, y as pixelsToEmu, z as degreesToRot, A as objToPolygon, f as libExports, r as resolveOpcTargetPath, B as rgbToHex, C as deobfuscateFont, D as getArrayBufferFromUrl } from "./helpers-BZLaTnr3.es.js";
2
+ import { j as getDocxHighlightKeywordFromHex, n as normalizeHexColor, p as ptToTwips, k as isValidHexColor, m as getHexColorFromDocxSystem, h as halfPointToPoints, o as twipsToPt, c as twipsToPixels, q as eighthPointsToPixels, l as linesToTwips, a as twipsToLines, t as twipsToInches, s as resolveShadingFillColor, b as pixelsToTwips, i as inchesToTwips, u as pixelsToEightPoints, v as emuToPixels, w as polygonToObj, x as rotToDegrees, y as pointsToTwips, z as pixelsToEmu, A as degreesToRot, B as objToPolygon, f as libExports, r as resolveOpcTargetPath, C as rgbToHex, D as deobfuscateFont, E as getArrayBufferFromUrl } from "./helpers-CraselFS.es.js";
3
3
  import { v as v4 } from "./uuid-CjlX8hrF.es.js";
4
4
  function getDefaultExportFromCjs(x2) {
5
5
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -9655,6 +9655,7 @@ function handleTableCellNode({
9655
9655
  node,
9656
9656
  table,
9657
9657
  row,
9658
+ tableProperties,
9658
9659
  rowBorders,
9659
9660
  baseTableBorders,
9660
9661
  tableLook,
@@ -9665,6 +9666,7 @@ function handleTableCellNode({
9665
9666
  rowIndex = 0,
9666
9667
  totalRows = 1,
9667
9668
  totalColumns,
9669
+ preferTableGridWidths = false,
9668
9670
  _referencedStyles
9669
9671
  }) {
9670
9672
  const { nodeListHandler } = params;
@@ -9693,7 +9695,10 @@ function handleTableCellNode({
9693
9695
  referencedStyles
9694
9696
  });
9695
9697
  if (colspan > 1) attributes["colspan"] = colspan;
9696
- let width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9698
+ let width = null;
9699
+ if (!preferTableGridWidths) {
9700
+ width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9701
+ }
9697
9702
  const widthType = tableCellProperties.cellWidth?.type;
9698
9703
  if (widthType) attributes["widthType"] = widthType;
9699
9704
  if (!width && columnWidth) width = columnWidth;
@@ -9718,9 +9723,8 @@ function handleTableCellNode({
9718
9723
  }
9719
9724
  }
9720
9725
  }
9721
- const background = {
9722
- color: tableCellProperties.shading?.fill
9723
- };
9726
+ const backgroundColor = resolveShadingFillColor(tableCellProperties.shading) ?? resolveShadingFillColor(tableProperties?.shading);
9727
+ const background = { color: backgroundColor };
9724
9728
  if (background.color) attributes["background"] = background;
9725
9729
  const verticalAlign = tableCellProperties.vAlign;
9726
9730
  if (verticalAlign) attributes["verticalAlign"] = verticalAlign;
@@ -10072,6 +10076,7 @@ function encode$B(params, encodedAttrs) {
10072
10076
  node,
10073
10077
  table,
10074
10078
  row,
10079
+ tableProperties,
10075
10080
  rowBorders,
10076
10081
  baseTableBorders,
10077
10082
  tableLook,
@@ -10082,6 +10087,7 @@ function encode$B(params, encodedAttrs) {
10082
10087
  rowIndex,
10083
10088
  totalRows,
10084
10089
  totalColumns,
10090
+ preferTableGridWidths,
10085
10091
  _referencedStyles
10086
10092
  } = params.extraParams;
10087
10093
  const schemaNode = handleTableCellNode({
@@ -10089,6 +10095,7 @@ function encode$B(params, encodedAttrs) {
10089
10095
  node,
10090
10096
  table,
10091
10097
  row,
10098
+ tableProperties,
10092
10099
  rowBorders,
10093
10100
  baseTableBorders,
10094
10101
  tableLook,
@@ -10099,6 +10106,7 @@ function encode$B(params, encodedAttrs) {
10099
10106
  rowIndex,
10100
10107
  totalRows,
10101
10108
  totalColumns,
10109
+ preferTableGridWidths,
10102
10110
  _referencedStyles
10103
10111
  });
10104
10112
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -27187,6 +27195,28 @@ const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasure
27187
27195
  };
27188
27196
  const XML_NODE_NAME$f = "w:tbl";
27189
27197
  const SD_NODE_NAME$e = "table";
27198
+ const INDENT_TWIPS_TOLERANCE = 5;
27199
+ const sumColumnTwips = (columns = []) => columns.reduce((sum, col) => {
27200
+ const raw = col?.col;
27201
+ const value = typeof raw === "number" ? raw : Number.parseInt(raw, 10);
27202
+ return Number.isFinite(value) ? sum + value : sum;
27203
+ }, 0);
27204
+ const getFirstRowCellWidthSumTwips = (rows = []) => {
27205
+ const firstRow = rows.find((row) => row?.elements?.some((el) => el.name === "w:tc"));
27206
+ if (!firstRow?.elements) return null;
27207
+ const cells = firstRow.elements.filter((el) => el.name === "w:tc");
27208
+ if (!cells.length) return null;
27209
+ let sum = 0;
27210
+ for (const cell of cells) {
27211
+ const tcPr = cell.elements?.find((el) => el.name === "w:tcPr");
27212
+ const tcW = tcPr?.elements?.find((el) => el.name === "w:tcW");
27213
+ const rawWidth = tcW?.attributes?.["w:w"];
27214
+ const width = typeof rawWidth === "number" ? rawWidth : Number.parseInt(rawWidth, 10);
27215
+ if (!Number.isFinite(width)) return null;
27216
+ sum += width;
27217
+ }
27218
+ return sum;
27219
+ };
27190
27220
  const encode$u = (params, encodedAttrs) => {
27191
27221
  const { nodes } = params;
27192
27222
  const node = nodes[0];
@@ -27248,6 +27278,13 @@ const encode$u = (params, encodedAttrs) => {
27248
27278
  };
27249
27279
  const rows = node.elements.filter((el) => el.name === "w:tr");
27250
27280
  let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
27281
+ const tableIndentTwips = encodedAttrs.tableProperties?.tableIndent?.value;
27282
+ const hasIndent = Number.isFinite(tableIndentTwips) && tableIndentTwips !== 0;
27283
+ const hasExplicitGrid = Boolean(tblGrid);
27284
+ const gridTwipsTotal = hasExplicitGrid ? sumColumnTwips(encodedAttrs["grid"]) : null;
27285
+ const rowTcWTwipsTotal = hasExplicitGrid && hasIndent ? getFirstRowCellWidthSumTwips(rows) : null;
27286
+ const indentDiff = rowTcWTwipsTotal != null && gridTwipsTotal != null ? rowTcWTwipsTotal - gridTwipsTotal : null;
27287
+ const preferTableGridWidths = hasExplicitGrid && hasIndent && gridTwipsTotal != null && rowTcWTwipsTotal != null && Math.sign(indentDiff) === Math.sign(tableIndentTwips) && Math.abs(indentDiff - tableIndentTwips) <= INDENT_TWIPS_TOLERANCE;
27251
27288
  if (!columnWidths.length) {
27252
27289
  const fallback = buildFallbackGridForTable({
27253
27290
  params,
@@ -27272,6 +27309,7 @@ const encode$u = (params, encodedAttrs) => {
27272
27309
  extraParams: {
27273
27310
  row,
27274
27311
  table: node,
27312
+ tableProperties: encodedAttrs.tableProperties,
27275
27313
  tableBorders: encodedAttrs.borders,
27276
27314
  tableLook,
27277
27315
  columnWidths,
@@ -27279,6 +27317,7 @@ const encode$u = (params, encodedAttrs) => {
27279
27317
  rowIndex,
27280
27318
  totalRows,
27281
27319
  totalColumns,
27320
+ preferTableGridWidths,
27282
27321
  _referencedStyles: referencedStyles
27283
27322
  }
27284
27323
  });
@@ -32368,16 +32407,31 @@ function translateHeadingNode(params) {
32368
32407
  };
32369
32408
  return translator$1N.decode({ ...params, node: paragraphNode });
32370
32409
  }
32410
+ function mergeMcIgnorable(defaultIgnorable = "", originalIgnorable = "") {
32411
+ const merged = [
32412
+ .../* @__PURE__ */ new Set([...defaultIgnorable.split(/\s+/).filter(Boolean), ...originalIgnorable.split(/\s+/).filter(Boolean)])
32413
+ ];
32414
+ return merged.join(" ");
32415
+ }
32371
32416
  function translateDocumentNode(params) {
32372
32417
  const bodyNode = {
32373
32418
  type: "body",
32374
32419
  content: params.node.content
32375
32420
  };
32376
32421
  const translatedBodyNode = exportSchemaToJson({ ...params, node: bodyNode });
32422
+ const originalAttrs = params.converter?.documentAttributes || {};
32423
+ const attributes = {
32424
+ ...DEFAULT_DOCX_DEFS,
32425
+ ...originalAttrs
32426
+ };
32427
+ const mergedIgnorable = mergeMcIgnorable(DEFAULT_DOCX_DEFS["mc:Ignorable"], originalAttrs["mc:Ignorable"]);
32428
+ if (mergedIgnorable) {
32429
+ attributes["mc:Ignorable"] = mergedIgnorable;
32430
+ }
32377
32431
  const node = {
32378
32432
  name: "w:document",
32379
32433
  elements: [translatedBodyNode],
32380
- attributes: DEFAULT_DOCX_DEFS
32434
+ attributes
32381
32435
  };
32382
32436
  return [node, params];
32383
32437
  }
@@ -33509,7 +33563,7 @@ class SuperConverter {
33509
33563
  static getStoredSuperdocVersion(docx) {
33510
33564
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33511
33565
  }
33512
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.2-next.2") {
33566
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.2-next.4") {
33513
33567
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33514
33568
  }
33515
33569
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
- const helpers = require("./helpers-CnY-716k.cjs");
3
+ const helpers = require("./helpers-C7_u3NNJ.cjs");
4
4
  const uuid = require("./uuid-R7L08bOx.cjs");
5
5
  function getDefaultExportFromCjs(x2) {
6
6
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -9656,6 +9656,7 @@ function handleTableCellNode({
9656
9656
  node,
9657
9657
  table,
9658
9658
  row,
9659
+ tableProperties,
9659
9660
  rowBorders,
9660
9661
  baseTableBorders,
9661
9662
  tableLook,
@@ -9666,6 +9667,7 @@ function handleTableCellNode({
9666
9667
  rowIndex = 0,
9667
9668
  totalRows = 1,
9668
9669
  totalColumns,
9670
+ preferTableGridWidths = false,
9669
9671
  _referencedStyles
9670
9672
  }) {
9671
9673
  const { nodeListHandler } = params;
@@ -9694,7 +9696,10 @@ function handleTableCellNode({
9694
9696
  referencedStyles
9695
9697
  });
9696
9698
  if (colspan > 1) attributes["colspan"] = colspan;
9697
- let width = tableCellProperties.cellWidth?.value ? helpers.twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9699
+ let width = null;
9700
+ if (!preferTableGridWidths) {
9701
+ width = tableCellProperties.cellWidth?.value ? helpers.twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9702
+ }
9698
9703
  const widthType = tableCellProperties.cellWidth?.type;
9699
9704
  if (widthType) attributes["widthType"] = widthType;
9700
9705
  if (!width && columnWidth) width = columnWidth;
@@ -9719,9 +9724,8 @@ function handleTableCellNode({
9719
9724
  }
9720
9725
  }
9721
9726
  }
9722
- const background = {
9723
- color: tableCellProperties.shading?.fill
9724
- };
9727
+ const backgroundColor = helpers.resolveShadingFillColor(tableCellProperties.shading) ?? helpers.resolveShadingFillColor(tableProperties?.shading);
9728
+ const background = { color: backgroundColor };
9725
9729
  if (background.color) attributes["background"] = background;
9726
9730
  const verticalAlign = tableCellProperties.vAlign;
9727
9731
  if (verticalAlign) attributes["verticalAlign"] = verticalAlign;
@@ -10073,6 +10077,7 @@ function encode$B(params, encodedAttrs) {
10073
10077
  node,
10074
10078
  table,
10075
10079
  row,
10080
+ tableProperties,
10076
10081
  rowBorders,
10077
10082
  baseTableBorders,
10078
10083
  tableLook,
@@ -10083,6 +10088,7 @@ function encode$B(params, encodedAttrs) {
10083
10088
  rowIndex,
10084
10089
  totalRows,
10085
10090
  totalColumns,
10091
+ preferTableGridWidths,
10086
10092
  _referencedStyles
10087
10093
  } = params.extraParams;
10088
10094
  const schemaNode = handleTableCellNode({
@@ -10090,6 +10096,7 @@ function encode$B(params, encodedAttrs) {
10090
10096
  node,
10091
10097
  table,
10092
10098
  row,
10099
+ tableProperties,
10093
10100
  rowBorders,
10094
10101
  baseTableBorders,
10095
10102
  tableLook,
@@ -10100,6 +10107,7 @@ function encode$B(params, encodedAttrs) {
10100
10107
  rowIndex,
10101
10108
  totalRows,
10102
10109
  totalColumns,
10110
+ preferTableGridWidths,
10103
10111
  _referencedStyles
10104
10112
  });
10105
10113
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -27188,6 +27196,28 @@ const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasure
27188
27196
  };
27189
27197
  const XML_NODE_NAME$f = "w:tbl";
27190
27198
  const SD_NODE_NAME$e = "table";
27199
+ const INDENT_TWIPS_TOLERANCE = 5;
27200
+ const sumColumnTwips = (columns = []) => columns.reduce((sum, col) => {
27201
+ const raw = col?.col;
27202
+ const value = typeof raw === "number" ? raw : Number.parseInt(raw, 10);
27203
+ return Number.isFinite(value) ? sum + value : sum;
27204
+ }, 0);
27205
+ const getFirstRowCellWidthSumTwips = (rows = []) => {
27206
+ const firstRow = rows.find((row) => row?.elements?.some((el) => el.name === "w:tc"));
27207
+ if (!firstRow?.elements) return null;
27208
+ const cells = firstRow.elements.filter((el) => el.name === "w:tc");
27209
+ if (!cells.length) return null;
27210
+ let sum = 0;
27211
+ for (const cell of cells) {
27212
+ const tcPr = cell.elements?.find((el) => el.name === "w:tcPr");
27213
+ const tcW = tcPr?.elements?.find((el) => el.name === "w:tcW");
27214
+ const rawWidth = tcW?.attributes?.["w:w"];
27215
+ const width = typeof rawWidth === "number" ? rawWidth : Number.parseInt(rawWidth, 10);
27216
+ if (!Number.isFinite(width)) return null;
27217
+ sum += width;
27218
+ }
27219
+ return sum;
27220
+ };
27191
27221
  const encode$u = (params, encodedAttrs) => {
27192
27222
  const { nodes } = params;
27193
27223
  const node = nodes[0];
@@ -27249,6 +27279,13 @@ const encode$u = (params, encodedAttrs) => {
27249
27279
  };
27250
27280
  const rows = node.elements.filter((el) => el.name === "w:tr");
27251
27281
  let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => helpers.twipsToPixels(item.col)) : [];
27282
+ const tableIndentTwips = encodedAttrs.tableProperties?.tableIndent?.value;
27283
+ const hasIndent = Number.isFinite(tableIndentTwips) && tableIndentTwips !== 0;
27284
+ const hasExplicitGrid = Boolean(tblGrid);
27285
+ const gridTwipsTotal = hasExplicitGrid ? sumColumnTwips(encodedAttrs["grid"]) : null;
27286
+ const rowTcWTwipsTotal = hasExplicitGrid && hasIndent ? getFirstRowCellWidthSumTwips(rows) : null;
27287
+ const indentDiff = rowTcWTwipsTotal != null && gridTwipsTotal != null ? rowTcWTwipsTotal - gridTwipsTotal : null;
27288
+ const preferTableGridWidths = hasExplicitGrid && hasIndent && gridTwipsTotal != null && rowTcWTwipsTotal != null && Math.sign(indentDiff) === Math.sign(tableIndentTwips) && Math.abs(indentDiff - tableIndentTwips) <= INDENT_TWIPS_TOLERANCE;
27252
27289
  if (!columnWidths.length) {
27253
27290
  const fallback = buildFallbackGridForTable({
27254
27291
  params,
@@ -27273,6 +27310,7 @@ const encode$u = (params, encodedAttrs) => {
27273
27310
  extraParams: {
27274
27311
  row,
27275
27312
  table: node,
27313
+ tableProperties: encodedAttrs.tableProperties,
27276
27314
  tableBorders: encodedAttrs.borders,
27277
27315
  tableLook,
27278
27316
  columnWidths,
@@ -27280,6 +27318,7 @@ const encode$u = (params, encodedAttrs) => {
27280
27318
  rowIndex,
27281
27319
  totalRows,
27282
27320
  totalColumns,
27321
+ preferTableGridWidths,
27283
27322
  _referencedStyles: referencedStyles
27284
27323
  }
27285
27324
  });
@@ -32369,16 +32408,31 @@ function translateHeadingNode(params) {
32369
32408
  };
32370
32409
  return translator$1N.decode({ ...params, node: paragraphNode });
32371
32410
  }
32411
+ function mergeMcIgnorable(defaultIgnorable = "", originalIgnorable = "") {
32412
+ const merged = [
32413
+ .../* @__PURE__ */ new Set([...defaultIgnorable.split(/\s+/).filter(Boolean), ...originalIgnorable.split(/\s+/).filter(Boolean)])
32414
+ ];
32415
+ return merged.join(" ");
32416
+ }
32372
32417
  function translateDocumentNode(params) {
32373
32418
  const bodyNode = {
32374
32419
  type: "body",
32375
32420
  content: params.node.content
32376
32421
  };
32377
32422
  const translatedBodyNode = exportSchemaToJson({ ...params, node: bodyNode });
32423
+ const originalAttrs = params.converter?.documentAttributes || {};
32424
+ const attributes = {
32425
+ ...DEFAULT_DOCX_DEFS,
32426
+ ...originalAttrs
32427
+ };
32428
+ const mergedIgnorable = mergeMcIgnorable(DEFAULT_DOCX_DEFS["mc:Ignorable"], originalAttrs["mc:Ignorable"]);
32429
+ if (mergedIgnorable) {
32430
+ attributes["mc:Ignorable"] = mergedIgnorable;
32431
+ }
32378
32432
  const node = {
32379
32433
  name: "w:document",
32380
32434
  elements: [translatedBodyNode],
32381
- attributes: DEFAULT_DOCX_DEFS
32435
+ attributes
32382
32436
  };
32383
32437
  return [node, params];
32384
32438
  }
@@ -33510,7 +33564,7 @@ class SuperConverter {
33510
33564
  static getStoredSuperdocVersion(docx) {
33511
33565
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33512
33566
  }
33513
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.2-next.2") {
33567
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.2-next.4") {
33514
33568
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33515
33569
  }
33516
33570
  /**
@@ -288,6 +288,43 @@ const componentToHex = (val) => {
288
288
  const rgbToHex = (rgb) => {
289
289
  return "#" + rgb.match(/\d+/g).map(componentToHex).join("");
290
290
  };
291
+ const DEFAULT_SHADING_FOREGROUND_COLOR = "#000000";
292
+ const hexToRgb = (hex) => {
293
+ const normalized = normalizeHexColor(hex);
294
+ if (!normalized) return null;
295
+ return {
296
+ r: Number.parseInt(normalized.slice(0, 2), 16),
297
+ g: Number.parseInt(normalized.slice(2, 4), 16),
298
+ b: Number.parseInt(normalized.slice(4, 6), 16)
299
+ };
300
+ };
301
+ const clamp01 = (value) => {
302
+ if (!Number.isFinite(value)) return 0;
303
+ return Math.min(1, Math.max(0, value));
304
+ };
305
+ const blendHexColors = (backgroundHex, foregroundHex, foregroundRatio) => {
306
+ const background = hexToRgb(backgroundHex);
307
+ const foreground = hexToRgb(foregroundHex);
308
+ if (!background || !foreground) return null;
309
+ const ratio = clamp01(foregroundRatio);
310
+ const r = Math.round(background.r * (1 - ratio) + foreground.r * ratio);
311
+ const g = Math.round(background.g * (1 - ratio) + foreground.g * ratio);
312
+ const b = Math.round(background.b * (1 - ratio) + foreground.b * ratio);
313
+ const toByte = (n) => n.toString(16).padStart(2, "0").toUpperCase();
314
+ return `${toByte(r)}${toByte(g)}${toByte(b)}`;
315
+ };
316
+ const resolveShadingFillColor = (shading) => {
317
+ if (!shading || typeof shading !== "object") return null;
318
+ const fill = normalizeHexColor(shading.fill);
319
+ if (!fill) return null;
320
+ const val = typeof shading.val === "string" ? shading.val.trim().toLowerCase() : "";
321
+ const pctMatch = val.match(/^pct(\d{1,3})$/);
322
+ if (!pctMatch) return fill;
323
+ const pct = Number.parseInt(pctMatch[1], 10);
324
+ if (!Number.isFinite(pct) || pct < 0 || pct > 100) return fill;
325
+ const foreground = normalizeHexColor(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR;
326
+ return blendHexColors(fill, foreground, pct / 100) ?? fill;
327
+ };
291
328
  const deobfuscateFont = (arrayBuffer, guidHex) => {
292
329
  const dta = new Uint8Array(arrayBuffer);
293
330
  const guidStr = guidHex.replace(/[-{}]/g, "");
@@ -362,6 +399,7 @@ exports.pointsToTwips = pointsToTwips;
362
399
  exports.polygonToObj = polygonToObj;
363
400
  exports.ptToTwips = ptToTwips;
364
401
  exports.resolveOpcTargetPath = resolveOpcTargetPath;
402
+ exports.resolveShadingFillColor = resolveShadingFillColor;
365
403
  exports.rgbToHex = rgbToHex;
366
404
  exports.rotToDegrees = rotToDegrees;
367
405
  exports.twipsToInches = twipsToInches;
@@ -287,6 +287,43 @@ const componentToHex = (val) => {
287
287
  const rgbToHex = (rgb) => {
288
288
  return "#" + rgb.match(/\d+/g).map(componentToHex).join("");
289
289
  };
290
+ const DEFAULT_SHADING_FOREGROUND_COLOR = "#000000";
291
+ const hexToRgb = (hex) => {
292
+ const normalized = normalizeHexColor(hex);
293
+ if (!normalized) return null;
294
+ return {
295
+ r: Number.parseInt(normalized.slice(0, 2), 16),
296
+ g: Number.parseInt(normalized.slice(2, 4), 16),
297
+ b: Number.parseInt(normalized.slice(4, 6), 16)
298
+ };
299
+ };
300
+ const clamp01 = (value) => {
301
+ if (!Number.isFinite(value)) return 0;
302
+ return Math.min(1, Math.max(0, value));
303
+ };
304
+ const blendHexColors = (backgroundHex, foregroundHex, foregroundRatio) => {
305
+ const background = hexToRgb(backgroundHex);
306
+ const foreground = hexToRgb(foregroundHex);
307
+ if (!background || !foreground) return null;
308
+ const ratio = clamp01(foregroundRatio);
309
+ const r = Math.round(background.r * (1 - ratio) + foreground.r * ratio);
310
+ const g = Math.round(background.g * (1 - ratio) + foreground.g * ratio);
311
+ const b = Math.round(background.b * (1 - ratio) + foreground.b * ratio);
312
+ const toByte = (n) => n.toString(16).padStart(2, "0").toUpperCase();
313
+ return `${toByte(r)}${toByte(g)}${toByte(b)}`;
314
+ };
315
+ const resolveShadingFillColor = (shading) => {
316
+ if (!shading || typeof shading !== "object") return null;
317
+ const fill = normalizeHexColor(shading.fill);
318
+ if (!fill) return null;
319
+ const val = typeof shading.val === "string" ? shading.val.trim().toLowerCase() : "";
320
+ const pctMatch = val.match(/^pct(\d{1,3})$/);
321
+ if (!pctMatch) return fill;
322
+ const pct = Number.parseInt(pctMatch[1], 10);
323
+ if (!Number.isFinite(pct) || pct < 0 || pct > 100) return fill;
324
+ const foreground = normalizeHexColor(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR;
325
+ return blendHexColors(fill, foreground, pct / 100) ?? fill;
326
+ };
290
327
  const deobfuscateFont = (arrayBuffer, guidHex) => {
291
328
  const dta = new Uint8Array(arrayBuffer);
292
329
  const guidStr = guidHex.replace(/[-{}]/g, "");
@@ -338,10 +375,11 @@ function convertSizeToCSS(value, type) {
338
375
  }
339
376
  }
340
377
  export {
341
- objToPolygon as A,
342
- rgbToHex as B,
343
- deobfuscateFont as C,
344
- getArrayBufferFromUrl as D,
378
+ degreesToRot as A,
379
+ objToPolygon as B,
380
+ rgbToHex as C,
381
+ deobfuscateFont as D,
382
+ getArrayBufferFromUrl as E,
345
383
  twipsToLines as a,
346
384
  pixelsToTwips as b,
347
385
  twipsToPixels as c,
@@ -360,12 +398,12 @@ export {
360
398
  ptToTwips as p,
361
399
  eighthPointsToPixels as q,
362
400
  resolveOpcTargetPath as r,
363
- pixelsToEightPoints as s,
401
+ resolveShadingFillColor as s,
364
402
  twipsToInches as t,
365
- emuToPixels as u,
366
- polygonToObj as v,
367
- rotToDegrees as w,
368
- pointsToTwips as x,
369
- pixelsToEmu as y,
370
- degreesToRot as z
403
+ pixelsToEightPoints as u,
404
+ emuToPixels as v,
405
+ polygonToObj as w,
406
+ rotToDegrees as x,
407
+ pointsToTwips as y,
408
+ pixelsToEmu as z
371
409
  };
@@ -1,10 +1,10 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-DXRy_ln-.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-Cq-aFnBK.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
5
5
  import "./jszip-B1fkPkPJ.es.js";
6
- import "./helpers-BZLaTnr3.es.js";
7
- import "./SuperConverter-BwBuaGR-.es.js";
6
+ import "./helpers-CraselFS.es.js";
7
+ import "./SuperConverter-B7668oVY.es.js";
8
8
  import { i as inject, a as provide, c as computed, o as onBeforeUnmount, p as process$1, b as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, e as TransitionGroup, w as watchEffect, r as ref, f as onMounted, g as Teleport, F as Fragment, j as reactive, k as effectScope, m as markRaw, l as toRaw, n as isRef, q as isReactive, s as getCurrentInstance, u as watch, v as unref, x as hasInjectionContext, y as nextTick, z as getCurrentScope, A as onScopeDispose, B as toRefs, C as global, D as shallowRef, E as createElementBlock, G as openBlock, H as toDisplayString, I as createVNode, J as withCtx, K as createBaseVNode, L as normalizeStyle, M as createCommentVNode, N as createBlock, O as withModifiers, P as normalizeClass, Q as resolveDirective, R as withDirectives, S as renderList, U as createApp, V as resolveDynamicComponent, W as defineAsyncComponent } from "./vue-BnBKJwCW.es.js";
9
9
  import "./jszip.min-DCl8qkFO.es.js";
10
10
  import { createZip } from "../super-editor/file-zipper.es.js";
@@ -7672,7 +7672,7 @@ const _sfc_main = {
7672
7672
  __name: "SuperDoc",
7673
7673
  emits: ["selection-update"],
7674
7674
  setup(__props, { emit: __emit }) {
7675
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CRhrGEsL.es.js"));
7675
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-hG1Tu8iv.es.js"));
7676
7676
  const superdocStore = useSuperdocStore();
7677
7677
  const commentsStore = useCommentsStore();
7678
7678
  const {
@@ -8657,7 +8657,7 @@ class SuperDoc extends EventEmitter {
8657
8657
  this.config.colors = shuffleArray(this.config.colors);
8658
8658
  this.userColorMap = /* @__PURE__ */ new Map();
8659
8659
  this.colorIndex = 0;
8660
- this.version = "1.8.2-next.2";
8660
+ this.version = "1.8.2-next.4";
8661
8661
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8662
8662
  this.superdocId = config.superdocId || v4();
8663
8663
  this.colors = this.config.colors;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- const index = require("./index-DT0-49y4.cjs");
2
+ const index = require("./index-Cm1X7-Lz.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
5
5
  const provider = require("@hocuspocus/provider");
6
6
  require("./jszip-C8_CqJxM.cjs");
7
- require("./helpers-CnY-716k.cjs");
8
- require("./SuperConverter-B39dCut-.cjs");
7
+ require("./helpers-C7_u3NNJ.cjs");
8
+ require("./SuperConverter-CmfkG_P-.cjs");
9
9
  const vue = require("./vue-De9wkgLl.cjs");
10
10
  require("./jszip.min-BPh2MMAa.cjs");
11
11
  const superEditor_fileZipper = require("../super-editor/file-zipper.cjs");
@@ -7689,7 +7689,7 @@ const _sfc_main = {
7689
7689
  __name: "SuperDoc",
7690
7690
  emits: ["selection-update"],
7691
7691
  setup(__props, { emit: __emit }) {
7692
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BwFluCQM.cjs")));
7692
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D-1pvbsl.cjs")));
7693
7693
  const superdocStore = useSuperdocStore();
7694
7694
  const commentsStore = useCommentsStore();
7695
7695
  const {
@@ -8674,7 +8674,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8674
8674
  this.config.colors = shuffleArray(this.config.colors);
8675
8675
  this.userColorMap = /* @__PURE__ */ new Map();
8676
8676
  this.colorIndex = 0;
8677
- this.version = "1.8.2-next.2";
8677
+ this.version = "1.8.2-next.4";
8678
8678
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8679
8679
  this.superdocId = config.superdocId || uuid.v4();
8680
8680
  this.colors = this.config.colors;