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.Observer
the Observer from the Observer PatternStyleGuide.AccordionHandler
the class handler for .accordionStyleGuide.BackToTopHandler
the class handler for .back-to-topStyleGuide.CarouselHandler
the class handler for .carouselStyleGuide.CopyHandler
the class handler for .copyStyleGuide.ColorScheme
the class for the light and dark schemeStyleGuide.DatepickerHandler
the class handler for .datepickerStyleGuide.DebugModeHandler
this handler toggles the debug mode from Style GuideStyleGuide.DetailsNavigationHandler
the class handler for .details-navigationStyleGuide.DropdownHandler
the class handler for .dropdownStyleGuide.FormControlHandler
the class handler for form control elementsStyleGuide.InputHandler
the class handler for .inputStyleGuide.ListingHandler
the class handler for .listingStyleGuide.MenuHandler
the class handler for .menuStyleGuide.MessageHandler
the class handler for .messageStyleGuide.MultiDotBarHandler
the class handler for .multi-dot-barStyleGuide.NotificationHandler
the class handler for .notificationStyleGuide.QuoteTickerHandler
the class handler for .quote-tickerStyleGuide.PageHeaderHandler
the class handler for .page-headerStyleGuide.PaginationHandler
the class handler for .paginationStyleGuide.PerformanceBarHandler
the class handler for .performance-barStyleGuide.RatingHandler
the class handler for .ratingStyleGuide.RealtimePushHandler
the class handler for .realtime-pushStyleGuide.SidePanelHandler
the class handler for .side-panelStyleGuide.SnapshotHandler
the class handler for .snapshotStyleGuide.SuggestSearchHandler
the class handler for .suggest-searchStyleGuide.TabHandler
the class handler for .tabStyleGuide.TabRegionHandler
the class handler for .tab-regionStyleGuide.TooltipHandler
the class handler for .tooltip
Static Functions
StyleGuide.addCallback();
see Callbacks
Properties
version
the current Style Guide version numbername
the class name, includes the themestyleGuide.isMobile
boolean that is true, when currently the browser has a mobile screen size (xs, sm, md)styleGuide.Color
see Colors classstyleGuide.browser
access to the initialized browser classstyleGuide.accordionHandler
access to the initialized .accordion handler classstyleGuide.backToTopHandler
access to the initialized .back-to-top handler classstyleGuide.carouselHandler
access to the initialized .carousel handler classstyleGuide.copyHandler
access to the initialized .copy handler classstyleGuide.colorScheme
access to the initialized the ColorScheme handler classstyleGuide.DatepickerHandler
access to the initialized .datepicker handler classstyleGuide.debugModeHandler
access to the initialized debug mode handler classstyleGuide.detailsNavigationHandler
access to the initialized .details-navigation handler classstyleGuide.dropdownHandler
access to the initialized .dropdown handler classstyleGuide.formControlHandler
access to the initialized form control elements handler classstyleGuide.inputHandler
access to the initialized .input handler classstyleGuide.listingHandler
access to the initialized .listing handler classstyleGuide.menuHandler
access to the initialized .menu handler classstyleGuide.messageHandler
access to the initialized .message handler classstyleGuide.multiDotBarHandler
access to the initialized .multi-dot-bar handler classstyleGuide.notificationHandler
access to the initialized .notification handler classstyleGuide.quoteTickerHandler
access to the initialized .quote-ticker handler classstyleGuide.pageHeaderHandler
access to the initialized .page-header handler classstyleGuide.paginationHandler
access to the initialized .pagination handler classstyleGuide.performanceBarHandler
access to the initialized .performance-bar handler classstyleGuide.ratingHandler
access to the initialized .rating handler classstyleGuide.realtimePushHandler
access to the initialized .realtime-push handler classstyleGuide.sidePanelHandler
access to the initialized .side-panel handler classstyleGuide.snapshotHandler
access to the initialized .snapshot handler classstyleGuide.suggestSearchHandler
access to the initialized .suggest-search handler classstyleGuide.tabHandler
access to the initialized .tab handler classstyleGuide.tabRegionHandler
access to the initialized .tab-region handler classstyleGuide.tooltipHandler
access to the initialized .tooltip handler class
Functions
styleGuide.show(element: Element): void
remove the .display-none global modifier from the given elementstyleGuide.hide(element: Element): void
add the .display-none global modifier to the given elementstyleGuide.toggle(element: Element, show?: boolean): void
toggle the .display-none global modifier on the given elementstyleGuide.isShown(element: Element): boolean
return false, if the .display-none global modifier is attached to the given elementstyleGuide.notify(text: string, options: NotificationOptions): void
show a message in the global notification, see .notificationstyleGuide.popup(popupContent: HTMLElement, options: NotificationOptions): void
show 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'); });