Class StyleGuide
The StyleGuide class is the entry class into the Style Guide. You have to import them once into your project so that all components run correctly.
There is one JavaScript file per theme:
- finanzen.ch:
script-ch.js - default:
script-default.js - markets-insider:
script-mi.js - finanzen-net:
script-net.js
// Example how to integrate the finanzen-net theme script
import { StyleGuide } from '@finanzen-net/common-styles/dist/script-net';
Script API
In the following we show all properties and functions of the Style Guide script class.
Static Properties
const styleGuide = StyleGuide.Instance;return the current Style Guide instanceStyleGuide.Observerthe Observer from the Observer PatternStyleGuide.AccordionHandlerthe class handler for .accordionStyleGuide.BackToTopHandlerthe class handler for .back-to-topStyleGuide.CarouselHandlerthe class handler for .carouselStyleGuide.CopyHandlerthe class handler for .copyStyleGuide.ColorSchemethe class for the light and dark schemeStyleGuide.DatepickerHandlerthe class handler for .datepickerStyleGuide.DebugModeHandlerthis handler toggles the debug mode from Style GuideStyleGuide.DetailsNavigationHandlerthe class handler for .details-navigationStyleGuide.DropdownHandlerthe class handler for .dropdownStyleGuide.FormControlHandlerthe class handler for form control elementsStyleGuide.InputHandlerthe class handler for .inputStyleGuide.ListingHandlerthe class handler for .listingStyleGuide.MenuHandlerthe class handler for .menuStyleGuide.MessageHandlerthe class handler for .messageStyleGuide.MultiDotBarHandlerthe class handler for .multi-dot-barStyleGuide.NotificationHandlerthe class handler for .notificationStyleGuide.QuoteTickerHandlerthe class handler for .quote-tickerStyleGuide.PageHeaderHandlerthe class handler for .page-headerStyleGuide.PaginationHandlerthe class handler for .paginationStyleGuide.PerformanceBarHandlerthe class handler for .performance-barStyleGuide.RatingHandlerthe class handler for .ratingStyleGuide.RealtimePushHandlerthe class handler for .realtime-pushStyleGuide.SidePanelHandlerthe class handler for .side-panelStyleGuide.SnapshotHandlerthe class handler for .snapshotStyleGuide.SuggestSearchHandlerthe class handler for .suggest-searchStyleGuide.TabHandlerthe class handler for .tabStyleGuide.TabRegionHandlerthe class handler for .tab-regionStyleGuide.TooltipHandlerthe class handler for .tooltip
Static Functions
StyleGuide.addCallback();see Callbacks
Properties
versionthe current Style Guide version numbernamethe class name, includes the themestyleGuide.isMobileboolean that is true, when currently the browser has a mobile screen size (xs, sm, md)styleGuide.Colorsee Colors classstyleGuide.browseraccess to the initialized browser classstyleGuide.accordionHandleraccess to the initialized .accordion handler classstyleGuide.backToTopHandleraccess to the initialized .back-to-top handler classstyleGuide.carouselHandleraccess to the initialized .carousel handler classstyleGuide.copyHandleraccess to the initialized .copy handler classstyleGuide.colorSchemeaccess to the initialized the ColorScheme handler classstyleGuide.DatepickerHandleraccess to the initialized .datepicker handler classstyleGuide.debugModeHandleraccess to the initialized debug mode handler classstyleGuide.detailsNavigationHandleraccess to the initialized .details-navigation handler classstyleGuide.dropdownHandleraccess to the initialized .dropdown handler classstyleGuide.formControlHandleraccess to the initialized form control elements handler classstyleGuide.inputHandleraccess to the initialized .input handler classstyleGuide.listingHandleraccess to the initialized .listing handler classstyleGuide.menuHandleraccess to the initialized .menu handler classstyleGuide.messageHandleraccess to the initialized .message handler classstyleGuide.multiDotBarHandleraccess to the initialized .multi-dot-bar handler classstyleGuide.notificationHandleraccess to the initialized .notification handler classstyleGuide.quoteTickerHandleraccess to the initialized .quote-ticker handler classstyleGuide.pageHeaderHandleraccess to the initialized .page-header handler classstyleGuide.paginationHandleraccess to the initialized .pagination handler classstyleGuide.performanceBarHandleraccess to the initialized .performance-bar handler classstyleGuide.ratingHandleraccess to the initialized .rating handler classstyleGuide.realtimePushHandleraccess to the initialized .realtime-push handler classstyleGuide.sidePanelHandleraccess to the initialized .side-panel handler classstyleGuide.snapshotHandleraccess to the initialized .snapshot handler classstyleGuide.suggestSearchHandleraccess to the initialized .suggest-search handler classstyleGuide.tabHandleraccess to the initialized .tab handler classstyleGuide.tabRegionHandleraccess to the initialized .tab-region handler classstyleGuide.tooltipHandleraccess to the initialized .tooltip handler class
Functions
styleGuide.show(element: Element): voidremove the .display-none global modifier from the given elementstyleGuide.hide(element: Element): voidadd the .display-none global modifier to the given elementstyleGuide.toggle(element: Element, show?: boolean): voidtoggle the .display-none global modifier on the given elementstyleGuide.isShown(element: Element): booleanreturn false, if the .display-none global modifier is attached to the given elementstyleGuide.notify(text: string, options: NotificationOptions): voidshow a message in the global notification, see .notificationstyleGuide.popup(popupContent: HTMLElement, options: NotificationOptions): voidshow a popup, see .notification
Callbacks
You can run functions after the Style Guide has been initialized. Push directly to the global window.styleGuideCallbacks array variable a callback function, or use the StyleGuide.addCallback() function.
HTML Example
<script>
window.styleGuideCallbacks = window.styleGuideCallbacks || [];
window.styleGuideCallbacks.push(() => { console.log('do stuff'); });
</script>
JavaScript Example
import { StyleGuide } from '@finanzen-net/common-styles/dist/script-net';
StyleGuide.addCallback(() => { console.log('do stuff'); });