AttributeValue:
string
|number
|boolean
|undefined
Represents a value that can be assigned to an attribute.
ConfigValidator<
T
>: { [K in keyof T]: WritableWithDefaultOptions<T[K]> | undefined }
Represents a type that validates a configuration object.
• T extends object
The type of the configuration object to be validated.
This type maps each key of the configuration object T
to an optional
WritableWithDefaultOptions
type, allowing for partial validation.
Directive<
T
,U
>: (node
,args
) =>void
|object
Represents a directive function that can be applied to an SSRHTMLElement.
• T = void
The type of the arguments passed to the directive.
• U extends SSRHTMLElement
= SSRHTMLElement
The type of the SSRHTMLElement, defaults to SSRHTMLElement.
• node: U
The SSRHTMLElement to which the directive is applied.
• args: T
The arguments passed to the directive.
void
| object
An optional object that may contain:
update
: A function to update the directive with new arguments.destroy
: A function to clean up when the directive is no longer needed.DirectiveAndParam<
T
,U
>: [Directive
<T
,U
>,T
]
Represents a tuple containing a directive and its associated parameter.
• T
The type of the parameter associated with the directive.
• U extends SSRHTMLElement
= SSRHTMLElement
The type of the SSRHTMLElement, defaults to SSRHTMLElement.
DirectivesAndOptParam<
T
,U
>: { [K in keyof T]: Directive<void, U> | DirectiveAndParam<T[K], U> }
Represents a mapping of directives and their optional parameters.
• T extends any
[]
An array type representing the parameters for the directives.
• U extends SSRHTMLElement
= SSRHTMLElement
The type of the SSR HTML element, defaults to SSRHTMLElement
.
Extends<
T
,U
>:T
extendsU
?1
:0
A conditional type that checks if type T
extends type U
.
• T
The type to check.
• U
The type to check against.
1
if T
extends U
, otherwise 0
.
const
INVALID_VALUE: uniquesymbol
A unique symbol representing an invalid value. This can be used as a sentinel value to indicate that a variable or property does not hold a valid value.
IsSlotContent<
T
>:Extends
<T
,SlotContent
<any
>> |Extends
<SlotContent
<any
>,T
> extends1
?T
:0
Type utility to determine if a given type T
is or extends SlotContent<any>
.
This utility uses conditional types to check if T
extends SlotContent<any>
or if SlotContent<any>
extends T
.
If either condition is true, it returns T
, otherwise it returns 0
.
• T
The type to be checked.
T
if T
is or extends SlotContent<any>
, otherwise 0
.
NormalizeValue<
T
>: (value
) =>T
| typeofINVALID_VALUE
A type alias for a function that normalizes a value of type T
.
The function takes a value of type T
and returns either a normalized value of type T
or a special constant INVALID_VALUE
indicating that the value is invalid.
• T
The type of the value to be normalized.
• value: T
The value to be normalized.
T
| typeof INVALID_VALUE
The normalized value of type T
or INVALID_VALUE
if the value is invalid.
Interface representing the configuration for properties.
• U extends object
An object type representing the properties.
optional
config:ReadableSignal
<Partial
<U
>> |ValuesOrReadableSignals
<Partial
<U
>>
Either a store of objects containing, for each property, the default value, or an object containing, for each property, either a store containing the default value or the default value itself.
optional
props:ValuesOrWritableSignals
<U
>
Object containing, for each property, either its initial value, or a store that will contain the value at any time. When the value of a property is undefined or invalid, the value from the config is used.
SlotContent<
Props
>:CoreSlotContent
<Props
> | (props
) =>React.ReactNode
|React.ComponentType
<Props
> |React.ReactNode
Represents the content that can be rendered within a slot.
• Props extends object
= object
The type of the props that can be passed to the slot content.
This type can be one of the following:
null
or undefined
string
props
of type Props
and returns a React.ReactNode
.React.ComponentType<Props>
, which is a React component that accepts Props
.React.ReactNode
, which is any renderable React node.Represents a server-side rendered HTML element with limited functionality.
This interface extends a subset of the HTMLElement interface, providing methods to set and remove attributes, manipulate the element's classes, and partially manipulate the element's style.
It inherits the setAttribute and getAttribute methods from the HTMLElement interface.
classList:
Pick
<DOMTokenList
,"remove"
|"add"
|"toggle"
>
Object allowing to manipulate the classes of the element.
style:
Partial
<Record
<StyleKey
,StyleValue
>>
Object allowing to manipulate the style of the element.
StyleKey:
Exclude
<keyofCSSStyleDeclaration
,"length"
|"item"
|"parentRule"
|"getPropertyValue"
|"getPropertyPriority"
|"setProperty"
|"removeProperty"
| *typeof*Symbol.iterator
|number
|"cssText"
>
Represents a key of the CSSStyleDeclaration interface, excluding certain properties and methods.
This is useful for scenarios where you need to work with CSS properties directly without dealing with the methods and other non-style properties of CSSStyleDeclaration.
StyleValue:
string
|undefined
|null
Represents a value that can be used for styling purposes.
This type can be a string representing a style value, or it can be undefined or null. It is useful for scenarios where a style value might be optional or not set.
ValuesOrReadableSignals<
T
>: { [K in keyof T]?: ReadableSignal<T[K] | undefined> | T[K] }
A type that maps each property of an object type T
to either a ReadableSignal
of that property type or the property type itself.
• T extends object
The object type whose properties are being mapped.
ValuesOrWritableSignals<
T
>: { [K in keyof T]?: WritableSignal<T[K] | undefined> | T[K] }
A type that maps the properties of an object type T
to either a WritableSignal
of the property type or the property type itself.
• T extends object
The object type whose properties are being mapped.
Represents a generic widget with reactive state, stores, and various functionalities.
The type of the action handlers for user interactions.
• Props extends object
= object
The type of the properties that can be passed to the widget.
• State extends object
= object
The type of the state managed by the widget.
• Api extends object
= object
The type of the API functions available for interacting with the widget.
• Directives extends object
= object
The type of the directives used in the widget's template.
api:
Api
all the api functions to interact with the widget
directives:
Directives
directives to be used on html elements in the template of the widget or in the slots
state$:
ReadableSignal
<State
>
the reactive state of the widget, combining all the values served by the stores
stores: { [K in string | number | symbol as `${K & string}$`]: ReadableSignal<State[K]> }
the different stores of the widget, all reactive
patch(
parameters
):void
Modify the parameter values, and recalculate the stores accordingly
• parameters: Partial
<Props
>
void
WidgetFactory<
W
>: (props
?) =>W
A factory function type for creating instances of a widget.
• W extends Widget
The type of the widget that extends the base Widget type.
• props?: PropsConfig
<WidgetProps
<W
>>
Optional configuration properties for the widget.
W
An instance of the widget.
WidgetProps<
T
>:T
extendsobject
?U
:never
Extracts the type of the argument expected by the patch
method of a given type T
.
This utility type takes a generic type T
which must have a patch
method. The patch
method
should accept an argument that is a partial of some object type U
. If T
meets this condition,
WidgetProps
will resolve to the type U
. Otherwise, it will resolve to never
.
• T extends object
A type that includes a patch
method accepting a partial object.
Represents the context for a widget slot, providing access to the widget and its state.
• W extends Widget
The type of the widget.
api:
W
["api"
]
all the api functions to interact with the widget
directives:
W
["directives"
]
directives to be used on html elements in the template of the widget or in the slots
state:
WidgetState
<W
>
the state of the widget
WidgetState<
T
>:T
extendsobject
?U
:never
Extracts the state type from a widget type that contains a state$
property.
• T extends object
A type that extends an object with a state$
property of type SubscribableStore<any>
.
The type of the state contained within the state$
property if it extends an object, otherwise never
.
Interface representing options for a writable store with default values.
• T
The type of the value stored.
optional
equal: (a
,b
) =>boolean
the equal function, allowing to compare two values. used to check if a previous and current values are equals.
• a: T
• b: T
boolean
optional
normalizeValue:NormalizeValue
<T
>
the normalize value function. should return the INVALID_VALUE symbol when the provided value is invalid