style_builders.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @license
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. import '../environment/dev';
  6. import { SafeStyle } from '../internals/style_impl';
  7. /**
  8. * Creates a SafeStyle object from a template literal (without any embedded
  9. * expressions).
  10. *
  11. * ` style` should be in the format
  12. * ` name: value; [name: value; ...]` and must not have any < or >
  13. * characters in it. This is so that SafeStyle's contract is preserved,
  14. * allowing the SafeStyle to correctly be interpreted as a sequence of CSS
  15. * declarations and without affecting the syntactic structure of any
  16. * surrounding CSS and HTML.
  17. *
  18. * This function is a template literal tag function. It should be called with
  19. * a template literal that does not contain any expressions. For example,
  20. * safeStyle`foo`;
  21. * This function first checks if it is called with a literal template, and
  22. * then performs basic sanity checks on the format of ` style`
  23. * but does not constrain the format of ` name} and {@code value`, except
  24. * for disallowing tag characters.
  25. *
  26. * @param templateObj This contains the literal part of the template literal.
  27. */
  28. export declare function safeStyle(templateObj: TemplateStringsArray): SafeStyle;
  29. /** Creates a `SafeStyle` value by concatenating multiple `SafeStyle`s. */
  30. export declare function concatStyles(styles: readonly SafeStyle[]): SafeStyle;