wordinweb 0.1.17 → 0.1.18

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.
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ interface XmlElement {
33
33
  * everything untouched.
34
34
  */
35
35
 
36
- type BorderStyle = "none" | "single" | "double" | "dotted" | "dashed" | "thick" | "wave" | "dotDash" | "dotDotDash" | "triple";
36
+ type BorderStyle = "none" | "single" | "double" | "dotted" | "dashed" | "thick" | "wave" | "dotDash" | "dotDotDash" | "thinThickSmallGap" | "triple";
37
37
  interface Border {
38
38
  style: BorderStyle;
39
39
  /** Stroke width in px. */
@@ -635,6 +635,7 @@ interface DrawingLine {
635
635
  y2: number;
636
636
  color: string;
637
637
  weight: number;
638
+ style?: "single" | "dotted" | "dashed";
638
639
  }
639
640
  interface DrawingImage {
640
641
  part: string;
@@ -755,6 +756,8 @@ interface DrawingPath {
755
756
  width: number;
756
757
  opacity?: number;
757
758
  };
759
+ /** Zero-based visible SmartArt node this path paints. */
760
+ smartArtNodeIndex?: number;
758
761
  }
759
762
  /**
760
763
  * Footnote/endnote reference mark. In body text (w:footnoteReference /
@@ -1672,6 +1675,16 @@ interface DrawingHitItem {
1672
1675
  ink?: boolean;
1673
1676
  /** Native SmartArt diagram selection target. */
1674
1677
  smartArt?: boolean;
1678
+ /** Node hit boxes inside the SmartArt drawing, relative to this item. */
1679
+ smartArtNodes?: Array<{
1680
+ index: number;
1681
+ x: number;
1682
+ y: number;
1683
+ width: number;
1684
+ height: number;
1685
+ }>;
1686
+ chartData?: ChartData;
1687
+ smartArtData?: SmartArtData;
1675
1688
  /** A shape fill hit that sits UNDER the shape's own text spans (same z): a
1676
1689
  * click on bare fill selects or drags the shape, while clicks on its text
1677
1690
  * glyphs still reach the text editor. */
@@ -1989,8 +2002,9 @@ interface SelectionFormat {
1989
2002
  verticalAlign?: "superscript" | "subscript";
1990
2003
  }
1991
2004
 
1992
- type ShapePreset = "line" | "rectangle" | "roundedRectangle" | "ellipse" | "diamond" | "textBox";
2005
+ type ShapePreset = "line" | "verticalLine" | "rectangle" | "roundedRectangle" | "ellipse" | "diamond" | "textBox";
1993
2006
  type WordArtPreset = "plain" | "archUp" | "archDown" | "wave" | "chevron";
2007
+ type DrawingLineDash = "solid" | "dashed" | "dotted";
1994
2008
  type DrawingTool = {
1995
2009
  kind?: "pen";
1996
2010
  color: string;
@@ -2006,7 +2020,18 @@ type DrawingTool = {
2006
2020
  kind: "lasso";
2007
2021
  };
2008
2022
 
2023
+ interface SmartArtTextFormat {
2024
+ fontFamily: string;
2025
+ fontSizePt: number;
2026
+ color: string;
2027
+ bold: boolean;
2028
+ italic: boolean;
2029
+ alignment: "left" | "center" | "right";
2030
+ }
2031
+
2009
2032
  type ObjectArrangeAction = "alignLeft" | "alignCenter" | "alignRight" | "alignTop" | "alignMiddle" | "alignBottom" | "rotateLeft" | "rotateRight" | "bringToFront" | "sendToBack";
2033
+ type SelectedObjectKind = "shape" | "line" | "smartArt" | "chart" | "image" | "model3d";
2034
+ type SelectedObjectCommand = "altText" | "editText" | "fill" | "outline" | "lineStyle" | "rotate" | "size" | "position" | "wrapInline" | "wrapSquare" | "wrapTopAndBottom" | "wrapFront" | "wrapBehind" | "bringForward" | "sendBackward" | "reset3d" | "delete";
2010
2035
 
2011
2036
  type ParagraphAlignment = "left" | "center" | "right" | "justify";
2012
2037
  interface PageLayoutPatch {
@@ -2052,6 +2077,14 @@ type TableOp = "rowAbove" | "rowBelow" | "deleteRow" | "colLeft" | "colRight" |
2052
2077
  v: "top" | "center" | "bottom";
2053
2078
  };
2054
2079
 
2080
+ type ParagraphDividerStyle = "single" | "double" | "dotted" | "dashed" | "thinThickSmallGap";
2081
+ interface ParagraphDivider {
2082
+ style: ParagraphDividerStyle;
2083
+ color: string;
2084
+ widthPt: number;
2085
+ spacePt: number;
2086
+ }
2087
+
2055
2088
  interface CoverPageContent {
2056
2089
  title: string;
2057
2090
  subtitle?: string;
@@ -2100,7 +2133,7 @@ interface ToolbarMenuSelectProps {
2100
2133
  * every user-facing part is a button/listbox rendered by us. */
2101
2134
  declare function ToolbarMenuSelect({ value, options, onChange, placeholder, title, ariaLabel, triggerAriaLabel, width, menuWidth, className, style, }: ToolbarMenuSelectProps): react.JSX.Element;
2102
2135
  /** Toolbar control groups a host can disable via the `features` prop. */
2103
- type ToolbarFeature = "history" | "styles" | "font" | "size" | "format" | "color" | "highlight" | "alignment" | "indent" | "spacing" | "link" | "lists" | "table" | "image" | "icon" | "screenshot" | "model3D" | "media" | "object" | "chart" | "smartArt" | "comment" | "footnote" | "bookmark" | "crossReference" | "dateTime" | "field" | "equation" | "symbol" | "shape" | "textBox" | "wordArt" | "drawing" | "arrange" | "dropCap" | "headerFooter" | "coverPage" | "pageNumber" | "break" | "layout" | "help" | "download";
2136
+ type ToolbarFeature = "history" | "styles" | "font" | "size" | "format" | "color" | "highlight" | "alignment" | "indent" | "spacing" | "link" | "lists" | "table" | "image" | "icon" | "screenshot" | "model3D" | "media" | "object" | "chart" | "smartArt" | "comment" | "footnote" | "bookmark" | "crossReference" | "dateTime" | "field" | "equation" | "symbol" | "shape" | "divider" | "textBox" | "wordArt" | "drawing" | "arrange" | "dropCap" | "headerFooter" | "coverPage" | "pageNumber" | "break" | "layout" | "help" | "download";
2104
2137
  type ToolbarMode = "simple" | "advanced";
2105
2138
  interface DocxToolbarProps {
2106
2139
  api: DocxViewApi | null;
@@ -2140,17 +2173,29 @@ interface DocxViewApi {
2140
2173
  /** Insert a Unicode symbol through the normal undo/suggestion-aware typing path. */
2141
2174
  insertSymbol(symbol: string): boolean;
2142
2175
  /** Insert a floating editable DrawingML shape at the caret. */
2143
- insertShape(preset: ShapePreset, text?: string): boolean;
2176
+ insertShape(preset: ShapePreset, text?: string, lineStyle?: {
2177
+ color: string;
2178
+ width: number;
2179
+ dash: DrawingLineDash;
2180
+ }): boolean;
2144
2181
  /** Insert editable DrawingML WordArt at the caret. */
2145
2182
  insertWordArt(text: string, preset?: WordArtPreset): boolean;
2146
2183
  /** Insert a native editable ChartML chart at the caret. */
2147
2184
  insertChart(data: ChartData): boolean;
2148
2185
  /** Replace the selected native chart's type and data. */
2149
2186
  updateSelectedChart(data: ChartData): boolean;
2187
+ /** Data for the selected native chart, or null when another object is selected. */
2188
+ getSelectedChart(): ChartData | null;
2150
2189
  /** Insert a native editable SmartArt diagram at the caret. */
2151
2190
  insertSmartArt(data: SmartArtData): boolean;
2152
2191
  /** Replace the selected native SmartArt diagram's layout and node text. */
2153
2192
  updateSelectedSmartArt(data: SmartArtData): boolean;
2193
+ /** Data for the selected native SmartArt diagram, or null when another object is selected. */
2194
+ getSelectedSmartArt(): SmartArtData | null;
2195
+ /** Text formatting for the selected SmartArt node, or the first node when the group is selected. */
2196
+ getSelectedSmartArtTextFormat(): SmartArtTextFormat | null;
2197
+ /** Format the selected SmartArt node, or every node when the group is selected. */
2198
+ setSelectedSmartArtTextFormat(patch: Partial<SmartArtTextFormat>): boolean;
2154
2199
  /** Insert a native Office 3D model with an optional custom poster image. */
2155
2200
  insertModel3D(file: Blob, poster?: Blob): Promise<boolean>;
2156
2201
  /** Insert Word online-video metadata with a browser-safe poster. */
@@ -2165,6 +2210,15 @@ interface DocxViewApi {
2165
2210
  arrangeObject(action: ObjectArrangeAction): boolean;
2166
2211
  /** True while an image, shape, or ink group is selected. */
2167
2212
  hasSelectedObject(): boolean;
2213
+ /** Kind of the selected object, used by contextual formatting controls. */
2214
+ getSelectedObjectContext(): {
2215
+ kind: SelectedObjectKind;
2216
+ canEditText: boolean;
2217
+ smartArtNodeSelected?: boolean;
2218
+ smartArtNodeIndex?: number;
2219
+ } | null;
2220
+ /** Run a formatting command against the current selected object. */
2221
+ runSelectedObjectCommand(command: SelectedObjectCommand): boolean;
2168
2222
  undo(): void;
2169
2223
  redo(): void;
2170
2224
  canUndo(): boolean;
@@ -2173,6 +2227,8 @@ interface DocxViewApi {
2173
2227
  insertTable(rows: number, cols: number): void;
2174
2228
  /** Row/column/table operations on the table containing the caret. */
2175
2229
  tableOp(op: TableOp): void;
2230
+ /** Current table-cell fill, undefined when the caret is outside a table. */
2231
+ getTableCellFill(): string | null | undefined;
2176
2232
  /** Insert an image file at the caret (inline, natural size clamped to column). */
2177
2233
  insertImage(file: Blob): Promise<void>;
2178
2234
  /** Capture a screen, window, or browser tab and insert the current frame as a PNG picture. */
@@ -2198,6 +2254,10 @@ interface DocxViewApi {
2198
2254
  beforePt?: number | null;
2199
2255
  afterPt?: number | null;
2200
2256
  }): void;
2257
+ /** Create, customize, or remove the bottom-border divider on the selected paragraph(s). */
2258
+ setParagraphDivider(divider: ParagraphDivider | null): boolean;
2259
+ /** Direct bottom-border divider on the caret paragraph. */
2260
+ getParagraphDivider(): ParagraphDivider | null;
2201
2261
  /** Apply or remove a native Word drop cap on the caret paragraph. */
2202
2262
  setDropCap(mode: "drop" | "margin" | null, lines?: number): boolean;
2203
2263
  /** Remove direct character formatting from the selection. */