@fluidframework/sequence 2.43.0-343119 → 2.43.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/api-report/sequence.legacy.alpha.api.md +2 -2
  3. package/dist/intervalCollection.d.ts +4 -9
  4. package/dist/intervalCollection.d.ts.map +1 -1
  5. package/dist/intervalCollection.js +96 -82
  6. package/dist/intervalCollection.js.map +1 -1
  7. package/dist/intervalCollectionMap.d.ts +1 -1
  8. package/dist/intervalCollectionMap.d.ts.map +1 -1
  9. package/dist/intervalCollectionMap.js +2 -2
  10. package/dist/intervalCollectionMap.js.map +1 -1
  11. package/dist/intervalCollectionMapInterfaces.d.ts +13 -6
  12. package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
  13. package/dist/intervalCollectionMapInterfaces.js.map +1 -1
  14. package/dist/intervals/intervalUtils.d.ts +4 -3
  15. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  16. package/dist/intervals/intervalUtils.js +16 -3
  17. package/dist/intervals/intervalUtils.js.map +1 -1
  18. package/dist/intervals/sequenceInterval.d.ts +21 -7
  19. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  20. package/dist/intervals/sequenceInterval.js +88 -16
  21. package/dist/intervals/sequenceInterval.js.map +1 -1
  22. package/dist/packageVersion.d.ts +1 -1
  23. package/dist/packageVersion.d.ts.map +1 -1
  24. package/dist/packageVersion.js +1 -1
  25. package/dist/packageVersion.js.map +1 -1
  26. package/dist/sequence.js +1 -1
  27. package/dist/sequence.js.map +1 -1
  28. package/lib/intervalCollection.d.ts +4 -9
  29. package/lib/intervalCollection.d.ts.map +1 -1
  30. package/lib/intervalCollection.js +98 -82
  31. package/lib/intervalCollection.js.map +1 -1
  32. package/lib/intervalCollectionMap.d.ts +1 -1
  33. package/lib/intervalCollectionMap.d.ts.map +1 -1
  34. package/lib/intervalCollectionMap.js +2 -2
  35. package/lib/intervalCollectionMap.js.map +1 -1
  36. package/lib/intervalCollectionMapInterfaces.d.ts +13 -6
  37. package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
  38. package/lib/intervalCollectionMapInterfaces.js.map +1 -1
  39. package/lib/intervals/intervalUtils.d.ts +4 -3
  40. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  41. package/lib/intervals/intervalUtils.js +15 -3
  42. package/lib/intervals/intervalUtils.js.map +1 -1
  43. package/lib/intervals/sequenceInterval.d.ts +21 -7
  44. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  45. package/lib/intervals/sequenceInterval.js +88 -16
  46. package/lib/intervals/sequenceInterval.js.map +1 -1
  47. package/lib/packageVersion.d.ts +1 -1
  48. package/lib/packageVersion.d.ts.map +1 -1
  49. package/lib/packageVersion.js +1 -1
  50. package/lib/packageVersion.js.map +1 -1
  51. package/lib/sequence.js +1 -1
  52. package/lib/sequence.js.map +1 -1
  53. package/package.json +18 -18
  54. package/src/intervalCollection.ts +122 -142
  55. package/src/intervalCollectionMap.ts +6 -2
  56. package/src/intervalCollectionMapInterfaces.ts +15 -5
  57. package/src/intervals/intervalUtils.ts +31 -3
  58. package/src/intervals/sequenceInterval.ts +135 -72
  59. package/src/packageVersion.ts +1 -1
  60. package/src/sequence.ts +1 -1
@@ -3,29 +3,36 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
6
- import { IMergeTreeOptions, ListNode } from "@fluidframework/merge-tree/internal";
6
+ import { IMergeTreeOptions, ListNode, type ISegmentInternal } from "@fluidframework/merge-tree/internal";
7
7
  import type { IntervalCollection, ISerializedIntervalCollectionV1, ISerializedIntervalCollectionV2 } from "./intervalCollection.js";
8
- import { ISerializedInterval, IntervalDeltaOpType, SerializedIntervalDelta } from "./intervals/index.js";
8
+ import { ISerializedInterval, IntervalDeltaOpType, SerializedIntervalDelta, type SequenceIntervalClass } from "./intervals/index.js";
9
9
  export interface IntervalAddLocalMetadata {
10
10
  type: typeof IntervalDeltaOpType.ADD;
11
11
  localSeq: number;
12
12
  endpointChangesNode?: ListNode<IntervalAddLocalMetadata | IntervalChangeLocalMetadata>;
13
- rebased?: ISerializedInterval;
14
- original: ISerializedInterval;
13
+ rebased?: Record<"start" | "end", {
14
+ segment: ISegmentInternal;
15
+ offset: number;
16
+ }> | "detached";
17
+ interval: SequenceIntervalClass;
15
18
  }
16
19
  export interface IntervalChangeLocalMetadata {
17
20
  type: typeof IntervalDeltaOpType.CHANGE;
18
21
  localSeq: number;
19
22
  previous: ISerializedInterval;
20
23
  endpointChangesNode?: ListNode<IntervalChangeLocalMetadata | IntervalChangeLocalMetadata>;
21
- rebased?: SerializedIntervalDelta;
22
- original: SerializedIntervalDelta;
24
+ rebased?: Record<"start" | "end", {
25
+ segment: ISegmentInternal;
26
+ offset: number;
27
+ }> | "detached";
28
+ interval: SequenceIntervalClass;
23
29
  }
24
30
  export interface IntervalDeleteLocalMetadata {
25
31
  type: typeof IntervalDeltaOpType.DELETE;
26
32
  localSeq: number;
27
33
  previous: ISerializedInterval;
28
34
  endpointChangesNode?: undefined;
35
+ interval?: undefined;
29
36
  }
30
37
  export type IntervalMessageLocalMetadata = IntervalAddLocalMetadata | IntervalChangeLocalMetadata | IntervalDeleteLocalMetadata;
31
38
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAElF,OAAO,KAAK,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,sBAAsB,CAA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,EAAE,yBAAyB,GAAG,SAAS,EAC9C,eAAe,EAAE,4BAA4B,GAAG,SAAS,GACvD,IAAI,CAAC;CACR;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,IAAI,EAAE,gCAAgC,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,+BAA+B,GAAG,+BAA+B,CAAC;CACzE;AAED,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qCAAqC,GAC9C;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;CAC1B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,CAAC"}
1
+ {"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,iBAAiB,EACjB,QAAQ,EACR,KAAK,gBAAgB,EACrB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,sBAAsB,CAAC;A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YG;IACH,yBAAyB,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,2BAA2B,EAAE,GAAG,GAAG,GAAG,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;;;;;OAOG;IACH,OAAO,CACN,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC9C,eAAe,EAAE,4BAA4B,GAAG,SAAS,GACvD,IAAI,CAAC;CACR;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,IAAI,EAAE,gCAAgC,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,+BAA+B,GAAG,+BAA+B,CAAC;CACzE;AAED,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qCAAqC,GAC9C;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;CAC1B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { IMergeTreeOptions, ListNode } from \"@fluidframework/merge-tree/internal\";\n\nimport type {\n\tIntervalCollection,\n\tISerializedIntervalCollectionV1,\n\tISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n} from \"./intervals/index.js\";\n\nexport interface IntervalAddLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.ADD;\n\tlocalSeq: number;\n\tendpointChangesNode?: ListNode<IntervalAddLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?: ISerializedInterval;\n\toriginal: ISerializedInterval;\n}\nexport interface IntervalChangeLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.CHANGE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: ListNode<IntervalChangeLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?: SerializedIntervalDelta;\n\toriginal: SerializedIntervalDelta;\n}\nexport interface IntervalDeleteLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.DELETE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: undefined;\n}\nexport type IntervalMessageLocalMetadata =\n\t| IntervalAddLocalMetadata\n\t| IntervalChangeLocalMetadata\n\t| IntervalDeleteLocalMetadata;\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions\n\textends Pick<\n\t\tIMergeTreeOptions,\n\t\t| \"mergeTreeReferencesCanSlideToEndpoint\"\n\t\t| \"mergeTreeEnableObliterate\"\n\t\t| \"mergeTreeEnableSidedObliterate\"\n\t\t| \"mergeTreeEnableAnnotateAdjust\"\n\t> {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link @fluidframework/merge-tree#SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link @fluidframework/merge-tree#SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\n\t/**\n\t * This is for testing, and allows us to output intervals in the older formats.\n\t */\n\tintervalSerializationFormat: \"1\" | \"2\";\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n *\n */\nexport interface IIntervalCollectionOperation {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IntervalMessageLocalMetadata | undefined,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: \"sharedStringIntervalCollection\";\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n */\nexport type IIntervalCollectionTypeOperationValue =\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.ADD;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: ISerializedInterval;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.CHANGE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.DELETE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t };\n"]}
1
+ {"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIMergeTreeOptions,\n\tListNode,\n\ttype ISegmentInternal,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport type {\n\tIntervalCollection,\n\tISerializedIntervalCollectionV1,\n\tISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n\ttype SequenceIntervalClass,\n} from \"./intervals/index.js\";\n\nexport interface IntervalAddLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.ADD;\n\tlocalSeq: number;\n\tendpointChangesNode?: ListNode<IntervalAddLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?:\n\t\t| Record<\"start\" | \"end\", { segment: ISegmentInternal; offset: number }>\n\t\t| \"detached\";\n\tinterval: SequenceIntervalClass;\n}\nexport interface IntervalChangeLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.CHANGE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: ListNode<IntervalChangeLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?:\n\t\t| Record<\"start\" | \"end\", { segment: ISegmentInternal; offset: number }>\n\t\t| \"detached\";\n\tinterval: SequenceIntervalClass;\n}\nexport interface IntervalDeleteLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.DELETE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: undefined;\n\tinterval?: undefined;\n}\nexport type IntervalMessageLocalMetadata =\n\t| IntervalAddLocalMetadata\n\t| IntervalChangeLocalMetadata\n\t| IntervalDeleteLocalMetadata;\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions\n\textends Pick<\n\t\tIMergeTreeOptions,\n\t\t| \"mergeTreeReferencesCanSlideToEndpoint\"\n\t\t| \"mergeTreeEnableObliterate\"\n\t\t| \"mergeTreeEnableSidedObliterate\"\n\t\t| \"mergeTreeEnableAnnotateAdjust\"\n\t> {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link @fluidframework/merge-tree#SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link @fluidframework/merge-tree#SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\n\t/**\n\t * This is for testing, and allows us to output intervals in the older formats.\n\t */\n\tintervalSerializationFormat: \"1\" | \"2\";\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n *\n */\nexport interface IIntervalCollectionOperation {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IntervalMessageLocalMetadata | undefined,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: \"sharedStringIntervalCollection\";\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n */\nexport type IIntervalCollectionTypeOperationValue =\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.ADD;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: ISerializedInterval;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.CHANGE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.DELETE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t };\n"]}
@@ -42,7 +42,7 @@ export interface IInterval {
42
42
  *
43
43
  * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release
44
44
  */
45
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;
45
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): IInterval | undefined;
46
46
  /**
47
47
  * @returns whether this interval overlaps with `b`.
48
48
  * Intervals are considered to overlap if their intersection is non-empty.
@@ -224,6 +224,7 @@ export declare const IntervalStickiness: {
224
224
  * @alpha
225
225
  */
226
226
  export type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];
227
- export declare function startReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference;
228
- export declare function endReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference;
227
+ export declare function startReferenceSlidingPreference(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): SlidingPreference;
228
+ export declare function endReferenceSlidingPreference(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): SlidingPreference;
229
+ export declare function computeStickinessFromSide(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): IntervalStickiness;
229
230
  //# sourceMappingURL=intervalUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;OAKG;IACH,KAAK,IAAI,SAAS,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC;;;;OAIG;IACH,MAAM,CACL,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,EAAE,CAAC,EAAE,yBAA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H,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAC9C,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,iBAAiB,CAMnB;AAED,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,iBAAiB,CAOnB;AAED,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,kBAAkB,CAYpB"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { SlidingPreference, } from "@fluidframework/merge-tree/internal";
5
+ import { SlidingPreference, Side, } from "@fluidframework/merge-tree/internal";
6
6
  /**
7
7
  * Values are used in persisted formats (ops).
8
8
  * @internal
@@ -72,16 +72,28 @@ export const IntervalStickiness = {
72
72
  */
73
73
  FULL: 0b11,
74
74
  };
75
- export function startReferenceSlidingPreference(stickiness) {
75
+ export function startReferenceSlidingPreference(startPos, startSide, endPos, endSide) {
76
+ const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
76
77
  // if any start stickiness, prefer sliding backwards
77
78
  return (stickiness & IntervalStickiness.START) === 0
78
79
  ? SlidingPreference.FORWARD
79
80
  : SlidingPreference.BACKWARD;
80
81
  }
81
- export function endReferenceSlidingPreference(stickiness) {
82
+ export function endReferenceSlidingPreference(startPos, startSide, endPos, endSide) {
83
+ const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
82
84
  // if any end stickiness, prefer sliding forwards
83
85
  return (stickiness & IntervalStickiness.END) === 0
84
86
  ? SlidingPreference.BACKWARD
85
87
  : SlidingPreference.FORWARD;
86
88
  }
89
+ export function computeStickinessFromSide(startPos, startSide, endPos, endSide) {
90
+ let stickiness = IntervalStickiness.NONE;
91
+ if (startSide === Side.After || startPos === "start") {
92
+ stickiness |= IntervalStickiness.START;
93
+ }
94
+ if (endSide === Side.Before || endPos === "end") {
95
+ stickiness |= IntervalStickiness.END;
96
+ }
97
+ return stickiness;
98
+ }
87
99
  //# sourceMappingURL=intervalUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,iBAAiB,GAGjB,MAAM,qCAAqC,CAAC;AA+D7C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACP,CAAC;AAKX;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,GAAG,mBAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,MAAM,CAAN,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,KAAZ,YAAY,QAgBvB;AA+FD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,MAAM,UAAU,+BAA+B,CAC9C,UAA8B;IAE9B,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,iBAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC5C,UAA8B;IAE9B,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,iBAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n * @privateRemarks Remove from external exports, and replace usages of IInterval with this interface after deprecation period\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
1
+ {"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,iBAAiB,EAEjB,IAAI,GACJ,MAAM,qCAAqC,CAAC;AA+D7C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACP,CAAC;AAKX;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,GAAG,mBAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,MAAM,CAAN,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,KAAZ,YAAY,QAgBvB;AA+FD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,MAAM,UAAU,+BAA+B,CAC9C,QAA8C,EAC9C,SAAe,EACf,MAA4C,EAC5C,OAAa;IAEb,MAAM,UAAU,GAAG,yBAAyB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACnF,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,iBAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC5C,QAA8C,EAC9C,SAAe,EACf,MAA4C,EAC5C,OAAa;IAEb,MAAM,UAAU,GAAG,yBAAyB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnF,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,iBAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,yBAAyB,CACxC,QAA8C,EAC9C,SAAe,EACf,MAA4C,EAC5C,OAAa;IAEb,IAAI,UAAU,GAAuB,kBAAkB,CAAC,IAAI,CAAC;IAE7D,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACtD,UAAU,IAAI,kBAAkB,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,KAAK,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACjD,UAAU,IAAI,kBAAkB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,OAAO,UAAgC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tcanSlideToEndpoint?: boolean,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n * @privateRemarks Remove from external exports, and replace usages of IInterval with this interface after deprecation period\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n\nexport function computeStickinessFromSide(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): IntervalStickiness {\n\tlet stickiness: IntervalStickiness = IntervalStickiness.NONE;\n\n\tif (startSide === Side.After || startPos === \"start\") {\n\t\tstickiness |= IntervalStickiness.START;\n\t}\n\n\tif (endSide === Side.Before || endPos === \"end\") {\n\t\tstickiness |= IntervalStickiness.END;\n\t}\n\n\treturn stickiness as IntervalStickiness;\n}\n"]}
@@ -81,7 +81,7 @@ export interface SequenceInterval extends ISerializableInterval {
81
81
  * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
82
82
  * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release
83
83
  */
84
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval | undefined;
84
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): SequenceInterval | undefined;
85
85
  /**
86
86
  * @returns whether this interval overlaps with `b`.
87
87
  * Intervals are considered to overlap if their intersection is non-empty.
@@ -200,16 +200,30 @@ export declare class SequenceIntervalClass implements SequenceInterval, ISeriali
200
200
  * @returns whether this interval overlaps two numerical positions.
201
201
  */
202
202
  overlapsPos(bstart: number, bend: number): boolean;
203
+ moveEndpointReferences(rebased: Partial<Record<"start" | "end", {
204
+ segment: ISegment;
205
+ offset: number;
206
+ }>>): void;
203
207
  /**
204
208
  * {@inheritDoc IInterval.modify}
205
209
  */
206
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceIntervalClass;
210
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): SequenceIntervalClass;
207
211
  ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage): void;
208
212
  }
209
- export declare function createPositionReferenceFromSegoff(client: Client, segoff: {
210
- segment: ISegment;
211
- offset: number;
212
- } | undefined | "start" | "end", refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean, rollback?: boolean): LocalReferencePosition;
213
+ export declare function createPositionReferenceFromSegoff({ client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback, }: {
214
+ client: Client;
215
+ segoff: {
216
+ segment: ISegment;
217
+ offset: number;
218
+ } | undefined | "start" | "end";
219
+ refType: ReferenceType;
220
+ op?: ISequencedDocumentMessage;
221
+ localSeq?: number;
222
+ fromSnapshot?: boolean;
223
+ slidingPreference: SlidingPreference | undefined;
224
+ canSlideToEndpoint: boolean | undefined;
225
+ rollback?: boolean;
226
+ }): LocalReferencePosition;
213
227
  export declare function createTransientInterval(start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client): SequenceIntervalClass;
214
- export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean, props?: PropertySet, rollback?: boolean): SequenceIntervalClass;
228
+ export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, canSlideToEndpoint?: boolean, props?: PropertySet, rollback?: boolean): SequenceIntervalClass;
215
229
  //# sourceMappingURL=sequenceInterval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,MAAM,EACN,QAAQ,EACR,sBAAsB,EAEtB,WAAW,EACX,aAAa,EACb,iBAAiB,EASjB,aAAa,EACb,IAAI,EAOJ,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAEN,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,KAAK,uBAAuB,EAC5B,MAAM,oBAAoB,CAAC;AAkC5B,wBAAgB,uBAAuB,CACtC,kBAAkB,EAAE,mBAAmB,GAAG,uBAAuB,GAC/D;IACF,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;CACxB,CAYA;AAED;;;;;;;;;;;;;;;;;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AC,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACjD,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,sBAAsB,CAwCzB;AA+DD,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,yBAUd;AAED,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,OAAe,EACnC,KAAK,CAAC,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,OAAO,GAChB,qBAAqB,CAwFvB"}
@@ -13,8 +13,7 @@ import { assert } from "@fluidframework/core-utils/internal";
13
13
  import { PropertiesManager, ReferenceType, SlidingPreference, compareReferencePositions, createDetachedLocalReferencePosition, createMap, getSlideToSegoff, maxReferencePosition, minReferencePosition, refTypeIncludesFlag, reservedRangeLabelsKey, Side, endpointPosAndSide, addProperties, copyPropertiesAndManager, UnassignedSequenceNumber, UniversalSequenceNumber, } from "@fluidframework/merge-tree/internal";
14
14
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
15
15
  import { v4 as uuid } from "uuid";
16
- import { computeStickinessFromSide } from "../intervalCollection.js";
17
- import { IntervalType, endReferenceSlidingPreference, startReferenceSlidingPreference, } from "./intervalUtils.js";
16
+ import { IntervalStickiness, IntervalType, computeStickinessFromSide, endReferenceSlidingPreference, startReferenceSlidingPreference, } from "./intervalUtils.js";
18
17
  function compareSides(sideA, sideB) {
19
18
  if (sideA === sideB) {
20
19
  return 0;
@@ -246,14 +245,39 @@ export class SequenceIntervalClass {
246
245
  const endPos = this.client.localReferencePositionToPosition(this.end);
247
246
  return endPos > bstart && startPos < bend;
248
247
  }
248
+ moveEndpointReferences(rebased) {
249
+ if (rebased.start) {
250
+ const startRef = createPositionReferenceFromSegoff({
251
+ client: this.client,
252
+ segoff: rebased.start,
253
+ refType: this.start.refType,
254
+ slidingPreference: this.start.slidingPreference,
255
+ canSlideToEndpoint: this.start.canSlideToEndpoint,
256
+ });
257
+ if (this.start.properties) {
258
+ startRef.addProperties(this.start.properties);
259
+ }
260
+ this.start = startRef;
261
+ }
262
+ if (rebased.end) {
263
+ const endRef = createPositionReferenceFromSegoff({
264
+ client: this.client,
265
+ segoff: rebased.end,
266
+ refType: this.end.refType,
267
+ slidingPreference: this.end.slidingPreference,
268
+ canSlideToEndpoint: this.end.canSlideToEndpoint,
269
+ });
270
+ if (this.end.properties) {
271
+ endRef.addProperties(this.end.properties);
272
+ }
273
+ this.end = endRef;
274
+ }
275
+ }
249
276
  /**
250
277
  * {@inheritDoc IInterval.modify}
251
278
  */
252
- modify(label, start, end, op, localSeq, useNewSlidingBehavior = false) {
279
+ modify(label, start, end, op, localSeq, canSlideToEndpoint = false) {
253
280
  const { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);
254
- const startSegment = this.start.getSegment();
255
- const endSegment = this.end.getSegment();
256
- const stickiness = computeStickinessFromSide(startPos ?? startSegment?.endpointType, startSide ?? this.startSide, endPos ?? endSegment?.endpointType, endSide ?? this.endSide);
257
281
  const getRefType = (baseType) => {
258
282
  let refType = baseType;
259
283
  if (op === undefined) {
@@ -264,14 +288,32 @@ export class SequenceIntervalClass {
264
288
  };
265
289
  let startRef = this.start;
266
290
  if (startPos !== undefined) {
267
- startRef = createPositionReference(this.client, startPos, getRefType(this.start.refType), op, undefined, localSeq, startReferenceSlidingPreference(stickiness), startReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD, useNewSlidingBehavior);
291
+ const slidingPreference = startReferenceSlidingPreference(startPos, startSide ?? Side.Before, endPos, endSide ?? Side.Before);
292
+ startRef = createPositionReference({
293
+ client: this.client,
294
+ pos: startPos,
295
+ refType: getRefType(this.start.refType),
296
+ op,
297
+ localSeq,
298
+ slidingPreference,
299
+ canSlideToEndpoint: canSlideToEndpoint && slidingPreference === SlidingPreference.BACKWARD,
300
+ });
268
301
  if (this.start.properties) {
269
302
  startRef.addProperties(this.start.properties);
270
303
  }
271
304
  }
272
305
  let endRef = this.end;
273
306
  if (endPos !== undefined) {
274
- endRef = createPositionReference(this.client, endPos, getRefType(this.end.refType), op, undefined, localSeq, endReferenceSlidingPreference(stickiness), endReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD, useNewSlidingBehavior);
307
+ const slidingPreference = endReferenceSlidingPreference(startPos, startSide ?? Side.Before, endPos, endSide ?? Side.Before);
308
+ endRef = createPositionReference({
309
+ client: this.client,
310
+ pos: endPos,
311
+ refType: getRefType(this.end.refType),
312
+ op,
313
+ localSeq,
314
+ slidingPreference,
315
+ canSlideToEndpoint: canSlideToEndpoint && slidingPreference === SlidingPreference.FORWARD,
316
+ });
275
317
  if (this.end.properties) {
276
318
  endRef.addProperties(this.end.properties);
277
319
  }
@@ -289,7 +331,7 @@ export class SequenceIntervalClass {
289
331
  }
290
332
  }
291
333
  _SequenceIntervalClass_props = new WeakMap();
292
- export function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback) {
334
+ export function createPositionReferenceFromSegoff({ client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback, }) {
293
335
  if (segoff === "start" || segoff === "end") {
294
336
  return client.createLocalReferencePosition(segoff, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
295
337
  }
@@ -311,7 +353,7 @@ export function createPositionReferenceFromSegoff(client, segoff, refType, op, l
311
353
  }
312
354
  return createDetachedLocalReferencePosition(slidingPreference, refType);
313
355
  }
314
- function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, exclusive = false, useNewSlidingBehavior = false, rollback) {
356
+ function createPositionReference({ client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, canSlideToEndpoint, rollback, }) {
315
357
  let segoff;
316
358
  if (op) {
317
359
  assert((refType & ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
@@ -323,7 +365,7 @@ function createPositionReference(client, pos, refType, op, fromSnapshot, localSe
323
365
  referenceSequenceNumber: op.referenceSequenceNumber,
324
366
  clientId: op.clientId,
325
367
  });
326
- segoff = getSlideToSegoff(segoff, slidingPreference, undefined, useNewSlidingBehavior);
368
+ segoff = getSlideToSegoff(segoff, slidingPreference, undefined, canSlideToEndpoint);
327
369
  }
328
370
  }
329
371
  else {
@@ -333,18 +375,27 @@ function createPositionReference(client, pos, refType, op, fromSnapshot, localSe
333
375
  ? pos
334
376
  : client.getContainingSegment(pos, undefined, localSeq);
335
377
  }
336
- return createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, exclusive, rollback);
378
+ return createPositionReferenceFromSegoff({
379
+ client,
380
+ segoff,
381
+ refType,
382
+ op,
383
+ localSeq,
384
+ fromSnapshot,
385
+ slidingPreference,
386
+ canSlideToEndpoint,
387
+ rollback,
388
+ });
337
389
  }
338
390
  export function createTransientInterval(start, end, client) {
339
391
  return createSequenceInterval("transient", uuid(), start, end, client, IntervalType.Transient);
340
392
  }
341
- export function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, useNewSlidingBehavior = false, props, rollback) {
393
+ export function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, canSlideToEndpoint = false, props, rollback) {
342
394
  const { startPos, startSide, endPos, endSide } = endpointPosAndSide(start ?? "start", end ?? "end");
343
395
  assert(startPos !== undefined &&
344
396
  endPos !== undefined &&
345
397
  startSide !== undefined &&
346
398
  endSide !== undefined, 0x794 /* start and end cannot be undefined because they were not passed in as undefined */);
347
- const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
348
399
  let beginRefType = ReferenceType.RangeBegin;
349
400
  let endRefType = ReferenceType.RangeEnd;
350
401
  if (intervalType === IntervalType.Transient) {
@@ -364,8 +415,29 @@ export function createSequenceInterval(label, id, start, end, client, intervalTy
364
415
  endRefType |= ReferenceType.StayOnRemove;
365
416
  }
366
417
  }
367
- const startLref = createPositionReference(client, startPos, beginRefType, op, fromSnapshot, undefined, startReferenceSlidingPreference(stickiness), startReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD, useNewSlidingBehavior, rollback);
368
- const endLref = createPositionReference(client, endPos, endRefType, op, fromSnapshot, undefined, endReferenceSlidingPreference(stickiness), endReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD, useNewSlidingBehavior, rollback);
418
+ const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
419
+ const startSlidingPreference = startReferenceSlidingPreference(startPos, startSide, endPos, endSide);
420
+ const startLref = createPositionReference({
421
+ client,
422
+ pos: startPos,
423
+ refType: beginRefType,
424
+ op,
425
+ fromSnapshot,
426
+ slidingPreference: startSlidingPreference,
427
+ canSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,
428
+ rollback,
429
+ });
430
+ const endSlidingPreference = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);
431
+ const endLref = createPositionReference({
432
+ client,
433
+ pos: endPos,
434
+ refType: endRefType,
435
+ op,
436
+ fromSnapshot,
437
+ slidingPreference: endSlidingPreference,
438
+ canSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,
439
+ rollback,
440
+ });
369
441
  const rangeProp = {
370
442
  [reservedRangeLabelsKey]: [label],
371
443
  };