oasis-editor 0.0.128 → 0.0.130

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 (30) hide show
  1. package/dist/{OasisEditorApp-3vvH6KOz.js → OasisEditorApp-BQvsqccA.js} +492 -21
  2. package/dist/app/controllers/useEditorLayout.d.ts +2 -1
  3. package/dist/app/controllers/useEditorTableCornerResize.d.ts +56 -0
  4. package/dist/core/commands/publicCommandTypes.d.ts +10 -0
  5. package/dist/core/commands/table/tableColumnCommands.d.ts +6 -0
  6. package/dist/core/commands/table/tableRowCommands.d.ts +6 -0
  7. package/dist/core/pluginUiTypes.d.ts +8 -1
  8. package/dist/core/transactionMergeKeys.d.ts +3 -0
  9. package/dist/i18n/locales/en.d.ts +19 -0
  10. package/dist/i18n/locales/pt-BR.d.ts +19 -0
  11. package/dist/{index-Ceyv5JS5.js → index-CX5iCo8O.js} +590 -350
  12. package/dist/oasis-editor.css +1 -1
  13. package/dist/oasis-editor.js +1 -1
  14. package/dist/oasis-editor.umd.cjs +4 -4
  15. package/dist/plugins/internal/essentialsCapabilities.d.ts +20 -0
  16. package/dist/ui/OasisEditorEditor.d.ts +3 -1
  17. package/dist/ui/app/EditorDragLayers.d.ts +2 -0
  18. package/dist/ui/app/buildEditorViewProps.d.ts +4 -1
  19. package/dist/ui/app/createEditorDocumentRuntime.d.ts +1 -0
  20. package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
  21. package/dist/ui/app/useEditorInteractionWiring.d.ts +2 -0
  22. package/dist/ui/canvas/CanvasSelectionGeometry.d.ts +9 -0
  23. package/dist/ui/components/Toolbar/presets/builtinToolbarIds.d.ts +0 -1
  24. package/dist/ui/components/Toolbar/ribbon/RibbonTabs.d.ts +2 -1
  25. package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +10 -2
  26. package/dist/ui/components/Toolbar/schema/items.d.ts +1 -1
  27. package/dist/ui/editorUiTypes.d.ts +9 -0
  28. package/dist/ui/overlays/TableHandlesOverlay.d.ts +22 -0
  29. package/package.json +1 -1
  30. package/dist/ui/components/Toolbar/groups/TableGroup.d.ts +0 -7
@@ -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 setAttribute, ag as setStyleProperty, 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 createStore, aE as reconcile, aF as RadioGroup, aG as Radio$1, aH as TextAreaField, aI as Text, aJ as SurfaceButton, aK as delegateEvents, aL as onMount, aM as onCleanup, aN as use, aO as PluginUiHost, aP as OasisEditorEditor, aQ as OasisBrandMark, aR as setPreciseFontPreference, aS as setWelcomeSeen, aT as enablePreciseFontMode, aU as TWIPS_PER_POINT, aV as PX_PER_INCH, aW as TWIPS_PER_INCH, aX as normalizeHex6, aY as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aZ as TABLE_BORDER_EDGE_KEYS, a_ as resolveEffectiveParagraphStyle, a$ as resolveEffectiveTextStyleForParagraph, b0 as EMU_PER_PT, b1 as OOXML_ROTATION_UNITS, b2 as OOXML_PERCENT_DENOMINATOR, b3 as parseHexColorToRgb255, b4 as EMU_PER_PX, b5 as getRunEndnoteReference, b6 as iterateFootnoteReferenceRuns, b7 as iterateEndnoteReferenceRuns, b8 as imageContentTypeDefaults, b9 as getRunFieldChar, ba as getRunFieldInstruction, bb as createEditorRun, bc as JSZip, bd as imageExtensionFromMime, be as pxToPt$1, bf as resolveFloatingObjectRect, bg as getTextBoxFloatingGeometry, bh as getPresetPathSegments, bi as buildListLabels, bj as DEFAULT_FONT_SIZE_PX, bk as resolveGradientAxis, bl as isDoubleUnderlineStyle, bm as isWavyUnderlineStyle, bn as underlineStyleLineWidthPx, bo as WAVY_UNDERLINE_WAVELENGTH_PX, bp as WAVY_UNDERLINE_AMPLITUDE_PX, bq as DOUBLE_UNDERLINE_OFFSET_PX, br as underlineStyleDashArray, bs as EMPHASIS_GLYPH, bt as rgb255ToHex, bu as getImageFloatingGeometry, bv as textStyleToFontSizePt, bw as resolveTextAlignmentBaselineOffset, bx as TEXT_BASELINE_RATIO, by as resolveOpenTypeFeatureTags, bz as resolveDecorationLineY, bA as DOUBLE_STRIKE_OFFSET_PX, bB as resolveListLabel, bC as getListLabelInset, bD as getAlignedListLabelInset, bE as getParagraphBorderInsets, bF as buildSegmentTable, bG as buildCanvasTableLayout, bH as resolveCanvasTableWidth, bI as resolveFloatingTableRect, bJ as paragraphBetweenBorderMatches, bK as normalizeFamily, bL as ROBOTO_FONT_FILES, bM as loadFontAsset, bN as OFFICE_COMPAT_FONT_FAMILIES, bO as BinaryReader, bP as buildSfnt, bQ as defaultFontDecoderRegistry, bR as SfntFontProgram, bS as collectPdfFontFamilies, bT as outlineFrom, bU as getPageHeaderZoneTop, bV as getPageColumnRects, bW as findFootnoteReference, bX as resolveImporterForFile, bY as roundTo, bZ as getDocumentSectionsCanonical, b_ as getDocumentParagraphsCanonical, b$ as getDocumentParagraphs, c0 as getDocumentPageSettings, c1 as getTableCellContentWidthForParagraph, c2 as layoutMetricsEpoch, c3 as bumpLayoutMetricsEpoch, c4 as createCanvasLayoutSnapshotProvider, c5 as on, c6 as debounce, c7 as unwrap, c8 as perfTimer, c9 as getRunTextBox, ca as createEditorDocument, cb as resolveResizedDimensions, cc as resolveTextBoxRenderHeight, cd as getToolbarStyleState, ce as VERTICAL_HIT_WEIGHT, cf as getCachedCanvasImage, cg as measureParagraphMinContentWidthPx, ch as getEditableBlocksForZone, ci as findParagraphLocation, cj as createSectionBoundaryParagraph, ck as normalizePageSettings, cl as DEFAULT_EDITOR_PAGE_SETTINGS, cm as markStart, cn as markEnd, co as getParagraphEntries, cp as getParagraphById, cq as createEditorFootnote, cr as createFootnoteReferenceRun, cs as renumberFootnotes, ct as getHeadingLevel, cu as preciseFontModeVersion, cv as isPreciseFontModeEnabled, cw as resolveNamedTextStyle, cx as togglePreciseFontMode, cy as nextFontSizePt, cz as previousFontSizePt, cA as fontSizePtToPx, cB as createDefaultToolbarPreset, cC as MenuRegistry, cD as createToolbarRegistry, cE as Editor, cF as resolveCommandRef, cG as commandRefName, cH as createOasisEditorClient, cI as createEditorZoom, cJ as startLongTaskObserver, cK as installGlobalReport, cL as applyStoredPreciseFontPreference, cM as getWelcomeSeen, cN as isLocalFontAccessSupported, cO as EDITOR_SCROLL_PADDING_PX, cP as Toolbar, cQ as OasisEditorLoading, cR as I18nProvider, cS as createTranslator, cT as registerDomStatsSurface, cU as createEditorLogger } from "./index-Ceyv5JS5.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 createStore, aE as reconcile, aF as RadioGroup, aG as Radio$1, aH as TextAreaField, aI as Text, aJ as SurfaceButton, aK as delegateEvents, aL as onMount, aM as onCleanup, aN as use, aO as PluginUiHost, aP as OasisEditorEditor, aQ as OasisBrandMark, aR as setPreciseFontPreference, aS as setWelcomeSeen, aT as enablePreciseFontMode, aU as TWIPS_PER_POINT, aV as PX_PER_INCH, aW as TWIPS_PER_INCH, aX as normalizeHex6, aY as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aZ as TABLE_BORDER_EDGE_KEYS, a_ as resolveEffectiveParagraphStyle, a$ as resolveEffectiveTextStyleForParagraph, b0 as EMU_PER_PT, b1 as OOXML_ROTATION_UNITS, b2 as OOXML_PERCENT_DENOMINATOR, b3 as parseHexColorToRgb255, b4 as EMU_PER_PX, b5 as getRunEndnoteReference, b6 as iterateFootnoteReferenceRuns, b7 as iterateEndnoteReferenceRuns, b8 as imageContentTypeDefaults, b9 as getRunFieldChar, ba as getRunFieldInstruction, bb as createEditorRun, bc as JSZip, bd as imageExtensionFromMime, be as pxToPt$1, bf as resolveFloatingObjectRect, bg as getTextBoxFloatingGeometry, bh as getPresetPathSegments, bi as buildListLabels, bj as DEFAULT_FONT_SIZE_PX, bk as resolveGradientAxis, bl as isDoubleUnderlineStyle, bm as isWavyUnderlineStyle, bn as underlineStyleLineWidthPx, bo as WAVY_UNDERLINE_WAVELENGTH_PX, bp as WAVY_UNDERLINE_AMPLITUDE_PX, bq as DOUBLE_UNDERLINE_OFFSET_PX, br as underlineStyleDashArray, bs as EMPHASIS_GLYPH, bt as rgb255ToHex, bu as getImageFloatingGeometry, bv as textStyleToFontSizePt, bw as resolveTextAlignmentBaselineOffset, bx as TEXT_BASELINE_RATIO, by as resolveOpenTypeFeatureTags, bz as resolveDecorationLineY, bA as DOUBLE_STRIKE_OFFSET_PX, bB as resolveListLabel, bC as getListLabelInset, bD as getAlignedListLabelInset, bE as getParagraphBorderInsets, bF as buildSegmentTable, bG as buildCanvasTableLayout, bH as resolveCanvasTableWidth, bI as resolveFloatingTableRect, bJ as paragraphBetweenBorderMatches, bK as normalizeFamily, bL as ROBOTO_FONT_FILES, bM as loadFontAsset, bN as OFFICE_COMPAT_FONT_FAMILIES, bO as BinaryReader, bP as buildSfnt, bQ as defaultFontDecoderRegistry, bR as SfntFontProgram, bS as collectPdfFontFamilies, bT as outlineFrom, bU as getPageHeaderZoneTop, bV as getPageColumnRects, bW as findFootnoteReference, bX as resolveImporterForFile, bY as roundTo, bZ as getDocumentSectionsCanonical, b_ as getDocumentParagraphsCanonical, b$ as getDocumentParagraphs, c0 as getDocumentPageSettings, c1 as getTableCellContentWidthForParagraph, c2 as layoutMetricsEpoch, c3 as bumpLayoutMetricsEpoch, c4 as createCanvasLayoutSnapshotProvider, c5 as on, c6 as debounce, c7 as unwrap, c8 as perfTimer, c9 as getRunTextBox, ca as createEditorDocument, cb as resolveResizedDimensions, cc as resolveTextBoxRenderHeight, cd as getToolbarStyleState, ce as VERTICAL_HIT_WEIGHT, cf as getCachedCanvasImage, cg as measureParagraphMinContentWidthPx, ch as getEditableBlocksForZone, ci as findParagraphLocation, cj as createSectionBoundaryParagraph, ck as normalizePageSettings, cl as DEFAULT_EDITOR_PAGE_SETTINGS, cm as markStart, cn as markEnd, co as getParagraphEntries, cp as getParagraphById, cq as createEditorFootnote, cr as createFootnoteReferenceRun, cs as renumberFootnotes, ct as getHeadingLevel, cu as preciseFontModeVersion, cv as isPreciseFontModeEnabled, cw as resolveNamedTextStyle, cx as togglePreciseFontMode, cy as nextFontSizePt, cz as previousFontSizePt, cA as fontSizePtToPx, cB as createDefaultToolbarPreset, cC as MenuRegistry, cD as createToolbarRegistry, cE as Editor, cF as resolveCommandRef, cG as commandRefName, cH as createOasisEditorClient, cI as createEditorZoom, cJ as startLongTaskObserver, cK as installGlobalReport, cL as applyStoredPreciseFontPreference, cM as getWelcomeSeen, cN as isLocalFontAccessSupported, cO as EDITOR_SCROLL_PADDING_PX, cP as Toolbar, cQ as OasisEditorLoading, cR as I18nProvider, cS as createTranslator, cT as registerDomStatsSurface, cU as createEditorLogger } from "./index-CX5iCo8O.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -27498,6 +27498,9 @@ const MERGE_KEYS = {
27498
27498
  tableWidth: "tableWidth",
27499
27499
  tableAlign: "tableAlign",
27500
27500
  tableCellWidth: "tableCellWidth",
27501
+ tableStyleOptions: "tableStyleOptions",
27502
+ tableStyleGallery: "tableStyleGallery",
27503
+ tableDistribute: "tableDistribute",
27501
27504
  layoutWrapPreset: "layoutWrapPreset",
27502
27505
  layoutFixedPosition: "layoutFixedPosition"
27503
27506
  };
@@ -29781,6 +29784,31 @@ function setTableRowHeight(state, tableId, rowIndex, height) {
29781
29784
  (blocks) => updateTablesInBlocks(blocks, updateTable)
29782
29785
  );
29783
29786
  }
29787
+ const DEFAULT_DISTRIBUTED_ROW_PX = 24;
29788
+ function distributeSelectedTableRows(state) {
29789
+ return updateActiveTableBlocks(state, (table) => {
29790
+ var _a2;
29791
+ let target = 0;
29792
+ for (const row of table.rows) {
29793
+ const height = (_a2 = row.style) == null ? void 0 : _a2.height;
29794
+ const px = typeof height === "number" ? height : typeof height === "string" ? Number.parseFloat(height) : 0;
29795
+ if (Number.isFinite(px) && px > target) target = px;
29796
+ }
29797
+ if (target <= 0) target = DEFAULT_DISTRIBUTED_ROW_PX;
29798
+ const nextRows = table.rows.map(
29799
+ (row) => ({
29800
+ ...row,
29801
+ style: {
29802
+ ...row.style ?? {},
29803
+ height: target,
29804
+ heightRule: "atLeast"
29805
+ }
29806
+ })
29807
+ );
29808
+ return { ...table, rows: nextRows };
29809
+ });
29810
+ }
29811
+ const DEFAULT_DISTRIBUTED_COLUMN_PT = 120;
29784
29812
  function parseWidthToPt(value) {
29785
29813
  if (typeof value === "number" && Number.isFinite(value)) {
29786
29814
  return value;
@@ -29896,6 +29924,49 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
29896
29924
  (blocks) => updateTablesInBlocks(blocks, updateTable)
29897
29925
  );
29898
29926
  }
29927
+ function distributeSelectedTableColumns(state) {
29928
+ return updateActiveTableBlocks(state, (table) => {
29929
+ const layout = buildTableCellLayout(table);
29930
+ const visualColumnCount = Math.max(
29931
+ 1,
29932
+ ...layout.map(
29933
+ (entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
29934
+ )
29935
+ );
29936
+ const totalPt = (table.gridCols ?? []).reduce(
29937
+ (sum, width) => sum + (typeof width === "number" && width > 0 ? width : 0),
29938
+ 0
29939
+ );
29940
+ const total = totalPt > 0 ? totalPt : visualColumnCount * DEFAULT_DISTRIBUTED_COLUMN_PT;
29941
+ const columnWidth = total / visualColumnCount;
29942
+ const nextGridCols = Array.from(
29943
+ { length: visualColumnCount },
29944
+ () => columnWidth
29945
+ );
29946
+ const nextRows = table.rows.map((row, rowIndex) => ({
29947
+ ...row,
29948
+ cells: row.cells.map((cell, cellIndex) => {
29949
+ const entry = layout.find(
29950
+ (item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
29951
+ );
29952
+ if (!entry) return cell;
29953
+ return {
29954
+ ...cell,
29955
+ style: {
29956
+ ...cell.style ?? {},
29957
+ width: columnWidth * Math.max(1, entry.colSpan)
29958
+ }
29959
+ };
29960
+ })
29961
+ }));
29962
+ return {
29963
+ ...table,
29964
+ gridCols: nextGridCols,
29965
+ rows: nextRows,
29966
+ style: { ...table.style ?? {}, width: total }
29967
+ };
29968
+ });
29969
+ }
29899
29970
  function insertTableAtSelection(state, rows, cols) {
29900
29971
  const initialCellWidth = `${100 / Math.max(1, cols)}%`;
29901
29972
  const insertionRevision = state.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
@@ -31475,7 +31546,7 @@ function DropCaret(props) {
31475
31546
  })
31476
31547
  });
31477
31548
  }
31478
- var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$5 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31549
+ var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-outline>`), _tmpl$3$2 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31479
31550
  function EditorDragLayers(props) {
31480
31551
  return [createComponent(Show, {
31481
31552
  get when() {
@@ -31508,19 +31579,40 @@ function EditorDragLayers(props) {
31508
31579
  });
31509
31580
  return _el$;
31510
31581
  })()
31582
+ }), createComponent(Show, {
31583
+ get when() {
31584
+ return props.tableCornerResize.previewRect();
31585
+ },
31586
+ children: (rect) => (() => {
31587
+ var _el$2 = _tmpl$2$5();
31588
+ createRenderEffect((_p$) => {
31589
+ var _v$4 = `${rect().left}px`, _v$5 = `${rect().top}px`, _v$6 = `${rect().width}px`, _v$7 = `${rect().height}px`;
31590
+ _v$4 !== _p$.e && setStyleProperty(_el$2, "left", _p$.e = _v$4);
31591
+ _v$5 !== _p$.t && setStyleProperty(_el$2, "top", _p$.t = _v$5);
31592
+ _v$6 !== _p$.a && setStyleProperty(_el$2, "width", _p$.a = _v$6);
31593
+ _v$7 !== _p$.o && setStyleProperty(_el$2, "height", _p$.o = _v$7);
31594
+ return _p$;
31595
+ }, {
31596
+ e: void 0,
31597
+ t: void 0,
31598
+ a: void 0,
31599
+ o: void 0
31600
+ });
31601
+ return _el$2;
31602
+ })()
31511
31603
  }), createComponent(Show, {
31512
31604
  get when() {
31513
31605
  return memo(() => !!props.imageOps.dragging())() && props.imageOps.draggedImageInfo();
31514
31606
  },
31515
31607
  children: (info) => (() => {
31516
- var _el$2 = _tmpl$2$5();
31608
+ var _el$3 = _tmpl$3$2();
31517
31609
  createRenderEffect((_p$) => {
31518
- var _v$4 = info().src, _v$5 = `${info().width}px`, _v$6 = `${info().height}px`, _v$7 = `${props.imageOps.mousePos().x - info().offsetX}px`, _v$8 = `${props.imageOps.mousePos().y - info().offsetY}px`;
31519
- _v$4 !== _p$.e && setAttribute(_el$2, "src", _p$.e = _v$4);
31520
- _v$5 !== _p$.t && setStyleProperty(_el$2, "width", _p$.t = _v$5);
31521
- _v$6 !== _p$.a && setStyleProperty(_el$2, "height", _p$.a = _v$6);
31522
- _v$7 !== _p$.o && setStyleProperty(_el$2, "left", _p$.o = _v$7);
31523
- _v$8 !== _p$.i && setStyleProperty(_el$2, "top", _p$.i = _v$8);
31610
+ var _v$8 = info().src, _v$9 = `${info().width}px`, _v$0 = `${info().height}px`, _v$1 = `${props.imageOps.mousePos().x - info().offsetX}px`, _v$10 = `${props.imageOps.mousePos().y - info().offsetY}px`;
31611
+ _v$8 !== _p$.e && setAttribute(_el$3, "src", _p$.e = _v$8);
31612
+ _v$9 !== _p$.t && setStyleProperty(_el$3, "width", _p$.t = _v$9);
31613
+ _v$0 !== _p$.a && setStyleProperty(_el$3, "height", _p$.a = _v$0);
31614
+ _v$1 !== _p$.o && setStyleProperty(_el$3, "left", _p$.o = _v$1);
31615
+ _v$10 !== _p$.i && setStyleProperty(_el$3, "top", _p$.i = _v$10);
31524
31616
  return _p$;
31525
31617
  }, {
31526
31618
  e: void 0,
@@ -31529,20 +31621,20 @@ function EditorDragLayers(props) {
31529
31621
  o: void 0,
31530
31622
  i: void 0
31531
31623
  });
31532
- return _el$2;
31624
+ return _el$3;
31533
31625
  })()
31534
31626
  }), createComponent(Show, {
31535
31627
  get when() {
31536
31628
  return memo(() => !!props.tableDrag.dragging())() && props.tableDrag.draggedTableInfo();
31537
31629
  },
31538
31630
  children: (info) => (() => {
31539
- var _el$3 = _tmpl$3$2();
31631
+ var _el$4 = _tmpl$4$1();
31540
31632
  createRenderEffect((_p$) => {
31541
- var _v$9 = `${info().width}px`, _v$0 = `${info().height}px`, _v$1 = `${props.tableDrag.mousePos().x - info().offsetX}px`, _v$10 = `${props.tableDrag.mousePos().y - info().offsetY}px`;
31542
- _v$9 !== _p$.e && setStyleProperty(_el$3, "width", _p$.e = _v$9);
31543
- _v$0 !== _p$.t && setStyleProperty(_el$3, "height", _p$.t = _v$0);
31544
- _v$1 !== _p$.a && setStyleProperty(_el$3, "left", _p$.a = _v$1);
31545
- _v$10 !== _p$.o && setStyleProperty(_el$3, "top", _p$.o = _v$10);
31633
+ var _v$11 = `${info().width}px`, _v$12 = `${info().height}px`, _v$13 = `${props.tableDrag.mousePos().x - info().offsetX}px`, _v$14 = `${props.tableDrag.mousePos().y - info().offsetY}px`;
31634
+ _v$11 !== _p$.e && setStyleProperty(_el$4, "width", _p$.e = _v$11);
31635
+ _v$12 !== _p$.t && setStyleProperty(_el$4, "height", _p$.t = _v$12);
31636
+ _v$13 !== _p$.a && setStyleProperty(_el$4, "left", _p$.a = _v$13);
31637
+ _v$14 !== _p$.o && setStyleProperty(_el$4, "top", _p$.o = _v$14);
31546
31638
  return _p$;
31547
31639
  }, {
31548
31640
  e: void 0,
@@ -31550,7 +31642,7 @@ function EditorDragLayers(props) {
31550
31642
  a: void 0,
31551
31643
  o: void 0
31552
31644
  });
31553
- return _el$3;
31645
+ return _el$4;
31554
31646
  })()
31555
31647
  }), createComponent(Show, {
31556
31648
  get when() {
@@ -35768,6 +35860,7 @@ function buildEditorViewProps(ctx) {
35768
35860
  commentHighlights: overlayInput.commentHighlights,
35769
35861
  selectedImageBox: overlayInput.selectedImageBox,
35770
35862
  selectedTextBoxBox: overlayInput.selectedTextBoxBox,
35863
+ selectedTableBox: overlayInput.selectedTableBox,
35771
35864
  layoutOptions: overlayInput.layoutOptions,
35772
35865
  caretBox: overlayInput.caretBox,
35773
35866
  inputBox: overlayInput.inputBox,
@@ -35818,6 +35911,7 @@ function buildEditorViewProps(ctx) {
35818
35911
  onImageRotateHandleMouseDown: surface.handleImageRotateHandleMouseDown,
35819
35912
  onTextBoxRotateHandleMouseDown: surface.handleTextBoxRotateHandleMouseDown,
35820
35913
  onTableDragHandleMouseDown: surface.tableDrag.handleMouseDown,
35914
+ onTableCornerResizeHandleMouseDown: surface.tableCornerResize.handleMouseDown,
35821
35915
  onRevisionMouseEnter: surface.revisionController.handleRevisionMouseEnter,
35822
35916
  onRevisionMouseLeave: surface.revisionController.handleRevisionMouseLeave,
35823
35917
  onEditorContextMenu: (event) => surface.handleEditorContextMenu(event)
@@ -44541,7 +44635,7 @@ function resolveCaretSlot(paragraphs, focusOffset) {
44541
44635
  };
44542
44636
  }
44543
44637
  function computeCanvasSelectionGeometry(snapshot, state) {
44544
- var _a2, _b2, _c, _d;
44638
+ var _a2, _b2, _c, _d, _e, _f;
44545
44639
  const normalized = normalizeSelection(state);
44546
44640
  const selectionBoxes = [];
44547
44641
  const surfaceRect = snapshot.surfaceRect;
@@ -44728,12 +44822,38 @@ function computeCanvasSelectionGeometry(snapshot, state) {
44728
44822
  height: caretHeight,
44729
44823
  visible: focusParagraphSegments.length > 0 && !isMultiCellSelection && !selectedImageBox && !selectedTextBoxBox
44730
44824
  };
44825
+ let selectedTableBox = null;
44826
+ const focusTableId = ((_f = (_e = (snapshot.paragraphsById.get(focusParagraphId) ?? [])[0]) == null ? void 0 : _e.tableCell) == null ? void 0 : _f.tableId) ?? null;
44827
+ if (focusTableId) {
44828
+ let left = Number.POSITIVE_INFINITY;
44829
+ let top = Number.POSITIVE_INFINITY;
44830
+ let right = Number.NEGATIVE_INFINITY;
44831
+ let bottom = Number.NEGATIVE_INFINITY;
44832
+ for (const paragraph of snapshot.paragraphs) {
44833
+ const cell = paragraph.tableCell;
44834
+ if (!cell || cell.tableId !== focusTableId) continue;
44835
+ left = Math.min(left, cell.left);
44836
+ top = Math.min(top, cell.top);
44837
+ right = Math.max(right, cell.left + cell.width);
44838
+ bottom = Math.max(bottom, cell.top + cell.height);
44839
+ }
44840
+ if (Number.isFinite(left) && right > left && bottom > top) {
44841
+ selectedTableBox = {
44842
+ tableId: focusTableId,
44843
+ left: left - surfaceRect.left,
44844
+ top: top - surfaceRect.top,
44845
+ width: right - left,
44846
+ height: bottom - top
44847
+ };
44848
+ }
44849
+ }
44731
44850
  return {
44732
44851
  selectionBoxes,
44733
44852
  inputBox: { left: caretLeft, top: caretTop, height: caretHeight },
44734
44853
  caretBox,
44735
44854
  selectedImageBox,
44736
- selectedTextBoxBox
44855
+ selectedTextBoxBox,
44856
+ selectedTableBox
44737
44857
  };
44738
44858
  }
44739
44859
  function computeCommentHighlights(snapshot, state) {
@@ -44939,6 +45059,7 @@ function useEditorLayoutImpl(props) {
44939
45059
  const [commentHighlights, setCommentHighlights] = createSignal([]);
44940
45060
  const [selectedImageBox, setSelectedImageBox] = createSignal(null);
44941
45061
  const [selectedTextBoxBox, setSelectedTextBoxBox] = createSignal(null);
45062
+ const [selectedTableBox, setSelectedTableBox] = createSignal(null);
44942
45063
  const [caretBox, setCaretBox] = createSignal({
44943
45064
  left: 0,
44944
45065
  top: 0,
@@ -44973,6 +45094,7 @@ function useEditorLayoutImpl(props) {
44973
45094
  setCommentHighlights([]);
44974
45095
  setSelectedImageBox(null);
44975
45096
  setSelectedTextBoxBox(null);
45097
+ setSelectedTableBox(null);
44976
45098
  setCaretBox(
44977
45099
  (current) => ({
44978
45100
  ...current,
@@ -44992,6 +45114,7 @@ function useEditorLayoutImpl(props) {
44992
45114
  setCommentHighlights([]);
44993
45115
  setSelectedImageBox(null);
44994
45116
  setSelectedTextBoxBox(null);
45117
+ setSelectedTableBox(null);
44995
45118
  setCaretBox(
44996
45119
  (current) => ({
44997
45120
  ...current,
@@ -45005,6 +45128,7 @@ function useEditorLayoutImpl(props) {
45005
45128
  setCommentHighlights(computeCommentHighlights(snapshot, props.state));
45006
45129
  setSelectedImageBox(geometry.selectedImageBox);
45007
45130
  setSelectedTextBoxBox(geometry.selectedTextBoxBox);
45131
+ setSelectedTableBox(geometry.selectedTableBox);
45008
45132
  setInputBox(geometry.inputBox);
45009
45133
  setCaretBox(geometry.caretBox);
45010
45134
  };
@@ -45112,6 +45236,7 @@ function useEditorLayoutImpl(props) {
45112
45236
  commentHighlights,
45113
45237
  selectedImageBox,
45114
45238
  selectedTextBoxBox,
45239
+ selectedTableBox,
45115
45240
  caretBox,
45116
45241
  preferredColumnX,
45117
45242
  setPreferredColumnX,
@@ -45689,6 +45814,7 @@ function createEditorDocumentRuntimeImpl(deps) {
45689
45814
  commentHighlights,
45690
45815
  selectedImageBox,
45691
45816
  selectedTextBoxBox,
45817
+ selectedTableBox,
45692
45818
  caretBox,
45693
45819
  preferredColumnX,
45694
45820
  setPreferredColumnX,
@@ -45777,6 +45903,7 @@ function createEditorDocumentRuntimeImpl(deps) {
45777
45903
  commentHighlights,
45778
45904
  selectedImageBox,
45779
45905
  selectedTextBoxBox,
45906
+ selectedTableBox,
45780
45907
  caretBox,
45781
45908
  preferredColumnX,
45782
45909
  setPreferredColumnX,
@@ -49352,7 +49479,7 @@ function setHoverCursorClass(isCol) {
49352
49479
  function setActiveCursorClass(isCol) {
49353
49480
  setResizeCursorClass(isCol);
49354
49481
  }
49355
- const DRAG_THRESHOLD_PX = 2;
49482
+ const DRAG_THRESHOLD_PX$1 = 2;
49356
49483
  function createEditorTableResize(deps) {
49357
49484
  const [resizing, setResizing] = createSignal(null);
49358
49485
  const handleMouseMove = (event) => {
@@ -49481,7 +49608,7 @@ function createEditorTableResize(deps) {
49481
49608
  if (!currentResizing) return;
49482
49609
  const z = ((_a2 = deps.zoomFactor) == null ? void 0 : _a2.call(deps)) ?? 1;
49483
49610
  const delta = ((currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos) / z;
49484
- if (Math.abs(delta) >= DRAG_THRESHOLD_PX) {
49611
+ if (Math.abs(delta) >= DRAG_THRESHOLD_PX$1) {
49485
49612
  deps.applyTransactionalState((current) => {
49486
49613
  if (currentResizing.type === "row") {
49487
49614
  return applyRowResize(current, currentResizing, delta);
@@ -49500,6 +49627,146 @@ function createEditorTableResize(deps) {
49500
49627
  handleMouseDown
49501
49628
  };
49502
49629
  }
49630
+ const DRAG_THRESHOLD_PX = 2;
49631
+ function computeCornerScales(resize) {
49632
+ const rawX = (resize.bounds.width + (resize.currentClientX - resize.startClientX)) / resize.bounds.width;
49633
+ const rawY = (resize.bounds.height + (resize.currentClientY - resize.startClientY)) / resize.bounds.height;
49634
+ const widthValues = Object.values(resize.widthsPt);
49635
+ const minColumnPt = widthValues.length > 0 ? Math.min(...widthValues) : 1;
49636
+ const minScaleX = minColumnPt > 0 ? MIN_TABLE_SIZE_PT / minColumnPt : 0;
49637
+ const minRowPx = ptToPx(MIN_TABLE_SIZE_PT);
49638
+ const minRowHeightPx = resize.rowHeightsPx.length > 0 ? Math.min(...resize.rowHeightsPx) : minRowPx;
49639
+ const minScaleY = minRowHeightPx > 0 ? minRowPx / minRowHeightPx : 0;
49640
+ return {
49641
+ scaleX: Math.max(minScaleX, rawX),
49642
+ scaleY: Math.max(minScaleY, rawY)
49643
+ };
49644
+ }
49645
+ function applyTableCornerResize(state, resize, scaleX, scaleY) {
49646
+ const nextWidths = {};
49647
+ for (const key of Object.keys(resize.widthsPt)) {
49648
+ const index = Number(key);
49649
+ nextWidths[index] = Math.max(
49650
+ MIN_TABLE_SIZE_PT,
49651
+ resize.widthsPt[index] * scaleX
49652
+ );
49653
+ }
49654
+ const nextTotalPt = Object.values(nextWidths).reduce(
49655
+ (sum, value) => sum + value,
49656
+ 0
49657
+ );
49658
+ let next = setTableColumnWidths(
49659
+ state,
49660
+ resize.tableId,
49661
+ nextWidths,
49662
+ nextTotalPt
49663
+ );
49664
+ resize.rowHeightsPx.forEach((heightPx, index) => {
49665
+ const nextHeightPt = Math.max(MIN_TABLE_SIZE_PT, pxToPt(heightPx * scaleY));
49666
+ next = setTableRowHeight(next, resize.tableId, index, nextHeightPt);
49667
+ });
49668
+ return next;
49669
+ }
49670
+ function createEditorTableCornerResize(deps) {
49671
+ const [resizing, setResizing] = createSignal(
49672
+ null
49673
+ );
49674
+ const previewRect = () => {
49675
+ const current = resizing();
49676
+ if (!current) return null;
49677
+ const { scaleX, scaleY } = computeCornerScales(current);
49678
+ return {
49679
+ left: current.bounds.left,
49680
+ top: current.bounds.top,
49681
+ width: current.bounds.width * scaleX,
49682
+ height: current.bounds.height * scaleY
49683
+ };
49684
+ };
49685
+ const handleWindowMouseMove = (event) => {
49686
+ setResizing(
49687
+ (current) => current ? {
49688
+ ...current,
49689
+ currentClientX: event.clientX,
49690
+ currentClientY: event.clientY
49691
+ } : null
49692
+ );
49693
+ };
49694
+ const stop = () => {
49695
+ setResizing(null);
49696
+ window.removeEventListener("mousemove", handleWindowMouseMove);
49697
+ window.removeEventListener("mouseup", handleWindowMouseUp);
49698
+ document.body.style.cursor = "";
49699
+ };
49700
+ const handleWindowMouseUp = (event) => {
49701
+ const current = resizing();
49702
+ if (current) {
49703
+ const movedX = Math.abs(event.clientX - current.startClientX);
49704
+ const movedY = Math.abs(event.clientY - current.startClientY);
49705
+ if (movedX >= DRAG_THRESHOLD_PX || movedY >= DRAG_THRESHOLD_PX) {
49706
+ const settled = {
49707
+ ...current,
49708
+ currentClientX: event.clientX,
49709
+ currentClientY: event.clientY
49710
+ };
49711
+ const { scaleX, scaleY } = computeCornerScales(settled);
49712
+ deps.applyTransactionalState(
49713
+ (state) => applyTableCornerResize(state, settled, scaleX, scaleY)
49714
+ );
49715
+ }
49716
+ }
49717
+ stop();
49718
+ };
49719
+ const handleMouseDown = (tableId, event) => {
49720
+ var _a2;
49721
+ const surface = deps.surfaceRef();
49722
+ if (!surface) return;
49723
+ const geometries = buildTableGeometries(
49724
+ surface,
49725
+ deps.state(),
49726
+ deps.documentLayout(),
49727
+ deps.canvasSnapshotProvider,
49728
+ (_a2 = deps.zoomFactor) == null ? void 0 : _a2.call(deps)
49729
+ );
49730
+ const geometry = geometries.find(
49731
+ (candidate) => candidate.tableId === tableId
49732
+ );
49733
+ const tableNode = getTableById(deps.state(), tableId);
49734
+ if (!geometry || !tableNode) return;
49735
+ const tableLayout = buildTableCellLayout(tableNode);
49736
+ const { widthsPt } = resolveColumnWidthsPt(
49737
+ tableNode,
49738
+ tableLayout,
49739
+ geometry
49740
+ );
49741
+ const rowHeightsPx = resolveRowHeightsPx(tableNode, tableLayout, geometry);
49742
+ const totalWidthPt = Object.values(widthsPt).reduce(
49743
+ (sum, value) => sum + value,
49744
+ 0
49745
+ );
49746
+ setResizing({
49747
+ tableId,
49748
+ bounds: {
49749
+ left: geometry.bounds.left,
49750
+ top: geometry.bounds.top,
49751
+ width: Math.max(1, geometry.bounds.width),
49752
+ height: Math.max(1, geometry.bounds.height)
49753
+ },
49754
+ startClientX: event.clientX,
49755
+ startClientY: event.clientY,
49756
+ currentClientX: event.clientX,
49757
+ currentClientY: event.clientY,
49758
+ widthsPt,
49759
+ totalWidthPt,
49760
+ rowHeightsPx
49761
+ });
49762
+ document.body.style.cursor = "nwse-resize";
49763
+ window.addEventListener("mousemove", handleWindowMouseMove);
49764
+ window.addEventListener("mouseup", handleWindowMouseUp);
49765
+ event.preventDefault();
49766
+ event.stopPropagation();
49767
+ };
49768
+ return { resizing, previewRect, handleMouseDown };
49769
+ }
49503
49770
  function createEditorTableDrag(deps) {
49504
49771
  return createEditorTableDragImpl(deps);
49505
49772
  }
@@ -50794,6 +51061,14 @@ function useEditorInteractionWiring(ctx) {
50794
51061
  documentLayout: ctx.documentLayout,
50795
51062
  canvasSnapshotProvider: ctx.canvasSnapshotProvider
50796
51063
  });
51064
+ const tableCornerResize = createEditorTableCornerResize({
51065
+ state,
51066
+ applyTransactionalState: ctx.applyTransactionalState,
51067
+ surfaceRef: ctx.surfaceRef,
51068
+ zoomFactor: ctx.zoomFactor,
51069
+ documentLayout: ctx.documentLayout,
51070
+ canvasSnapshotProvider: ctx.canvasSnapshotProvider
51071
+ });
50797
51072
  const tableDrag = createEditorTableDrag({
50798
51073
  state,
50799
51074
  applyTransactionalState: ctx.applyTransactionalState,
@@ -50872,6 +51147,7 @@ function useEditorInteractionWiring(ctx) {
50872
51147
  });
50873
51148
  return {
50874
51149
  tableResize,
51150
+ tableCornerResize,
50875
51151
  tableDrag,
50876
51152
  revisionController,
50877
51153
  textDrag,
@@ -51029,6 +51305,7 @@ function createEditorInteractionRuntimeImpl(deps) {
51029
51305
  styleController,
51030
51306
  onEditorMouseDown,
51031
51307
  tableResize: wiring.tableResize,
51308
+ tableCornerResize: wiring.tableCornerResize,
51032
51309
  tableDrag: wiring.tableDrag,
51033
51310
  revisionController: wiring.revisionController,
51034
51311
  textDrag: wiring.textDrag,
@@ -53470,6 +53747,102 @@ function buildTableCommands({
53470
53747
  "tableSetCellWidth",
53471
53748
  (p) => table.setCellWidth(String(p))
53472
53749
  ),
53750
+ tableToggleHeaderRow: actionCommand(
53751
+ "tableToggleHeaderRow",
53752
+ () => table.toggleTblLook("firstRow"),
53753
+ () => {
53754
+ var _a2;
53755
+ return {
53756
+ isEnabled: table.insideTable(),
53757
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.firstRow) ?? false
53758
+ };
53759
+ }
53760
+ ),
53761
+ tableToggleTotalRow: actionCommand(
53762
+ "tableToggleTotalRow",
53763
+ () => table.toggleTblLook("lastRow"),
53764
+ () => {
53765
+ var _a2;
53766
+ return {
53767
+ isEnabled: table.insideTable(),
53768
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.lastRow) ?? false
53769
+ };
53770
+ }
53771
+ ),
53772
+ tableToggleBandedRows: actionCommand(
53773
+ "tableToggleBandedRows",
53774
+ () => table.toggleTblLook("bandedRows"),
53775
+ () => {
53776
+ var _a2;
53777
+ return {
53778
+ isEnabled: table.insideTable(),
53779
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.bandedRows) ?? false
53780
+ };
53781
+ }
53782
+ ),
53783
+ tableToggleFirstColumn: actionCommand(
53784
+ "tableToggleFirstColumn",
53785
+ () => table.toggleTblLook("firstCol"),
53786
+ () => {
53787
+ var _a2;
53788
+ return {
53789
+ isEnabled: table.insideTable(),
53790
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.firstCol) ?? false
53791
+ };
53792
+ }
53793
+ ),
53794
+ tableToggleLastColumn: actionCommand(
53795
+ "tableToggleLastColumn",
53796
+ () => table.toggleTblLook("lastCol"),
53797
+ () => {
53798
+ var _a2;
53799
+ return {
53800
+ isEnabled: table.insideTable(),
53801
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.lastCol) ?? false
53802
+ };
53803
+ }
53804
+ ),
53805
+ tableToggleBandedColumns: actionCommand(
53806
+ "tableToggleBandedColumns",
53807
+ () => table.toggleTblLook("bandedCols"),
53808
+ () => {
53809
+ var _a2;
53810
+ return {
53811
+ isEnabled: table.insideTable(),
53812
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.bandedCols) ?? false
53813
+ };
53814
+ }
53815
+ ),
53816
+ setTableStyle: actionCommand(
53817
+ "setTableStyle",
53818
+ (p) => table.setStyleId(String(p ?? "")),
53819
+ () => ({
53820
+ isEnabled: table.insideTable(),
53821
+ value: table.getStyleId()
53822
+ })
53823
+ ),
53824
+ tableToggleAutoFit: actionCommand(
53825
+ "tableToggleAutoFit",
53826
+ () => table.toggleAutoFit(),
53827
+ () => ({
53828
+ isEnabled: table.insideTable(),
53829
+ isActive: table.getLayout() === "autofit"
53830
+ })
53831
+ ),
53832
+ tableDistributeColumns: actionCommand(
53833
+ "tableDistributeColumns",
53834
+ () => table.distributeColumns(),
53835
+ () => ({
53836
+ isEnabled: gate.isCommandEnabled("tableDistributeColumns") && table.canEditColumn()
53837
+ })
53838
+ ),
53839
+ tableDistributeRows: actionCommand(
53840
+ "tableDistributeRows",
53841
+ () => table.distributeRows(),
53842
+ () => ({
53843
+ isEnabled: gate.isCommandEnabled("tableDistributeRows") && table.canEditRow()
53844
+ })
53845
+ ),
53473
53846
  insertTable: actionCommand("insertTable", (p) => {
53474
53847
  const { rows, cols, columns } = p ?? {};
53475
53848
  const columnCount = cols ?? columns;
@@ -53882,6 +54255,34 @@ function createEditorEssentialsRuntimePlugin(options) {
53882
54255
  options.applyTransactionalState(producer, { mergeKey });
53883
54256
  options.focusInput();
53884
54257
  };
54258
+ const RAW_TBL_LOOK_DEFAULTS = {
54259
+ firstRow: false,
54260
+ lastRow: false,
54261
+ firstCol: false,
54262
+ lastCol: false,
54263
+ noHBand: false,
54264
+ noVBand: false
54265
+ };
54266
+ const selectedTableIn = (state) => {
54267
+ const secIdx = getActiveSectionIndex(state);
54268
+ const loc = findParagraphTableLocation(
54269
+ state.document,
54270
+ state.selection.focus.paragraphId,
54271
+ secIdx
54272
+ );
54273
+ if (!loc) return null;
54274
+ const section = getDocumentSections(state.document)[secIdx];
54275
+ if (!section) return null;
54276
+ const blocks = loc.zone === "header" ? section.header ?? [] : loc.zone === "footer" ? section.footer ?? [] : section.blocks;
54277
+ const table = blocks[loc.blockIndex];
54278
+ return table && table.type === "table" ? table : null;
54279
+ };
54280
+ const rawTblLookIn = (state) => {
54281
+ var _a2;
54282
+ const table = selectedTableIn(state);
54283
+ if (!table) return null;
54284
+ return { ...RAW_TBL_LOOK_DEFAULTS, ...((_a2 = table.style) == null ? void 0 : _a2.tblLook) ?? {} };
54285
+ };
53885
54286
  const selectionLabel = () => {
53886
54287
  const normalized = normalizeSelection(options.state());
53887
54288
  if (normalized.isCollapsed) return null;
@@ -53906,6 +54307,71 @@ function createEditorEssentialsRuntimePlugin(options) {
53906
54307
  return {
53907
54308
  insideTable,
53908
54309
  selectionLabel,
54310
+ getTblLook: () => {
54311
+ const raw = rawTblLookIn(options.state());
54312
+ if (!raw) return null;
54313
+ return {
54314
+ firstRow: raw.firstRow,
54315
+ lastRow: raw.lastRow,
54316
+ firstCol: raw.firstCol,
54317
+ lastCol: raw.lastCol,
54318
+ // Banding is stored as the negated "no band" flags in OOXML.
54319
+ bandedRows: !raw.noHBand,
54320
+ bandedCols: !raw.noVBand
54321
+ };
54322
+ },
54323
+ toggleTblLook: (flag) => apply((current) => {
54324
+ const raw = rawTblLookIn(current);
54325
+ if (!raw) return current;
54326
+ const next = { ...raw };
54327
+ switch (flag) {
54328
+ case "firstRow":
54329
+ next.firstRow = !raw.firstRow;
54330
+ break;
54331
+ case "lastRow":
54332
+ next.lastRow = !raw.lastRow;
54333
+ break;
54334
+ case "firstCol":
54335
+ next.firstCol = !raw.firstCol;
54336
+ break;
54337
+ case "lastCol":
54338
+ next.lastCol = !raw.lastCol;
54339
+ break;
54340
+ case "bandedRows":
54341
+ next.noHBand = !raw.noHBand;
54342
+ break;
54343
+ case "bandedCols":
54344
+ next.noVBand = !raw.noVBand;
54345
+ break;
54346
+ }
54347
+ return setTableStyleValue(current, "tblLook", next);
54348
+ }, MERGE_KEYS.tableStyleOptions),
54349
+ getStyleId: () => {
54350
+ var _a2, _b2;
54351
+ return ((_b2 = (_a2 = selectedTableIn(options.state())) == null ? void 0 : _a2.style) == null ? void 0 : _b2.styleId) ?? null;
54352
+ },
54353
+ setStyleId: (styleId) => apply(
54354
+ (current) => setTableStyleValue(current, "styleId", styleId || null),
54355
+ MERGE_KEYS.tableStyleGallery
54356
+ ),
54357
+ getLayout: () => {
54358
+ var _a2, _b2;
54359
+ return ((_b2 = (_a2 = selectedTableIn(options.state())) == null ? void 0 : _a2.style) == null ? void 0 : _b2.layout) ?? null;
54360
+ },
54361
+ toggleAutoFit: () => apply((current) => {
54362
+ var _a2;
54363
+ const table = selectedTableIn(current);
54364
+ const nextLayout = ((_a2 = table == null ? void 0 : table.style) == null ? void 0 : _a2.layout) === "autofit" ? "fixed" : "autofit";
54365
+ return setTableStyleValue(current, "layout", nextLayout);
54366
+ }, MERGE_KEYS.tableDistribute),
54367
+ distributeColumns: () => apply(
54368
+ (current) => distributeSelectedTableColumns(current),
54369
+ MERGE_KEYS.tableDistribute
54370
+ ),
54371
+ distributeRows: () => apply(
54372
+ (current) => distributeSelectedTableRows(current),
54373
+ MERGE_KEYS.tableDistribute
54374
+ ),
53909
54375
  canMerge: () => options.tableOps.canMergeSelectedTable(options.state()),
53910
54376
  canSplit: () => options.tableOps.canSplitSelectedTable(options.state()),
53911
54377
  canEditColumn: () => options.tableOps.canEditSelectedTableColumn(options.state()),
@@ -54757,6 +55223,7 @@ function OasisEditorApp(props = {}) {
54757
55223
  commentHighlights,
54758
55224
  selectedImageBox,
54759
55225
  selectedTextBoxBox,
55226
+ selectedTableBox,
54760
55227
  caretBox,
54761
55228
  preferredColumnX,
54762
55229
  setPreferredColumnX,
@@ -54803,6 +55270,7 @@ function OasisEditorApp(props = {}) {
54803
55270
  styleController,
54804
55271
  onEditorMouseDown,
54805
55272
  tableResize,
55273
+ tableCornerResize,
54806
55274
  tableDrag,
54807
55275
  revisionController,
54808
55276
  textDrag,
@@ -54902,6 +55370,7 @@ function OasisEditorApp(props = {}) {
54902
55370
  commentHighlights,
54903
55371
  selectedImageBox,
54904
55372
  selectedTextBoxBox,
55373
+ selectedTableBox,
54905
55374
  layoutOptions: layoutOptionsOverlay,
54906
55375
  caretBox,
54907
55376
  inputBox,
@@ -54920,6 +55389,7 @@ function OasisEditorApp(props = {}) {
54920
55389
  surface: {
54921
55390
  surfaceEvents: surfaceEventsWithTextDrag,
54922
55391
  tableResize,
55392
+ tableCornerResize,
54923
55393
  tableDrag,
54924
55394
  revisionController,
54925
55395
  handleDrop,
@@ -55064,6 +55534,7 @@ function OasisEditorApp(props = {}) {
55064
55534
  return zoom.zoomFactor;
55065
55535
  },
55066
55536
  tableResize,
55537
+ tableCornerResize,
55067
55538
  imageOps,
55068
55539
  tableDrag,
55069
55540
  textDrag