Skip to content
On this page

Module: features/feature

Enumerations

Visibility

Visibility: Object

Enum for what the visibility of a feature or component should be

NameTypeDescription
Hidden1The feature or component should not appear but still take up space
None2The feature or component should not appear not take up space
Visible0The feature or component should be visible

Defined in

profectus/src/features/feature.ts:61

Type Aliases

CoercableComponent

Ƭ CoercableComponent: string | DefineComponent | JSXFunction

Any value that can be coerced into (or is) a vue component

Defined in

profectus/src/features/feature.ts:25


GenericComponent

Ƭ GenericComponent: DefineComponent<any, any, any>

A type that refers to any vue component

Defined in

profectus/src/features/feature.ts:35


JSXFunction

Ƭ JSXFunction: () => JSX.Element & { [DoNotCache]: true }

A type referring to a function that returns JSX and is marked that it shouldn't be wrapped in a ComputedRef

See

jsx

Defined in

profectus/src/features/feature.ts:21


OptionsFunc

Ƭ OptionsFunc<T, R, S>: (obj: R) => OptionsObject<T, R, S>

Type parameters

NameType
TT
Runknown
SR

Type declaration

▸ (obj): OptionsObject<T, R, S>

Utility function for a function that returns an object of a given type, with "this" bound to what the type will eventually be processed into. Intended for making lazily evaluated objects.

Parameters
NameType
objR
Returns

OptionsObject<T, R, S>

Defined in

profectus/src/features/feature.ts:45


OptionsObject

Ƭ OptionsObject<T, R, S>: T & Partial<R> & ThisType<T & S>

Type parameters

NameType
TT
Runknown
SR

Defined in

profectus/src/features/feature.ts:47


Replace

Ƭ Replace<T, S>: S & Omit<T, keyof S>

Utility type that is S, with any properties from T that aren't already present in S

Type parameters

Name
T
S

Defined in

profectus/src/features/feature.ts:38


StyleValue

Ƭ StyleValue: string | CSSProperties | (string | CSSProperties)[]

Any value that can be passed into an HTML element's style attribute. Note that Profectus uses its own StyleValue and CSSProperties that are extended, in order to have additional properties added to them, such as variable CSS variables.

Defined in

profectus/src/features/feature.ts:31

Variables

Component

Const Component: typeof Component

A symbol to use as a key for a vue component a feature can be rendered with

See

VueFeature

Defined in

profectus/src/features/feature.ts:10


GatherProps

Const GatherProps: typeof GatherProps

A symbol to use as a key for a prop gathering function that a feature can use to send to its component

See

VueFeature

Defined in

profectus/src/features/feature.ts:15

Functions

excludeFeatures

excludeFeatures(obj, ...types): unknown[]

Traverses an object and returns all features that are not any of the given types. Features are any object with a "type" property that has a symbol value.

Parameters
NameTypeDescription
objRecord<string, unknown>The object to traverse
...typessymbol[]The feature types that will be skipped over
Returns

unknown[]

Defined in

profectus/src/features/feature.ts:130


findFeatures

findFeatures(obj, ...types): unknown[]

Traverses an object and returns all features of the given type(s)

Parameters
NameTypeDescription
objRecord<string, unknown>The object to traverse
...typessymbol[]The feature types that will be searched for
Returns

unknown[]

Defined in

profectus/src/features/feature.ts:105


getUniqueID

getUniqueID(prefix?): string

Gets a unique ID to give to each feature, used for any sort of system that needs to identify elements in the DOM rather than references to the feature itself. (For example, branches) IDs are guaranteed unique, but NOT persistent - they likely will change between updates.

Parameters
NameTypeDefault valueDescription
prefixstring"feature-"A string to prepend to the id to make it more readable in the inspector tools
Returns

string

Defined in

profectus/src/features/feature.ts:56


isHidden

isHidden(visibility): boolean

NameType
visibilityProcessedComputable<boolean | Visibility>

Defined in

profectus/src/features/feature.ts:75


isVisible

isVisible(visibility): boolean

NameType
visibilityProcessedComputable<boolean | Visibility>

Defined in

profectus/src/features/feature.ts:70


jsx

jsx(func): JSXFunction

Takes a function and marks it as JSX so it won't get auto-wrapped into a ComputedRef. The function may also return empty string as empty JSX tags cause issues.

Parameters
NameType
func() => "" | Element
Returns

JSXFunction

Defined in

profectus/src/features/feature.ts:84


setDefault

setDefault<T, K>(object, key, value): asserts object is Exclude<T, K> & Required<Pick<T, K>>

Utility function to set a property on an object if and only if it doesn't already exist

Type parameters
NameType
TT
Kextends string | number | symbol
Parameters
NameType
objectT
keyK
valueT[K]
Returns

asserts object is Exclude<T, K> & Required<Pick<T, K>>

Defined in

profectus/src/features/feature.ts:90