@fluidframework/sequence 2.10.0-307399 → 2.11.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.
package/src/sequence.ts CHANGED
@@ -46,7 +46,9 @@ import {
46
46
  createObliterateRangeOp,
47
47
  createRemoveRangeOp,
48
48
  matchProperties,
49
+ type AdjustParams,
49
50
  type InteriorSequencePlace,
51
+ type MapLike,
50
52
  } from "@fluidframework/merge-tree/internal";
51
53
  import {
52
54
  ISummaryTreeWithStats,
@@ -300,6 +302,21 @@ export interface ISharedSegmentSequence<T extends ISegment>
300
302
  */
301
303
  annotateRange(start: number, end: number, props: PropertySet): void;
302
304
 
305
+ /**
306
+ * Annotates a specified range within the sequence by applying the provided adjustments.
307
+ *
308
+ * @param start - The inclusive start position of the range to annotate. This is a zero-based index.
309
+ * @param end - The exclusive end position of the range to annotate. This is a zero-based index.
310
+ * @param adjust - A map-like object specifying the properties to adjust. Each key-value pair represents a property and its corresponding adjustment to be applied over the range.
311
+ * An adjustment is defined by an object containing a `delta` to be added to the current property value, and optional `min` and `max` constraints to limit the adjusted value.
312
+ *
313
+ * @remarks
314
+ * The range is defined by the start and end positions, where the start position is inclusive and the end position is exclusive.
315
+ * The properties provided in the adjust parameter will be applied to the specified range. Each adjustment modifies the current value of the property by adding the specified `value`.
316
+ * If the current value is not a number, the `delta` will be summed with 0 to compute the new value. The optional `min` and `max` constraints are applied after the adjustment to ensure the final value falls within the specified bounds.
317
+ */
318
+ annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void;
319
+
303
320
  /**
304
321
  * @param start - The inclusive start of the range to remove
305
322
  * @param end - The exclusive end of the range to remove
@@ -521,6 +538,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
521
538
  mergeTreeEnableSidedObliterate: (c, n) => c.getBoolean(n),
522
539
  intervalStickinessEnabled: (c, n) => c.getBoolean(n),
523
540
  mergeTreeReferencesCanSlideToEndpoint: (c, n) => c.getBoolean(n),
541
+ mergeTreeEnableAnnotateAdjust: (c, n) => c.getBoolean(n),
524
542
  },
525
543
  dataStoreRuntime.options,
526
544
  );
@@ -605,6 +623,10 @@ export abstract class SharedSegmentSequence<T extends ISegment>
605
623
  this.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));
606
624
  }
607
625
 
626
+ public annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void {
627
+ this.guardReentrancy(() => this.client.annotateAdjustRangeLocal(start, end, adjust));
628
+ }
629
+
608
630
  public getPropertiesAtPosition(pos: number): PropertySet | undefined {
609
631
  return this.client.getPropertiesAtPosition(pos);
610
632
  }