oasis-editor 0.0.138 → 0.0.139

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 (45) hide show
  1. package/dist/{OasisEditorApp-DMI2ZfOd.js → OasisEditorApp-B1x9P0Ua.js} +50 -8
  2. package/dist/adapters/mountController.d.ts +11 -0
  3. package/dist/adapters/react.d.ts +8 -0
  4. package/dist/adapters/ui.d.ts +1 -1
  5. package/dist/adapters/vue.d.ts +10 -0
  6. package/dist/app/bootstrap/createOasisEditorApp.d.ts +9 -0
  7. package/dist/app/bootstrap/createOasisEditorContainer.d.ts +9 -0
  8. package/dist/app/client/OasisEditorClient.d.ts +254 -1
  9. package/dist/app/client/publicDocumentApi.d.ts +223 -0
  10. package/dist/app/controllers/documentIO/DocumentExporter.d.ts +10 -2
  11. package/dist/app/controllers/documentIO/DocumentImporter.d.ts +6 -0
  12. package/dist/app/controllers/useEditorDocumentIO.d.ts +4 -2
  13. package/dist/app/controllers/useEditorFindReplace.d.ts +7 -0
  14. package/dist/app/controllers/useEditorPersistence.d.ts +10 -0
  15. package/dist/app/services/FindReplaceService.d.ts +9 -0
  16. package/dist/app/services/indexedDbPersistence.d.ts +10 -1
  17. package/dist/app/services/tablePropertiesService.d.ts +12 -3
  18. package/dist/app/services/userPreferences.d.ts +4 -0
  19. package/dist/assets/{importDocxWorker-DBjcGf-C.js → importDocxWorker-B1vHeo5L.js} +1 -1
  20. package/dist/core/Editor.d.ts +33 -1
  21. package/dist/core/commands/CommandBus.d.ts +26 -0
  22. package/dist/core/commands/publicCommandTypes.d.ts +53 -0
  23. package/dist/core/model/types/document.d.ts +2 -0
  24. package/dist/core/plugin.d.ts +60 -0
  25. package/dist/import/DocumentFormatImporter.d.ts +20 -4
  26. package/dist/import/documentImporterRegistry.d.ts +6 -2
  27. package/dist/{index-M7h7REmM.js → index-BVWzLonI.js} +1182 -760
  28. package/dist/index.d.ts +3 -1
  29. package/dist/mountController.d.ts +11 -0
  30. package/dist/oasis-editor.js +44 -36
  31. package/dist/oasis-editor.umd.cjs +4 -4
  32. package/dist/react.d.ts +8 -0
  33. package/dist/ui/OasisEditorAppProps.d.ts +8 -4
  34. package/dist/ui/app/connectEditorClientHost.d.ts +12 -2
  35. package/dist/ui/app/createEditorCommandRuntime.d.ts +8 -1
  36. package/dist/ui/app/createEditorDocumentRuntime.d.ts +4 -2
  37. package/dist/ui/canvas/CanvasDebug.d.ts +15 -1
  38. package/dist/ui/components/Menubar/menuRegistry.d.ts +11 -0
  39. package/dist/ui/components/Toolbar/registry/ToolbarRegistry.d.ts +43 -7
  40. package/dist/ui/components/Toolbar/schema/items.d.ts +39 -7
  41. package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +8 -4
  42. package/dist/ui.d.ts +1 -1
  43. package/dist/ui.js +29 -30
  44. package/dist/vue.d.ts +10 -0
  45. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as resolveEffectiveTableStyle, cP as createDefaultToolbarPreset, cQ as MenuRegistry, cR as createToolbarRegistry, cS as Editor, cT as resolveCommandRef, cU as commandRefName, cV as createOasisEditorClient, cW as createEditorZoom, cX as startLongTaskObserver, cY as installGlobalReport, cZ as applyStoredPreciseFontPreference, c_ as getWelcomeSeen, c$ as isLocalFontAccessSupported, d0 as EDITOR_SCROLL_PADDING_PX, d1 as Toolbar, d2 as OasisEditorLoading, d3 as I18nProvider, d4 as createTranslator, d5 as registerDomStatsSurface, d6 as createEditorLogger } from "./index-M7h7REmM.js";
4
+ import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as resolveEffectiveTableStyle, cP as createDefaultToolbarPreset, cQ as MenuRegistry, cR as createToolbarRegistry, cS as Editor, cT as resolveCommandRef, cU as commandRefName, cV as createOasisEditorClient, cW as createEditorZoom, cX as startLongTaskObserver, cY as installGlobalReport, cZ as applyStoredPreciseFontPreference, c_ as getWelcomeSeen, c$ as isLocalFontAccessSupported, d0 as EDITOR_SCROLL_PADDING_PX, d1 as Toolbar, d2 as OasisEditorLoading, d3 as I18nProvider, d4 as createTranslator, d5 as registerDomStatsSurface, d6 as createEditorLogger } from "./index-BVWzLonI.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -43910,15 +43910,21 @@ function createDocumentExporter(deps) {
43910
43910
  const blob = await exportEditorDocumentToDocxBlob(deps.document());
43911
43911
  download(blob, "oasis-editor.docx");
43912
43912
  deps.focusInput();
43913
+ return blob;
43913
43914
  };
43914
43915
  const handleExportPdf = async () => {
43915
43916
  const blob = await exportEditorDocumentToPdfBlob(deps.document());
43916
43917
  download(blob, "oasis-editor.pdf");
43917
43918
  deps.focusInput();
43919
+ return blob;
43918
43920
  };
43921
+ const exportDocxBlob = () => exportEditorDocumentToDocxBlob(deps.document());
43922
+ const exportPdfBlob = () => exportEditorDocumentToPdfBlob(deps.document());
43919
43923
  return {
43920
43924
  handleExportDocx,
43921
- handleExportPdf
43925
+ handleExportPdf,
43926
+ exportDocxBlob,
43927
+ exportPdfBlob
43922
43928
  };
43923
43929
  }
43924
43930
  async function readFileBuffer(file) {
@@ -44753,16 +44759,18 @@ function createEditorDocumentIOImpl(deps) {
44753
44759
  deps.focusInput();
44754
44760
  };
44755
44761
  const handleExportDocx = async () => {
44756
- await exporter.handleExportDocx();
44762
+ return exporter.handleExportDocx();
44757
44763
  };
44758
44764
  const handleExportPdf = async () => {
44759
- await exporter.handleExportPdf();
44765
+ return exporter.handleExportPdf();
44760
44766
  };
44761
44767
  return {
44762
44768
  importProgress,
44763
44769
  handleImportFile,
44764
44770
  handleExportDocx,
44765
44771
  handleExportPdf,
44772
+ exportDocxBlob: exporter.exportDocxBlob,
44773
+ exportPdfBlob: exporter.exportPdfBlob,
44766
44774
  insertImageFromFile,
44767
44775
  handleInsertImage
44768
44776
  };
@@ -53537,6 +53545,7 @@ function connectEditorClientHost(controller, deps) {
53537
53545
  deps.resetEditorChromeState();
53538
53546
  deps.focusInput();
53539
53547
  },
53548
+ applyTransactionalState: deps.applyTransactionalState,
53540
53549
  resetDocument: () => {
53541
53550
  deps.applyState(createInitialEditorState());
53542
53551
  deps.resetEditorChromeState();
@@ -53563,7 +53572,16 @@ function connectEditorClientHost(controller, deps) {
53563
53572
  clearHistory: () => deps.clearHistory(),
53564
53573
  importDocx: (file) => deps.docIO.handleImportFile(file),
53565
53574
  exportDocx: () => Promise.resolve(deps.docIO.handleExportDocx()),
53566
- exportPdf: () => Promise.resolve(deps.docIO.handleExportPdf())
53575
+ exportPdf: () => Promise.resolve(deps.docIO.handleExportPdf()),
53576
+ exportDocxBlob: () => deps.docIO.exportDocxBlob(),
53577
+ exportPdfBlob: () => deps.docIO.exportPdfBlob(),
53578
+ getUiState: deps.getUiState,
53579
+ updateUiState: deps.updateUiState,
53580
+ getZoom: deps.getZoom,
53581
+ setZoom: deps.setZoom,
53582
+ adjustZoom: deps.adjustZoom,
53583
+ toolbarRegistry: deps.toolbarRegistry,
53584
+ menuRegistry: deps.menuRegistry
53567
53585
  });
53568
53586
  }
53569
53587
  function createCommandBuilder(isCommandEnabled) {
@@ -55770,12 +55788,20 @@ function createEditorCommandRuntimeImpl(deps) {
55770
55788
  getStateSnapshot: deps.getStateSnapshot,
55771
55789
  cloneState: deps.cloneState,
55772
55790
  applyState: deps.applyState,
55791
+ applyTransactionalState: doc.applyTransactionalState,
55773
55792
  resetEditorChromeState: doc.resetEditorChromeState,
55774
55793
  focusInput: deps.focusInput,
55775
55794
  setFocused: deps.setFocused,
55776
55795
  clearHistory: doc.clearHistory,
55777
55796
  getPersistence: () => deps.documentOptions().persistence ?? doc.fallbackPersistence,
55778
- docIO: doc.docIO
55797
+ docIO: doc.docIO,
55798
+ getUiState: deps.getUiState,
55799
+ updateUiState: deps.updateUiState,
55800
+ getZoom: deps.zoom.zoomPercent,
55801
+ setZoom: deps.zoom.setZoomPercent,
55802
+ adjustZoom: deps.zoom.adjustZoom,
55803
+ toolbarRegistry,
55804
+ menuRegistry
55779
55805
  });
55780
55806
  createEffect(() => {
55781
55807
  if (!runtimeReady()) return;
@@ -55820,8 +55846,24 @@ var _tmpl$ = /* @__PURE__ */ template(`<div class="oasis-editor-shell oasis-edit
55820
55846
  function OasisEditorApp(props = {}) {
55821
55847
  var _a;
55822
55848
  const runtimeClient = ((_a = props.runtime) == null ? void 0 : _a.client) ?? createOasisEditorClient();
55823
- const ui = () => props.ui ?? {};
55824
- const documentOptions = () => props.document ?? {};
55849
+ const [uiOverrides] = createSignal({});
55850
+ const ui = () => {
55851
+ var _a2;
55852
+ return {
55853
+ ...props.ui ?? {},
55854
+ ...uiOverrides(),
55855
+ toolbar: {
55856
+ ...((_a2 = props.ui) == null ? void 0 : _a2.toolbar) ?? {},
55857
+ ...uiOverrides().toolbar ?? {}
55858
+ }
55859
+ };
55860
+ };
55861
+ const documentOptions = () => ({
55862
+ ...props.document ?? {},
55863
+ ...uiOverrides().readOnly === void 0 ? {} : {
55864
+ readOnly: uiOverrides().readOnly
55865
+ }
55866
+ });
55825
55867
  const runtimeOptions = () => props.runtime ?? {};
55826
55868
  syncCanvasDebugApiVisibility();
55827
55869
  const translator = createTranslator(() => ui().locale ?? "pt-BR");
@@ -6,7 +6,18 @@ import { OasisEditorAppProps, OasisEditorClient } from '../index.ts';
6
6
  * around their own reactivity hooks.
7
7
  */
8
8
  export interface OasisMountController {
9
+ /**
10
+ * Mounts the editor into the given container.
11
+ * @param container - The DOM element to mount into.
12
+ * @param props - Editor configuration props.
13
+ * @param onClient - Optional callback receiving the mounted client.
14
+ */
9
15
  mount(container: HTMLElement, props: OasisEditorAppProps, onClient?: (client: OasisEditorClient) => void): void;
16
+ /** Unmounts the editor and releases resources. */
10
17
  unmount(): void;
11
18
  }
19
+ /**
20
+ * Creates a framework-agnostic mount controller.
21
+ * @returns A new OasisMountController.
22
+ */
12
23
  export declare function createOasisMountController(): OasisMountController;
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { OasisEditorAppProps, OasisEditorClient } from '../index.ts';
3
3
 
4
+ /** Props for the React adapter component, extending the standard editor app props. */
4
5
  export type ReactOasisEditorProps = OasisEditorAppProps & {
5
6
  /**
6
7
  * Receives the mounted Oasis client. Props are mount-only for this adapter;
@@ -8,4 +9,11 @@ export type ReactOasisEditorProps = OasisEditorAppProps & {
8
9
  */
9
10
  onClient?: (client: OasisEditorClient) => void;
10
11
  };
12
+ /**
13
+ * React component that mounts the Oasis editor. Mount-only — remount to
14
+ * apply a new configuration.
15
+ *
16
+ * @param props - The editor configuration props.
17
+ * @returns A React element wrapping the editor.
18
+ */
11
19
  export declare const OasisEditor: React.FC<ReactOasisEditorProps>;
@@ -1,2 +1,2 @@
1
- export { ActionRow, Button, Checkbox, ColorField, ColorPicker, ColorPicker as ToolbarColorPicker, Dialog, DialogFooter, FieldGroup, FieldRow, FloatingActionButton, FormField, Grid, GridPicker, Heading, IconButton, Menu, NumberField, Popover, Radio, RadioGroup, Select, SelectField, Separator, SidePanel, SidePanelBody, SidePanelFooter, SidePanelHeader, SplitButton, Stack, StatusText, SurfaceButton, Tabs, Text, TextAreaField, TextField, ToolbarButton, ToggleChip, } from '../index.ts';
1
+ export { Button, Checkbox, ColorField, ColorPicker, ColorPicker as ToolbarColorPicker, Dialog, DialogFooter, FieldGroup, FieldRow, FloatingActionButton, FormField, Grid, GridPicker, Heading, IconButton, Menu, NumberField, Popover, Radio, RadioGroup, Select, SelectField, Separator, SidePanel, SidePanelBody, SidePanelFooter, SidePanelHeader, SplitButton, Stack, StatusText, SurfaceButton, Tabs, Text, TextAreaField, TextField, ToolbarButton, ToggleChip, } from '../index.ts';
2
2
  export type { ActionRowProps, ButtonProps, CheckboxProps, ColorFieldProps, ColorPickerKind, ColorPickerProps, DialogFooterProps, DialogProps, FieldGroupProps, FieldRowProps, FloatingActionButtonProps, FormFieldProps, GridOffset, GridPickerProps, GridProps, GridSize, HeadingProps, IconButtonProps, MenuProps, NumberFieldProps, PopoverProps, PopoverTriggerApi, RadioGroupOption, RadioGroupProps, RadioProps, ResponsiveValue, SelectFieldOption, SelectFieldProps, SeparatorProps, SidePanelProps, SidePanelSectionProps, SplitButtonProps, StackProps, StatusTextProps, SurfaceButtonProps, TabsItem, TabsProps, TextAreaFieldProps, TextProps, TextFieldProps, ToolbarButtonProps, ToolbarSelectProps, ToggleChipProps, } from '../index.ts';
@@ -1,6 +1,16 @@
1
1
  import { VNode, RendererNode, RendererElement, PropType } from 'vue';
2
2
  import { OasisEditorAppProps, OasisEditorClient } from '../index.ts';
3
3
 
4
+ /**
5
+ * Vue 3 component that mounts the Oasis editor. Mount-only — remount to
6
+ * apply a new configuration.
7
+ *
8
+ * @component
9
+ * @param props.config - Editor configuration props.
10
+ * @param props.class - CSS class for the container.
11
+ * @param props.style - CSS style for the container.
12
+ * @param props.onClient - Callback receiving the mounted client.
13
+ */
4
14
  export declare const OasisEditor: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
15
  config: {
6
16
  type: () => OasisEditorAppProps;
@@ -1,5 +1,14 @@
1
1
  import { OasisEditorAppProps } from '../../ui/OasisEditorApp.js';
2
2
  import { OasisEditorClient } from '../client/OasisEditorClient.js';
3
3
 
4
+ /** An Oasis editor instance created via {@link createOasisEditor}. */
4
5
  export type OasisEditorInstance = OasisEditorClient;
6
+ /**
7
+ * Mounts the full Oasis editor application (document shell) into a container
8
+ * element and returns the public editor client API.
9
+ *
10
+ * @param container - The DOM element to mount the editor into.
11
+ * @param props - Optional editor configuration props.
12
+ * @returns The editor client API.
13
+ */
5
14
  export declare function createOasisEditor(container: HTMLElement, props?: OasisEditorAppProps): OasisEditorInstance;
@@ -1,5 +1,14 @@
1
1
  import { OasisEditorContainerProps } from '../../ui/OasisEditorContainer.js';
2
2
  import { OasisEditorClient } from '../client/OasisEditorClient.js';
3
3
 
4
+ /** An Oasis editor container instance created via {@link createOasisEditorContainer}. */
4
5
  export type OasisEditorContainerInstance = OasisEditorClient;
6
+ /**
7
+ * Mounts the Oasis editor container component into a container element and
8
+ * returns the public editor client API.
9
+ *
10
+ * @param container - The DOM element to mount into.
11
+ * @param props - Optional container props.
12
+ * @returns The editor client API.
13
+ */
5
14
  export declare function createOasisEditorContainer(container: HTMLElement, props?: OasisEditorContainerProps): OasisEditorContainerInstance;
@@ -2,80 +2,305 @@ import { EditorDocument, EditorSelection, EditorState } from '../../core/model.j
2
2
  import { Editor } from '../../core/Editor.js';
3
3
  import { ToolbarCommandState } from '../../ui/components/Toolbar/schema/items.js';
4
4
  import { TypedCommandBus } from '../../core/commands/publicCommandTypes.js';
5
+ import { queryDocument, ApplyEditRequest, ApplyEditValue, DocumentRange, DocumentSelector, OasisResult, SemanticDocumentSnapshot } from './publicDocumentApi.js';
6
+ import { ToolbarRegistry } from '../../ui/components/Toolbar/registry/ToolbarRegistry.js';
7
+ import { MenuRegistry } from '../../ui/components/Menubar/menuRegistry.js';
5
8
 
6
- export type OasisEditorClientEvent = "ready" | "change" | "documentChange" | "selectionChange" | "error";
9
+ /** UI-related editor state that can be toggled or configured at runtime. */
10
+ export interface OasisEditorUiState {
11
+ showChrome?: boolean;
12
+ showTitleBar?: boolean;
13
+ showMenubar?: boolean;
14
+ showToolbar?: boolean;
15
+ showOutline?: boolean;
16
+ shell?: "document" | "inline" | "balloon";
17
+ locale?: "pt-BR" | "en";
18
+ toolbar?: {
19
+ view?: "ribbon" | "compact";
20
+ layout?: "overflow" | "wrap";
21
+ };
22
+ viewportHeight?: number | string;
23
+ readOnly?: boolean;
24
+ }
25
+ /** Events emitted by the editor client lifecycle. */
26
+ export type OasisEditorClientEvent = "ready" | "change" | "documentChange" | "selectionChange" | "uiChange" | "error";
27
+ /** Payload types associated with each client event. */
7
28
  export interface OasisEditorClientEvents {
8
29
  ready: Editor;
9
30
  change: EditorState;
10
31
  documentChange: EditorDocument;
11
32
  selectionChange: EditorSelection;
33
+ uiChange: OasisEditorUiState;
12
34
  error: unknown;
13
35
  }
36
+ /**
37
+ * Handler signature for subscribing to client events.
38
+ * @typeParam TEvent - The specific event type being handled.
39
+ */
14
40
  export type OasisEditorClientEventHandler<TEvent extends OasisEditorClientEvent = OasisEditorClientEvent> = (payload: OasisEditorClientEvents[TEvent]) => void;
41
+ /** Low-level document CRUD API exposed through the editor client. */
15
42
  export interface OasisEditorDocumentApi {
43
+ /** Returns the current document. */
16
44
  get(): EditorDocument;
45
+ /** @param document - The new document to set. Marks the editor dirty. */
17
46
  set(document: EditorDocument): void;
47
+ /** @param document - The document to load. Does NOT mark the editor dirty. */
18
48
  load(document: EditorDocument): void;
49
+ /** @param updater - Function that receives the current document and returns the new one. */
19
50
  update(updater: (document: EditorDocument) => EditorDocument): void;
51
+ /** Resets the document to its initial empty state. */
20
52
  reset(): void;
53
+ /** @returns A promise that resolves once the document is persisted. */
21
54
  save(): Promise<void>;
55
+ /** @returns `true` if the document has unsaved changes. */
22
56
  isDirty(): boolean;
57
+ /** Marks the document as clean (no unsaved changes). */
23
58
  markClean(): void;
59
+ /** @returns A monotonically increasing version counter, incremented on every mutation. */
60
+ version(): number;
61
+ }
62
+ /** Query API for reading the document without mutation. */
63
+ export interface OasisEditorQueryApi {
64
+ /** @returns A snapshot of the entire document (text, outline, nodes). */
65
+ snapshot(): SemanticDocumentSnapshot;
66
+ /**
67
+ * @param target - Optional selector or range to scope the text to.
68
+ * @returns Plain text for the whole document or a specific target/range.
69
+ */
70
+ getText(target?: DocumentSelector | DocumentRange): string;
71
+ /**
72
+ * @param selector - The selector identifying the node.
73
+ * @returns A semantic node descriptor, or `null` if not found.
74
+ */
75
+ getNode(selector: DocumentSelector): ReturnType<ReturnType<typeof queryDocument>["getNode"]>;
76
+ /**
77
+ * @param text - The text to search for.
78
+ * @returns An array of match descriptors.
79
+ */
80
+ find(text: string): ReturnType<ReturnType<typeof queryDocument>["find"]>;
81
+ /** @returns The document outline (heading-based hierarchy). */
82
+ outline(): ReturnType<ReturnType<typeof queryDocument>["outline"]>;
83
+ }
84
+ /** Edit API for applying structured operations to the document. */
85
+ export interface OasisEditorEditApi {
86
+ /**
87
+ * Applies one or more edit operations.
88
+ * @param request - The edit request containing operations and optional version checks.
89
+ * @returns A result indicating success or failure with error details.
90
+ */
91
+ apply(request: ApplyEditRequest): Promise<OasisResult<ApplyEditValue>>;
24
92
  }
93
+ /** Selection read/write API. */
25
94
  export interface OasisEditorSelectionApi {
95
+ /** @returns The current selection. */
26
96
  get(): EditorSelection;
97
+ /** @param selection - The new selection to set. */
27
98
  set(selection: EditorSelection): void;
28
99
  }
100
+ /** Focus management API. */
29
101
  export interface OasisEditorFocusApi {
102
+ /** Focuses the editor input area. */
30
103
  focus(): void;
104
+ /** Blurs the editor input area. */
31
105
  blur(): void;
32
106
  }
107
+ /** History (undo/redo) API. */
33
108
  export interface OasisEditorHistoryApi {
109
+ /** @returns The result of undoing the last operation. */
34
110
  undo(): unknown;
111
+ /** @returns The result of reapplying the last undone operation. */
35
112
  redo(): unknown;
113
+ /** @returns `true` if undo is available. */
36
114
  canUndo(): boolean;
115
+ /** @returns `true` if redo is available. */
37
116
  canRedo(): boolean;
117
+ /** Clears the entire undo/redo history. */
38
118
  clear(): void;
39
119
  }
120
+ /** File import API. */
40
121
  export interface OasisEditorImportApi {
122
+ /**
123
+ * Imports a .docx file from a browser File object.
124
+ * @param file - The .docx file to import.
125
+ */
41
126
  docx(file: File): Promise<void>;
42
127
  }
128
+ /** File export API. */
43
129
  export interface OasisEditorExportApi {
130
+ /** @returns A promise resolving to the exported .docx data. */
44
131
  docx(): Promise<unknown>;
132
+ /** @returns A promise resolving to the exported .pdf data. */
45
133
  pdf(): Promise<unknown>;
46
134
  }
135
+ /** Data input/output API with progress reporting and result wrapping. */
136
+ export interface OasisEditorDataIoApi {
137
+ /**
138
+ * Imports a document from raw data.
139
+ * @param request - Import configuration including format, data, and optional progress callback.
140
+ * @returns A wrapped result indicating success or failure.
141
+ */
142
+ import(request: {
143
+ format: "docx";
144
+ data: Blob | ArrayBuffer | Uint8Array;
145
+ filename?: string;
146
+ signal?: AbortSignal;
147
+ onProgress?: (progress: unknown) => void;
148
+ }): Promise<OasisResult<{
149
+ format: "docx";
150
+ }>>;
151
+ /**
152
+ * Exports the document as a Blob in the requested format.
153
+ * @param request - Export configuration including format and optional filename.
154
+ * @returns A wrapped result containing the blob.
155
+ */
156
+ export(request: {
157
+ format: "docx" | "pdf";
158
+ filename?: string;
159
+ }): Promise<OasisResult<{
160
+ format: "docx" | "pdf";
161
+ blob: Blob;
162
+ arrayBuffer: () => Promise<ArrayBuffer>;
163
+ }>>;
164
+ }
165
+ /** UI configuration and chrome API. */
166
+ export interface OasisEditorUiApi {
167
+ /** @returns The current UI state. */
168
+ state(): OasisEditorUiState;
169
+ /**
170
+ * Applies a partial UI state patch.
171
+ * @param patch - The partial state to apply.
172
+ * @returns The new UI state after applying the patch.
173
+ */
174
+ update(patch: OasisEditorUiState): OasisEditorUiState;
175
+ /** @param value - Whether the editor should be read-only. */
176
+ setReadOnly(value: boolean): void;
177
+ /** Zoom controls. */
178
+ zoom: {
179
+ get(): number;
180
+ set(value: number): void;
181
+ adjust(delta: number): void;
182
+ };
183
+ /** Chrome visibility controls. */
184
+ chrome: {
185
+ setVisible(value: boolean): void;
186
+ };
187
+ /** Title bar visibility control. */
188
+ titleBar: {
189
+ setVisible(value: boolean): void;
190
+ };
191
+ /** Menubar visibility and item registry. */
192
+ menubar: {
193
+ setVisible(value: boolean): void;
194
+ items: MenuRegistry;
195
+ };
196
+ /** Toolbar visibility and item registry. */
197
+ toolbar: {
198
+ setVisible(value: boolean): void;
199
+ items: ToolbarRegistry;
200
+ };
201
+ /** Outline panel visibility control. */
202
+ outline: {
203
+ setVisible(value: boolean): void;
204
+ };
205
+ /** @param value - The shell mode to set. */
206
+ shell: {
207
+ set(value: "document" | "inline" | "balloon"): void;
208
+ };
209
+ /** @param value - The locale to set. */
210
+ locale: {
211
+ set(value: "pt-BR" | "en"): void;
212
+ };
213
+ }
214
+ /**
215
+ * The main public API surface of an Oasis Editor instance. Returned by
216
+ * {@link createOasisEditor} and {@link createOasisEditorContainer}.
217
+ */
47
218
  export interface OasisEditorClient {
219
+ /** Resolves once the editor runtime is fully initialized. */
48
220
  readonly ready: Promise<Editor>;
221
+ /** Typed command bus for dispatching editor commands. */
49
222
  readonly commands: TypedCommandBus<ToolbarCommandState>;
223
+ /** Document CRUD API. */
50
224
  readonly document: OasisEditorDocumentApi;
225
+ /** Selection API. */
51
226
  readonly selection: OasisEditorSelectionApi;
227
+ /** Focus API. */
52
228
  readonly focus: OasisEditorFocusApi;
229
+ /** History (undo/redo) API. */
53
230
  readonly history: OasisEditorHistoryApi;
231
+ /** File import API. */
54
232
  readonly import: OasisEditorImportApi;
233
+ /** File export API. */
55
234
  readonly export: OasisEditorExportApi;
235
+ /** Document query API. */
236
+ readonly query: OasisEditorQueryApi;
237
+ /** Document edit API. */
238
+ readonly edit: OasisEditorEditApi;
239
+ /** Data import/export API with result wrapping. */
240
+ readonly io: OasisEditorDataIoApi;
241
+ /** UI configuration API. */
242
+ readonly ui: OasisEditorUiApi;
243
+ /** Disposes the editor, releasing resources. */
56
244
  dispose(): void | Promise<void>;
245
+ /** @returns The current editor state. */
57
246
  getState(): EditorState;
247
+ /** @returns The current document. */
58
248
  getDocument(): EditorDocument;
249
+ /** @param document - The new document to set. Marks the editor dirty. */
59
250
  setDocument(document: EditorDocument): void;
251
+ /** @param document - The document to load. Does NOT mark the editor dirty. */
60
252
  loadDocument(document: EditorDocument): void;
253
+ /**
254
+ * @param updater - Function that receives the current document and returns the new one.
255
+ */
61
256
  updateDocument(updater: (document: EditorDocument) => EditorDocument): void;
257
+ /** Resets the document to its initial state. */
62
258
  resetDocument(): void;
259
+ /** @returns A promise that resolves once the document is persisted. */
63
260
  save(): Promise<void>;
261
+ /** @returns `true` if the document has unsaved changes. */
64
262
  isDirty(): boolean;
263
+ /** Marks the document as clean. */
65
264
  markClean(): void;
265
+ /** @returns The current selection. */
66
266
  getSelection(): EditorSelection;
267
+ /** @param selection - The new selection to set. */
67
268
  setSelection(selection: EditorSelection): void;
269
+ /** Focuses the editor. */
68
270
  focusEditor(): void;
271
+ /** Blurs the editor. */
69
272
  blurEditor(): void;
273
+ /**
274
+ * Subscribes to a client event.
275
+ * @param event - The event name.
276
+ * @param callback - The handler to invoke when the event fires.
277
+ * @returns An unsubscribe function.
278
+ */
70
279
  on<TEvent extends OasisEditorClientEvent>(event: TEvent, callback: OasisEditorClientEventHandler<TEvent>): () => void;
280
+ /**
281
+ * Subscribes to a single emission of a client event.
282
+ * @param event - The event name.
283
+ * @param callback - The handler to invoke once.
284
+ * @returns An unsubscribe function.
285
+ */
71
286
  once<TEvent extends OasisEditorClientEvent>(event: TEvent, callback: OasisEditorClientEventHandler<TEvent>): () => void;
287
+ /**
288
+ * Removes a previously subscribed event handler.
289
+ * @param event - The event name.
290
+ * @param callback - The handler to remove.
291
+ */
72
292
  off<TEvent extends OasisEditorClientEvent>(event: TEvent, callback: OasisEditorClientEventHandler<TEvent>): void;
73
293
  }
294
+ /**
295
+ * Internal contract used by the host (editor UI shell) to drive the client.
296
+ * Extends the public {@link OasisEditorClient} with connection lifecycle methods.
297
+ */
74
298
  export interface OasisEditorClientHost {
75
299
  getRuntimeEditor(): Editor | null;
76
300
  getState(): EditorState;
77
301
  getDocument(): EditorDocument;
78
302
  setDocument(document: EditorDocument): void;
303
+ applyTransactionalState?(producer: (state: EditorState) => EditorState): void;
79
304
  resetDocument(): void;
80
305
  saveDocument(): Promise<void>;
81
306
  getSelection(): EditorSelection;
@@ -86,12 +311,40 @@ export interface OasisEditorClientHost {
86
311
  importDocx(file: File): Promise<void>;
87
312
  exportDocx(): Promise<unknown>;
88
313
  exportPdf(): Promise<unknown>;
314
+ exportDocxBlob(): Promise<Blob>;
315
+ exportPdfBlob(): Promise<Blob>;
316
+ getUiState?(): OasisEditorUiState;
317
+ updateUiState?(patch: OasisEditorUiState): OasisEditorUiState;
318
+ getZoom?(): number;
319
+ setZoom?(value: number): void;
320
+ adjustZoom?(delta: number): void;
321
+ toolbarRegistry?: ToolbarRegistry;
322
+ menuRegistry?: MenuRegistry;
89
323
  }
324
+ /**
325
+ * Combined interface for the internal client-controller, extending the public
326
+ * API with host connection, disposal, ready resolution, and event emission.
327
+ */
90
328
  export interface OasisEditorClientController extends OasisEditorClient {
329
+ /** @param host - The host to connect. */
91
330
  connectHost(host: OasisEditorClientHost): void;
331
+ /** @param dispose - The dispose function to call on cleanup. */
92
332
  setDispose(dispose: () => void | Promise<void>): void;
333
+ /** @param editor - The editor instance that is now ready. */
93
334
  resolveReady(editor: Editor): void;
335
+ /** @param error - The error that prevented initialization. */
94
336
  rejectReady(error: unknown): void;
337
+ /**
338
+ * Emits a client event.
339
+ * @param event - The event name.
340
+ * @param payload - The event payload.
341
+ */
95
342
  emit<TEvent extends OasisEditorClientEvent>(event: TEvent, payload: OasisEditorClientEvents[TEvent]): void;
96
343
  }
344
+ /**
345
+ * Creates a new editor client controller. The client is a lightweight broker
346
+ * that connects the public API surface to the host runtime once mounted.
347
+ *
348
+ * @returns A new {@link OasisEditorClientController} instance.
349
+ */
97
350
  export declare function createOasisEditorClient(): OasisEditorClientController;