chunk-2FBWETRC.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {
  2. createObserver
  3. } from "./chunk-AVLPSIKF.js";
  4. import {
  5. forceUpdate
  6. } from "./chunk-IOZKU7B2.js";
  7. // node_modules/@esri/calcite-components/dist/components/conditionalSlot.js
  8. var observed = /* @__PURE__ */ new Set();
  9. var mutationObserver;
  10. var observerOptions = { childList: true };
  11. function connectConditionalSlotComponent(component) {
  12. if (!mutationObserver) {
  13. mutationObserver = createObserver("mutation", processMutations);
  14. }
  15. mutationObserver.observe(component.el, observerOptions);
  16. }
  17. function disconnectConditionalSlotComponent(component) {
  18. observed.delete(component.el);
  19. processMutations(mutationObserver.takeRecords());
  20. mutationObserver.disconnect();
  21. for (const [element] of observed.entries()) {
  22. mutationObserver.observe(element, observerOptions);
  23. }
  24. }
  25. function processMutations(mutations) {
  26. mutations.forEach(({ target }) => {
  27. forceUpdate(target);
  28. });
  29. }
  30. export {
  31. connectConditionalSlotComponent,
  32. disconnectConditionalSlotComponent
  33. };
  34. /*!
  35. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  36. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  37. * v1.0.0-beta.97
  38. */
  39. //# sourceMappingURL=chunk-2FBWETRC.js.map