roosterjs 9.45.2 → 9.47.0

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,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 9.45.2)
1
+ // Type definitions for roosterjs (Version 9.47.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1293,7 +1293,7 @@ export type EntityFormatOperation = /**
1293
1293
  /**
1294
1294
  * Operations used by editTable() API
1295
1295
  */
1296
- export type TableOperation = TableVerticalInsertOperation | TableHorizontalInsertOperation | TableDeleteOperation | TableVerticalMergeOperation | TableHorizontalMergeOperation | TableCellMergeOperation | TableSplitOperation | TableAlignOperation | TableCellHorizontalAlignOperation | TableCellVerticalAlignOperation;
1296
+ export type TableOperation = TableVerticalInsertOperation | TableHorizontalInsertOperation | TableDeleteOperation | TableVerticalMergeOperation | TableHorizontalMergeOperation | TableCellMergeOperation | TableSplitOperation | TableAlignOperation | TableCellHorizontalAlignOperation | TableCellVerticalAlignOperation | TableCellShiftOperation;
1297
1297
 
1298
1298
  /**
1299
1299
  * Operations used by editTable() API for insert table cell vertically
@@ -1427,6 +1427,18 @@ export type TableCellVerticalAlignOperation = /**
1427
1427
  */
1428
1428
  | 'alignCellBottom';
1429
1429
 
1430
+ /**
1431
+ * Operations used by editTable() API to shift table cell content up or left
1432
+ */
1433
+ export type TableCellShiftOperation = /**
1434
+ * Move the table cell content to the cell on the left
1435
+ */
1436
+ 'shiftCellsLeft'
1437
+ /**
1438
+ * Move the table cell content to the cell above
1439
+ */
1440
+ | 'shiftCellsUp';
1441
+
1430
1442
  /**
1431
1443
  * Specify what type of content to paste
1432
1444
  */
@@ -2999,6 +3011,18 @@ export interface DomToModelListFormat {
2999
3011
  export interface ModelToDomContext extends EditorContext, ModelToDomSelectionContext, ModelToDomFormatContext, ModelToDomSettings, RewriteFromModelContext {
3000
3012
  }
3001
3013
 
3014
+ /**
3015
+ * Extended context used by segment and text handlers to carry per-paragraph segment state
3016
+ */
3017
+ export interface ModelToDomSegmentContext extends ModelToDomContext {
3018
+ /**
3019
+ * Whether the current segment is the last segment in the paragraph,
3020
+ * or there are no more Text segments after it (excluding SelectionMarkers).
3021
+ * When true, trailing spaces should be converted to  .
3022
+ */
3023
+ noFollowingTextSegmentOrLast?: boolean;
3024
+ }
3025
+
3002
3026
  /**
3003
3027
  * Represents internal data structure for a selection position, combined by block and segment node
3004
3028
  */
@@ -3139,7 +3163,7 @@ export type ContentModelHandler<T extends ContentModelSegment | ContentModelBloc
3139
3163
  * - For segments with decorators: decorator elements will also be included
3140
3164
  * - For inline entity segment, the delimiter SPANs will also be included
3141
3165
  */
3142
- export type ContentModelSegmentHandler<T extends ContentModelSegment> = (doc: Document, parent: Node, model: T, context: ModelToDomContext, segmentNodes: Node[]) => void;
3166
+ export type ContentModelSegmentHandler<T extends ContentModelSegment> = (doc: Document, parent: Node, model: T, context: ModelToDomSegmentContext, segmentNodes: Node[]) => void;
3143
3167
 
3144
3168
  /**
3145
3169
  * Type of Content Model to DOM handler for block
@@ -3535,8 +3559,9 @@ export interface Colors {
3535
3559
  * @param baseLValue Base value of light used for dark value calculation
3536
3560
  * @param colorType @optional Type of color, can be text, background, or border
3537
3561
  * @param element @optional Source HTML element of the color
3562
+ * @param comparingColor @optional When generating dark color for background color, we can provide text color as comparingColor to make sure the generated dark border color has enough contrast with text color in dark mode
3538
3563
  */
3539
- export type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorType?: 'text' | 'background' | 'border', element?: HTMLElement) => string;
3564
+ export type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorType?: 'text' | 'background' | 'border', element?: HTMLElement, comparingColor?: string) => string;
3540
3565
 
3541
3566
  /**
3542
3567
  * An interface of Editor, built on top of Content Model
@@ -7492,8 +7517,9 @@ export function getColor(element: HTMLElement, isBackground: boolean, isDarkMode
7492
7517
  * @param isBackground True to set background color, false to set text color
7493
7518
  * @param isDarkMode Whether element is in dark mode now
7494
7519
  * @param darkColorHandler @optional The dark color handler object to help manager dark mode color
7520
+ * @param comparingColor @optional When generating dark color for background color, we can provide text color as comparingColor to make sure the generated dark border color has enough contrast with text color in dark mode
7495
7521
  */
7496
- export function setColor(element: HTMLElement, color: string | null | undefined, isBackground: boolean, isDarkMode: boolean, darkColorHandler?: DarkColorHandler): void;
7522
+ export function setColor(element: HTMLElement, color: string | null | undefined, isBackground: boolean, isDarkMode: boolean, darkColorHandler?: DarkColorHandler, comparingColor?: string): void;
7497
7523
 
7498
7524
  /**
7499
7525
  * Parse color string to r/g/b value.
@@ -7572,6 +7598,13 @@ export function getSelectionRootNode(selection: DOMSelection | undefined): Node
7572
7598
  */
7573
7599
  export function getDOMInsertPointRect(doc: Document, pos: DOMInsertPoint): Rect | null;
7574
7600
 
7601
+ /**
7602
+ * Remove the unselected content from the model
7603
+ * @param model the model document
7604
+ * @param selection The editor selection
7605
+ * */
7606
+ export function trimModelForSelection(model: ContentModelDocument, selection: DOMSelection): void;
7607
+
7575
7608
  /**
7576
7609
  * Returns true when the event was fired from a key that produces a character value, otherwise false
7577
7610
  * This detection is not 100% accurate. event.key is not fully supported by all browsers, and in some browsers (e.g. IE),
@@ -7594,6 +7627,15 @@ export function isModifierKey(event: KeyboardEvent): boolean;
7594
7627
  */
7595
7628
  export function isCursorMovingKey(event: KeyboardEvent): boolean;
7596
7629
 
7630
+ /**
7631
+ * Get insertion point from coordinate.
7632
+ * @param doc Parent document object
7633
+ * @param domHelper The DOM helper of the editor
7634
+ * @param x The cursor coordinate for the x-axis
7635
+ * @param y The cursor coordinate for the y-axis
7636
+ */
7637
+ export function getNodePositionFromEvent(doc: Document, domHelper: DOMHelper, x: number, y: number): DOMInsertPoint | null;
7638
+
7597
7639
  /**
7598
7640
  * Combine border value array back to string
7599
7641
  * @param values Input string values
@@ -7660,7 +7702,7 @@ export function retrieveDocumentMetadata(doc: Document): Record<string, string>;
7660
7702
  * @param darkColorHandler The dark color handler object to help do color transformation
7661
7703
  * @param transformColorOptions Configuration options for controlling which elements and styles undergo color transformation.
7662
7704
  */
7663
- export function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler, transformColorOptions?: TransformColorOptions): void;
7705
+ export function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler, transformColorOptions?: TransformColorOptions, defaultTextColor?: string): void;
7664
7706
 
7665
7707
  /**
7666
7708
  * Configuration options for controlling which elements and styles undergo color transformation.