claspocommon
@claspo/common / DefaultEventEmitter
DefaultEventEmitter
default
A simple event emitter implementation for pub/sub communication. Supports named events and wildcard listeners that receive all events.
Example
const emitter = new DefaultEventEmitter();
const subscription = emitter.on('user:login', (data) => console.log(data));
emitter.emit('user:login', { userId: 123 });
subscription.off(); // UnsubscribeConstructors
Constructor
new default(): default;Creates a new DefaultEventEmitter instance.
Returns
Methods
createDefaultListenersState()
static createDefaultListenersState(): ListenersMap;Creates the initial listeners state with wildcard listener support.
Returns
ListenersMap
Empty listeners map with wildcard entry
emit()
emit(
eventName,
value,
params): void;Emits an event to all registered listeners. Also triggers wildcard listeners that receive all events.
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | The name of the event to emit |
value | any | The value to pass to listeners |
params | any | Optional additional parameters |
Returns
void
on()
on(eventName, listener): {
off: () => void;
};Registers a listener for a specific event. Use '*' as event name to listen to all events.
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | The event name to listen for |
listener | EventCallback | The callback function to invoke when the event is emitted |
Returns
{
off: () => void;
}An object with an off method to unsubscribe
| Name | Type |
|---|---|
off() | () => void |
destroy()
destroy(): void;Removes all event listeners and resets the emitter to initial state.
Returns
void
Properties
@claspo/common / LayoutType
LayoutType
LayoutType
Enumeration of widget layout types. Determines how the widget is positioned and displayed on the page.
Enumeration Members
@claspo/common / RenderMode
RenderMode
RenderMode
Enumeration of widget rendering modes. Determines how the widget responds to model changes.
Enumeration Members
@claspo/common / WidgetInitConfig.interface
WidgetInitConfig.interface
WidgetInitConfigI
Configuration interface for initializing a widget.
Indexable
[key: string]: anyAllows additional custom properties
Properties
| Property | Type | Description |
|---|---|---|
documentModel | ClDocumentI | Document model containing widget structure and content |
layoutType | LayoutType | Layout type |
widgetType | WidgetType | Widget type |
staticResourcesUrl | string | Base URL for loading static resources |
browserLanguage? | string | Needs for components localization |
appearanceLanguage? | string | Needed for Multi-language widget. |
optionalDocumentStyles? | Record<string, string> | Additional CSS custom properties to apply * |
viewIndex? | number | Initial view (page) index to display |
prizePoolModels? | PrizePoolModelI[] | Prize pool models for gamification features |
bundledComponentClasses? | any[] | Pre-bundled component classes for static rendering |
translations? | TranslationsI | Needed only for Multi-language widgets. Translation strings for internationalization |
trackingService? | TrackingServiceI | Service for tracking user interactions (view, click, etc.) |
zIndex? | number | CSS z-index value for the widget container |
disableLayoutAnimations? | boolean | Disables layout animations* |
disableGlobalScroll? | boolean | Disables global scroll locking when widget is open |
hostUrl? | string | Host URL for API requests |
TrackingServiceI
Service interface for tracking user interactions and events.
Properties
TranslationsI
type TranslationsI = Record<string, Record<string, string>>;Translation dictionary mapping language codes to key-value translation pairs.
@claspo/common / WidgetType
WidgetType
WidgetType
Enumeration of widget types. Defines the primary purpose and behavior of a widget.
Enumeration Members
@claspo/common / async/debounce
async/debounce
default()
function default<T>(func, timeout): DebouncedFunction<T>;Creates a debounced version of a function that delays execution until after the specified timeout has elapsed since the last call.
Type Parameters
| Type Parameter | Description |
|---|---|
T extends (...args) => any | The function type to debounce |
Parameters
| Parameter | Type | Description |
|---|---|---|
func | T | The function to debounce |
timeout | number | Delay in milliseconds before executing (default: 300) |
Returns
DebouncedFunction<T>
A debounced version of the function
Example
const debouncedSearch = debounce((query: string) => {
fetch(`/api/search?q=${query}`);
}, 500);@claspo/common / component-manifest/ComponentManifest.interface
component-manifest/ComponentManifest.interface
ManifestMappingType
Field mapping types for integration field configuration.
Enumeration Members
ComponentManifestI
Component manifest defining component configuration, properties, and editor controls.
Properties
| Property | Type | Description |
|---|---|---|
name | string | Component name for registration |
componentType | ClComponentType | Component type identifier |
version | string | Component version |
contextMenuModel | BaseContextMenuManifestModelI[] | Context menu configuration for editor |
floatingControlsModel | BaseFloatingControlManifestModelI[] | Floating controls configuration for editor |
propertyPaneModel | PropertyPaneManifestI | Property pane configuration for editor |
props | ClBaseComponentPropsI | Default component properties |
metaDescription | ComponentManifestMetaDescriptionI | Component metadata for editor display |
i18nPropertyPaneModel? | PropertyPaneManifestI | Property pane for i18n settings |
i18nPropPaths? | string[] | Property paths that support internationalization for multilingual content. The editor extracts values from these paths and sends them to an AI-based translator. The renderer then replaces the original values with the translated results using the same paths. Example [ "content,label", "control,options,[id],label" ] Note: [id] extracts all object keys |
focusParentOnClick? | boolean | If true, clicking current component focuses it's parent component |
preventDraggable? | boolean | If true, prevents drag operations for current component |
recursiveRemove? | boolean | If true, removes children when component is removed |
i18n? | ComponentManifestTranslationI | Translation strings by language. Used by components (e.g. error messages). Example { * "en": { * "control,validation,validationErrors,REQUIRED": "Required field", * }, * |
children? | ClBaseComponentI[] | Default child components |
mappingTypes? | ManifestMappingType[] | Field mapping types that component can handle |
focusableElements? | string[] | Element names that can receive focus |
actionsConditions? | { remove?: string; replace?: string; cut?: string; copy?: string; duplicate?: string; paste?: string; move?: string; } | Conditions for enabling/disabling editor actions |
actionsConditions.remove? | string | - |
actionsConditions.replace? | string | - |
actionsConditions.cut? | string | - |
actionsConditions.copy? | string | - |
actionsConditions.duplicate? | string | - |
actionsConditions.paste? | string | - |
actionsConditions.move? | string | - |
autoContrast? | AutoContrastI[] | Auto-contrast configuration for color adjustments |
keepGeneralTabOpenUntilInteracted? | boolean | If true, keeps general tab open until user interacts |
isExternalStartCapable? | boolean | If true, component can be started externally |
waitForResourcesLoad? | boolean | If true, waits for resources to load before showing |
ComponentManifestTranslationI
Translation strings organized by language code.
Indexable
[languageCode: string]: ComponentManifestTranslationItemIComponentManifestTranslationItemI
Translation items mapping property paths to translated values.
Indexable
[propPath: string]: stringComponentManifestMetaDescriptionI
Component metadata for editor display and sorting.
Properties
| Property | Type | Description |
|---|---|---|
label | ComponentManifestDescriptionLabelItemI | Display labels by language |
sortWeight? | number | Sort weight for ordering in component list |
icon? | string | Icon identifier for component |
ComponentManifestDescriptionLabelItemI
Component labels by language code.
Indexable
[languageCode: string]: stringAutoContrastI
Auto-contrast configuration for automatic color adjustments.
Properties
| Property | Type | Description |
|---|---|---|
master | AutoContrastMemberI | Master color source |
slave | AutoContrastMemberI | Slave color to adjust |
enabledPropPath | string[] | Property path to enabled flag |
AutoContrastMemberI
Member of an auto-contrast pair.
Properties
@claspo/common / component-manifest/ContextMenuManifest.interface
component-manifest/ContextMenuManifest.interface
ContextMenuManifestModelType
Context menu item types.
Enumeration Members
ContextMenuManifestModelName
Predefined context menu control names.
Enumeration Members
BaseContextMenuManifestModelI
Base interface for context menu manifest items.
Extended by
Properties
| Property | Type | Description |
|---|---|---|
type | ContextMenuManifestModelType | Item type (group or control) |
name? | ContextMenuManifestModelName | Predefined control name |
propPath? | string[] | Property path in component model |
element? | string | Target element name |
elementProp? | string | Element property name |
elementSubProp? | string | Element sub-property name |
children? | BaseContextMenuManifestModelI[] | Child menu items |
GroupContextMenuManifestModelI
Base interface for context menu manifest items.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | ContextMenuManifestModelType | Item type (group or control) |
name? | ContextMenuManifestModelName | Predefined control name |
propPath? | string[] | Property path in component model |
element? | string | Target element name |
elementProp? | string | Element property name |
elementSubProp? | string | Element sub-property name |
children | BaseContextMenuManifestModelI[] | Child menu items |
FocusParentComponentContextMenuManifestModelI
Base interface for context menu manifest items.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | ContextMenuManifestModelType | Item type (group or control) |
name? | ContextMenuManifestModelName | Predefined control name |
propPath? | string[] | Property path in component model |
element? | string | Target element name |
elementProp? | string | Element property name |
elementSubProp? | string | Element sub-property name |
children? | BaseContextMenuManifestModelI[] | Child menu items |
params? | FocusParentComponentContextMenuManifestParamsI | - |
FocusParentComponentContextMenuManifestParamsI
Properties
| Property | Type |
|---|---|
hideForEntryType | ClComponentType |
@claspo/common / component-manifest/FloatingControlManifest.interface
component-manifest/FloatingControlManifest.interface
FloatingControlManifestModelType
Floating control item types.
Enumeration Members
FloatingControlManifestModelName
Predefined floating control names.
Enumeration Members
BaseFloatingControlManifestModelI
Base interface for floating control manifest items. Floating controls appear around selected components in the editor.
Extended by
GroupFloatingControlManifestModelISizeFloatingControlManifestModelIColumnsProportionsFloatingControlManifestModelIViewSwitcherFloatingControlsManifestModelI
Properties
| Property | Type | Description |
|---|---|---|
type | FloatingControlManifestModelType | - |
name? | FloatingControlManifestModelName | - |
propPath? | string[] | - |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
children? | BaseFloatingControlManifestModelI[] | Child controls |
params? | any | Control-specific parameters |
GroupFloatingControlManifestModelI
Base interface for floating control manifest items. Floating controls appear around selected components in the editor.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | FloatingControlManifestModelType | - |
name? | FloatingControlManifestModelName | - |
propPath? | string[] | - |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
params? | any | Control-specific parameters |
children | BaseFloatingControlManifestModelI[] | Child controls |
SizeFloatingControlManifestModelI
Base interface for floating control manifest items. Floating controls appear around selected components in the editor.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | FloatingControlManifestModelType | - |
name? | FloatingControlManifestModelName | - |
propPath? | string[] | - |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
children? | BaseFloatingControlManifestModelI[] | Child controls |
params? | { width?: SizeDimensionFloatingControlManifestParamsI; height?: SizeDimensionFloatingControlManifestParamsI; rotation?: RotationFloatingControlManifestParamsI; } | Control-specific parameters |
params.width? | SizeDimensionFloatingControlManifestParamsI | - |
params.height? | SizeDimensionFloatingControlManifestParamsI | - |
params.rotation? | RotationFloatingControlManifestParamsI | - |
SizeDimensionFloatingControlManifestParamsI
Properties
RotationFloatingControlManifestParamsI
Properties
ColumnsProportionsFloatingControlManifestModelI
Base interface for floating control manifest items. Floating controls appear around selected components in the editor.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | FloatingControlManifestModelType | - |
name? | FloatingControlManifestModelName | - |
propPath? | string[] | - |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
children? | BaseFloatingControlManifestModelI[] | Child controls |
params? | ColumnsProportionsFloatingControlManifestParamsI | Control-specific parameters |
ColumnsProportionsFloatingControlManifestParamsI
Properties
ViewSwitcherFloatingControlsManifestModelI
Base interface for floating control manifest items. Floating controls appear around selected components in the editor.
Extends
Properties
| Property | Type | Description |
|---|---|---|
type | FloatingControlManifestModelType | - |
name? | FloatingControlManifestModelName | - |
propPath? | string[] | - |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
children? | BaseFloatingControlManifestModelI[] | Child controls |
params | { views: ViewSwitcherFloatingControlsManifestViewI[]; } | Control-specific parameters |
params.views | ViewSwitcherFloatingControlsManifestViewI[] | - |
ViewSwitcherFloatingControlsManifestViewI
Properties
@claspo/common / component-manifest/PropertyPaneManifest.interface
component-manifest/PropertyPaneManifest.interface
PropertyPaneManifestModelType
Enumeration Members
ClPropertyPaneManifestModelName
Enumeration Members
TabPropertyPaneManifestType
Enumeration Members
TextPropertyPaneManifestParamsType
Enumeration Members
SizePropertyPaneOption
Enumeration Members
IndentationPropertyPaneManifestType
Enumeration Members
PropertyPaneManifestI
Property pane manifest defining editor panel structure.
Properties
| Property | Type | Description |
|---|---|---|
content | BasePropertyPaneManifestModelI[] | Content tab controls |
general? | BasePropertyPaneManifestModelI[] | General/style tab controls |
header? | BasePropertyPaneManifestModelI[] | Header controls |
BasePropertyPaneManifestModelI
Base interface for property pane controls and groups.
Extended by
GroupPropertyPaneManifestModelIBorderPropertyPaneManifestModelIBackgroundPropertyPaneManifestModelITabPropertyPaneManifestModelITextPropertyPaneManifestModelISizePropertyPaneManifestModelIIndentationPropertyPaneManifestModelIHoverAnimationPropertyPaneManifestModelIColorSelectPropertyPaneManifestModelITextInputPropertyPaneManifestModelISwitchPropertyPaneManifestModelISwitchWithInputPropertyPaneManifestModelIDisplayPropertyPaneManifestModelIInputValidationPropertyPaneManifestModelISelectPropertyPaneManifestModelITextStylesPropertyPaneManifestModelIRadioButtonsPropertyPaneManifestModelIOptionsPropertyPaneManifestModelIDatepickerPropertyPaneManifestModelIFloatingComponentPositionPropertyPaneManifestModelIActionsPropertyPaneManifestModelIIntegrationFieldMappingPropertyPaneManifestModelIInsertBlockPropertyPaneManifestModelIIconSelectPaneManifestModelIPrizeSettingsPropertyPaneManifestModelI
Properties
| Property | Type | Description |
|---|---|---|
type | PropertyPaneManifestModelType | - |
name? | ClPropertyPaneManifestModelName | only CONTROL type requires this field |
propPath? | string[] | propPath is used to specify full path to the prop unline combination of element, elementProp and optional elementSubProp |
element? | string | - |
elementProp? | string | - |
elementSubProp? | string | - |
propPathCondition? | string | - |
params? | any | - |
displayCondition? | string | - |
hideSyncSelect? | boolean | - |
syncSelectDisplayCondition? | string | - |
syncSelectOptions? | (string | null)[] | - |
children? | BasePropertyPaneManifestModelI[] | only GROUP type requires this field |
DisableControlIfPropPathMatchValueParamsI
Properties
TransformerConfig
Type Parameters
| Type Parameter |
|---|
TParams |
Properties
GroupPropertyPaneManifestModelI
Extends
Properties
| Property | Type | Description |
|---|---|---|
children | BasePropertyPaneManifestModelI[] | only GROUP type requires this field |
BorderPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params? | BorderPropertyPaneManifestParamsI |
BorderPropertyPaneManifestParamsI
Properties
BackgroundPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params? | BackgroundPropertyPaneManifestParamsI |
BackgroundPropertyPaneManifestParamsI
Properties
TabPropertyPaneManifestModelI
Extends
Properties
| Property | Type | Description |
|---|---|---|
children | BasePropertyPaneManifestModelI[] | only GROUP type requires this field |
params | TabPropertyPaneManifestParamsI | - |
TabPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
label | string |
type? | TabPropertyPaneManifestType |
TextPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | TextPropertyPaneManifestParamsI |
TextPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
text | string |
translateParams? | object |
type? | SECONDARY |
styles? | string[] |
classes? | string[] |
SizePropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | { [key: string]: SizePropertyPaneManifestParamsI; } |
SizePropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
options | SizePropertyPaneOption[] |
minValue? | number |
element? | string |
elementProp? | string |
propPath? | string |
IndentationPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | IndentationPropertyPaneManifestParamsI |
IndentationPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
indentationType | IndentationPropertyPaneManifestType |
horizontalOnly? | boolean |
HoverAnimationPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | HoverAnimationPropertyPaneManifestParamsI |
HoverAnimationPropertyPaneManifestParamsI
Properties
ColorSelectPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | ColorSelectPropertyPaneManifestParamsI |
ColorSelectPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
label? | string |
validators? | BaseInputValidatorsI |
BaseInputValidatorsI
Properties
TextInputPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | TextInputPropertyPaneManifestParamsI |
TextInputPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
label? | string |
subLabel? | string |
description? | string |
placeholder? | string |
validators? | BaseInputValidatorsI |
defaultValue? | any |
transformers? | TransformerConfig<undefined>[] |
TextColorPropertyPaneManifestParamsI
Properties
SwitchPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | SwitchPropertyPaneManifestParamsI |
SwitchPropertyPaneManifestParamsI
Properties
SwitchWithInputPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | SwitchWithInputPropertyPaneManifestParamsI |
SwitchWithInputPropertyPaneManifestParamsI
Properties
DisplayPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | DisplayPropertyPaneManifestParamsI |
DisplayPropertyPaneManifestParamsI
Properties
InputValidationPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | ValidationPropertyPaneManifestParamsI |
ValidationPropertyPaneManifestParamsI
Properties
SelectOptionI
Properties
SelectPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | SelectPropertyPaneManifestParamsI |
SelectPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
label | string |
options | SelectOptionI[] |
overlayWidth? | number |
defaultValue? | any |
TextStylesPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | TextStylesPropertyPaneManifestParamsI[] |
TextStylesPropertyPaneManifestParamsI
Properties
RadioButtonsPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | RadioButtonsPropertyPaneManifestParamsI |
RadioButtonsPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
label | string |
options | SelectOptionI[] |
reactToAnyStateChanges? | boolean |
OptionsPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | OptionsPropertyPaneManifestParamsI |
OptionsPropertyPaneManifestParamsI
Properties
DatepickerPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | DatepickerPropertyPaneManifestParamsI |
DatepickerPropertyPaneManifestParamsI
Properties
FloatingComponentPositionPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | FloatingComponentPositionPropertyPaneManifestParamsI |
FloatingComponentPositionPropertyPaneManifestParamsI
Properties
ActionsPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | ActionsPropertyPaneManifestParamsI |
ActionsPropertyPaneManifestParamsI
Properties
IntegrationFieldMappingPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | IntegrationFieldMappingPropertyPaneManifestParamsI |
IntegrationFieldMappingPropertyPaneManifestParamsI
Properties
InsertBlockPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | InsertBlockPropertyPaneManifestParamsI[] |
InsertBlockPropertyPaneManifestParamsI
Properties
IconSelectPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params | IconSelectPaneManifestParamsI |
IconSelectPaneManifestParamsI
Properties
| Property | Type |
|---|---|
options | IconSelectOptionForPropertyPaneManifestI[] |
label? | string |
excludeImageTypes? | string[] |
enableCustomIcons? | boolean |
storageType? | string |
IconSelectOptionForPropertyPaneManifestI
Properties
PrizeSettingsPropertyPaneManifestModelI
Extends
Properties
| Property | Type |
|---|---|
params? | PrizeSettingsPropertyPaneManifestParamsI |
PrizeSettingsPropertyPaneManifestParamsI
Properties
| Property | Type |
|---|---|
minOptions? | number |
linkedGamifiedComponentType? | | ClComponentType | null |
prizeImageEnabled? | boolean |
@claspo/common / document/Document.interface
document/Document.interface
ClComponentType
Enumeration of component types in the widget system.
Enumeration Members
ClDocumentHandlerType
Enumeration of handler event types.
Enumeration Members
ClDocumentActionType
Enumeration of available action types.
Enumeration Members
ClDocumentOpenLinkActionTarget
Link target options.
Enumeration Members
ClWidgetVerticalPosition
Vertical position options for widgets.
Enumeration Members
ClWidgetHorizontalPosition
Horizontal position options for widgets.
Enumeration Members
ClLauncherEntryAnimationType
Launcher entry animation types.
Enumeration Members
ClLoopAnimationType
Available loop animation types.
Enumeration Members
ClCloseButtonHorizontalPosition
Close button horizontal position options.
Enumeration Members
ClDocumentI
Root document structure containing views and shared configuration.
Properties
| Property | Type | Description |
|---|---|---|
views | ClBaseComponentI[] | Array of view components (pages/screens) |
shared | ClDocumentSharedI | Shared document configuration and styling |
ClBaseComponentI
Base interface for all component models in the document tree.
Properties
| Property | Type | Description |
|---|---|---|
id | string | Unique component identifier |
path | number[] | Position path in the component tree (array of indices) |
type | ClComponentType | Component type identifier |
version | string | Component version string |
props | ClBaseComponentPropsI | Component properties and configuration |
name | string | Component name for registration |
label? | string | Display label (used for views) |
children? | ClBaseComponentI[] | Child components |
focusParentOnClick? | boolean | If true, clicking focuses the parent instead |
preventDraggable? | boolean | If true, prevents drag-and-drop on this component |
recursiveRemove? | boolean | If true, removing this component removes children recursively |
ClBaseComponentPropsI
Component properties interface with styling, handlers, and content.
Properties
| Property | Type | Description |
|---|---|---|
adaptiveStyles? | BaseComponentAdaptiveStylesI | Platform-specific styles (desktop/mobile) |
styles? | ClBaseComponentElementParamsI[] | Environment-independent styles |
handlers? | ClDocumentHandlerI[] | Event handlers attached to the component |
content? | any | Content configuration (text, images, etc.) |
control? | any | Form control configuration |
isAlignRestricted? | boolean | If true, alignment options are restricted |
floating? | boolean | If true, component floats above other content |
BaseComponentAdaptiveStylesI
Platform-specific style configurations.
Properties
| Property | Type | Description |
|---|---|---|
desktop | ClBaseComponentElementParamsI[] | Desktop viewport styles |
mobile | ClBaseComponentElementParamsI[] | Mobile viewport styles |
ClBaseComponentElementParamsI
Element styling parameters for a single element within a component.
Properties
| Property | Type | Description |
|---|---|---|
element | string | Element identifier (e.g., 'host', 'button', 'label') |
styleAttributes | ClComponentStyleAttributesI | CSS style properties |
hoverStyleAttributes? | ClComponentStyleAttributesI | Styles applied on hover |
hoverAnimationType? | string | Type of hover animation |
placeholderStyleAttributes? | ClComponentStyleAttributesI | Styles for placeholder text (inputs) |
markerStyleAttributes? | ClComponentStyleAttributesI | Styles for list markers |
params? | any | Additional element parameters |
classes? | string | CSS class names to apply |
ClComponentStyleAttributesI
Map of CSS style property names to values.
Indexable
[key: string]: stringClDocumentHandlerI
Event handler configuration for a component.
Properties
| Property | Type | Description |
|---|---|---|
type | CLICK | Type of event to handle |
actions | ClDocumentActionI<any>[] | Actions to execute when event fires |
relativeSelector? | string | Optional CSS selector for targeting child elements |
ClDocumentActionI
Action configuration for event handlers.
Type Parameters
| Type Parameter | Description |
|---|---|
T | Type of action parameters |
Properties
| Property | Type | Description |
|---|---|---|
type | ClDocumentActionType | Action type identifier |
params? | T | Action-specific parameters |
ClDocumentOpenLinkActionParamsI
Parameters for the OPEN_LINK action.
Properties
| Property | Type | Description |
|---|---|---|
link | string | URL to open |
target | ClDocumentOpenLinkActionTarget | Target window for the link |
tagsEnabled | boolean | If true, merge tags in the URL are processed |
trackClickParams? | { [key: string]: string; } | Additional tracking parameters |
customData? | string | Custom data to pass with the action |
countAsTargetAction? | boolean | If true, counts as a conversion/target action |
ClDocumentGoToViewActionParamsI
Parameters for navigating to a specific view.
Properties
ClDocumentGoToNextViewActionParamsI
Parameters for navigating to the next view.
Properties
ClDocumentGoToPreviousViewActionParamsI
Parameters for navigating to the previous view.
Properties
ClDocumentCloseWidgetActionParamsI
Parameters for closing the widget.
Properties
ClDocumentSubscribeContactActionParamsI
Parameters for the subscribe contact action.
Extended by
Properties
ClDocumentShowWidgetActionParamsI
Parameters for showing another widget.
Properties
ClDocumentRequestActionParamsI
Parameters for the request/submit action.
Extends
Properties
ClDocumentSharedI
Shared document configuration applied across all views.
Properties
| Property | Type | Description |
|---|---|---|
headerFontFamily | string | Font family for headers |
textFontFamily | string | Font family for body text |
textClasses | { [key: string]: ClDocumentSharedTextClassI; } | Predefined text style classes |
googleFonts | string[] | Google Fonts to load |
floatingBox? | ClFloatingBoxParamsI | Floating box layout configuration |
floatingBar? | ClFloatingBarParamsI | Floating bar layout configuration |
launcher? | ClLauncherParamsI | Launcher configuration |
dialog? | ClDialogParamsI | Dialog/modal configuration |
closeIcon? | ClCloseButtonParamsI | Close button configuration |
colorSchemaName? | string | Active color schema name |
cssVars? | ClDocumentCssVarsI | CSS custom properties (variables) |
actualSize? | ClDocumentActualSizeI[] | Actual rendered sizes per view |
linkParams? | ClDocumentLinkParamsI | Link styling parameters |
mobileBreakpointWidth? | number | Breakpoint width for mobile/desktop switch |
zIndex? | number | CSS z-index for the widget |
ClDialogParamsI
Dialog/modal background configuration.
Properties
ClDocumentSharedTextClassI
Shared text style class definition.
Properties
ClFloatingBoxParamsI
Floating box positioning parameters.
Properties
| Property | Type | Description |
|---|---|---|
verticalPosition | ClWidgetVerticalPosition | Vertical position on desktop |
horizontalPosition | ClWidgetHorizontalPosition | Horizontal position on desktop |
verticalOffset | string | Vertical offset from position |
horizontalOffset | string | Horizontal offset from position |
mobile | ClFloatingBoxEnvironmentParamsI | Mobile-specific positioning |
ClFloatingBoxEnvironmentParamsI
Environment-specific floating box positioning.
Properties
| Property | Type | Description |
|---|---|---|
verticalPosition | ClWidgetVerticalPosition | Vertical position |
horizontalPosition | ClWidgetHorizontalPosition | Horizontal position |
verticalOffset | string | Vertical offset from position |
horizontalOffset | string | Horizontal offset from position |
ClFloatingBarParamsI
Floating bar positioning parameters.
Properties
| Property | Type | Description |
|---|---|---|
desktop | ClFloatingBarEnvironmentParamsI | Desktop positioning |
mobile | ClFloatingBarEnvironmentParamsI | Mobile positioning |
ClFloatingBarEnvironmentParamsI
Environment-specific floating bar positioning.
Properties
| Property | Type | Description |
|---|---|---|
verticalPosition | ClWidgetVerticalPosition | Vertical position |
horizontalPosition | ClWidgetHorizontalPosition | Horizontal position |
verticalOffset | string | Vertical offset from position |
horizontalOffset | string | Horizontal offset from position |
ClLauncherParamsI
Launcher widget configuration.
Properties
| Property | Type | Description |
|---|---|---|
desktop | ClLauncherEnvironmentParamsI | Desktop positioning |
mobile | ClLauncherEnvironmentParamsI | Mobile positioning |
entryAnimation | ClLauncherEntryAnimationI | Entry animation configuration |
loopAnimation | ClLoopAnimationI | Loop animation configuration |
ClLauncherEnvironmentParamsI
Environment-specific launcher positioning.
Properties
| Property | Type | Description |
|---|---|---|
verticalPosition | ClWidgetVerticalPosition | Vertical position |
horizontalPosition | ClWidgetHorizontalPosition | Horizontal position |
verticalOffset | string | Vertical offset from position |
horizontalOffset | string | Horizontal offset from position |
ClLauncherEntryAnimationI
Launcher entry animation configuration.
Properties
| Property | Type | Description |
|---|---|---|
type | ClLauncherEntryAnimationType | null | Animation type or null for no animation |
ClLoopAnimationI
Loop animation configuration.
Properties
| Property | Type | Description |
|---|---|---|
type | ClLoopAnimationType | null | Animation type or null for no animation |
params? | any | Animation-specific parameters |
ClCloseButtonParamsI
Close button configuration.
Properties
| Property | Type | Description |
|---|---|---|
desktop? | ClCloseButtonEnvironmentParamsI | Desktop close button settings |
mobile? | ClCloseButtonEnvironmentParamsI | Mobile close button settings |
showOnViews? | string[] | View IDs where close button should be shown |
enabled? | boolean | If true, close button is enabled |
ClCloseButtonEnvironmentParamsI
Environment-specific close button configuration.
Extends
Properties
| Property | Type | Description |
|---|---|---|
verticalOffset | string | Vertical offset from position |
horizontalOffset | string | Horizontal offset from position |
width | string | Button width |
height | string | Button height |
horizontalPosition | ClCloseButtonHorizontalPosition | Horizontal position |
content | string | Icon content (index for default, URL for custom) |
defaultIcon | boolean | If true, uses a default icon |
color? | string | Icon color |
size? | number | Icon size |
ClIconEnvironmentParamsI
Icon configuration for buttons.
Extended by
Properties
ClDocumentCssVarsI
CSS custom properties (variables) map.
Indexable
[key: string]: stringClDocumentActualSizeI
Actual rendered size of a view.
Properties
| Property | Type | Description |
|---|---|---|
viewId | string | View identifier |
desktop | ClDocumentEnvironmentActualSize | Desktop dimensions |
mobile | ClDocumentEnvironmentActualSize | Mobile dimensions |
ClDocumentEnvironmentActualSize
Environment-specific actual size dimensions.
Properties
ClDocumentLinkParamsI
Link styling parameters.
Properties
ClDocumentActionParams
type ClDocumentActionParams =
| ClDocumentOpenLinkActionParamsI
| ClDocumentGoToViewActionParamsI
| ClDocumentGoToNextViewActionParamsI
| ClDocumentGoToPreviousViewActionParamsI
| ClDocumentCloseWidgetActionParamsI
| ClDocumentSubscribeContactActionParamsI
| ClDocumentShowWidgetActionParamsI
| ClDocumentRequestActionParamsI;Union type of all possible action parameter types.
@claspo/common / dom/ViewportSize
dom/ViewportSize
default
Utility class for measuring viewport dimensions. Provides static methods to get viewport size, width, height, and scrollbar width.
Constructors
Constructor
new default(): default;Returns
Methods
size()
static size(htmlDocumentObject?): ViewportSizeI;Returns the current viewport size (width and height).
Parameters
| Parameter | Type | Description |
|---|---|---|
htmlDocumentObject? | Document | Optional document object (defaults to window.document) |
Returns
Object containing viewport width and height
width()
static width(htmlDocumentObject?): number;Returns the viewport width in pixels. Uses the maximum of clientWidth and innerWidth for cross-browser compatibility.
Parameters
| Parameter | Type | Description |
|---|---|---|
htmlDocumentObject? | Document | Optional document object (defaults to window.document) |
Returns
number
Viewport width in pixels
height()
static height(htmlDocumentObject?): number;Returns the viewport height in pixels. Uses the maximum of clientHeight and innerHeight for cross-browser compatibility.
Parameters
| Parameter | Type | Description |
|---|---|---|
htmlDocumentObject? | Document | Optional document object (defaults to window.document) |
Returns
number
Viewport height in pixels
scrollbarWidth()
static scrollbarWidth(htmlDocumentObject?): number;Returns the scrollbar width in pixels. Calculated as the difference between innerWidth and clientWidth.
Parameters
| Parameter | Type | Description |
|---|---|---|
htmlDocumentObject? | Document | Optional document object (defaults to window.document) |
Returns
number
Scrollbar width in pixels (0 if no scrollbar)
ViewportSizeI
Represents viewport dimensions.
Properties
@claspo/common / dom/copyToClipboard
dom/copyToClipboard
default()
function default(textToCopy): Promise<void>;Copies text to the system clipboard using the Clipboard API.
Trims whitespace and replaces <br> tags with spaces.
Parameters
| Parameter | Type | Description |
|---|---|---|
textToCopy | string | The text to copy to the clipboard |
Returns
Promise<void>
A promise that resolves when the text is copied, or rejects if clipboard is unavailable
Example
copyToClipboard('Hello World').then(() => console.log('Copied!'));@claspo/common / dom/insertHtmlIntoElement
dom/insertHtmlIntoElement
default()
function default(params): void;Safely inserts HTML content into a DOM element after sanitizing it. Can either replace existing content or append to it.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | InsertHtmlIntoElementParamsI | Configuration object with element, html, and optional appendHtml flag |
Returns
void
Example
insertHtmlIntoElement({
element: document.getElementById('container'),
html: '<p>Hello</p>',
appendHtml: true
});InsertHtmlIntoElementParamsI
Parameters for inserting HTML into an element.
Properties
@claspo/common / dom/sanitizeHTML
dom/sanitizeHTML
default()
function default(html): string;Sanitizes HTML content by removing potentially dangerous elements and attributes. Removes script tags, style tags, event handlers, and javascript: URLs.
Parameters
| Parameter | Type | Description |
|---|---|---|
html | string | The HTML string to sanitize |
Returns
string
The sanitized HTML string safe for insertion into the DOM
Example
const safe = sanitizeHTML('<div onclick="alert(1)">Hello</div>');
// Returns: '<div>Hello</div>'@claspo/common / flat
flat
flat()
function flat<T>(arr, depth): T[];Flattens a nested array to a specified depth. Similar to Array.prototype.flat() but with broader browser support.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The element type of the array |
Parameters
| Parameter | Type | Description |
|---|---|---|
arr | (T | T[])[] | The array to flatten |
depth | number | The depth level to flatten (default: 1) |
Returns
T[]
A new flattened array
Example
flat([[1, 2], [3, [4, 5]]], 1); // [1, 2, 3, [4, 5]]
flat([[1, 2], [3, [4, 5]]], 2); // [1, 2, 3, 4, 5]@claspo/common / object/isDictionary
object/isDictionary
default()
function default(object): boolean;Checks if a value is a plain object (dictionary). Returns true for objects that are not null and not arrays.
Parameters
| Parameter | Type | Description |
|---|---|---|
object | unknown | The value to check |
Returns
boolean
True if the value is a plain object, false otherwise
Example
isDictionary({a: 1}); // true
isDictionary([1, 2, 3]); // false
isDictionary(null); // false@claspo/common / object/omitKeys
object/omitKeys
default()
function default<T, K>(kv, ignoreKeys): Omit<T, K>;Creates a new object with specified keys omitted.
Type Parameters
| Type Parameter | Description |
|---|---|
T extends Record<string, unknown> | The source object type |
K extends string | number | symbol | The keys to omit |
Parameters
| Parameter | Type | Description |
|---|---|---|
kv | T | The source object |
ignoreKeys | K[] | Array of keys to exclude from the result |
Returns
Omit<T, K>
A new object without the specified keys
Example
const obj = { a: 1, b: 2, c: 3 };
omitKeys(obj, ['b']); // { a: 1, c: 3 }@claspo/common / utils/NumericDecline
utils/NumericDecline
default()
function default(
itemsCount,
translateKeys,
language): string;Returns the correct grammatical form based on a numeric value. Handles pluralization rules for different languages (English, Russian, etc.).
Parameters
| Parameter | Type | Description |
|---|---|---|
itemsCount | number | The number to determine the form for |
translateKeys | string[] | Array of translation keys [singular, plural, genitive plural] |
language | string | The language code (e.g., 'en', 'ru') |
Returns
string
The appropriate translation key for the given count
Example
getNumericDecline(1, ['item', 'items', 'items'], 'en'); // 'item'
getNumericDecline(5, ['item', 'items', 'items'], 'en'); // 'items'
getNumericDecline(21, ['товар', 'товара', 'товаров'], 'ru'); // 'товар'@claspo/common / utils/addEventListener
utils/addEventListener
default()
function default(
element,
eventType,
callback,
options?): void;Adds an event listener to an element, with fallback to base implementation. Handles cases where addEventListener may have been overridden.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | EventTarget | The target element to attach the listener to |
eventType | string | The event type to listen for (e.g., 'click', 'load') |
callback | EventListenerOrEventListenerObject | The callback function or object to invoke |
options? | boolean | AddEventListenerOptions | Optional listener options (capture, passive, etc.) |
Returns
void
Example
addEventListenerToElement(button, 'click', () => console.log('clicked'));Updated about 12 hours ago
