oasis-editor 0.0.37 → 0.0.39

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-CXQHbZ10.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 resolveFloatingObjectRect, a0 as getTextBoxFloatingGeometry, a1 as getPresetPathSegments, a2 as projectBlocksLayout, a3 as buildListLabels, a4 as textStyleToFontSizePt, a5 as PX_PER_POINT, a6 as DEFAULT_FONT_SIZE_PX, a7 as isDoubleUnderlineStyle, a8 as isWavyUnderlineStyle, a9 as underlineStyleLineWidthPx, aa as underlineStyleDashArray, ab as resolveListLabel, ac as getListLabelInset, ad as getAlignedListLabelInset, ae as getParagraphBorderInsets, af as buildSegmentTable, ag as buildCanvasTableLayout, 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-XgdC48U9.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) {
@@ -10156,94 +10156,6 @@ function borderDashArray(type) {
10156
10156
  return void 0;
10157
10157
  }
10158
10158
  }
10159
- function drawCellEdge(writer, pageIndex, border, x1, y1, x2, y2) {
10160
- if (border.type === "none" || border.width <= 0) {
10161
- return;
10162
- }
10163
- writer.drawLine(pageIndex, {
10164
- x1: pxToPt$1(x1),
10165
- y1: pxToPt$1(y1),
10166
- x2: pxToPt$1(x2),
10167
- y2: pxToPt$1(y2),
10168
- stroke: border.color,
10169
- lineWidth: pxToPt$1(border.width),
10170
- dashArray: borderDashArray(border.type)
10171
- });
10172
- }
10173
- function drawCellBorders(writer, pageIndex, cell, originX, originY) {
10174
- const left = originX + cell.left;
10175
- const top = originY + cell.top;
10176
- const right = left + cell.width;
10177
- const bottom = top + cell.height;
10178
- drawCellEdge(writer, pageIndex, cell.borders.top, left, top, right, top);
10179
- drawCellEdge(
10180
- writer,
10181
- pageIndex,
10182
- cell.borders.right,
10183
- right,
10184
- top,
10185
- right,
10186
- bottom
10187
- );
10188
- drawCellEdge(
10189
- writer,
10190
- pageIndex,
10191
- cell.borders.bottom,
10192
- left,
10193
- bottom,
10194
- right,
10195
- bottom
10196
- );
10197
- drawCellEdge(writer, pageIndex, cell.borders.left, left, top, left, bottom);
10198
- }
10199
- async function drawTableBlock(writer, pageIndex, block, document2, originX, originY, contentWidth, fontRegistry, listOrdinals) {
10200
- if (block.sourceBlock.type !== "table") {
10201
- return;
10202
- }
10203
- const sourceTable = block.sourceBlock;
10204
- const segmentTable = block.tableSegment ? buildSegmentTable(sourceTable, block.tableSegment) : sourceTable;
10205
- if (segmentTable.rows.length === 0) {
10206
- return;
10207
- }
10208
- const stateStub = { document: document2 };
10209
- const tableLayout = buildCanvasTableLayout({
10210
- table: segmentTable,
10211
- state: stateStub,
10212
- pageIndex: 0,
10213
- originX: 0,
10214
- originY: 0,
10215
- contentWidth,
10216
- estimatedHeight: block.estimatedHeight
10217
- });
10218
- for (const cell of tableLayout.cells) {
10219
- if (!cell.shading) continue;
10220
- writer.drawRect(pageIndex, {
10221
- x: pxToPt$1(originX + cell.left),
10222
- y: pxToPt$1(originY + cell.top),
10223
- width: pxToPt$1(cell.width),
10224
- height: pxToPt$1(cell.height),
10225
- fill: cell.shading
10226
- });
10227
- }
10228
- for (const cell of tableLayout.cells) {
10229
- drawCellBorders(writer, pageIndex, cell, originX, originY);
10230
- }
10231
- for (const cell of tableLayout.cells) {
10232
- for (const paragraphLayout of cell.paragraphs) {
10233
- await drawParagraph(
10234
- writer,
10235
- pageIndex,
10236
- paragraphLayout.paragraph,
10237
- paragraphLayout.lines,
10238
- document2,
10239
- originX + paragraphLayout.originX,
10240
- originY + paragraphLayout.originY,
10241
- fontRegistry,
10242
- listOrdinals
10243
- );
10244
- }
10245
- }
10246
- }
10247
10159
  function getPadding(textBox) {
10248
10160
  var _a, _b, _c, _d;
10249
10161
  return {
@@ -10272,7 +10184,7 @@ function drawShapeGeometry(writer, pageIndex, textBox, xPx, yPx, widthPx, height
10272
10184
  lineWidth: borderWidthPt
10273
10185
  });
10274
10186
  }
10275
- async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heightPx) {
10187
+ async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heightPx, drawers) {
10276
10188
  var _a;
10277
10189
  if (textBox.blocks.length === 0) {
10278
10190
  return;
@@ -10318,7 +10230,7 @@ async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heigh
10318
10230
  let cursorY = innerY;
10319
10231
  for (const block of blocks) {
10320
10232
  if (block.sourceBlock.type === "paragraph" && block.layout) {
10321
- await drawParagraph(
10233
+ await drawers.drawParagraph(
10322
10234
  writer,
10323
10235
  ctx.pageIndex,
10324
10236
  block.sourceBlock,
@@ -10327,10 +10239,11 @@ async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heigh
10327
10239
  innerX,
10328
10240
  cursorY,
10329
10241
  ctx.fontRegistry,
10330
- listOrdinals
10242
+ listOrdinals,
10243
+ drawers
10331
10244
  );
10332
10245
  } else if (block.sourceBlock.type === "table") {
10333
- await drawTableBlock(
10246
+ await drawers.drawTableBlock(
10334
10247
  writer,
10335
10248
  ctx.pageIndex,
10336
10249
  block,
@@ -10339,14 +10252,15 @@ async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heigh
10339
10252
  cursorY,
10340
10253
  innerWidth,
10341
10254
  ctx.fontRegistry,
10342
- listOrdinals
10255
+ listOrdinals,
10256
+ drawers
10343
10257
  );
10344
10258
  }
10345
10259
  cursorY += Math.max(0, block.estimatedHeight);
10346
10260
  }
10347
10261
  writer.restoreGraphicsState(ctx.pageIndex);
10348
10262
  }
10349
- async function paintTextBox(writer, textBox, ctx, xPx, yPx, widthPx, heightPx) {
10263
+ async function paintTextBox(writer, textBox, ctx, xPx, yPx, widthPx, heightPx, drawers) {
10350
10264
  const rotation = textBox.rotation;
10351
10265
  if (rotation) {
10352
10266
  writer.saveGraphicsState(ctx.pageIndex);
@@ -10366,7 +10280,16 @@ async function paintTextBox(writer, textBox, ctx, xPx, yPx, widthPx, heightPx) {
10366
10280
  widthPx,
10367
10281
  heightPx
10368
10282
  );
10369
- await drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heightPx);
10283
+ await drawTextBoxContent(
10284
+ writer,
10285
+ textBox,
10286
+ ctx,
10287
+ xPx,
10288
+ yPx,
10289
+ widthPx,
10290
+ heightPx,
10291
+ drawers
10292
+ );
10370
10293
  if (rotation) {
10371
10294
  writer.restoreGraphicsState(ctx.pageIndex);
10372
10295
  }
@@ -10382,7 +10305,8 @@ async function drawFloatingTextBoxesForParagraph(options) {
10382
10305
  contentLeft,
10383
10306
  contentTop,
10384
10307
  contentWidth,
10385
- paragraphTop
10308
+ paragraphTop,
10309
+ drawers
10386
10310
  } = options;
10387
10311
  for (const line of lines) {
10388
10312
  const slotByOffset = new Map(
@@ -10413,7 +10337,8 @@ async function drawFloatingTextBoxesForParagraph(options) {
10413
10337
  rect.x,
10414
10338
  rect.y,
10415
10339
  rect.width,
10416
- rect.height
10340
+ rect.height,
10341
+ drawers
10417
10342
  );
10418
10343
  }
10419
10344
  }
@@ -10797,7 +10722,7 @@ function drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2,
10797
10722
  });
10798
10723
  }
10799
10724
  }
10800
- async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, document2, originX, originY, fontRegistry) {
10725
+ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, document2, originX, originY, fontRegistry, drawers) {
10801
10726
  const textBox = fragment.textBox;
10802
10727
  if (!textBox || textBox.floating) {
10803
10728
  return;
@@ -10813,10 +10738,11 @@ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, docu
10813
10738
  originX + slot.left,
10814
10739
  originY + line.top + line.height - textBox.height,
10815
10740
  textBox.width,
10816
- textBox.height
10741
+ textBox.height,
10742
+ drawers
10817
10743
  );
10818
10744
  }
10819
- async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry) {
10745
+ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
10820
10746
  var _a;
10821
10747
  if (fragment.image) {
10822
10748
  const slot = line.slots.find(
@@ -10852,7 +10778,8 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
10852
10778
  document2,
10853
10779
  originX,
10854
10780
  originY,
10855
- fontRegistry
10781
+ fontRegistry,
10782
+ drawers
10856
10783
  );
10857
10784
  return;
10858
10785
  }
@@ -11078,7 +11005,7 @@ function drawParagraphDecorations(writer, pageIndex, paragraphStyle, lines, orig
11078
11005
  });
11079
11006
  }
11080
11007
  }
11081
- async function drawParagraph(writer, pageIndex, paragraph, lines, document2, originX, originY, fontRegistry, listOrdinals) {
11008
+ async function drawParagraph(writer, pageIndex, paragraph, lines, document2, originX, originY, fontRegistry, listOrdinals, drawers) {
11082
11009
  for (const line of lines) {
11083
11010
  drawListPrefix(
11084
11011
  writer,
@@ -11101,11 +11028,102 @@ async function drawParagraph(writer, pageIndex, paragraph, lines, document2, ori
11101
11028
  document2,
11102
11029
  originX,
11103
11030
  originY,
11104
- fontRegistry
11031
+ fontRegistry,
11032
+ drawers
11033
+ );
11034
+ }
11035
+ }
11036
+ }
11037
+ function drawCellEdge(writer, pageIndex, border, x1, y1, x2, y2) {
11038
+ if (border.type === "none" || border.width <= 0) {
11039
+ return;
11040
+ }
11041
+ writer.drawLine(pageIndex, {
11042
+ x1: pxToPt$1(x1),
11043
+ y1: pxToPt$1(y1),
11044
+ x2: pxToPt$1(x2),
11045
+ y2: pxToPt$1(y2),
11046
+ stroke: border.color,
11047
+ lineWidth: pxToPt$1(border.width),
11048
+ dashArray: borderDashArray(border.type)
11049
+ });
11050
+ }
11051
+ function drawCellBorders(writer, pageIndex, cell, originX, originY) {
11052
+ const left = originX + cell.left;
11053
+ const top = originY + cell.top;
11054
+ const right = left + cell.width;
11055
+ const bottom = top + cell.height;
11056
+ drawCellEdge(writer, pageIndex, cell.borders.top, left, top, right, top);
11057
+ drawCellEdge(
11058
+ writer,
11059
+ pageIndex,
11060
+ cell.borders.right,
11061
+ right,
11062
+ top,
11063
+ right,
11064
+ bottom
11065
+ );
11066
+ drawCellEdge(
11067
+ writer,
11068
+ pageIndex,
11069
+ cell.borders.bottom,
11070
+ left,
11071
+ bottom,
11072
+ right,
11073
+ bottom
11074
+ );
11075
+ drawCellEdge(writer, pageIndex, cell.borders.left, left, top, left, bottom);
11076
+ }
11077
+ async function drawTableBlock(writer, pageIndex, block, document2, originX, originY, contentWidth, fontRegistry, listOrdinals, drawers) {
11078
+ if (block.sourceBlock.type !== "table") {
11079
+ return;
11080
+ }
11081
+ const sourceTable = block.sourceBlock;
11082
+ const segmentTable = block.tableSegment ? buildSegmentTable(sourceTable, block.tableSegment) : sourceTable;
11083
+ if (segmentTable.rows.length === 0) {
11084
+ return;
11085
+ }
11086
+ const stateStub = { document: document2 };
11087
+ const tableLayout = buildCanvasTableLayout({
11088
+ table: segmentTable,
11089
+ state: stateStub,
11090
+ pageIndex: 0,
11091
+ originX: 0,
11092
+ originY: 0,
11093
+ contentWidth,
11094
+ estimatedHeight: block.estimatedHeight
11095
+ });
11096
+ for (const cell of tableLayout.cells) {
11097
+ if (!cell.shading) continue;
11098
+ writer.drawRect(pageIndex, {
11099
+ x: pxToPt$1(originX + cell.left),
11100
+ y: pxToPt$1(originY + cell.top),
11101
+ width: pxToPt$1(cell.width),
11102
+ height: pxToPt$1(cell.height),
11103
+ fill: cell.shading
11104
+ });
11105
+ }
11106
+ for (const cell of tableLayout.cells) {
11107
+ drawCellBorders(writer, pageIndex, cell, originX, originY);
11108
+ }
11109
+ for (const cell of tableLayout.cells) {
11110
+ for (const paragraphLayout of cell.paragraphs) {
11111
+ await drawParagraph(
11112
+ writer,
11113
+ pageIndex,
11114
+ paragraphLayout.paragraph,
11115
+ paragraphLayout.lines,
11116
+ document2,
11117
+ originX + paragraphLayout.originX,
11118
+ originY + paragraphLayout.originY,
11119
+ fontRegistry,
11120
+ listOrdinals,
11121
+ drawers
11105
11122
  );
11106
11123
  }
11107
11124
  }
11108
11125
  }
11126
+ const blockDrawers = { drawParagraph, drawTableBlock };
11109
11127
  async function drawBlockList(writer, pageIndex, blocks, document2, originX, originY, contentWidth, fontRegistry, listOrdinals, pageSettings) {
11110
11128
  if (!blocks || blocks.length === 0) {
11111
11129
  return;
@@ -11139,7 +11157,8 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
11139
11157
  originX,
11140
11158
  textTop,
11141
11159
  fontRegistry,
11142
- listOrdinals
11160
+ listOrdinals,
11161
+ blockDrawers
11143
11162
  );
11144
11163
  if (pageSettings) {
11145
11164
  await drawFloatingTextBoxesForParagraph({
@@ -11152,7 +11171,8 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
11152
11171
  contentLeft: originX,
11153
11172
  contentTop,
11154
11173
  contentWidth,
11155
- paragraphTop: boxTop
11174
+ paragraphTop: boxTop,
11175
+ drawers: blockDrawers
11156
11176
  });
11157
11177
  }
11158
11178
  } else if (block.sourceBlock.type === "table") {
@@ -11165,7 +11185,8 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
11165
11185
  cursorY,
11166
11186
  contentWidth,
11167
11187
  fontRegistry,
11168
- listOrdinals
11188
+ listOrdinals,
11189
+ blockDrawers
11169
11190
  );
11170
11191
  }
11171
11192
  cursorY += Math.max(0, block.estimatedHeight);
@@ -0,0 +1,19 @@
1
+ import { EditorDocument, EditorLayoutBlock, EditorLayoutLine, EditorParagraphNode } from '../../../core/model.js';
2
+ import { OasisPdfWriter } from '../OasisPdfWriter.js';
3
+ import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
4
+
5
+ /**
6
+ * The block-level drawing functions a text box's inner content recurses into.
7
+ * Injected into the draw pipeline so `drawTextBoxShape` can render nested
8
+ * paragraphs/tables without importing `drawParagraph`/`drawTable` (which import
9
+ * back through the fragment painter), keeping the recursion acyclic. The
10
+ * concrete object is built by `createBlockDrawers` in `drawBlockList.ts`, the
11
+ * orchestrator that sits above this pipeline.
12
+ *
13
+ * Each function takes the `drawers` bundle as its final argument so deeper
14
+ * nesting (a text box inside a text box) keeps threading the same callbacks.
15
+ */
16
+ export interface BlockDrawers {
17
+ drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
18
+ drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
19
+ }
@@ -1,8 +1,9 @@
1
1
  import { EditorDocument, EditorLayoutFragment, EditorLayoutLine, EditorParagraphNode, EditorTextStyle } from '../../../core/model.js';
2
2
  import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
3
+ import { BlockDrawers } from './blockDrawers.js';
3
4
  import { OasisPdfWriter } from '../OasisPdfWriter.js';
4
5
 
5
6
  export declare function drawFragmentHighlight(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
6
7
  export declare function drawFragmentShading(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
7
8
  export declare function drawFragmentDecoration(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>, kind: "underline" | "strike" | "doubleStrike"): void;
8
- export declare function drawFragmentText(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, fragment: EditorLayoutFragment, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry): Promise<void>;
9
+ export declare function drawFragmentText(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, fragment: EditorLayoutFragment, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, drawers: BlockDrawers): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { EditorDocument, EditorLayoutLine, EditorParagraphNode, EditorParagraphStyle } from '../../../core/model.js';
2
2
  import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
3
3
  import { OasisPdfWriter } from '../OasisPdfWriter.js';
4
+ import { BlockDrawers } from './blockDrawers.js';
4
5
 
5
6
  /**
6
7
  * Paints paragraph shading (`w:shd`) and borders (`w:pBdr`) for PDF export,
@@ -9,4 +10,4 @@ import { OasisPdfWriter } from '../OasisPdfWriter.js';
9
10
  * dotted edges use {@link borderDashArray} to match the canvas renderer.
10
11
  */
11
12
  export declare function drawParagraphDecorations(writer: OasisPdfWriter, pageIndex: number, paragraphStyle: EditorParagraphStyle, lines: EditorLayoutLine[], originX: number, contentTop: number, contentWidth: number): void;
12
- export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): Promise<void>;
13
+ export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import { EditorDocument, EditorLayoutBlock } from '../../../core/model.js';
2
2
  import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
3
3
  import { OasisPdfWriter } from '../OasisPdfWriter.js';
4
+ import { BlockDrawers } from './blockDrawers.js';
4
5
 
5
- export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): Promise<void>;
6
+ export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { EditorDocument, EditorLayoutLine, EditorPageSettings, EditorTextBoxData } from '../../../core/model.js';
2
2
  import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
3
3
  import { OasisPdfWriter } from '../OasisPdfWriter.js';
4
+ import { BlockDrawers } from './blockDrawers.js';
4
5
 
5
6
  interface TextBoxPaintContext {
6
7
  document: EditorDocument;
@@ -12,7 +13,7 @@ interface TextBoxPaintContext {
12
13
  * honoring `textBox.rotation` by rotating about the box center — mirroring the
13
14
  * canvas `paintTextBox`. Shared by inline and floating text box rendering.
14
15
  */
15
- export declare function paintTextBox(writer: OasisPdfWriter, textBox: EditorTextBoxData, ctx: TextBoxPaintContext, xPx: number, yPx: number, widthPx: number, heightPx: number): Promise<void>;
16
+ export declare function paintTextBox(writer: OasisPdfWriter, textBox: EditorTextBoxData, ctx: TextBoxPaintContext, xPx: number, yPx: number, widthPx: number, heightPx: number, drawers: BlockDrawers): Promise<void>;
16
17
  /**
17
18
  * Paints the floating (anchored) text boxes / shapes of a single paragraph,
18
19
  * mirroring the canvas `drawFloatingTextBoxesForParagraph`: positions are
@@ -30,5 +31,6 @@ export declare function drawFloatingTextBoxesForParagraph(options: {
30
31
  contentTop: number;
31
32
  contentWidth: number;
32
33
  paragraphTop: number;
34
+ drawers: BlockDrawers;
33
35
  }): Promise<void>;
34
36
  export {};