@zag-js/popover 0.0.0-dev-20220510084727 → 0.0.0-dev-20220514160702

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -629,6 +629,10 @@ var dom = {
629
629
  return (_a = ctx.doc) != null ? _a : document;
630
630
  },
631
631
  getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
632
+ getRootNode: (ctx) => {
633
+ var _a;
634
+ return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
635
+ },
632
636
  getAnchorId: (ctx) => {
633
637
  var _a, _b;
634
638
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.anchor) != null ? _b : `popover:${ctx.uid}:anchor`;
@@ -655,12 +659,12 @@ var dom = {
655
659
  var _a, _b;
656
660
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.closeBtn) != null ? _b : `popover:${ctx.uid}:close-button`;
657
661
  },
658
- getAnchorEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getAnchorId(ctx)),
659
- getTriggerEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getTriggerId(ctx)),
660
- getContentEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getContentId(ctx)),
661
- getPositionerEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPositionerId(ctx)),
662
- getTitleEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getTitleId(ctx)),
663
- getDescriptionEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getDescriptionId(ctx)),
662
+ getAnchorEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getAnchorId(ctx)),
663
+ getTriggerEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getTriggerId(ctx)),
664
+ getContentEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getContentId(ctx)),
665
+ getPositionerEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getPositionerId(ctx)),
666
+ getTitleEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getTitleId(ctx)),
667
+ getDescriptionEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getDescriptionId(ctx)),
664
668
  getFocusableEls: (ctx) => getFocusables(dom.getContentEl(ctx)),
665
669
  getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
666
670
  getDocTabbableEls: (ctx) => getTabbables(cast(dom.getDoc(ctx))),
@@ -965,6 +969,8 @@ function machine(ctx = {}) {
965
969
  setupDocument(ctx2, evt) {
966
970
  if (evt.doc)
967
971
  ctx2.doc = (0, import_core.ref)(evt.doc);
972
+ if (evt.root)
973
+ ctx2.rootNode = (0, import_core.ref)(evt.root);
968
974
  ctx2.uid = evt.id;
969
975
  },
970
976
  clearPointerDown(ctx2) {