@harbour-enterprises/superdoc 0.19.0-next.2 → 0.19.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 (32) hide show
  1. package/dist/chunks/{PdfViewer-D59q6eRC.es.js → PdfViewer-Df9H8xeA.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-D-X0_rBI.cjs → PdfViewer-DmC4Qg1S.cjs} +1 -1
  3. package/dist/chunks/{index-Q9QnSj8V.cjs → index-CWQGBk3Z.cjs} +108 -8
  4. package/dist/chunks/{index-DYxO8sGC.es.js → index-C_oHQN7n.es.js} +108 -8
  5. package/dist/chunks/{super-editor.es-DfRBE7HT.cjs → super-editor.es-B_u6OGsf.cjs} +6 -10
  6. package/dist/chunks/{super-editor.es-DcrpYhcf.es.js → super-editor.es-C2QwEj1z.es.js} +6 -10
  7. package/dist/core/SuperDoc.d.ts +6 -6
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/core/helpers/file.d.ts +44 -0
  10. package/dist/core/helpers/file.d.ts.map +1 -0
  11. package/dist/stores/superdoc-store.d.ts.map +1 -1
  12. package/dist/style.css +9 -9
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-C8B4S-1x.js → converter-CMajoq-M.js} +2 -2
  15. package/dist/super-editor/chunks/{docx-zipper-BOcyXVbk.js → docx-zipper-C5rg6GNf.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-DSLtHYXL.js → editor-CH3sE8Fq.js} +4 -8
  17. package/dist/super-editor/chunks/{toolbar-bgMTmwZ7.js → toolbar-BHnLBr61.js} +2 -2
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/docx-zipper.es.js +2 -2
  20. package/dist/super-editor/editor.es.js +3 -3
  21. package/dist/super-editor/file-zipper.es.js +1 -1
  22. package/dist/super-editor/src/core/Editor.d.ts +3 -3
  23. package/dist/super-editor/style.css +6 -6
  24. package/dist/super-editor/super-editor.es.js +8 -8
  25. package/dist/super-editor/toolbar.es.js +2 -2
  26. package/dist/super-editor.cjs +1 -1
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.cjs +2 -2
  29. package/dist/superdoc.es.js +2 -2
  30. package/dist/superdoc.umd.js +112 -16
  31. package/dist/superdoc.umd.js.map +1 -1
  32. package/package.json +2 -2
package/dist/style.css CHANGED
@@ -2172,10 +2172,10 @@ on the right if it is inside shape textbox.
2172
2172
  min-height: 40px;
2173
2173
  }
2174
2174
 
2175
- .editor-element[data-v-dc9f9cb3] {
2175
+ .editor-element[data-v-8b2f8c17] {
2176
2176
  position: relative;
2177
2177
  }
2178
- .super-editor-container[data-v-dc9f9cb3] {
2178
+ .super-editor-container[data-v-8b2f8c17] {
2179
2179
  width: auto;
2180
2180
  height: auto;
2181
2181
  min-width: 8in;
@@ -2184,13 +2184,13 @@ on the right if it is inside shape textbox.
2184
2184
  display: flex;
2185
2185
  flex-direction: column;
2186
2186
  }
2187
- .ruler[data-v-dc9f9cb3] {
2187
+ .ruler[data-v-8b2f8c17] {
2188
2188
  margin-bottom: 2px;
2189
2189
  }
2190
- .super-editor[data-v-dc9f9cb3] {
2190
+ .super-editor[data-v-8b2f8c17] {
2191
2191
  color: initial;
2192
2192
  }
2193
- .placeholder-editor[data-v-dc9f9cb3] {
2193
+ .placeholder-editor[data-v-8b2f8c17] {
2194
2194
  position: absolute;
2195
2195
  top: 0;
2196
2196
  left: 0;
@@ -2202,7 +2202,7 @@ on the right if it is inside shape textbox.
2202
2202
  background-color: white;
2203
2203
  box-sizing: border-box;
2204
2204
  }
2205
- .placeholder-title[data-v-dc9f9cb3] {
2205
+ .placeholder-title[data-v-8b2f8c17] {
2206
2206
  display: flex;
2207
2207
  justify-content: center;
2208
2208
  margin-bottom: 40px;
@@ -2340,18 +2340,18 @@ img[data-v-7dd69850] {
2340
2340
  border-color: transparent;
2341
2341
  }
2342
2342
 
2343
- .superdoc-html-viewer[data-v-7bd2cb5d] {
2343
+ .superdoc-html-viewer[data-v-da3494ba] {
2344
2344
  font-family: initial;
2345
2345
  color: initial;
2346
2346
  width: 100%;
2347
2347
  height: auto;
2348
2348
  position: relative;
2349
2349
  }
2350
- .superdoc-html-viewer__document[data-v-7bd2cb5d] {
2350
+ .superdoc-html-viewer__document[data-v-da3494ba] {
2351
2351
  width: 100%;
2352
2352
  height: auto;
2353
2353
  }
2354
- .superdoc-html-viewer__content[data-v-7bd2cb5d] {
2354
+ .superdoc-html-viewer__content[data-v-da3494ba] {
2355
2355
  width: 100%;
2356
2356
  min-width: 800px;
2357
2357
  padding: 38px 75px 75px;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-C8B4S-1x.js";
3
- import { _ as _export_sfc } from "./chunks/editor-DSLtHYXL.js";
2
+ import { T as TextSelection } from "./chunks/converter-CMajoq-M.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CH3sE8Fq.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -30776,7 +30776,7 @@ const _SuperConverter = class _SuperConverter {
30776
30776
  return;
30777
30777
  }
30778
30778
  }
30779
- static updateDocumentVersion(docx = this.convertedXml, version = "0.19.0-next.0") {
30779
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.18.1") {
30780
30780
  const customLocation = "docProps/custom.xml";
30781
30781
  if (!docx[customLocation]) {
30782
30782
  docx[customLocation] = generateCustomXml();
@@ -31261,7 +31261,7 @@ function storeSuperdocVersion(docx) {
31261
31261
  function generateCustomXml() {
31262
31262
  return DEFAULT_CUSTOM_XML;
31263
31263
  }
31264
- function generateSuperdocVersion(pid = 2, version = "0.19.0-next.0") {
31264
+ function generateSuperdocVersion(pid = 2, version = "0.18.1") {
31265
31265
  return {
31266
31266
  type: "element",
31267
31267
  name: "property",
@@ -1,4 +1,4 @@
1
- import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-C8B4S-1x.js";
1
+ import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-CMajoq-M.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
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
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, 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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-C8B4S-1x.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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-CMajoq-M.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-BOcyXVbk.js";
17
+ import { D as DocxZipper } from "./docx-zipper-C5rg6GNf.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -14668,7 +14668,7 @@ const _Editor = class _Editor extends EventEmitter {
14668
14668
  * @returns {Object | void} Migration results
14669
14669
  */
14670
14670
  processCollaborationMigrations() {
14671
- console.debug("[checkVersionMigrations] Current editor version", "0.19.0-next.0");
14671
+ console.debug("[checkVersionMigrations] Current editor version", "0.18.1");
14672
14672
  if (!this.options.ydoc) return;
14673
14673
  const metaMap = this.options.ydoc.getMap("meta");
14674
14674
  let docVersion = metaMap.get("version");
@@ -25231,11 +25231,7 @@ const ContentBlock = Node$1.create({
25231
25231
  ];
25232
25232
  },
25233
25233
  renderDOM({ htmlAttributes }) {
25234
- return [
25235
- "div",
25236
- Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name }),
25237
- 0
25238
- ];
25234
+ return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
25239
25235
  },
25240
25236
  addCommands() {
25241
25237
  return {
@@ -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-C8B4S-1x.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DSLtHYXL.js";
2
+ import { p as process$1 } from "./converter-CMajoq-M.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CH3sE8Fq.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-C8B4S-1x.js";
1
+ import { a5 } from "./chunks/converter-CMajoq-M.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-C8B4S-1x.js";
2
- import { D } from "./chunks/docx-zipper-BOcyXVbk.js";
1
+ import "./chunks/converter-CMajoq-M.js";
2
+ import { D } from "./chunks/docx-zipper-C5rg6GNf.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-DSLtHYXL.js";
2
- import "./chunks/converter-C8B4S-1x.js";
3
- import "./chunks/docx-zipper-BOcyXVbk.js";
1
+ import { E } from "./chunks/editor-CH3sE8Fq.js";
2
+ import "./chunks/converter-CMajoq-M.js";
3
+ import "./chunks/docx-zipper-C5rg6GNf.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-BOcyXVbk.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-C5rg6GNf.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -45,7 +45,7 @@
45
45
  * @property {string} [role='editor'] - User role ('editor', 'viewer', 'suggester')
46
46
  * @property {Array} [colors=[]] - Available colors
47
47
  * @property {Object} [converter] - Document converter
48
- * @property {Object} [fileSource] - Source of the file
48
+ * @property {File|Blob|Buffer} [fileSource] - Source of the file (File/Blob in browser, Buffer in Node.js)
49
49
  * @property {Object} [initialState] - Initial editor state
50
50
  * @property {string} [documentId] - Unique document identifier
51
51
  * @property {Array} [extensions=[]] - Editor extensions
@@ -647,9 +647,9 @@ export type EditorOptions = {
647
647
  */
648
648
  converter?: any;
649
649
  /**
650
- * - Source of the file
650
+ * - Source of the file (File/Blob in browser, Buffer in Node.js)
651
651
  */
652
- fileSource?: any;
652
+ fileSource?: File | Blob | Buffer;
653
653
  /**
654
654
  * - Initial editor state
655
655
  */
@@ -1798,10 +1798,10 @@ on the right if it is inside shape textbox.
1798
1798
  min-height: 40px;
1799
1799
  }
1800
1800
 
1801
- .editor-element[data-v-dc9f9cb3] {
1801
+ .editor-element[data-v-8b2f8c17] {
1802
1802
  position: relative;
1803
1803
  }
1804
- .super-editor-container[data-v-dc9f9cb3] {
1804
+ .super-editor-container[data-v-8b2f8c17] {
1805
1805
  width: auto;
1806
1806
  height: auto;
1807
1807
  min-width: 8in;
@@ -1810,13 +1810,13 @@ on the right if it is inside shape textbox.
1810
1810
  display: flex;
1811
1811
  flex-direction: column;
1812
1812
  }
1813
- .ruler[data-v-dc9f9cb3] {
1813
+ .ruler[data-v-8b2f8c17] {
1814
1814
  margin-bottom: 2px;
1815
1815
  }
1816
- .super-editor[data-v-dc9f9cb3] {
1816
+ .super-editor[data-v-8b2f8c17] {
1817
1817
  color: initial;
1818
1818
  }
1819
- .placeholder-editor[data-v-dc9f9cb3] {
1819
+ .placeholder-editor[data-v-8b2f8c17] {
1820
1820
  position: absolute;
1821
1821
  top: 0;
1822
1822
  left: 0;
@@ -1828,7 +1828,7 @@ on the right if it is inside shape textbox.
1828
1828
  background-color: white;
1829
1829
  box-sizing: border-box;
1830
1830
  }
1831
- .placeholder-title[data-v-dc9f9cb3] {
1831
+ .placeholder-title[data-v-8b2f8c17] {
1832
1832
  display: flex;
1833
1833
  justify-content: center;
1834
1834
  margin-bottom: 40px;
@@ -9,14 +9,14 @@ 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 __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-C8B4S-1x.js";
13
- import { aI, a5, i, a2 } from "./chunks/converter-C8B4S-1x.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-DSLtHYXL.js";
15
- import { k, C, l, T, i as i2, m, j } from "./chunks/editor-DSLtHYXL.js";
12
+ import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-CMajoq-M.js";
13
+ import { aI, a5, i, a2 } from "./chunks/converter-CMajoq-M.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-CH3sE8Fq.js";
15
+ import { k, C, l, T, i as i2, m, j } from "./chunks/editor-CH3sE8Fq.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-bgMTmwZ7.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BHnLBr61.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-BOcyXVbk.js";
19
+ import { D } from "./chunks/docx-zipper-C5rg6GNf.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -4225,7 +4225,7 @@ const _sfc_main$1 = {
4225
4225
  required: false
4226
4226
  },
4227
4227
  fileSource: {
4228
- type: File,
4228
+ type: [File, Blob],
4229
4229
  required: false
4230
4230
  },
4231
4231
  state: {
@@ -4505,7 +4505,7 @@ const _sfc_main$1 = {
4505
4505
  };
4506
4506
  }
4507
4507
  };
4508
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-dc9f9cb3"]]);
4508
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-8b2f8c17"]]);
4509
4509
  const _hoisted_1 = ["innerHTML"];
4510
4510
  const _sfc_main = {
4511
4511
  __name: "SuperInput",
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-bgMTmwZ7.js";
3
- import "./chunks/editor-DSLtHYXL.js";
2
+ import { T } from "./chunks/toolbar-BHnLBr61.js";
3
+ import "./chunks/editor-CH3sE8Fq.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DfRBE7HT.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-B_u6OGsf.cjs");
4
4
  require("./chunks/vue-DWle4Cai.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DcrpYhcf.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-C2QwEj1z.es.js";
2
2
  import "./chunks/vue-CXxsqYcP.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DfRBE7HT.cjs");
4
- const superdoc = require("./chunks/index-Q9QnSj8V.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-B_u6OGsf.cjs");
4
+ const superdoc = require("./chunks/index-CWQGBk3Z.cjs");
5
5
  require("./chunks/vue-DWle4Cai.cjs");
6
6
  require("./chunks/jszip-b7l8QkfH.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DcrpYhcf.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DYxO8sGC.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-C2QwEj1z.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-C_oHQN7n.es.js";
3
3
  import "./chunks/vue-CXxsqYcP.es.js";
4
4
  import "./chunks/jszip-B8KIZSNe.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -38484,7 +38484,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38484
38484
  return;
38485
38485
  }
38486
38486
  }
38487
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.19.0-next.0") {
38487
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.18.1") {
38488
38488
  const customLocation = "docProps/custom.xml";
38489
38489
  if (!docx[customLocation]) {
38490
38490
  docx[customLocation] = generateCustomXml();
@@ -38966,7 +38966,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38966
38966
  function generateCustomXml() {
38967
38967
  return DEFAULT_CUSTOM_XML;
38968
38968
  }
38969
- function generateSuperdocVersion(pid = 2, version2 = "0.19.0-next.0") {
38969
+ function generateSuperdocVersion(pid = 2, version2 = "0.18.1") {
38970
38970
  return {
38971
38971
  type: "element",
38972
38972
  name: "property",
@@ -56140,7 +56140,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56140
56140
  * @returns {Object | void} Migration results
56141
56141
  */
56142
56142
  processCollaborationMigrations() {
56143
- console.debug("[checkVersionMigrations] Current editor version", "0.19.0-next.0");
56143
+ console.debug("[checkVersionMigrations] Current editor version", "0.18.1");
56144
56144
  if (!this.options.ydoc) return;
56145
56145
  const metaMap = this.options.ydoc.getMap("meta");
56146
56146
  let docVersion = metaMap.get("version");
@@ -66586,11 +66586,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66586
66586
  ];
66587
66587
  },
66588
66588
  renderDOM({ htmlAttributes }) {
66589
- return [
66590
- "div",
66591
- Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name }),
66592
- 0
66593
- ];
66589
+ return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
66594
66590
  },
66595
66591
  addCommands() {
66596
66592
  return {
@@ -88712,7 +88708,7 @@ ${style2}
88712
88708
  required: false
88713
88709
  },
88714
88710
  fileSource: {
88715
- type: File,
88711
+ type: [File, Blob],
88716
88712
  required: false
88717
88713
  },
88718
88714
  state: {
@@ -88992,7 +88988,7 @@ ${style2}
88992
88988
  };
88993
88989
  }
88994
88990
  };
88995
- const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-dc9f9cb3"]]);
88991
+ const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-8b2f8c17"]]);
88996
88992
  const _hoisted_1$h = ["innerHTML"];
88997
88993
  const _sfc_main$i = {
88998
88994
  __name: "SuperInput",
@@ -90304,6 +90300,59 @@ ${style2}
90304
90300
  return refs;
90305
90301
  }
90306
90302
  }
90303
+ const extractBrowserFile = (input) => {
90304
+ if (!input) return null;
90305
+ if (typeof File === "function" && input instanceof File) return input;
90306
+ if (typeof Blob === "function" && input instanceof Blob) {
90307
+ const hasFileCtor = typeof File === "function";
90308
+ if (hasFileCtor) {
90309
+ const name = input.name || "document";
90310
+ return new File([input], name, { type: input.type });
90311
+ }
90312
+ return input;
90313
+ }
90314
+ if (input.originFileObj) return extractBrowserFile(input.originFileObj);
90315
+ if (input.file) return extractBrowserFile(input.file);
90316
+ if (input.raw) return extractBrowserFile(input.raw);
90317
+ return null;
90318
+ };
90319
+ const inferTypeFromName = (name = "") => {
90320
+ const lower = String(name).toLowerCase();
90321
+ if (lower.endsWith(".docx")) return DOCX;
90322
+ if (lower.endsWith(".pdf")) return PDF;
90323
+ if (lower.endsWith(".html") || lower.endsWith(".htm")) return HTML;
90324
+ if (lower.endsWith(".md") || lower.endsWith(".markdown")) return "text/markdown";
90325
+ return "";
90326
+ };
90327
+ const normalizeDocumentEntry = (entry) => {
90328
+ const maybeFile = extractBrowserFile(entry);
90329
+ if (maybeFile) {
90330
+ const name = (
90331
+ /** @type {any} */
90332
+ maybeFile.name || entry && entry.name || "document"
90333
+ );
90334
+ const type2 = maybeFile.type || inferTypeFromName(name) || DOCX;
90335
+ return {
90336
+ type: type2,
90337
+ data: maybeFile,
90338
+ name,
90339
+ isNewFile: true
90340
+ };
90341
+ }
90342
+ if (entry && typeof entry === "object" && "data" in entry) {
90343
+ const file = extractBrowserFile(entry.data);
90344
+ if (file) {
90345
+ const type2 = entry.type || file.type || inferTypeFromName(file.name) || DOCX;
90346
+ return {
90347
+ ...entry,
90348
+ type: type2,
90349
+ data: file,
90350
+ name: entry.name || file.name || "document"
90351
+ };
90352
+ }
90353
+ }
90354
+ return entry;
90355
+ };
90307
90356
  function useFieldValueWatcher(field, originalValue) {
90308
90357
  const fieldId = field.itemid;
90309
90358
  const rawField = field;
@@ -92159,13 +92208,39 @@ ${reason}`);
92159
92208
  }
92160
92209
  }
92161
92210
  };
92211
+ const _blobToFile = (blob, name, type2) => {
92212
+ return new File([blob], name, { type: type2 });
92213
+ };
92162
92214
  const _initializeDocumentData = async (doc2) => {
92215
+ doc2 = normalizeDocumentEntry(doc2);
92163
92216
  if (currentConfig.value?.html) doc2.html = currentConfig.value.html;
92164
92217
  if (!doc2.data && doc2.url && !doc2.type) doc2.type = DOCX;
92165
92218
  if (currentConfig.value?.modules.collaboration && !doc2.isNewFile) {
92166
92219
  return { ...doc2, data: null, url: null };
92167
92220
  }
92168
- if (doc2.data) return doc2;
92221
+ if (doc2.data instanceof File) {
92222
+ let fileName = doc2.name;
92223
+ const extension = doc2.type === DOCX ? ".docx" : doc2.type === PDF ? ".pdf" : ".bin";
92224
+ if (!fileName) {
92225
+ fileName = `document${extension}`;
92226
+ } else if (!fileName.includes(".")) {
92227
+ fileName = `${fileName}${extension}`;
92228
+ }
92229
+ if (doc2.data.name !== fileName) {
92230
+ const fileObject = _blobToFile(doc2.data, fileName, doc2.data.type || doc2.type);
92231
+ return { ...doc2, name: fileName, data: fileObject };
92232
+ }
92233
+ if (!doc2.name) return { ...doc2, name: fileName };
92234
+ return doc2;
92235
+ } else if (doc2.data instanceof Blob) {
92236
+ let fileName = doc2.name;
92237
+ if (!fileName) {
92238
+ const extension = doc2.type === DOCX ? ".docx" : doc2.type === PDF ? ".pdf" : ".bin";
92239
+ fileName = `document${extension}`;
92240
+ }
92241
+ const fileObject = _blobToFile(doc2.data, fileName, doc2.data.type || doc2.type);
92242
+ return { ...doc2, data: fileObject };
92243
+ } else if (doc2.data) return doc2;
92169
92244
  else if (doc2.url && doc2.type) {
92170
92245
  if (doc2.type.toLowerCase() === "docx") doc2.type = DOCX;
92171
92246
  else if (doc2.type.toLowerCase() === "pdf") doc2.type = PDF;
@@ -105375,7 +105450,7 @@ ${style2}
105375
105450
  __name: "HtmlViewer",
105376
105451
  props: {
105377
105452
  fileSource: {
105378
- type: File,
105453
+ type: [File, Blob],
105379
105454
  required: true
105380
105455
  },
105381
105456
  documentId: {
@@ -105430,7 +105505,7 @@ ${style2}
105430
105505
  };
105431
105506
  }
105432
105507
  };
105433
- const HtmlViewer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7bd2cb5d"]]);
105508
+ const HtmlViewer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-da3494ba"]]);
105434
105509
  const _hoisted_1$2 = {
105435
105510
  class: "ai-highlight-container",
105436
105511
  id: "aiHighlightContainer"
@@ -106259,7 +106334,7 @@ ${style2}
106259
106334
  this.config.colors = shuffleArray(this.config.colors);
106260
106335
  this.userColorMap = /* @__PURE__ */ new Map();
106261
106336
  this.colorIndex = 0;
106262
- this.version = "0.19.0-next.0";
106337
+ this.version = "0.18.1";
106263
106338
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
106264
106339
  this.superdocId = config2.superdocId || v4();
106265
106340
  this.colors = this.config.colors;
@@ -106308,13 +106383,15 @@ ${style2}
106308
106383
  const doc2 = this.config.document;
106309
106384
  const hasDocumentConfig = !!doc2 && typeof doc2 === "object" && Object.keys(this.config.document)?.length;
106310
106385
  const hasDocumentUrl = !!doc2 && typeof doc2 === "string" && doc2.length > 0;
106311
- const hasDocumentFile = !!doc2 && doc2 instanceof File;
106386
+ const hasDocumentFile = !!doc2 && typeof File === "function" && doc2 instanceof File;
106387
+ const hasDocumentBlob = !!doc2 && doc2 instanceof Blob && !(doc2 instanceof File);
106312
106388
  const hasListOfDocuments = this.config.documents && this.config.documents?.length;
106313
106389
  if (hasDocumentConfig && hasListOfDocuments) {
106314
106390
  console.warn("🦋 [superdoc] You can only provide one of document or documents");
106315
106391
  }
106316
106392
  if (hasDocumentConfig) {
106317
- this.config.documents = [this.config.document];
106393
+ const normalized = normalizeDocumentEntry(this.config.document);
106394
+ this.config.documents = [normalized];
106318
106395
  } else if (hasDocumentUrl) {
106319
106396
  this.config.documents = [
106320
106397
  {
@@ -106333,6 +106410,25 @@ ${style2}
106333
106410
  isNewFile: true
106334
106411
  }
106335
106412
  ];
106413
+ } else if (hasDocumentBlob) {
106414
+ const docType = this.config.document.type || DOCX;
106415
+ let extension = ".docx";
106416
+ if (docType === PDF) {
106417
+ extension = ".pdf";
106418
+ } else if (docType === HTML) {
106419
+ extension = ".html";
106420
+ }
106421
+ this.config.documents = [
106422
+ {
106423
+ type: docType,
106424
+ data: this.config.document,
106425
+ name: `document${extension}`,
106426
+ isNewFile: true
106427
+ }
106428
+ ];
106429
+ }
106430
+ if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
106431
+ this.config.documents = this.config.documents.map((d2) => normalizeDocumentEntry(d2));
106336
106432
  }
106337
106433
  }
106338
106434
  #initVueApp() {