-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3817301
commit b248af6
Showing
3 changed files
with
554 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
packages/common/src/types/command/legacy/DestinationDescriptorV6.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { | ||
PartialListTargetDescriptorV6, | ||
PartialPrimitiveTargetDescriptorV6, | ||
PartialRangeTargetDescriptorV6, | ||
} from "./PartialTargetDescriptorV6.types"; | ||
|
||
/** | ||
* The insertion mode to use when inserting relative to a target. | ||
* - `before` inserts before the target. Depending on the target, a delimiter | ||
* may be inserted after the inserted text. | ||
* - `after` inserts after the target. Depending on the target, a delimiter may | ||
* be inserted before the inserted text. | ||
* - `to` replaces the target. However, this insertion mode may also be used | ||
* when the target is really only a pseudo-target. For example, you could say | ||
* `"bring type air to bat"` even if `bat` doesn't already have a type. In | ||
* that case, `"take type bat"` wouldn't work, so `"type bat"` is really just | ||
* a pseudo-target in that situation. | ||
*/ | ||
type InsertionMode = "before" | "after" | "to"; | ||
|
||
interface PrimitiveDestinationDescriptor { | ||
type: "primitive"; | ||
|
||
/** | ||
* The insertion mode to use when inserting relative to {@link target}. | ||
*/ | ||
insertionMode: InsertionMode; | ||
|
||
target: | ||
| PartialPrimitiveTargetDescriptorV6 | ||
| PartialRangeTargetDescriptorV6 | ||
| PartialListTargetDescriptorV6; | ||
} | ||
|
||
/** | ||
* A list of destinations. This is used when the user uses more than one insertion mode | ||
* in a single command. For example, `"bring air after bat and before cap"`. | ||
*/ | ||
interface ListDestinationDescriptor { | ||
type: "list"; | ||
destinations: PrimitiveDestinationDescriptor[]; | ||
} | ||
|
||
/** | ||
* An implicit destination. This is used for e.g. `"bring air"` (note the user | ||
* doesn't explicitly specify the destination), or `"snip funk"`. | ||
*/ | ||
interface ImplicitDestinationDescriptor { | ||
type: "implicit"; | ||
} | ||
|
||
export type DestinationDescriptorV6 = | ||
| ListDestinationDescriptor | ||
| PrimitiveDestinationDescriptor | ||
| ImplicitDestinationDescriptor; |
Oops, something went wrong.