oasis-editor 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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 { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as getHeadingLevel, aK as preciseFontModeVersion, aL as isPreciseFontModeEnabled, aM as togglePreciseFontMode, aN as nextFontSizePt, aO as previousFontSizePt, aP as fontSizePtToPx, aQ as createDefaultToolbarPreset, aR as MenuRegistry, aS as createToolbarRegistry, aT as Editor, aU as resolveCommandRef, aV as commandRefName, aW as InlineShell, aX as BalloonShell, aY as DocumentShell, aZ as createMemo, a_ as getCaretRectFromSnapshot, a$ as getParagraphRectFromSnapshot, b0 as createComponent, b1 as CaretOverlay, b2 as Show, b3 as createRenderEffect, b4 as style, b5 as setAttribute, b6 as setStyleProperty, b7 as memo, b8 as template, b9 as useI18n, ba as insert, bb as use, bc as addEventListener, bd as Dialog, be as delegateEvents, bf as className, bg as For, bh as UNDERLINE_STYLE_OPTIONS, bi as Tabs, bj as measureParagraphMinContentWidthPx, bk as getEditableBlocksForZone, bl as findParagraphLocation, bm as createSectionBoundaryParagraph, bn as normalizePageSettings, bo as DEFAULT_EDITOR_PAGE_SETTINGS, bp as markStart, bq as markEnd, br as getParagraphEntries, bs as getParagraphById, bt as PluginUiHost, bu as OasisEditorEditor, bv as perfTimer, bw as OasisBrandMark, bx as setPreciseFontPreference, by as setWelcomeSeen, bz as enablePreciseFontMode, bA as createOasisEditorClient, bB as createEditorZoom, bC as startLongTaskObserver, bD as installGlobalReport, bE as applyStoredPreciseFontPreference, bF as getWelcomeSeen, bG as isLocalFontAccessSupported, bH as EDITOR_SCROLL_PADDING_PX, bI as Toolbar, bJ as OasisEditorLoading, bK as I18nProvider, bL as createEditorLogger, bM as createTranslator, bN as getCachedCanvasImage, bO as registerDomStatsSurface } from "./index-BOYdiFMb.js";
4
+ import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as getHeadingLevel, aK as preciseFontModeVersion, aL as isPreciseFontModeEnabled, aM as togglePreciseFontMode, aN as nextFontSizePt, aO as previousFontSizePt, aP as fontSizePtToPx, aQ as createDefaultToolbarPreset, aR as MenuRegistry, aS as createToolbarRegistry, aT as Editor, aU as resolveCommandRef, aV as commandRefName, aW as InlineShell, aX as BalloonShell, aY as DocumentShell, aZ as createMemo, a_ as getCaretRectFromSnapshot, a$ as getParagraphRectFromSnapshot, b0 as createComponent, b1 as CaretOverlay, b2 as Show, b3 as createRenderEffect, b4 as style, b5 as setAttribute, b6 as setStyleProperty, b7 as memo, b8 as template, b9 as useI18n, ba as insert, bb as use, bc as addEventListener, bd as Dialog, be as delegateEvents, bf as className, bg as For, bh as UNDERLINE_STYLE_OPTIONS, bi as Tabs, bj as measureParagraphMinContentWidthPx, bk as getEditableBlocksForZone, bl as findParagraphLocation, bm as createSectionBoundaryParagraph, bn as normalizePageSettings, bo as DEFAULT_EDITOR_PAGE_SETTINGS, bp as markStart, bq as markEnd, br as getParagraphEntries, bs as getParagraphById, bt as PluginUiHost, bu as OasisEditorEditor, bv as perfTimer, bw as OasisBrandMark, bx as setPreciseFontPreference, by as setWelcomeSeen, bz as enablePreciseFontMode, bA as createOasisEditorClient, bB as createEditorZoom, bC as startLongTaskObserver, bD as installGlobalReport, bE as applyStoredPreciseFontPreference, bF as getWelcomeSeen, bG as isLocalFontAccessSupported, bH as EDITOR_SCROLL_PADDING_PX, bI as Toolbar, bJ as OasisEditorLoading, bK as I18nProvider, bL as createEditorLogger, bM as createTranslator, bN as getCachedCanvasImage, bO as registerDomStatsSurface } from "./index-BrL9FzT-.js";
5
5
  function getSelectedObjectRun(state, predicate) {
6
6
  const normalized = normalizeSelection(state);
7
7
  if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
@@ -8913,7 +8913,7 @@ function serializeImageRun(runId, rId, context, rPrXml) {
8913
8913
  const drawing = buildDrawingXml(img, docPrId, altAttr, picXml);
8914
8914
  return `<w:r>${rPrXml}${drawing}</w:r>`;
8915
8915
  }
8916
- function buildTextBoxGraphicXml(textBox, cx, cy, context, styles) {
8916
+ function buildTextBoxGraphicXml(textBox, cx, cy, context, styles, serializeBlocksXml2) {
8917
8917
  const shape = textBox.shape;
8918
8918
  const preset = escapeXml((shape == null ? void 0 : shape.preset) ?? "rect");
8919
8919
  const rotValue = textBox.rotation ? Math.round(textBox.rotation * OOXML_ROTATION_UNITS) : 0;
@@ -8947,18 +8947,25 @@ function buildTextBoxGraphicXml(textBox, cx, cy, context, styles) {
8947
8947
  bodyAttrs.push('anchorCtr="0"');
8948
8948
  const autoFitXml = (body == null ? void 0 : body.autoFit) ? "<a:spAutoFit/>" : "";
8949
8949
  const hasTextBoxContent = textBox.blocks.length > 0;
8950
- const innerXml = hasTextBoxContent ? serializeBlocksXml(textBox.blocks, context, styles) : "";
8950
+ const innerXml = hasTextBoxContent ? serializeBlocksXml2(textBox.blocks, context, styles) : "";
8951
8951
  const cNvSpPrXml = hasTextBoxContent ? '<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>' : "<wps:cNvSpPr/>";
8952
8952
  const txbxXml = hasTextBoxContent ? `<wps:txbx><w:txbxContent>${innerXml}</w:txbxContent></wps:txbx>` : "";
8953
8953
  return '<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp>' + cNvSpPrXml + `<wps:spPr bwMode="auto"><a:xfrm${xfrmRotAttr}><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="${preset}"><a:avLst/></a:prstGeom>` + fillXml + lnXml + "</wps:spPr>" + txbxXml + `<wps:bodyPr ${bodyAttrs.join(" ")}>${autoFitXml}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`;
8954
8954
  }
8955
- function serializeTextBoxRun(run, textBox, context, styles, rPrXml) {
8955
+ function serializeTextBoxRun(run, textBox, context, styles, rPrXml, serializeBlocksXml2) {
8956
8956
  const cx = Math.round(textBox.width * EMU_PER_PX);
8957
8957
  const cy = Math.round(textBox.height * EMU_PER_PX);
8958
8958
  const docPrId = context.textBoxDocPrIds.get(run.id) ?? 1;
8959
8959
  const docPrName = textBox.name ?? "Text Box";
8960
8960
  const altAttr = textBox.alt !== void 0 ? ` descr="${escapeXml(textBox.alt)}" title="${escapeXml(textBox.alt)}"` : "";
8961
- const graphicXml = buildTextBoxGraphicXml(textBox, cx, cy, context, styles);
8961
+ const graphicXml = buildTextBoxGraphicXml(
8962
+ textBox,
8963
+ cx,
8964
+ cy,
8965
+ context,
8966
+ styles,
8967
+ serializeBlocksXml2
8968
+ );
8962
8969
  const drawing = buildDrawingContainerXml({
8963
8970
  cx,
8964
8971
  cy,
@@ -9027,7 +9034,7 @@ function wrapRunWithHyperlink(runXml, link, context) {
9027
9034
  }
9028
9035
  return `<w:hyperlink r:id="${rId}">${runXml}</w:hyperlink>`;
9029
9036
  }
9030
- function serializeRun(run, context, paragraphStyleId, styles) {
9037
+ function serializeRun(run, context, paragraphStyleId, styles, serializeBlocksXml2) {
9031
9038
  if (run.__isFootnoteRefMarker) {
9032
9039
  return serializeFootnoteRefMarker();
9033
9040
  }
@@ -9083,7 +9090,8 @@ function serializeRun(run, context, paragraphStyleId, styles) {
9083
9090
  run.textBox,
9084
9091
  context,
9085
9092
  styles,
9086
- serializeRunProperties(materializedRunStyle)
9093
+ serializeRunProperties(materializedRunStyle),
9094
+ serializeBlocksXml2
9087
9095
  );
9088
9096
  }
9089
9097
  if (run.image) {
@@ -9106,9 +9114,15 @@ function serializeRun(run, context, paragraphStyleId, styles) {
9106
9114
  }
9107
9115
  return `<w:r>${serializeRunProperties(materializedRunStyle)}${serializeRunText(run.text)}</w:r>`;
9108
9116
  }
9109
- function serializeRunWithRelationships(run, context, paragraphStyleId, styles) {
9117
+ function serializeRunWithRelationships(run, context, paragraphStyleId, styles, serializeBlocksXml2) {
9110
9118
  var _a;
9111
- const runXml = serializeRun(run, context, paragraphStyleId, styles);
9119
+ const runXml = serializeRun(
9120
+ run,
9121
+ context,
9122
+ paragraphStyleId,
9123
+ styles,
9124
+ serializeBlocksXml2
9125
+ );
9112
9126
  const href = (_a = run.styles) == null ? void 0 : _a.link;
9113
9127
  if (!href) {
9114
9128
  return runXml;
@@ -9156,7 +9170,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
9156
9170
  },
9157
9171
  context,
9158
9172
  paragraphStyleId,
9159
- styles
9173
+ styles,
9174
+ serializeBlocksXml
9160
9175
  );
9161
9176
  }
9162
9177
  out += token.xml;
@@ -9168,7 +9183,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
9168
9183
  { ...run, text: run.text.slice(cursor - runStart) },
9169
9184
  context,
9170
9185
  paragraphStyleId,
9171
- styles
9186
+ styles,
9187
+ serializeBlocksXml
9172
9188
  );
9173
9189
  }
9174
9190
  } else {
@@ -9176,7 +9192,8 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
9176
9192
  run,
9177
9193
  context,
9178
9194
  paragraphStyleId,
9179
- styles
9195
+ styles,
9196
+ serializeBlocksXml
9180
9197
  );
9181
9198
  }
9182
9199
  pos = runEnd;
@@ -9233,7 +9250,8 @@ function serializeParagraphXml(paragraph, context, styles, overrides) {
9233
9250
  run,
9234
9251
  context,
9235
9252
  (_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
9236
- styles
9253
+ styles,
9254
+ serializeBlocksXml
9237
9255
  );
9238
9256
  }
9239
9257
  ).join("");
@@ -1,5 +1,6 @@
1
1
  import { EditorNamedStyle, EditorTextRun } from '../../../core/model.js';
2
2
  import { DocContext } from '../docxTypes.js';
3
+ import { SerializeBlocksXml } from './textBoxRunXml.js';
3
4
 
4
- export declare function serializeRun(run: EditorTextRun, context: DocContext, paragraphStyleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined): string;
5
- export declare function serializeRunWithRelationships(run: EditorTextRun, context: DocContext, paragraphStyleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined): string;
5
+ export declare function serializeRun(run: EditorTextRun, context: DocContext, paragraphStyleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined, serializeBlocksXml: SerializeBlocksXml): string;
6
+ export declare function serializeRunWithRelationships(run: EditorTextRun, context: DocContext, paragraphStyleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined, serializeBlocksXml: SerializeBlocksXml): string;
@@ -1,4 +1,11 @@
1
- import { EditorNamedStyle, EditorTextBoxData, EditorTextRun } from '../../../core/model.js';
1
+ import { EditorBlockNode, EditorNamedStyle, EditorTextBoxData, EditorTextRun } from '../../../core/model.js';
2
2
  import { DocContext } from '../docxTypes.js';
3
3
 
4
- export declare function serializeTextBoxRun(run: EditorTextRun, textBox: EditorTextBoxData, context: DocContext, styles: Record<string, EditorNamedStyle> | undefined, rPrXml: string): string;
4
+ /**
5
+ * Serializes a list of blocks (paragraphs/tables) to `w:p`/`w:tbl` XML. A text
6
+ * box's body recurses into this. Injected as a callback by the orchestrator
7
+ * (`blocksXml`) rather than imported, so this module does not import back into
8
+ * `blocksXml` (which serializes runs through `runXml` -> here).
9
+ */
10
+ export type SerializeBlocksXml = (blocks: EditorBlockNode[], context: DocContext, styles: Record<string, EditorNamedStyle> | undefined) => string;
11
+ export declare function serializeTextBoxRun(run: EditorTextRun, textBox: EditorTextBoxData, context: DocContext, styles: Record<string, EditorNamedStyle> | undefined, rPrXml: string, serializeBlocksXml: SerializeBlocksXml): string;
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
2483
2483
  onCleanup(() => {
2484
2484
  cancelled = true;
2485
2485
  });
2486
- import("./OasisEditorApp-s0BpEyzt.js").then((m) => {
2486
+ import("./OasisEditorApp-gZEDGfQL.js").then((m) => {
2487
2487
  cancelled = true;
2488
2488
  setProgress(1);
2489
2489
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -1,4 +1,4 @@
1
- import { aX, bP, bQ, bR, bS, bT, bd, bU, aY, aT, bV, bW, bX, aW, bY, aR, bZ, b_, b$, c0, c1, bJ, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, bi, cd, bI, ce, bR as bR2, bW as bW2, bY as bY2, c5 as c52, c7 as c72, cc as cc2, cf, aV, aQ, cg, ch, ci, aS, cj, ck, aU } from "./index-BOYdiFMb.js";
1
+ import { aX, bP, bQ, bR, bS, bT, bd, bU, aY, aT, bV, bW, bX, aW, bY, aR, bZ, b_, b$, c0, c1, bJ, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, bi, cd, bI, ce, bR as bR2, bW as bW2, bY as bY2, c5 as c52, c7 as c72, cc as cc2, cf, aV, aQ, cg, ch, ci, aS, cj, ck, aU } from "./index-BrL9FzT-.js";
2
2
  export {
3
3
  aX as BalloonShell,
4
4
  bP as Button,