Bootstrap

API directive

attributesData

function

attributesData<T>(...directives): object

Returns an object with the attributes, style and class keys containing information derived from a list of directives.

  • The attributes value is a JSON representation of key/value attributes, excepted for the class and style attributes
  • The classNames value is an array of string representing the classes to be applied
  • The style value is a JSON representation of the styles to be applied
Type Parameters

T extends any[]

Parameters

• ...directives: DirectivesAndOptParam<T, SSRHTMLElement>

List of directives to generate attributes from. Each parameter can be the directive or an array with the directive and its parameter

Returns

object

JSON object with the attributes, class and style keys.

attributes

attributes: Record<string, string>

classNames

classNames: string[]

style

style: Partial<Record<StyleKey, StyleValue>>


AttributesDirectiveProps

interface

Properties for configuring server-side rendering directives.

Properties
attributes?

optional attributes: Record<string, AttributeValue | ReadableSignal<AttributeValue>>

Attributes to be added to the provided node.

Remarks

The style attribute must be added separately.


classNames?

optional classNames: Record<string, boolean | ReadableSignal<boolean>>

Class names to be added to an HTML element.

Remarks

Key-value pairs where keys are class names and values indicate whether the class should be added (true) or removed (false).


events?

optional events: Partial<object>

Events to be attached to an HTML element.

Type declaration
abort

abort: object | (this, event) => void

animationcancel

animationcancel: object | (this, event) => void

animationend

animationend: object | (this, event) => void

animationiteration

animationiteration: object | (this, event) => void

animationstart

animationstart: object | (this, event) => void

auxclick

auxclick: object | (this, event) => void

beforeinput

beforeinput: object | (this, event) => void

beforetoggle

beforetoggle: object | (this, event) => void

blur

blur: object | (this, event) => void

cancel

cancel: object | (this, event) => void

canplay

canplay: object | (this, event) => void

canplaythrough

canplaythrough: object | (this, event) => void

change

change: object | (this, event) => void

click

click: object | (this, event) => void

close

close: object | (this, event) => void

compositionend

compositionend: object | (this, event) => void

compositionstart

compositionstart: object | (this, event) => void

compositionupdate

compositionupdate: object | (this, event) => void

contextmenu

contextmenu: object | (this, event) => void

copy

copy: object | (this, event) => void

cuechange

cuechange: object | (this, event) => void

cut

cut: object | (this, event) => void

dblclick

dblclick: object | (this, event) => void

drag

drag: object | (this, event) => void

dragend

dragend: object | (this, event) => void

dragenter

dragenter: object | (this, event) => void

dragleave

dragleave: object | (this, event) => void

dragover

dragover: object | (this, event) => void

dragstart

dragstart: object | (this, event) => void

drop

drop: object | (this, event) => void

durationchange

durationchange: object | (this, event) => void

emptied

emptied: object | (this, event) => void

ended

ended: object | (this, event) => void

error

error: object | (this, event) => void

focus

focus: object | (this, event) => void

focusin

focusin: object | (this, event) => void

focusout

focusout: object | (this, event) => void

formdata

formdata: object | (this, event) => void

fullscreenchange

fullscreenchange: object | (this, event) => void

fullscreenerror

fullscreenerror: object | (this, event) => void

gotpointercapture

gotpointercapture: object | (this, event) => void

input

input: object | (this, event) => void

invalid

invalid: object | (this, event) => void

keydown

keydown: object | (this, event) => void

keypress

keypress: object | (this, event) => void

keyup

keyup: object | (this, event) => void

load

load: object | (this, event) => void

loadeddata

loadeddata: object | (this, event) => void

loadedmetadata

loadedmetadata: object | (this, event) => void

loadstart

loadstart: object | (this, event) => void

lostpointercapture

lostpointercapture: object | (this, event) => void

mousedown

mousedown: object | (this, event) => void

mouseenter

mouseenter: object | (this, event) => void

mouseleave

mouseleave: object | (this, event) => void

mousemove

mousemove: object | (this, event) => void

mouseout

mouseout: object | (this, event) => void

mouseover

mouseover: object | (this, event) => void

mouseup

mouseup: object | (this, event) => void

paste

paste: object | (this, event) => void

pause

pause: object | (this, event) => void

play

play: object | (this, event) => void

playing

playing: object | (this, event) => void

pointercancel

pointercancel: object | (this, event) => void

pointerdown

pointerdown: object | (this, event) => void

pointerenter

pointerenter: object | (this, event) => void

pointerleave

pointerleave: object | (this, event) => void

pointermove

pointermove: object | (this, event) => void

pointerout

pointerout: object | (this, event) => void

pointerover

pointerover: object | (this, event) => void

pointerup

pointerup: object | (this, event) => void

progress

progress: object | (this, event) => void

ratechange

ratechange: object | (this, event) => void

reset

reset: object | (this, event) => void

resize

resize: object | (this, event) => void

scroll

scroll: object | (this, event) => void

scrollend

scrollend: object | (this, event) => void

securitypolicyviolation

securitypolicyviolation: object | (this, event) => void

seeked

seeked: object | (this, event) => void

seeking

seeking: object | (this, event) => void

select

select: object | (this, event) => void

selectionchange

selectionchange: object | (this, event) => void

selectstart

selectstart: object | (this, event) => void

slotchange

slotchange: object | (this, event) => void

stalled

stalled: object | (this, event) => void

submit

submit: object | (this, event) => void

suspend

suspend: object | (this, event) => void

timeupdate

timeupdate: object | (this, event) => void

toggle

toggle: object | (this, event) => void

touchcancel

touchcancel: object | (this, event) => void

touchend

touchend: object | (this, event) => void

touchmove

touchmove: object | (this, event) => void

touchstart

touchstart: object | (this, event) => void

transitioncancel

transitioncancel: object | (this, event) => void

transitionend

transitionend: object | (this, event) => void

transitionrun

transitionrun: object | (this, event) => void

transitionstart

transitionstart: object | (this, event) => void

volumechange

volumechange: object | (this, event) => void

waiting

waiting: object | (this, event) => void

webkitanimationend

webkitanimationend: object | (this, event) => void

webkitanimationiteration

webkitanimationiteration: object | (this, event) => void

webkitanimationstart

webkitanimationstart: object | (this, event) => void

webkittransitionend

webkittransitionend: object | (this, event) => void

wheel

wheel: object | (this, event) => void

Remarks

Key-value pairs where keys are event types and values are event handlers.


styles?

optional styles: Partial<Record<StyleKey, StyleValue | ReadableSignal<StyleValue>>>

Styles to be added to an HTML element.

Remarks

Key-value pairs where keys are CSS style properties and values are style values.


bindDirective

function

bindDirective<T, U>(directive, directiveArg$): Directive<void, U>

Binds the given directive to a store that provides its argument.

Type Parameters

T

U extends SSRHTMLElement = SSRHTMLElement

Parameters

directive: Directive<T, U>

directive to bind

directiveArg$: ReadableSignal<T>

store containing the argument of the directive

Returns

Directive<void, U>

The bound directive that can be used with no argument.

Remarks

The returned directive can be used without argument, it will ignore any argument passed to it and will call the provided directive with the content of the provided store as its argument, calling its update method when the content of the store changes.


bindDirectiveNoArg

function

bindDirectiveNoArg<T, U>(directive): Directive<void, U>

Returns a directive that ignores any argument passed to it and calls the provided directive without any argument.

Type Parameters

T

U extends SSRHTMLElement = SSRHTMLElement

Parameters

directive: Directive<void | T, U>

directive to wrap

Returns

Directive<void, U>

The resulting directive.


browserDirective

function

browserDirective<T, U>(directive): Directive<T, SSRHTMLElement>

Creates a directive that wraps the provided directive to only run it in a browser environment (and not in a server-side rendering environment).

Type Parameters

T

U extends HTMLElement

Parameters

directive: Directive<T, U>

The directive to run only in a browser.

Returns

Directive<T, SSRHTMLElement>

The wrapped directive.


classDirective

function

classDirective(node, args): void | object

Directive that takes as an argument a string containing CSS classes to be put on the HTML element.

Parameters

node: SSRHTMLElement

args: string

Returns

void | object


createAttributesDirective

function

createAttributesDirective<T>(propsFn): Directive<T>

Creates a directive for server-side rendering with bindable elements. This directive binds events, attributes, styles, and classNames to an HTML element.

Type Parameters

T = void

Parameters

propsFn

A function that returns the AttributesDirectiveProps with the data to bind. This function can take an optional parameter that corrspond to the second parameter of the created directive.

Returns

Directive<T>

A directive object with bound events, attributes, styles, and classNames.


createBrowserStoreArrayDirective

function

createBrowserStoreArrayDirective(): object

Returns a directive and a store. The store contains at any time the array of all the DOM elements on which the directive is currently used.

Returns

object

An object with two properties: the directive property that is the directive to use on some DOM elements, and the elements$ property that is the store containing an array of all the elements on which the directive is currently used.

directive

directive: Directive<void, SSRHTMLElement>

elements$

elements$: ReadableSignal<HTMLElement[]>

Remarks

It is the same as createStoreArrayDirective, but the returned directive is only executed in a browser environment and the type of the elements is HTMLElement instead of SSRHTMLElement.

If the directive is intended to be used on a single element element, it may be more appropriate to use createBrowserStoreDirective instead.


createBrowserStoreDirective

function

createBrowserStoreDirective(): object

Returns a directive and a store. When the directive is used on a DOM element, the store contains that DOM element. When the directive is not used, the store contains null.

Returns

object

An object with two properties: the directive property that is the directive to use on one DOM element, and the element$ property that is the store containing the element on which the directive is currently used (or null if the store is not currently used).

directive

directive: Directive<void, SSRHTMLElement>

element$

element$: ReadableSignal<null | HTMLElement>

Remarks

It is the same as createStoreDirective, but the returned directive is only executed in a browser environment and the type of the element is HTMLElement instead of SSRHTMLElement.

If the directive is used on more than one element, an error is displayed in the console and the element is ignored. If the directive is intended to be used on more than one element, please use createStoreArrayDirective instead.


createStoreArrayDirective

function

createStoreArrayDirective(): object

Returns a directive and a store. The store contains at any time the array of all the DOM elements on which the directive is currently used.

Returns

object

An object with two properties: the directive property that is the directive to use on some DOM elements, and the elements$ property that is the store containing an array of all the elements on which the directive is currently used.

directive

directive: Directive

elements$

elements$: ReadableSignal<SSRHTMLElement[]>

Remarks

It is the same as createBrowserStoreArrayDirective, but the returned directive is also executed in a server environment and the type of the elements is SSRHTMLElement instead of HTMLElement.

If the directive is intended to be used on a single element element, it may be more appropriate to use createStoreDirective instead.


createStoreDirective

function

createStoreDirective(): object

Returns a directive and a store. When the directive is used on a DOM element, the store contains that DOM element. When the directive is not used, the store contains null.

Returns

object

An object with two properties: the directive property that is the directive to use on one DOM element, and the element$ property that is the store containing the element on which the directive is currently used (or null if the store is not currently used).

directive

directive: Directive

element$

element$: ReadableSignal<null | SSRHTMLElement>

Remarks

It is the same as createBrowserStoreDirective, but the returned directive is also executed in a server environment and the type of the element is SSRHTMLElement instead of HTMLElement.

If the directive is used on more than one element, an error is displayed in the console and the element is ignored. If the directive is intended to be used on more than one element, please use createStoreArrayDirective instead.


directiveAttributes

function

directiveAttributes<T>(...directives): Record<string, string>

Returns JSON representation of the attributes to be applied derived from a list of directives.

Type Parameters

T extends any[]

Parameters

• ...directives: DirectivesAndOptParam<T, SSRHTMLElement>

List of directives to generate attributes from. Each parameter can be the directive or an array with the directive and its parameter

Returns

Record<string, string>

JSON object with name/value for the attributes


directiveSubscribe

function

directiveSubscribe(store, asyncUnsubscribe): Directive

Returns a directive that subscribes to the given store while it is used on a DOM element, and that unsubscribes from it when it is no longer used.

Parameters

store: ReadableSignal<any>

store on which there will be an active subscription while the returned directive is used.

asyncUnsubscribe: boolean = true

true if unsubscribing from the store should be done asynchronously (which is the default), and false if it should be done synchronously when the directive is destroyed

Returns

Directive

The resulting directive.


directiveUpdate

function

directiveUpdate<T>(update): Directive<T>

Returns a directive that calls the provided function with the arguments passed to the directive on initialization and each time they are updated.

Type Parameters

T

Parameters

update

Function called with the directive argument when the directive is initialized and when its argument is updated.

Returns

Directive<T>

The resulting directive.


isBrowserHTMLElement

function

isBrowserHTMLElement(element): element is HTMLElement

On a browser environment, returns true if the given element is an HTMLElement. On a server environment, always returns false.

Parameters

element: SSRHTMLElement

The element to check.

Returns

element is HTMLElement

true in a browser environment if the given element is an HTMLElement, otherwise false.


mapDirectiveArg

function

mapDirectiveArg<T, U, V>(directive, fn): Directive<T, V>

Maps the argument to another argument of a directive using a provided function.

Type Parameters

T

U

V extends SSRHTMLElement = SSRHTMLElement

Parameters

directive: Directive<U, V>

The directive to be applied.

fn

The function to map the argument.

Returns

Directive<T, V>

A new directive that applies the mapping function to the argument.


mergeDirectives

function

mergeDirectives<T, U>(...args): Directive<T, U>

Merges multiple directives into a single directive that executes all of them when called.

Type Parameters

T

U extends SSRHTMLElement = SSRHTMLElement

Parameters

• ...args: (Directive<T, U> | Directive<void, U>)[]

directives to merge into a single directive.

Returns

Directive<T, U>

The resulting merged directive.

Remarks

All directives receive the same argument upon initialization and update. Directives are created and updated in the same order as they appear in the arguments list, they are destroyed in the reverse order. All calls to the directives (to create, update and destroy them) are wrapped in a call to the batch function of tansu


multiDirective

function

multiDirective<T, U>(element, directives): object

Directive that applies all the directives passed as arguments.

Type Parameters

T extends any[]

U extends SSRHTMLElement = SSRHTMLElement

Parameters

element: U

the element to apply the directives to

directives: DirectivesAndOptParam<T, U>

the directives to apply

Returns

object

The directive instance.

destroy

destroy: () => void

Returns

void

update

update: (directives) => void

Parameters

directives: (Directive<void, U> | DirectiveAndParam<any, U>)[]

Returns

void


registrationArray

function

registrationArray<T>(): ReadableSignal<T[]> & object

Utility to create a store that contains an array of items.

Type Parameters

T

Returns

ReadableSignal<T[]> & object

a store containing an array of items.


ssrAttributes

function

ssrAttributes<T>(...directives): object

Same as directiveAttributes, but returns an empty object when run in a browser environement.

Type Parameters

T extends any[]

Parameters

• ...directives: any

Returns

object

JSON object with name/value for the attributes


UseDirective

class
Type Parameters

T

Implements
Constructors
new UseDirective

new UseDirective<T>(): UseDirective<T>

Returns

UseDirective<T>

Properties
use

use: undefined | Directive | DirectiveAndParam<T>

Methods
ngOnChanges

ngOnChanges(): void

Returns

void

Inherit Doc
Implementation of

OnChanges.ngOnChanges


useDirectiveForHost

function

useDirectiveForHost<T>(directive?, params?): object

Set up an agnos-ui directive as an angular host directive.

Type Parameters

T

Parameters

directive?: Directive<T>

the directive

params?: T

the params to pass to the directive

Returns

object

the update function to change the directive or params

update

update: (newDirective?, newParams?) => void

Parameters

newDirective?: Directive<T>

newParams?: T

Returns

void


UseMultiDirective

class
Type Parameters

T extends any[]

Implements
Constructors
new UseMultiDirective

new UseMultiDirective<T>(): UseMultiDirective<T>

Returns

UseMultiDirective<T>

Properties
useMulti

useMulti: DirectivesAndOptParam<T, SSRHTMLElement>

Methods
ngOnChanges

ngOnChanges(): void

Returns

void

Inherit Doc
Implementation of

OnChanges.ngOnChanges