/**
 * The PluginsRegistry allows to register plugins that will be able to transform
 * the style of a rules, add css definitions or dependencies.
 */ import { RuleModifier , StyleObject } from './Rule' ; export type Plugin = ( ruleModifier : RuleModifier , style : StyleObject ) => void ; const plugins = [ ] ; /**
 * Register a plugin.
 *
 */ export function registerPlugin ( plugin ) { if ( typeof plugin !== 'function' ) { throw new Error ( 'Expected the plugin to be a function' ) ; } if ( plugins . indexOf ( plugin ) === - 1 ) { plugins . push ( plugin ) ; } } /**
 * Applies all plugins to a rule.
 */ export function applyPlugins ( ruleModifier , style ) { for ( const plugin of plugins ) { plugin ( ruleModifier , style ) ; } }