@harbour-enterprises/superdoc 0.24.0-next.3 → 0.24.0-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.
Files changed (72) hide show
  1. package/dist/chunks/{PdfViewer-DEWI6Uts.es.js → PdfViewer-D7C8g2G4.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-skWUtg2N.cjs → PdfViewer-kOVuv-4I.cjs} +1 -1
  3. package/dist/chunks/blank-docx-ABm6XYAA.es.js +4 -0
  4. package/dist/chunks/blank-docx-DfW3Eeh2.cjs +3 -0
  5. package/dist/chunks/{index-2QL0aZ2S.cjs → index-BFKwBQjS.cjs} +12 -4
  6. package/dist/chunks/{index-C_AMhrHP.es.js → index-CnEAVnHQ.es.js} +12 -4
  7. package/dist/chunks/{super-editor.es-CfK_qBM9.cjs → super-editor.es-BmGTQ05x.cjs} +1010 -859
  8. package/dist/chunks/{super-editor.es-iMAoOYOw.es.js → super-editor.es-CBPoWvjs.es.js} +1010 -859
  9. package/dist/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/core/types/index.d.ts.map +1 -1
  11. package/dist/style.css +27 -27
  12. package/dist/super-editor/ai-writer.es.js +2 -2
  13. package/dist/super-editor/chunks/{converter-BueCftlx.js → converter-DpPj67OW.js} +916 -863
  14. package/dist/super-editor/chunks/{docx-zipper-C9jmfWYZ.js → docx-zipper-6Kc95yG-.js} +1 -1
  15. package/dist/super-editor/chunks/{editor-BsuNqVvp.js → editor-Dx6AhT5N.js} +124 -6
  16. package/dist/super-editor/chunks/{toolbar-DxhfgAoa.js → toolbar-CXSg2lJ9.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/super-editor/src/core/Editor.d.ts +11 -0
  22. package/dist/super-editor/super-editor/src/core/helpers/canRenderFont.d.ts +12 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts +6 -1
  24. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +1 -1
  25. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +2 -1
  26. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +5 -3
  27. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +4 -0
  28. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +9 -0
  29. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/gridSpan-translator.d.ts +6 -0
  30. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/index.d.ts +1 -0
  31. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/header-translator.d.ts +6 -0
  32. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/index.d.ts +1 -0
  33. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts +7 -0
  34. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/index.d.ts +1 -0
  35. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/hideMark-translator.d.ts +6 -0
  36. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/index.d.ts +1 -0
  37. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/index.d.ts +1 -0
  38. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/noWrap-translator.d.ts +6 -0
  39. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/shd/shd-translator.d.ts +1 -1
  40. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/translate-table-cell.d.ts +0 -5
  41. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/index.d.ts +1 -0
  42. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/tcBorders-translator.d.ts +6 -0
  43. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/index.d.ts +1 -0
  44. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/tcFitText-translator.d.ts +6 -0
  45. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/index.d.ts +1 -0
  46. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/tcMar-translator.d.ts +6 -0
  47. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/index.d.ts +1 -0
  48. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/tcPr-translator.d.ts +5 -0
  49. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/index.d.ts +1 -0
  50. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/tcW-translator.d.ts +6 -0
  51. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/index.d.ts +1 -0
  52. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/textDirection-translator.d.ts +6 -0
  53. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/index.d.ts +1 -0
  54. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/tl2br-translator.d.ts +6 -0
  55. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/index.d.ts +1 -0
  56. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/tr2bl-translator.d.ts +6 -0
  57. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/index.d.ts +1 -0
  58. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/vAlign-translator.d.ts +6 -0
  59. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/index.d.ts +1 -0
  60. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/vMerge-translator.d.ts +6 -0
  61. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +112 -0
  62. package/dist/super-editor/super-editor.es.js +91 -76
  63. package/dist/super-editor/toolbar.es.js +2 -2
  64. package/dist/super-editor.cjs +1 -1
  65. package/dist/super-editor.es.js +1 -1
  66. package/dist/superdoc.cjs +3 -3
  67. package/dist/superdoc.es.js +3 -3
  68. package/dist/superdoc.umd.js +1020 -861
  69. package/dist/superdoc.umd.js.map +1 -1
  70. package/package.json +1 -1
  71. package/dist/chunks/blank-docx-CPqX9RF5.cjs +0 -3
  72. package/dist/chunks/blank-docx-iwdyG9RH.es.js +0 -4
@@ -1,4 +1,4 @@
1
- import { p as process$1, ax as commonjsGlobal, B as Buffer, ay as getDefaultExportFromCjs, az as getContentTypesFromXml, aA as xmljs } from "./converter-BueCftlx.js";
1
+ import { p as process$1, ax as commonjsGlobal, B as Buffer, ay as getDefaultExportFromCjs, az as getContentTypesFromXml, aA as xmljs } from "./converter-DpPj67OW.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -9,12 +9,12 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
12
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFontsWithLocalFonts_fn, determineUnsupportedFontsWithCanvas_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship, aw as inchesToPixels } from "./converter-BueCftlx.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship, aw as inchesToPixels } from "./converter-DpPj67OW.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-C9jmfWYZ.js";
17
+ import { D as DocxZipper } from "./docx-zipper-6Kc95yG-.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -13101,6 +13101,29 @@ const setImageNodeSelection = (view, pos) => {
13101
13101
  }
13102
13102
  return false;
13103
13103
  };
13104
+ function canRenderFont(fontName, fallbackFont = "sans-serif") {
13105
+ const _canRenderFont = (fontName2, fallbackFont2) => {
13106
+ const canvas = document.createElement("canvas");
13107
+ const ctx = canvas.getContext("2d");
13108
+ ctx.textBaseline = "top";
13109
+ const text = "abcdefghijklmnopqrstuvwxyz0123456789";
13110
+ ctx.font = `72px ${fallbackFont2}`;
13111
+ const initialTextMeasurement = ctx.measureText(text);
13112
+ const fallbackWidth = initialTextMeasurement.width;
13113
+ const fallbackHeight = initialTextMeasurement.actualBoundingBoxDescent;
13114
+ ctx.font = `72px "${fontName2}", ${fallbackFont2}`;
13115
+ const customTextMeasurement = ctx.measureText(text);
13116
+ const customFontWidth = customTextMeasurement.width;
13117
+ const customFontHeight = customTextMeasurement.actualBoundingBoxDescent;
13118
+ const isAvailable = customFontWidth !== fallbackWidth || customFontHeight !== fallbackHeight;
13119
+ return isAvailable;
13120
+ };
13121
+ if (_canRenderFont(fontName, fallbackFont)) {
13122
+ return true;
13123
+ }
13124
+ const oppositeFallbackFont = fallbackFont === "sans-serif" ? "serif" : "sans-serif";
13125
+ return _canRenderFont(fontName, oppositeFallbackFont);
13126
+ }
13104
13127
  const { findChildren: findChildren$3 } = helpers;
13105
13128
  function getAllFieldAnnotations(state) {
13106
13129
  let fieldAnnotations = findChildren$3(state.doc, (node) => node.type.name === "fieldAnnotation");
@@ -14193,6 +14216,11 @@ const _Editor = class _Editor extends EventEmitter {
14193
14216
  * @type {boolean}
14194
14217
  */
14195
14218
  __publicField(this, "isFocused", false);
14219
+ /**
14220
+ * All the embedded fonts that were imported by the Editor
14221
+ * @type {string[]}
14222
+ */
14223
+ __publicField(this, "fontsImported", []);
14196
14224
  __publicField(this, "options", {
14197
14225
  element: null,
14198
14226
  selector: null,
@@ -14253,6 +14281,7 @@ const _Editor = class _Editor extends EventEmitter {
14253
14281
  onPaginationUpdate: () => null,
14254
14282
  onException: () => null,
14255
14283
  onListDefinitionsChange: () => null,
14284
+ onFontsResolved: null,
14256
14285
  // async (file) => url;
14257
14286
  handleImageUpload: null,
14258
14287
  // telemetry
@@ -15238,6 +15267,9 @@ init_fn = function() {
15238
15267
  this.emit("beforeCreate", { editor: this });
15239
15268
  this.on("contentError", this.options.onContentError);
15240
15269
  this.mount(this.options.element);
15270
+ if (!this.options.isHeadless) {
15271
+ __privateMethod(this, _Editor_instances, checkFonts_fn).call(this);
15272
+ }
15241
15273
  this.on("create", this.options.onCreate);
15242
15274
  this.on("update", this.options.onUpdate);
15243
15275
  this.on("selectionUpdate", this.options.onSelectionUpdate);
@@ -15438,13 +15470,90 @@ initMedia_fn = function() {
15438
15470
  * @returns {void}
15439
15471
  */
15440
15472
  initFonts_fn = function() {
15441
- const styleString = this.converter.getDocumentFonts();
15442
- if (styleString?.length) {
15473
+ const results = this.converter.getFontFaceImportString();
15474
+ if (results?.styleString?.length) {
15443
15475
  const style = document.createElement("style");
15444
- style.textContent = styleString;
15476
+ style.textContent = results.styleString;
15445
15477
  document.head.appendChild(style);
15478
+ this.fontsImported = results.fontsImported;
15446
15479
  }
15447
15480
  };
15481
+ checkFonts_fn = async function() {
15482
+ if (!this.options.onFontsResolved || typeof this.options.onFontsResolved !== "function") {
15483
+ return;
15484
+ }
15485
+ if (this.options.isHeadless) {
15486
+ return;
15487
+ }
15488
+ const fontsUsedInDocument = this.converter.getDocumentFonts();
15489
+ if (!("queryLocalFonts" in window)) {
15490
+ console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
15491
+ const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
15492
+ this.options.onFontsResolved({
15493
+ documentFonts: fontsUsedInDocument,
15494
+ unsupportedFonts
15495
+ });
15496
+ return;
15497
+ }
15498
+ const localFontAccess = await navigator.permissions.query({ name: "local-fonts" });
15499
+ if (localFontAccess.state === "denied") {
15500
+ console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
15501
+ const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
15502
+ this.options.onFontsResolved({
15503
+ documentFonts: fontsUsedInDocument,
15504
+ unsupportedFonts
15505
+ });
15506
+ return;
15507
+ }
15508
+ try {
15509
+ const localFonts = await window.queryLocalFonts();
15510
+ const uniqueLocalFonts = [...new Set(localFonts.map((font) => font.family))];
15511
+ const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithLocalFonts_fn).call(this, fontsUsedInDocument, uniqueLocalFonts);
15512
+ this.options.onFontsResolved({
15513
+ documentFonts: fontsUsedInDocument,
15514
+ unsupportedFonts
15515
+ });
15516
+ } catch {
15517
+ console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
15518
+ const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
15519
+ this.options.onFontsResolved({
15520
+ documentFonts: fontsUsedInDocument,
15521
+ unsupportedFonts
15522
+ });
15523
+ }
15524
+ };
15525
+ /**
15526
+ * Determines which fonts used in the document are not available locally nor imported.
15527
+ *
15528
+ * @param {string[]} fonts - Array of font family names used in the document.
15529
+ * @param {string[]} localFonts - Array of local font family names available on the system.
15530
+ * @returns {string[]} Array of font names that are unsupported.
15531
+ */
15532
+ determineUnsupportedFontsWithLocalFonts_fn = function(fonts, localFonts) {
15533
+ const unsupportedFonts = fonts.filter((font) => {
15534
+ const isLocalFont = localFonts.includes(font);
15535
+ const isFontImported = this.fontsImported.includes(font);
15536
+ return !isLocalFont && !isFontImported;
15537
+ });
15538
+ return unsupportedFonts;
15539
+ };
15540
+ /**
15541
+ * Determines which fonts used in the document are not supported
15542
+ * by attempting to render them on a canvas.
15543
+ * Fonts are considered unsupported if they cannot be rendered
15544
+ * and are not already imported in the document via @font-face.
15545
+ *
15546
+ * @param {string[]} fonts - Array of font family names used in the document.
15547
+ * @returns {string[]} Array of unsupported font family names.
15548
+ */
15549
+ determineUnsupportedFontsWithCanvas_fn = function(fonts) {
15550
+ const unsupportedFonts = fonts.filter((font) => {
15551
+ const canRender = canRenderFont(font);
15552
+ const isFontImported = this.fontsImported.includes(font);
15553
+ return !canRender && !isFontImported;
15554
+ });
15555
+ return unsupportedFonts;
15556
+ };
15448
15557
  /**
15449
15558
  * Creates document PM schema.
15450
15559
  * @returns {void}
@@ -24256,6 +24365,15 @@ const TableCell = Node$1.create({
24256
24365
  widthUnit: {
24257
24366
  default: "px",
24258
24367
  rendered: false
24368
+ },
24369
+ /**
24370
+ * @category Attribute
24371
+ * @param {TableCellProperties} tableCellProperties - Properties for the table cell.
24372
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 463
24373
+ */
24374
+ tableCellProperties: {
24375
+ default: null,
24376
+ rendered: false
24259
24377
  }
24260
24378
  };
24261
24379
  },
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-BueCftlx.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BsuNqVvp.js";
2
+ import { p as process$1 } from "./converter-DpPj67OW.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Dx6AhT5N.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-BueCftlx.js";
1
+ import { a5 } from "./chunks/converter-DpPj67OW.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-BueCftlx.js";
2
- import { D } from "./chunks/docx-zipper-C9jmfWYZ.js";
1
+ import "./chunks/converter-DpPj67OW.js";
2
+ import { D } from "./chunks/docx-zipper-6Kc95yG-.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-BsuNqVvp.js";
2
- import "./chunks/converter-BueCftlx.js";
3
- import "./chunks/docx-zipper-C9jmfWYZ.js";
1
+ import { E } from "./chunks/editor-Dx6AhT5N.js";
2
+ import "./chunks/converter-DpPj67OW.js";
3
+ import "./chunks/docx-zipper-6Kc95yG-.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-C9jmfWYZ.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-6Kc95yG-.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -82,6 +82,7 @@
82
82
  * @property {Function} [onPaginationUpdate] - Called when pagination updates
83
83
  * @property {Function} [onException] - Called when an exception occurs
84
84
  * @property {Function} [onListDefinitionsChange] - Called when list definitions change
85
+ * @property {Function} [onFontsResolved] - Called when all fonts used in the document are determined
85
86
  * @property {Function} [handleImageUpload] - Handler for image uploads
86
87
  * @property {Object} [telemetry] - Telemetry configuration
87
88
  * @property {boolean} [suppressDefaultDocxStyles] - Prevent default styles from being applied in docx mode
@@ -173,6 +174,11 @@ export class Editor extends EventEmitter {
173
174
  * @type {boolean}
174
175
  */
175
176
  isFocused: boolean;
177
+ /**
178
+ * All the embedded fonts that were imported by the Editor
179
+ * @type {string[]}
180
+ */
181
+ fontsImported: string[];
176
182
  options: {
177
183
  element: any;
178
184
  selector: any;
@@ -232,6 +238,7 @@ export class Editor extends EventEmitter {
232
238
  onPaginationUpdate: () => any;
233
239
  onException: () => any;
234
240
  onListDefinitionsChange: () => any;
241
+ onFontsResolved: any;
235
242
  handleImageUpload: any;
236
243
  telemetry: any;
237
244
  customUpdatedFiles: {};
@@ -850,6 +857,10 @@ export type EditorOptions = {
850
857
  * - Called when list definitions change
851
858
  */
852
859
  onListDefinitionsChange?: Function;
860
+ /**
861
+ * - Called when all fonts used in the document are determined
862
+ */
863
+ onFontsResolved?: Function;
853
864
  /**
854
865
  * - Handler for image uploads
855
866
  */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Checks if a given font can be rendered on the browser
3
+ *
4
+ * @param {string} fontName - The name of the font to check for availability.
5
+ * @returns {boolean} True if the font can be rendered, false otherwise.
6
+ *
7
+ * @example
8
+ * if (canRenderFont('Arial')) {
9
+ * // Use Arial font
10
+ * }
11
+ */
12
+ export function canRenderFont(fontName: string, fallbackFont?: string): boolean;
@@ -89,6 +89,7 @@ export class SuperConverter {
89
89
  fonts: any;
90
90
  addedMedia: {};
91
91
  comments: any[];
92
+ inlineDocumentFonts: any[];
92
93
  docHiglightColors: Set<any>;
93
94
  xml: any;
94
95
  numbering: {};
@@ -155,7 +156,11 @@ export class SuperConverter {
155
156
  */
156
157
  promoteToGuid(): any;
157
158
  getDocumentDefaultStyles(): {};
158
- getDocumentFonts(): string;
159
+ getDocumentFonts(): any[];
160
+ getFontFaceImportString(): {
161
+ styleString: string;
162
+ fontsImported: any[];
163
+ };
159
164
  getDocumentInternalId(): void;
160
165
  createDocumentIdElement(): {
161
166
  type: string;
@@ -11,7 +11,7 @@ export function emuToPixels(emu: any): number;
11
11
  export function pixelsToEmu(px: any): number;
12
12
  export function pixelsToHalfPoints(pixels: any): number;
13
13
  export function halfPointToPoints(halfPoints: any): number;
14
- export function eigthPointsToPixels(eigthPoints: any): number;
14
+ export function eighthPointsToPixels(eighthPoints: any): number;
15
15
  export function pixelsToEightPoints(pixels: any): number;
16
16
  export function rotToDegrees(rot: any): number;
17
17
  export function degreesToRot(degrees: any): number;
@@ -29,7 +29,7 @@ export function createDocumentJson(docx: ParsedDocx, converter: SuperConverter,
29
29
  pageStyles: any;
30
30
  } | null;
31
31
  export function defaultNodeListHandler(): {
32
- handler: ({ nodes: elements, docx, insideTrackChange, converter, editor, filename, parentStyleId, lists, path, }: {
32
+ handler: ({ nodes: elements, docx, insideTrackChange, converter, editor, filename, parentStyleId, lists, inlineDocumentFonts, path, }: {
33
33
  nodes: any;
34
34
  docx: any;
35
35
  insideTrackChange: any;
@@ -38,6 +38,7 @@ export function defaultNodeListHandler(): {
38
38
  filename: any;
39
39
  parentStyleId: any;
40
40
  lists: any;
41
+ inlineDocumentFonts: any;
41
42
  path?: any[];
42
43
  }) => any[];
43
44
  handlerEntities: any[];
@@ -3,14 +3,16 @@
3
3
  * @param tblStyleTag
4
4
  * @param {ParsedDocx} docx
5
5
  * @param {NodeListHandler} nodeListHandler
6
- * @returns {{uiPriotity: *, borders: {}, name: *, rowBorders: {}, basedOn: *}|null}
6
+ * @returns {{borders: {}, name: *, rowBorders: {}, fonts: *, justification: *, cellMargins: {}, fontSize: *}|null}
7
7
  */
8
8
  export function getReferencedTableStyles(tblStyleTag: any, docx: ParsedDocx): {
9
- uiPriotity: any;
10
9
  borders: {};
11
10
  name: any;
12
11
  rowBorders: {};
13
- basedOn: any;
12
+ fonts: any;
13
+ justification: any;
14
+ cellMargins: {};
15
+ fontSize: any;
14
16
  } | null;
15
17
  /**
16
18
  * @type {import("docxImporter").NodeHandlerEntry}
@@ -35,6 +35,10 @@ export type NodeHandlerParams = {
35
35
  * - The imported lists object
36
36
  */
37
37
  lists?: any;
38
+ /**
39
+ * - The inline fonts found in the document
40
+ */
41
+ inlineDocumentFonts?: string[];
38
42
  /**
39
43
  * - The path of nodes leading to the current node.
40
44
  */
@@ -37,6 +37,15 @@ export function encodeProperties(node?: object, translatorsByXmlName?: object, a
37
37
  * @returns {Array} An array of decoded elements.
38
38
  */
39
39
  export function decodeProperties(translatorsBySdName?: object, properties?: object): any[];
40
+ /**
41
+ * Helper to create property handlers for nested properties (eg: w:tcBorders => borders)
42
+ * @param {string} xmlName The XML element name (with namespace).
43
+ * @param {string} sdName The SuperDoc attribute name (without namespace).
44
+ * @param {import('@translator').NodeTranslatorConfig[]} propertyTranslators An array of property translators to handle nested properties.
45
+ * @param {object} [defaultEncodedAttrs={}] Optional default attributes to include during encoding.
46
+ * @returns {import('@translator').NodeTranslatorConfig} The nested property handler config with xmlName, sdName, encode, and decode functions.
47
+ */
48
+ export function createNestedPropertiesTranslator(xmlName: string, sdName: string, propertyTranslators: import("@translator").NodeTranslatorConfig[], defaultEncodedAttrs?: object): import("@translator").NodeTranslatorConfig;
40
49
  export function generateV2HandlerEntity(handlerName: string, translator: import("../node-translator/").NodeTranslator): import("../../v2/importer/docxImporter").NodeHandlerEntry;
41
50
  export function createAttributeHandler(xmlName?: string, sdName?: string | null, transformEncode?: any, transformDecode?: any): import("@translator").AttrConfig;
42
51
  export function parseBoolean(value: string): boolean | undefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:gridSpan element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 399
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./gridSpan-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:header element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 401
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./header-translator.js";
@@ -0,0 +1,7 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * The NodeTranslator instance for the w:headers element.
5
+ * @type {import('@translator').NodeTranslator}
6
+ */
7
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./headers-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:hideMark element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 413
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./hideMark-translator.js";
@@ -0,0 +1 @@
1
+ export * from "./noWrap-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the noWrap element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 413
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The NodeTranslator instance for the gridBefore element.
2
+ * The NodeTranslator instance for the w:shd element.
3
3
  * @type {import('@translator').NodeTranslator}
4
4
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 416
5
5
  */
@@ -10,8 +10,3 @@ export function translateTableCell(params: import("@converter/exporter").ExportP
10
10
  * @returns {import('@converter/exporter').XmlReadyNode}
11
11
  */
12
12
  export function generateTableCellProperties(node: import("@converter/exporter").SchemaNode): import("@converter/exporter").XmlReadyNode;
13
- /**
14
- * @param {Object} cellMargins
15
- * @returns {Array}
16
- */
17
- export function generateCellMargins(cellMargins: any): any[];
@@ -0,0 +1 @@
1
+ export * from "./tcBorders-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the tcBorders element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 459
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tcFitText-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tcFitText element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 460
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tcMar-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tcMar element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 462
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tcPr-translator.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tcPr element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ */
5
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tcW-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tcW element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 465
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./textDirection-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:textDirection element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 258
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tl2br-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tl2br element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 468
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./tr2bl-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:tr2bl element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./vAlign-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:vAlign element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 478
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./vMerge-translator.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The NodeTranslator instance for the w:vMerge element.
3
+ * @type {import('@translator').NodeTranslator}
4
+ * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 479
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;