Skip to content

@vltpkg/dss-breadcrumb

Classes

Defined in: index.ts:169

The Breadcrumb class is used to represent a valid breadcrumb path that helps you traverse a graph and find a specific node or edge.

Alongside the traditional analogy, “Breadcrumb” is also being used here as a term used to describe the subset of the query language that uses only pseudo selectors, id selectors & combinators.

The Breadcrumb class implements a doubly-linked list of items that can be used to navigate through the breadcrumb. The InteractiveBreadcrumb can also be used to keep track of state of the current breadcrumb item that should be used for checks.

It also validates that each element of the provided query string is valid according to the previous definition of a “Breadcrumb” query language subset.

Implements

Constructors

new Breadcrumb()
new Breadcrumb(query): Breadcrumb

Defined in: index.ts:178

Initializes the interactive breadcrumb with a query string.

Parameters
query

string

Returns

Breadcrumb

Properties

comment
comment: undefined | string

Defined in: index.ts:171

Implementation of

ModifierBreadcrumb.comment

specificity
specificity: BreadcrumbSpecificity

Defined in: index.ts:172

Implementation of

ModifierBreadcrumb.specificity

Accessors

first
Get Signature
get first(): ModifierBreadcrumbItem

Defined in: index.ts:338

Retrieves the first breadcrumb item.

Returns

ModifierBreadcrumbItem

Implementation of

ModifierBreadcrumb.first

last
Get Signature
get last(): ModifierBreadcrumbItem

Defined in: index.ts:348

Retrieves the last breadcrumb item.

Returns

ModifierBreadcrumbItem

Implementation of

ModifierBreadcrumb.last

single
Get Signature
get single(): boolean

Defined in: index.ts:359

Returns true if the breadcrumb is composed of a single item.

Returns

boolean

Implementation of

ModifierBreadcrumb.single

Methods

[iterator]()
iterator: ArrayIterator<ModifierBreadcrumbItem>

Defined in: index.ts:363

Returns

ArrayIterator<ModifierBreadcrumbItem>

Implementation of
ModifierBreadcrumb.[iterator]
clear()
clear(): void

Defined in: index.ts:370

Empties the current breadcrumb list.

Returns

void

Implementation of

ModifierBreadcrumb.clear

interactive()
interactive(): InteractiveBreadcrumb

Defined in: index.ts:382

Gets an InteractiveBreadcrumb instance that can be used to track state of the current breadcrumb item.

Returns

InteractiveBreadcrumb

Implementation of

ModifierBreadcrumb.interactive


InteractiveBreadcrumb

Defined in: index.ts:391

The InteractiveBreadcrumb is used to keep track of state of the current breadcrumb item that should be used for checks.

Implements

Constructors

new InteractiveBreadcrumb()
new InteractiveBreadcrumb(breadcrumb): InteractiveBreadcrumb

Defined in: index.ts:395

Parameters

Breadcrumb

Returns

InteractiveBreadcrumb

Accessors

current
Get Signature
get current():
| undefined
| ModifierBreadcrumbItem

Defined in: index.ts:402

The current breadcrumb item.

Returns

| undefined | ModifierBreadcrumbItem

Implementation of
ModifierInteractiveBreadcrumb.current
done
Get Signature
get done(): boolean

Defined in: index.ts:409

Returns true if the current breadcrumb has no more items left.

Returns

boolean

Implementation of
ModifierInteractiveBreadcrumb.done

Methods

next()
next(): this

Defined in: index.ts:416

The next breadcrumb item.

Returns

this

Implementation of
ModifierInteractiveBreadcrumb.next

Interfaces

ModifierBreadcrumb

Defined in: types.ts:40

A breadcrumb is a linked list of items, where each item has a value and a type.

Extends

Properties

comment
comment: undefined | string

Defined in: types.ts:43

first
first: ModifierBreadcrumbItem

Defined in: types.ts:44

interactive()
interactive: () => ModifierInteractiveBreadcrumb

Defined in: types.ts:48

Returns

ModifierInteractiveBreadcrumb

last
last: ModifierBreadcrumbItem

Defined in: types.ts:45

single
single: boolean

Defined in: types.ts:46

specificity
specificity: BreadcrumbSpecificity

Defined in: types.ts:47

Methods

clear()
clear(): void

Defined in: types.ts:42

Returns

void

Type Aliases

type BreadcrumbSpecificity = object

Defined in: types.ts:4

The specificity of a breadcrumb, used for sorting.

Type declaration

commonCounter
commonCounter: number
idCounter
idCounter: number

InternalModifierComparatorOptions

type InternalModifierComparatorOptions = object

Defined in: types.ts:12

Options for the higher-level comparing breadcrumbs function.

Type declaration

range?
optional range: string;

ModifierBreadcrumbItem

type ModifierBreadcrumbItem = object

Defined in: types.ts:26

A valid item of a given breadcrumb.

Type declaration

comparator()
comparator: opts => boolean
Parameters
opts

ModifierComparatorOptions

Returns

boolean

importer
importer: boolean
name?
optional name: string;
next
next:
| ModifierBreadcrumbItem
| undefined;
prev
prev:
| ModifierBreadcrumbItem
| undefined;
type
type: string
value
value: string

ModifierComparatorOptions

type ModifierComparatorOptions = object

Defined in: types.ts:19

Options for comparing breadcrumbs.

Type declaration

semver?
optional semver: string;

ModifierInteractiveBreadcrumb

type ModifierInteractiveBreadcrumb = object

Defined in: types.ts:54

An interactive breadcrumb that holds state on what is the current item.

Type declaration

current
current:
| ModifierBreadcrumbItem
| undefined;
done
done: boolean
next()
next: () => ModifierInteractiveBreadcrumb
Returns

ModifierInteractiveBreadcrumb

Functions

extractPseudoParameter()

function extractPseudoParameter(item): ParsedPseudoParameters

Defined in: index.ts:86

Helper function to extract parameter value from pseudo selector nodes.

Parameters

item

any

Returns

ParsedPseudoParameters


getPseudoSelectorFullText()

function getPseudoSelectorFullText(item): string

Defined in: index.ts:122

Helper function to get the full text representation of a pseudo selector including parameters

Parameters

item

PostcssNode

Returns

string


parseBreadcrumb()

function parseBreadcrumb(query): ModifierBreadcrumb

Defined in: index.ts:426

Returns an Breadcrumb list of items for a given query string.

Parameters

query

string

Returns

ModifierBreadcrumb


removeQuotes()

function removeQuotes(value): string

Defined in: index.ts:80

Helper function to remove quotes from a string value.

Parameters

value

string

Returns

string


specificitySort()

function specificitySort(breadcrumbs): ModifierBreadcrumb[]

Defined in: index.ts:435

Sorts an array of Breadcrumb objects by specificity. Objects with higher idCounter values come first, if idCounter values are equal, then objects with higher commonCounter values come first. Otherwise, the original order is preserved.

Parameters

ModifierBreadcrumb[]

Returns

ModifierBreadcrumb[]