static.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @license
  3. * Copyright 2020 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. import { html as coreHtml, svg as coreSvg, TemplateResult } from './lit-html.js';
  7. /**
  8. * Wraps a string so that it behaves like part of the static template
  9. * strings instead of a dynamic value.
  10. *
  11. * Users must take care to ensure that adding the static string to the template
  12. * results in well-formed HTML, or else templates may break unexpectedly.
  13. *
  14. * Note that this function is unsafe to use on untrusted content, as it will be
  15. * directly parsed into HTML. Do not pass user input to this function
  16. * without sanitizing it.
  17. *
  18. * Static values can be changed, but they will cause a complete re-render
  19. * since they effectively create a new template.
  20. */
  21. export declare const unsafeStatic: (value: string) => {
  22. _$litStatic$: string;
  23. };
  24. /**
  25. * Tags a string literal so that it behaves like part of the static template
  26. * strings instead of a dynamic value.
  27. *
  28. * The only values that may be used in template expressions are other tagged
  29. * `literal` results or `unsafeStatic` values (note that untrusted content
  30. * should never be passed to `unsafeStatic`).
  31. *
  32. * Users must take care to ensure that adding the static string to the template
  33. * results in well-formed HTML, or else templates may break unexpectedly.
  34. *
  35. * Static values can be changed, but they will cause a complete re-render since
  36. * they effectively create a new template.
  37. */
  38. export declare const literal: (strings: TemplateStringsArray, ...values: unknown[]) => {
  39. _$litStatic$: unknown;
  40. };
  41. /**
  42. * Wraps a lit-html template tag (`html` or `svg`) to add static value support.
  43. */
  44. export declare const withStatic: (coreTag: typeof coreHtml | typeof coreSvg) => (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
  45. /**
  46. * Interprets a template literal as an HTML template that can efficiently
  47. * render to and update a container.
  48. *
  49. * Includes static value support from `lit-html/static.js`.
  50. */
  51. export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
  52. /**
  53. * Interprets a template literal as an SVG template that can efficiently
  54. * render to and update a container.
  55. *
  56. * Includes static value support from `lit-html/static.js`.
  57. */
  58. export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
  59. //# sourceMappingURL=static.d.ts.map