@@ -531,21 +531,21 @@ interface CollectionComparators {
531531 is ( selector : string ) : boolean ;
532532 some ( fn : CollectionTestFn , thisArg ?: unknown ) : boolean ;
533533 every ( fn : CollectionTestFn , thisArg ?: unknown ) : boolean ;
534- same ( collection : Collection | Element$1 | string ) : boolean ;
535- anySame ( collection : Collection | Element$1 | string ) : boolean ;
536- allAreNeighbors ( collection : Collection | Element$1 | string ) : boolean ;
537- allAreNeighbours ( collection : Collection | Element$1 | string ) : boolean ;
538- contains ( collection : Collection | Element$1 | string ) : boolean ;
539- has ( collection : Collection | Element$1 | string ) : boolean ;
534+ same ( collection : SharedCollection | string ) : boolean ;
535+ anySame ( collection : SharedCollection | string ) : boolean ;
536+ allAreNeighbors ( collection : SharedCollection | string ) : boolean ;
537+ allAreNeighbours ( collection : SharedCollection | string ) : boolean ;
538+ contains ( collection : SharedCollection | string ) : boolean ;
539+ has ( collection : SharedCollection | string ) : boolean ;
540540}
541541//#endregion
542542//#region src/collection/filter.d.mts
543543/** A predicate run against each element of a collection. */
544544type FilterEleFn = ( ele : Element$1 , i : number , eles : Collection ) => boolean | unknown ;
545545/** Inputs accepted by `.filter()` and friends: selector string, predicate, or collection. */
546- type FilterArg = string | FilterEleFn | Collection | Element$1 | undefined | null ;
546+ type FilterArg = string | FilterEleFn | SharedCollection | undefined | null ;
547547/** Inputs accepted by set operations: selector string or collection. */
548- type SetArg = string | Collection | Element$1 | undefined | null ;
548+ type SetArg = string | SharedCollection | undefined | null ;
549549/** Result of `.diff()`/`.difference()`. */
550550interface DiffResult {
551551 left : Collection ;
@@ -1500,12 +1500,12 @@ interface RemoveDataFunc<Self> {
15001500//#region src/collection/data.d.mts
15011501/** Data/scratch accessors contributed to the collection prototype. */
15021502interface CollectionData {
1503- data : DataFunc < Collection > ;
1504- removeData : RemoveDataFunc < Collection > ;
1505- scratch : DataFunc < Collection > ;
1506- removeScratch : RemoveDataFunc < Collection > ;
1507- attr : DataFunc < Collection > ;
1508- removeAttr : RemoveDataFunc < Collection > ;
1503+ data : DataFunc < SharedCollection > ;
1504+ removeData : RemoveDataFunc < SharedCollection > ;
1505+ scratch : DataFunc < SharedCollection > ;
1506+ removeScratch : RemoveDataFunc < SharedCollection > ;
1507+ attr : DataFunc < SharedCollection > ;
1508+ removeAttr : RemoveDataFunc < SharedCollection > ;
15091509 id ( ) : string | undefined ;
15101510}
15111511//#endregion
@@ -1533,25 +1533,25 @@ type PositionFn = (ele: Element$1, i: number) => Position | undefined | false;
15331533 * full/partial Position, a (name, value) pair, or an event handler).
15341534 */
15351535interface PositionAccessor {
1536- ( this : Collection ) : Position ;
1537- ( this : Collection , pos : Partial < Position > ) : Collection ;
1538- ( this : Collection , name : string ) : number ;
1539- ( this : Collection , name : string , value : number ) : Collection ;
1540- ( this : Collection , handler : ( ...args : any [ ] ) => void ) : Collection ;
1536+ ( this : SharedCollection ) : Position ;
1537+ ( this : SharedCollection , pos : Partial < Position > ) : Collection ;
1538+ ( this : SharedCollection , name : string ) : number ;
1539+ ( this : SharedCollection , name : string , value : number ) : Collection ;
1540+ ( this : SharedCollection , handler : ( ...args : any [ ] ) => void ) : Collection ;
15411541}
15421542/** Position accessor methods contributed to the collection prototype. */
15431543interface CollectionPosition {
15441544 position : PositionAccessor ;
15451545 modelPosition : PositionAccessor ;
15461546 point : PositionAccessor ;
1547- positions ( this : Collection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1548- modelPositions ( this : Collection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1549- points ( this : Collection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1550- shift ( this : Collection , dim : Partial < Position > | string , val ?: number | boolean , silent ?: boolean ) : Collection ;
1551- renderedPosition ( this : Collection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1552- renderedPoint ( this : Collection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1553- relativePosition ( this : Collection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1554- relativePoint ( this : Collection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1547+ positions ( this : SharedCollection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1548+ modelPositions ( this : SharedCollection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1549+ points ( this : SharedCollection , pos : Partial < Position > | PositionFn , silent ?: boolean ) : Collection ;
1550+ shift ( this : SharedCollection , dim : Partial < Position > | string , val ?: number | boolean , silent ?: boolean ) : Collection ;
1551+ renderedPosition ( this : SharedCollection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1552+ renderedPoint ( this : SharedCollection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1553+ relativePosition ( this : SharedCollection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
1554+ relativePoint ( this : SharedCollection , dim ?: Partial < Position > | string , val ?: number ) : Position | number | Collection | undefined ;
15551555}
15561556//#endregion
15571557//#region src/collection/dimensions/bounds.d.mts
@@ -1571,11 +1571,11 @@ interface BoundingBoxOptions {
15711571}
15721572/** Bounding-box methods contributed to the collection prototype. */
15731573interface CollectionBounds {
1574- renderedBoundingBox ( this : Collection , options ?: BoundingBoxOptions ) : BoundingBox ;
1575- renderedBoundingbox ( this : Collection , options ?: BoundingBoxOptions ) : BoundingBox ;
1576- boundingBox ( this : Collection , options ?: BoundingBoxOptions ) : BoundingBox ;
1577- boundingbox ( this : Collection , options ?: BoundingBoxOptions ) : BoundingBox ;
1578- bb ( this : Collection , options ?: BoundingBoxOptions ) : BoundingBox ;
1574+ renderedBoundingBox ( this : SharedCollection , options ?: BoundingBoxOptions ) : BoundingBox ;
1575+ renderedBoundingbox ( this : SharedCollection , options ?: BoundingBoxOptions ) : BoundingBox ;
1576+ boundingBox ( this : SharedCollection , options ?: BoundingBoxOptions ) : BoundingBox ;
1577+ boundingbox ( this : SharedCollection , options ?: BoundingBoxOptions ) : BoundingBox ;
1578+ bb ( this : SharedCollection , options ?: BoundingBoxOptions ) : BoundingBox ;
15791579}
15801580//#endregion
15811581//#region src/collection/dimensions/width-height.d.mts
@@ -1725,11 +1725,11 @@ interface LayoutDimensions {
17251725}
17261726/** Layout methods contributed to the collection prototype. */
17271727interface CollectionLayout {
1728- layoutDimensions ( this : Collection , options : LayoutDimensionsOptions ) : LayoutDimensions ;
1729- layoutPositions ( this : Collection , layout : LayoutLike , options : LayoutOptions , fn : LayoutPositionFn ) : Collection ;
1730- layout ( this : Collection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
1731- createLayout ( this : Collection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
1732- makeLayout ( this : Collection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
1728+ layoutDimensions ( this : SharedCollection , options : LayoutDimensionsOptions ) : LayoutDimensions ;
1729+ layoutPositions ( this : SharedCollection , layout : LayoutLike , options : LayoutOptions , fn : LayoutPositionFn ) : Collection ;
1730+ layout ( this : SharedCollection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
1731+ createLayout ( this : SharedCollection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
1732+ makeLayout ( this : SharedCollection , options ?: Partial < LayoutOptions > ) : LayoutLike ;
17331733}
17341734//#endregion
17351735//#region src/collection/style.d.mts
@@ -1770,7 +1770,7 @@ interface CollectionSwitchFunctions {
17701770//#endregion
17711771//#region src/collection/traversing.d.mts
17721772/** Selector/filter argument accepted by traversal methods. */
1773- type SelectorArg = string | ( ( ele : Element$1 , i : number , eles : Collection ) => boolean | unknown ) | Collection | Element$1 | undefined | null ;
1773+ type SelectorArg = string | ( ( ele : Element$1 , i : number , eles : Collection ) => boolean | unknown ) | SharedCollection | undefined | null ;
17741774interface CollectionTraversing {
17751775 roots ( selector ?: SelectorArg ) : NodeCollection ;
17761776 leaves ( selector ?: SelectorArg ) : NodeCollection ;
@@ -1921,9 +1921,14 @@ interface Collection extends CollectionBaseFns, CollectionAlgorithms, Collection
19211921}
19221922/** A single element (node or edge); array-like of itself, length 1. */
19231923interface Element$1 extends Collection { }
1924- type PublicSelectorArg = string | Collection | Element$1 | ( ( ele : Element$1 , i : number , eles : Collection ) => boolean | unknown ) | undefined | null ;
1924+ type PublicSelectorArg = string | SharedCollection | ( ( ele : Element$1 , i : number , eles : Collection ) => boolean | unknown ) | undefined | null ;
19251925type Singular = Element$1 ;
1926- interface NodeCollection extends Collection {
1926+ /** Edge-only members hidden from the public node types. */
1927+ type EdgeOnlyKeys = 'source' | 'target' | 'sources' | 'targets' | 'connectedNodes' | 'parallelEdges' | 'codirectedEdges' | 'isLoop' | 'isSimple' | 'midpoint' | 'controlPoints' | 'segmentPoints' | 'sourceEndpoint' | 'targetEndpoint' | 'renderedMidpoint' | 'renderedControlPoints' | 'renderedSegmentPoints' | 'renderedSourceEndpoint' | 'renderedTargetEndpoint' ;
1928+ /** Node-only members hidden from the public edge types. */
1929+ type NodeOnlyKeys = 'parent' | 'parents' | 'ancestors' | 'commonAncestors' | 'children' | 'siblings' | 'descendants' | 'roots' | 'leaves' | 'orphans' | 'nonorphans' | 'isParent' | 'isChild' | 'isChildless' | 'isOrphan' | 'connectedEdges' | 'edgesWith' | 'edgesTo' | 'degree' | 'indegree' | 'outdegree' | 'totalDegree' | 'minDegree' | 'maxDegree' | 'minIndegree' | 'maxIndegree' | 'minOutdegree' | 'maxOutdegree' | 'incomers' | 'outgoers' | 'successors' | 'predecessors' | 'position' | 'positions' | 'modelPosition' | 'modelPositions' | 'point' | 'points' | 'relativePosition' | 'relativePoint' | 'renderedPosition' | 'renderedPoint' | 'shift' | 'grabbable' | 'grabbed' | 'grabify' | 'ungrabify' | 'lock' | 'unlock' | 'locked' | 'layoutDimensions' | 'layoutPositions' | 'affinityPropagation' | 'ap' | 'fuzzyCMeans' | 'fcm' | 'hierarchicalClustering' | 'hca' | 'kMeans' | 'kMedoids' ;
1930+ /** Node-kind return-type narrowings layered over the wide collection. */
1931+ interface NodeCollectionNarrowed {
19271932 parent ( selector ?: PublicSelectorArg ) : NodeCollection ;
19281933 parents ( selector ?: PublicSelectorArg ) : NodeCollection ;
19291934 ancestors ( selector ?: PublicSelectorArg ) : NodeCollection ;
@@ -1937,19 +1942,24 @@ interface NodeCollection extends Collection {
19371942 leaves ( selector ?: PublicSelectorArg ) : NodeCollection ;
19381943 connectedEdges ( selector ?: PublicSelectorArg ) : EdgeCollection ;
19391944}
1940- interface EdgeCollection extends Collection {
1945+ /** Edge-kind return-type narrowings layered over the wide collection. */
1946+ interface EdgeCollectionNarrowed {
19411947 source ( selector ?: PublicSelectorArg ) : NodeSingular ;
19421948 target ( selector ?: PublicSelectorArg ) : NodeSingular ;
19431949 sources ( selector ?: PublicSelectorArg ) : NodeCollection ;
19441950 targets ( selector ?: PublicSelectorArg ) : NodeCollection ;
1945- edgesWith ( otherNodes : string | Collection ) : EdgeCollection ;
1946- edgesTo ( otherNodes : string | Collection ) : EdgeCollection ;
19471951 connectedNodes ( selector ?: PublicSelectorArg ) : NodeCollection ;
19481952 parallelEdges ( selector ?: PublicSelectorArg ) : EdgeCollection ;
19491953 codirectedEdges ( selector ?: PublicSelectorArg ) : EdgeCollection ;
19501954}
1951- type NodeSingular = Singular & NodeCollection ;
1952- type EdgeSingular = Singular & EdgeCollection ;
1955+ type NodeNarrowedKeys = keyof NodeCollectionNarrowed ;
1956+ type EdgeNarrowedKeys = keyof EdgeCollectionNarrowed ;
1957+ /** Kind-agnostic collection: members common to both nodes and edges. */
1958+ type SharedCollection = Omit < Collection , EdgeOnlyKeys | NodeOnlyKeys > ;
1959+ type NodeCollection = Omit < Collection , EdgeOnlyKeys | NodeNarrowedKeys > & NodeCollectionNarrowed ;
1960+ type EdgeCollection = Omit < Collection , NodeOnlyKeys | EdgeNarrowedKeys > & EdgeCollectionNarrowed ;
1961+ type NodeSingular = Omit < Element$1 , EdgeOnlyKeys | NodeNarrowedKeys > & NodeCollectionNarrowed ;
1962+ type EdgeSingular = Omit < Element$1 , NodeOnlyKeys | EdgeNarrowedKeys > & EdgeCollectionNarrowed ;
19531963//#endregion
19541964//#region src/style/css-types.d.mts
19551965/**
0 commit comments