oasis-editor 0.0.128 → 0.0.129

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 { 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 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-XyL0Hpf4.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;
@@ -53470,6 +53541,102 @@ function buildTableCommands({
53470
53541
  "tableSetCellWidth",
53471
53542
  (p) => table.setCellWidth(String(p))
53472
53543
  ),
53544
+ tableToggleHeaderRow: actionCommand(
53545
+ "tableToggleHeaderRow",
53546
+ () => table.toggleTblLook("firstRow"),
53547
+ () => {
53548
+ var _a2;
53549
+ return {
53550
+ isEnabled: table.insideTable(),
53551
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.firstRow) ?? false
53552
+ };
53553
+ }
53554
+ ),
53555
+ tableToggleTotalRow: actionCommand(
53556
+ "tableToggleTotalRow",
53557
+ () => table.toggleTblLook("lastRow"),
53558
+ () => {
53559
+ var _a2;
53560
+ return {
53561
+ isEnabled: table.insideTable(),
53562
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.lastRow) ?? false
53563
+ };
53564
+ }
53565
+ ),
53566
+ tableToggleBandedRows: actionCommand(
53567
+ "tableToggleBandedRows",
53568
+ () => table.toggleTblLook("bandedRows"),
53569
+ () => {
53570
+ var _a2;
53571
+ return {
53572
+ isEnabled: table.insideTable(),
53573
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.bandedRows) ?? false
53574
+ };
53575
+ }
53576
+ ),
53577
+ tableToggleFirstColumn: actionCommand(
53578
+ "tableToggleFirstColumn",
53579
+ () => table.toggleTblLook("firstCol"),
53580
+ () => {
53581
+ var _a2;
53582
+ return {
53583
+ isEnabled: table.insideTable(),
53584
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.firstCol) ?? false
53585
+ };
53586
+ }
53587
+ ),
53588
+ tableToggleLastColumn: actionCommand(
53589
+ "tableToggleLastColumn",
53590
+ () => table.toggleTblLook("lastCol"),
53591
+ () => {
53592
+ var _a2;
53593
+ return {
53594
+ isEnabled: table.insideTable(),
53595
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.lastCol) ?? false
53596
+ };
53597
+ }
53598
+ ),
53599
+ tableToggleBandedColumns: actionCommand(
53600
+ "tableToggleBandedColumns",
53601
+ () => table.toggleTblLook("bandedCols"),
53602
+ () => {
53603
+ var _a2;
53604
+ return {
53605
+ isEnabled: table.insideTable(),
53606
+ isActive: ((_a2 = table.getTblLook()) == null ? void 0 : _a2.bandedCols) ?? false
53607
+ };
53608
+ }
53609
+ ),
53610
+ setTableStyle: actionCommand(
53611
+ "setTableStyle",
53612
+ (p) => table.setStyleId(String(p ?? "")),
53613
+ () => ({
53614
+ isEnabled: table.insideTable(),
53615
+ value: table.getStyleId()
53616
+ })
53617
+ ),
53618
+ tableToggleAutoFit: actionCommand(
53619
+ "tableToggleAutoFit",
53620
+ () => table.toggleAutoFit(),
53621
+ () => ({
53622
+ isEnabled: table.insideTable(),
53623
+ isActive: table.getLayout() === "autofit"
53624
+ })
53625
+ ),
53626
+ tableDistributeColumns: actionCommand(
53627
+ "tableDistributeColumns",
53628
+ () => table.distributeColumns(),
53629
+ () => ({
53630
+ isEnabled: gate.isCommandEnabled("tableDistributeColumns") && table.canEditColumn()
53631
+ })
53632
+ ),
53633
+ tableDistributeRows: actionCommand(
53634
+ "tableDistributeRows",
53635
+ () => table.distributeRows(),
53636
+ () => ({
53637
+ isEnabled: gate.isCommandEnabled("tableDistributeRows") && table.canEditRow()
53638
+ })
53639
+ ),
53473
53640
  insertTable: actionCommand("insertTable", (p) => {
53474
53641
  const { rows, cols, columns } = p ?? {};
53475
53642
  const columnCount = cols ?? columns;
@@ -53882,6 +54049,34 @@ function createEditorEssentialsRuntimePlugin(options) {
53882
54049
  options.applyTransactionalState(producer, { mergeKey });
53883
54050
  options.focusInput();
53884
54051
  };
54052
+ const RAW_TBL_LOOK_DEFAULTS = {
54053
+ firstRow: false,
54054
+ lastRow: false,
54055
+ firstCol: false,
54056
+ lastCol: false,
54057
+ noHBand: false,
54058
+ noVBand: false
54059
+ };
54060
+ const selectedTableIn = (state) => {
54061
+ const secIdx = getActiveSectionIndex(state);
54062
+ const loc = findParagraphTableLocation(
54063
+ state.document,
54064
+ state.selection.focus.paragraphId,
54065
+ secIdx
54066
+ );
54067
+ if (!loc) return null;
54068
+ const section = getDocumentSections(state.document)[secIdx];
54069
+ if (!section) return null;
54070
+ const blocks = loc.zone === "header" ? section.header ?? [] : loc.zone === "footer" ? section.footer ?? [] : section.blocks;
54071
+ const table = blocks[loc.blockIndex];
54072
+ return table && table.type === "table" ? table : null;
54073
+ };
54074
+ const rawTblLookIn = (state) => {
54075
+ var _a2;
54076
+ const table = selectedTableIn(state);
54077
+ if (!table) return null;
54078
+ return { ...RAW_TBL_LOOK_DEFAULTS, ...((_a2 = table.style) == null ? void 0 : _a2.tblLook) ?? {} };
54079
+ };
53885
54080
  const selectionLabel = () => {
53886
54081
  const normalized = normalizeSelection(options.state());
53887
54082
  if (normalized.isCollapsed) return null;
@@ -53906,6 +54101,71 @@ function createEditorEssentialsRuntimePlugin(options) {
53906
54101
  return {
53907
54102
  insideTable,
53908
54103
  selectionLabel,
54104
+ getTblLook: () => {
54105
+ const raw = rawTblLookIn(options.state());
54106
+ if (!raw) return null;
54107
+ return {
54108
+ firstRow: raw.firstRow,
54109
+ lastRow: raw.lastRow,
54110
+ firstCol: raw.firstCol,
54111
+ lastCol: raw.lastCol,
54112
+ // Banding is stored as the negated "no band" flags in OOXML.
54113
+ bandedRows: !raw.noHBand,
54114
+ bandedCols: !raw.noVBand
54115
+ };
54116
+ },
54117
+ toggleTblLook: (flag) => apply((current) => {
54118
+ const raw = rawTblLookIn(current);
54119
+ if (!raw) return current;
54120
+ const next = { ...raw };
54121
+ switch (flag) {
54122
+ case "firstRow":
54123
+ next.firstRow = !raw.firstRow;
54124
+ break;
54125
+ case "lastRow":
54126
+ next.lastRow = !raw.lastRow;
54127
+ break;
54128
+ case "firstCol":
54129
+ next.firstCol = !raw.firstCol;
54130
+ break;
54131
+ case "lastCol":
54132
+ next.lastCol = !raw.lastCol;
54133
+ break;
54134
+ case "bandedRows":
54135
+ next.noHBand = !raw.noHBand;
54136
+ break;
54137
+ case "bandedCols":
54138
+ next.noVBand = !raw.noVBand;
54139
+ break;
54140
+ }
54141
+ return setTableStyleValue(current, "tblLook", next);
54142
+ }, MERGE_KEYS.tableStyleOptions),
54143
+ getStyleId: () => {
54144
+ var _a2, _b2;
54145
+ return ((_b2 = (_a2 = selectedTableIn(options.state())) == null ? void 0 : _a2.style) == null ? void 0 : _b2.styleId) ?? null;
54146
+ },
54147
+ setStyleId: (styleId) => apply(
54148
+ (current) => setTableStyleValue(current, "styleId", styleId || null),
54149
+ MERGE_KEYS.tableStyleGallery
54150
+ ),
54151
+ getLayout: () => {
54152
+ var _a2, _b2;
54153
+ return ((_b2 = (_a2 = selectedTableIn(options.state())) == null ? void 0 : _a2.style) == null ? void 0 : _b2.layout) ?? null;
54154
+ },
54155
+ toggleAutoFit: () => apply((current) => {
54156
+ var _a2;
54157
+ const table = selectedTableIn(current);
54158
+ const nextLayout = ((_a2 = table == null ? void 0 : table.style) == null ? void 0 : _a2.layout) === "autofit" ? "fixed" : "autofit";
54159
+ return setTableStyleValue(current, "layout", nextLayout);
54160
+ }, MERGE_KEYS.tableDistribute),
54161
+ distributeColumns: () => apply(
54162
+ (current) => distributeSelectedTableColumns(current),
54163
+ MERGE_KEYS.tableDistribute
54164
+ ),
54165
+ distributeRows: () => apply(
54166
+ (current) => distributeSelectedTableRows(current),
54167
+ MERGE_KEYS.tableDistribute
54168
+ ),
53909
54169
  canMerge: () => options.tableOps.canMergeSelectedTable(options.state()),
53910
54170
  canSplit: () => options.tableOps.canSplitSelectedTable(options.state()),
53911
54171
  canEditColumn: () => options.tableOps.canEditSelectedTableColumn(options.state()),
@@ -105,6 +105,16 @@ export interface OasisCommandPayloads {
105
105
  tableAlignCenter: undefined;
106
106
  tableAlignRight: undefined;
107
107
  tableSetCellWidth: string | number;
108
+ tableToggleHeaderRow: undefined;
109
+ tableToggleTotalRow: undefined;
110
+ tableToggleBandedRows: undefined;
111
+ tableToggleFirstColumn: undefined;
112
+ tableToggleLastColumn: undefined;
113
+ tableToggleBandedColumns: undefined;
114
+ setTableStyle: string;
115
+ tableToggleAutoFit: undefined;
116
+ tableDistributeColumns: undefined;
117
+ tableDistributeRows: undefined;
108
118
  insertTable: InsertTablePayload;
109
119
  }
110
120
  export interface OasisCommandResults {
@@ -1,3 +1,9 @@
1
1
  import { EditorState } from '../../model.js';
2
2
 
3
3
  export declare function setTableColumnWidths(state: EditorState, tableId: string, columnWidths: Record<number, number | string>, tableWidth?: number | string, tableIndentLeft?: number | string): EditorState;
4
+ /**
5
+ * Equalize the widths of every visual column in the active table (Word's
6
+ * "Distribute Columns"), preserving the table's total width. Merged cells keep
7
+ * their span, so a cell spanning N columns gets N equal shares.
8
+ */
9
+ export declare function distributeSelectedTableColumns(state: EditorState): EditorState;
@@ -3,3 +3,9 @@ import { EditorState, EditorTableRowStyle } from '../../model.js';
3
3
  export declare function setSelectedTableRowStyleValue<K extends keyof EditorTableRowStyle>(state: EditorState, key: K, value: EditorTableRowStyle[K] | null): EditorState;
4
4
  export declare function setSelectedTableRowHeader(state: EditorState, value: boolean | null): EditorState;
5
5
  export declare function setTableRowHeight(state: EditorState, tableId: string, rowIndex: number, height: number | string | null): EditorState;
6
+ /**
7
+ * Equalize the heights of every row in the active table (Word's "Distribute
8
+ * Rows"). Uses the tallest explicit row height as the target (or a default when
9
+ * none is set) with the `atLeast` rule so cell content can still grow.
10
+ */
11
+ export declare function distributeSelectedTableRows(state: EditorState): EditorState;
@@ -1,5 +1,12 @@
1
- export declare const RIBBON_TABS: readonly ["file", "home", "insert", "draw", "layout", "references", "collaboration", "protection", "view", "plugins", "ai"];
1
+ export declare const RIBBON_TABS: readonly ["file", "home", "insert", "draw", "layout", "references", "collaboration", "protection", "view", "tableDesign", "tableLayout", "plugins", "ai"];
2
2
  export type RibbonTabId = (typeof RIBBON_TABS)[number];
3
+ /**
4
+ * Contextual tabs are hidden from the tab strip unless their gating command
5
+ * reports `isActive`. This mirrors Word's contextual ribbons (e.g. table tools
6
+ * that appear only when the caret is inside a table). The mapping is
7
+ * UI-agnostic: the value is the command id whose `isActive` state gates the tab.
8
+ */
9
+ export declare const CONTEXTUAL_TABS: Partial<Record<RibbonTabId, string>>;
3
10
  export type RibbonRow = 1 | 2;
4
11
  export type RibbonSize = "normal" | "large";
5
12
  export type RibbonGroupResizeState = "full" | "compact" | "collapsed";
@@ -29,6 +29,9 @@ export declare const MERGE_KEYS: {
29
29
  readonly tableWidth: "tableWidth";
30
30
  readonly tableAlign: "tableAlign";
31
31
  readonly tableCellWidth: "tableCellWidth";
32
+ readonly tableStyleOptions: "tableStyleOptions";
33
+ readonly tableStyleGallery: "tableStyleGallery";
34
+ readonly tableDistribute: "tableDistribute";
32
35
  readonly layoutWrapPreset: "layoutWrapPreset";
33
36
  readonly layoutFixedPosition: "layoutFixedPosition";
34
37
  };
@@ -235,6 +235,16 @@ export declare const en: {
235
235
  "table.alignLeft": string;
236
236
  "table.alignCenter": string;
237
237
  "table.alignRight": string;
238
+ "table.headerRow": string;
239
+ "table.totalRow": string;
240
+ "table.bandedRows": string;
241
+ "table.firstColumn": string;
242
+ "table.lastColumn": string;
243
+ "table.bandedColumns": string;
244
+ "table.tableStyle": string;
245
+ "table.autoFit": string;
246
+ "table.distributeRows": string;
247
+ "table.distributeColumns": string;
238
248
  "table.cellWidth": string;
239
249
  "table.cellBgColorPrompt": string;
240
250
  "table.cellWidthPrompt": string;
@@ -353,6 +363,8 @@ export declare const en: {
353
363
  "ribbon.tab.collaboration": string;
354
364
  "ribbon.tab.protection": string;
355
365
  "ribbon.tab.view": string;
366
+ "ribbon.tab.tableDesign": string;
367
+ "ribbon.tab.tableLayout": string;
356
368
  "ribbon.tab.plugins": string;
357
369
  "ribbon.tab.ai": string;
358
370
  "ribbon.group.clipboard": string;
@@ -368,6 +380,13 @@ export declare const en: {
368
380
  "ribbon.group.table": string;
369
381
  "ribbon.group.section": string;
370
382
  "ribbon.group.general": string;
383
+ "ribbon.group.tableStyleOptions": string;
384
+ "ribbon.group.tableStyles": string;
385
+ "ribbon.group.borders": string;
386
+ "ribbon.group.rowsColumns": string;
387
+ "ribbon.group.merge": string;
388
+ "ribbon.group.cellSize": string;
389
+ "ribbon.group.alignment": string;
371
390
  "toolbar.exportDocx": string;
372
391
  "toolbar.exportPdf": string;
373
392
  "underline.style.single": string;
@@ -235,6 +235,16 @@ export declare const ptBR: {
235
235
  "table.alignLeft": string;
236
236
  "table.alignCenter": string;
237
237
  "table.alignRight": string;
238
+ "table.headerRow": string;
239
+ "table.totalRow": string;
240
+ "table.bandedRows": string;
241
+ "table.firstColumn": string;
242
+ "table.lastColumn": string;
243
+ "table.bandedColumns": string;
244
+ "table.tableStyle": string;
245
+ "table.autoFit": string;
246
+ "table.distributeRows": string;
247
+ "table.distributeColumns": string;
238
248
  "table.cellWidth": string;
239
249
  "table.cellBgColorPrompt": string;
240
250
  "table.cellWidthPrompt": string;
@@ -353,6 +363,8 @@ export declare const ptBR: {
353
363
  "ribbon.tab.collaboration": string;
354
364
  "ribbon.tab.protection": string;
355
365
  "ribbon.tab.view": string;
366
+ "ribbon.tab.tableDesign": string;
367
+ "ribbon.tab.tableLayout": string;
356
368
  "ribbon.tab.plugins": string;
357
369
  "ribbon.tab.ai": string;
358
370
  "ribbon.group.clipboard": string;
@@ -368,6 +380,13 @@ export declare const ptBR: {
368
380
  "ribbon.group.table": string;
369
381
  "ribbon.group.section": string;
370
382
  "ribbon.group.general": string;
383
+ "ribbon.group.tableStyleOptions": string;
384
+ "ribbon.group.tableStyles": string;
385
+ "ribbon.group.borders": string;
386
+ "ribbon.group.rowsColumns": string;
387
+ "ribbon.group.merge": string;
388
+ "ribbon.group.cellSize": string;
389
+ "ribbon.group.alignment": string;
371
390
  "toolbar.exportDocx": string;
372
391
  "toolbar.exportPdf": string;
373
392
  "underline.style.single": string;