Reference
Classes
Breadcrumb
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): BreadcrumbDefined in: index.ts:178
Initializes the interactive breadcrumb with a query string.
Parameters
| Parameter | Type |
|---|---|
query | string |
Returns
Properties
| Property | Type |
|---|---|
comment | undefined | string |
specificity | BreadcrumbSpecificity |
Accessors
first
Get Signature
get first(): ModifierBreadcrumbItemDefined in: index.ts:338
Retrieves the first breadcrumb item.
Returns
Implementation of
last
Get Signature
get last(): ModifierBreadcrumbItemDefined in: index.ts:348
Retrieves the last breadcrumb item.
Returns
Implementation of
single
Get Signature
get single(): booleanDefined in: index.ts:359
Returns true if the breadcrumb is composed of a single item.
Returns
boolean
Implementation of
Methods
[iterator]()
iterator: ArrayIterator<ModifierBreadcrumbItem>Defined in: index.ts:363
Returns
ArrayIterator<ModifierBreadcrumbItem>
Implementation of
ModifierBreadcrumb.[iterator]clear()
clear(): voidDefined in: index.ts:370
Empties the current breadcrumb list.
Returns
void
Implementation of
interactive()
interactive(): InteractiveBreadcrumbDefined in: index.ts:382
Gets an InteractiveBreadcrumb instance that can be used to track state of the current breadcrumb item.
Returns
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): InteractiveBreadcrumbDefined in: index.ts:393
Parameters
| Parameter | Type |
|---|---|
breadcrumb | Breadcrumb |
Returns
Accessors
current
Get Signature
get current():
| undefined
| ModifierBreadcrumbItemDefined in: index.ts:400
The current breadcrumb item.
Returns
| undefined
| ModifierBreadcrumbItem
Implementation of
ModifierInteractiveBreadcrumb.currentdone
Get Signature
get done(): booleanDefined in: index.ts:407
Returns true if the current breadcrumb has no more items left.
Returns
boolean
Implementation of
ModifierInteractiveBreadcrumb.doneMethods
next()
next(): thisDefined in: index.ts:414
The next breadcrumb item.
Returns
this
Implementation of
ModifierInteractiveBreadcrumb.nextInterfaces
ModifierBreadcrumb
Defined in: types.ts:40
A breadcrumb is a linked list of items, where each item has a value and a type.
Extends
Iterable<ModifierBreadcrumbItem>
Properties
| Property | Type |
|---|---|
comment | undefined | string |
first | ModifierBreadcrumbItem |
interactive | () => ModifierInteractiveBreadcrumb |
last | ModifierBreadcrumbItem |
single | boolean |
specificity | BreadcrumbSpecificity |
Methods
clear()
clear(): voidDefined in: types.ts:41
Returns
void
Type Aliases
BreadcrumbSpecificity
type BreadcrumbSpecificity = object;Defined in: types.ts:4
The specificity of a breadcrumb, used for sorting.
Type declaration
| Name | Type |
|---|---|
commonCounter | number |
idCounter | number |
InternalModifierComparatorOptions
type InternalModifierComparatorOptions = object;Defined in: types.ts:12
Options for the higher-level comparing breadcrumbs function.
Type declaration
| Name | Type |
|---|---|
range? | string |
ModifierBreadcrumbItem
type ModifierBreadcrumbItem = object;Defined in: types.ts:26
A valid item of a given breadcrumb.
Type declaration
| Name | Type |
|---|---|
comparator | (opts) => boolean |
importer | boolean |
name? | string |
next | | ModifierBreadcrumbItem | undefined |
prev | | ModifierBreadcrumbItem | undefined |
type | string |
value | string |
ModifierComparatorOptions
type ModifierComparatorOptions = object;Defined in: types.ts:19
Options for comparing breadcrumbs.
Type declaration
| Name | Type |
|---|---|
semver? | string |
ModifierInteractiveBreadcrumb
type ModifierInteractiveBreadcrumb = object;Defined in: types.ts:53
An interactive breadcrumb that holds state on what is the current item.
Type declaration
| Name | Type |
|---|---|
current | | ModifierBreadcrumbItem | undefined |
done | boolean |
next | () => ModifierInteractiveBreadcrumb |
Functions
extractPseudoParameter()
function extractPseudoParameter(item): ParsedPseudoParametersDefined in: index.ts:86
Helper function to extract parameter value from pseudo selector nodes.
Parameters
| Parameter | Type |
|---|---|
item | any |
Returns
ParsedPseudoParameters
getPseudoSelectorFullText()
function getPseudoSelectorFullText(item): stringDefined in: index.ts:122
Helper function to get the full text representation of a pseudo selector including parameters
Parameters
| Parameter | Type |
|---|---|
item | PostcssNode |
Returns
string
parseBreadcrumb()
function parseBreadcrumb(query): ModifierBreadcrumbDefined in: index.ts:424
Returns an Breadcrumb list of items for a given query string.
Parameters
| Parameter | Type |
|---|---|
query | string |
Returns
removeQuotes()
function removeQuotes(value): stringDefined in: index.ts:80
Helper function to remove quotes from a string value.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
string
specificitySort()
function specificitySort(breadcrumbs): ModifierBreadcrumb[]Defined in: index.ts:433
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
| Parameter | Type |
|---|---|
breadcrumbs | ModifierBreadcrumb[] |