code: function removeNodeFromSlot (slot, node) {
    const isInDefaultMode = slot.assignedNodes().length === 0;
    unregisterNode(slot, node, () => {
      if (isInDefaultMode) {
        slot.__removeChild(node);
      }
    });
  }
docs: Removes a node from a slot (default content). It ensures that if the slot doesn't have any assigned nodes yet, that the node is actually removed, otherwise it's just unregistered.