@codemirror/state 6.1.4 → 6.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.2.0 (2022-12-26)
2
+
3
+ ### New features
4
+
5
+ `EditorSelection.range` now accepts an optional 4th argument to specify the bidi level of the range's head position.
6
+
1
7
  ## 6.1.4 (2022-11-15)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1516,10 +1516,11 @@ class EditorSelection {
1516
1516
  /**
1517
1517
  Create a selection range.
1518
1518
  */
1519
- static range(anchor, head, goalColumn) {
1520
- let goal = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */;
1521
- return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | goal | 8 /* RangeFlag.AssocAfter */)
1522
- : SelectionRange.create(anchor, head, goal | (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0));
1519
+ static range(anchor, head, goalColumn, bidiLevel) {
1520
+ let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
1521
+ (bidiLevel == null ? 3 : Math.min(2, bidiLevel));
1522
+ return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
1523
+ : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
1523
1524
  }
1524
1525
  /**
1525
1526
  @internal
package/dist/index.d.ts CHANGED
@@ -476,7 +476,7 @@ declare class EditorSelection {
476
476
  /**
477
477
  Create a selection range.
478
478
  */
479
- static range(anchor: number, head: number, goalColumn?: number): SelectionRange;
479
+ static range(anchor: number, head: number, goalColumn?: number, bidiLevel?: number): SelectionRange;
480
480
  }
481
481
 
482
482
  declare type FacetConfig<Input, Output> = {
package/dist/index.js CHANGED
@@ -1511,10 +1511,11 @@ class EditorSelection {
1511
1511
  /**
1512
1512
  Create a selection range.
1513
1513
  */
1514
- static range(anchor, head, goalColumn) {
1515
- let goal = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */;
1516
- return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | goal | 8 /* RangeFlag.AssocAfter */)
1517
- : SelectionRange.create(anchor, head, goal | (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0));
1514
+ static range(anchor, head, goalColumn, bidiLevel) {
1515
+ let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
1516
+ (bidiLevel == null ? 3 : Math.min(2, bidiLevel));
1517
+ return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
1518
+ : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
1518
1519
  }
1519
1520
  /**
1520
1521
  @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/state",
3
- "version": "6.1.4",
3
+ "version": "6.2.0",
4
4
  "description": "Editor state data structures for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",