private-ssr-support.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * @license
  3. * Copyright 2019 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. import { _$LH as p, noChange, } from './lit-html.js';
  7. /**
  8. * END USERS SHOULD NOT RELY ON THIS OBJECT.
  9. *
  10. * We currently do not make a mangled rollup build of the lit-ssr code. In order
  11. * to keep a number of (otherwise private) top-level exports mangled in the
  12. * client side code, we export a _$LH object containing those members (or
  13. * helper methods for accessing private fields of those members), and then
  14. * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
  15. * client-side code is being used in `dev` mode or `prod` mode.
  16. * @private
  17. */
  18. export const _$LH = {
  19. boundAttributeSuffix: p._boundAttributeSuffix,
  20. marker: p._marker,
  21. markerMatch: p._markerMatch,
  22. HTML_RESULT: p._HTML_RESULT,
  23. getTemplateHtml: p._getTemplateHtml,
  24. overrideDirectiveResolve: (directiveClass, resolveOverrideFn) => class extends directiveClass {
  25. _$resolve(_part, values) {
  26. return resolveOverrideFn(this, values);
  27. }
  28. },
  29. setDirectiveClass(value, directiveClass) {
  30. // This property needs to remain unminified.
  31. value['_$litDirective$'] = directiveClass;
  32. },
  33. getAttributePartCommittedValue: (part, value, index) => {
  34. // Use the part setter to resolve directives/concatenate multiple parts
  35. // into a final value (captured by passing in a commitValue override)
  36. let committedValue = noChange;
  37. // Note that _commitValue need not be in `stableProperties` because this
  38. // method is only run on `AttributePart`s created by lit-ssr using the same
  39. // version of the library as this file
  40. part._commitValue = (value) => (committedValue = value);
  41. part._$setValue(value, part, index);
  42. return committedValue;
  43. },
  44. connectedDisconnectable: (props) => ({
  45. ...props,
  46. _$isConnected: true,
  47. }),
  48. resolveDirective: p._resolveDirective,
  49. AttributePart: p._AttributePart,
  50. PropertyPart: p._PropertyPart,
  51. BooleanAttributePart: p._BooleanAttributePart,
  52. EventPart: p._EventPart,
  53. ElementPart: p._ElementPart,
  54. };
  55. //# sourceMappingURL=private-ssr-support.js.map