import { areStringsEquivalent } from "@fluid-example/flow-util-lib" ; import { ISegment } from "@fluidframework/merge-tree" ; import { getCss } from "../document" ; const concat = ( leftTokens , rightTokens ) => ! rightTokens ? leftTokens : ! leftTokens ? rightTokens : `${ leftTokens } ${ rightTokens }` ; export interface ICssProps { classList ? : string ; style ? : string ; } export function syncCss ( element , { classList , style } , className ? ) { const classes = concat ( className , classList ) ; if ( ! areStringsEquivalent ( classes , element . className ) ) { element . className = classes ; } if ( ! areStringsEquivalent ( style , element . style . cssText ) ) { element . style . cssText = style ; } } export function sameCss ( segment , { classList , style } ) { const actual = getCss ( segment ) ; return areStringsEquivalent ( actual . classList , classList ) && areStringsEquivalent ( actual . style , style ) ; }