angular.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.findInputsOnElementWithTag = findInputsOnElementWithTag;
  11. exports.findInputsOnElementWithAttr = findInputsOnElementWithAttr;
  12. exports.findOutputsOnElementWithTag = findOutputsOnElementWithTag;
  13. exports.findOutputsOnElementWithAttr = findOutputsOnElementWithAttr;
  14. const elements_1 = require("./elements");
  15. /** Finds the specified Angular @Input in the given elements with tag name. */
  16. function findInputsOnElementWithTag(html, inputName, tagNames) {
  17. return [
  18. // Inputs can be also used without brackets (e.g. `<mat-toolbar color="primary">`)
  19. ...(0, elements_1.findAttributeOnElementWithTag)(html, inputName, tagNames),
  20. // Add one column to the mapped offset because the first bracket for the @Input
  21. // is part of the attribute and therefore also part of the offset. We only want to return
  22. // the offset for the inner name of the bracketed input.
  23. ...(0, elements_1.findAttributeOnElementWithTag)(html, `[${inputName}]`, tagNames).map(offset => offset + 1),
  24. ];
  25. }
  26. /** Finds the specified Angular @Input in elements that have one of the specified attributes. */
  27. function findInputsOnElementWithAttr(html, inputName, attrs) {
  28. return [
  29. // Inputs can be also used without brackets (e.g. `<button mat-button color="primary">`)
  30. ...(0, elements_1.findAttributeOnElementWithAttrs)(html, inputName, attrs),
  31. // Add one column to the mapped offset because the first bracket for the @Input
  32. // is part of the attribute and therefore also part of the offset. We only want to return
  33. // the offset for the inner name of the bracketed input.
  34. ...(0, elements_1.findAttributeOnElementWithAttrs)(html, `[${inputName}]`, attrs).map(offset => offset + 1),
  35. ];
  36. }
  37. /** Finds the specified Angular @Output in the given elements with tag name. */
  38. function findOutputsOnElementWithTag(html, outputName, tagNames) {
  39. // Add one column to the mapped offset because the first parenthesis for the @Output
  40. // is part of the attribute and therefore also part of the offset. We only want to return
  41. // the offset for the inner name of the output.
  42. return (0, elements_1.findAttributeOnElementWithTag)(html, `(${outputName})`, tagNames).map(offset => offset + 1);
  43. }
  44. /** Finds the specified Angular @Output in elements that have one of the specified attributes. */
  45. function findOutputsOnElementWithAttr(html, outputName, attrs) {
  46. // Add one column to the mapped offset because the first bracket for the @Output
  47. // is part of the attribute and therefore also part of the offset. We only want to return
  48. // the offset for the inner name of the output.
  49. return (0, elements_1.findAttributeOnElementWithAttrs)(html, `(${outputName})`, attrs).map(offset => offset + 1);
  50. }
  51. //# sourceMappingURL=angular.js.map