Skip to content

@morph-mapper/source


@morph-mapper/source / useRelativePaths

Function: useRelativePaths() ​

useRelativePaths(): object

Defined in: hooks/use-relative-paths.ts:8

Returns ​

getRelativePathSelection ​

getRelativePathSelection: () => object[]

Filters the list of relative paths to only include those that have a partially equal value path to the selected absolute path.

Returns ​

object[]

onRelativePathChange ​

onRelativePathChange: (value) => void

Used to set the selected relative path to the one with the selected reference.

Parameters ​

value ​

string

Returns ​

void

pathModeIsAvailable ​

pathModeIsAvailable: (mode) => boolean

Used by UI elements to allow or block the activation of a certain path mode. Absolute paths are always available, but relative paths are only available if there are any present in the list of relative paths, and if one of the relative paths has a partially equal value path to the selected absolute path.

Parameters ​

mode ​

PathMode

Returns ​

boolean

setPathMode ​

setPathMode: (mode) => void

Used to set the path mode to either absolute or relative. When selecting relative, the selected relative path is set to the longest relative path that has a partially equal value path.

Parameters ​

mode ​

PathMode

Returns ​

void