UNPKG

nice-ui

Version:

React design system, components, and utilities

27 lines (26 loc) 654 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PortalState = void 0; class PortalState { constructor() { /** * The parent portal in the portal tree. */ this.parent = null; /** * Collection of all children portals in this sub-tree. */ this.roots = new Set(); } addRoot(root) { this.roots.add(root); if (this.parent) this.parent.addRoot(root); } delRoot(root) { this.roots.delete(root); if (this.parent) this.parent.delRoot(root); } } exports.PortalState = PortalState;