mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°7355 - Update @popperjs to 2.11.8
This commit is contained in:
54
node_modules/@popperjs/core/README.md
generated
vendored
54
node_modules/@popperjs/core/README.md
generated
vendored
@@ -45,27 +45,33 @@ We've created a
|
||||
[Migration Guide](https://popper.js.org/docs/v2/migration-guide/) to help you
|
||||
migrate from Popper 1 to Popper 2.
|
||||
|
||||
To contribute to the Popper website and documentation, please visit the [dedicated repository](https://github.com/popperjs/website).
|
||||
To contribute to the Popper website and documentation, please visit the
|
||||
[dedicated repository](https://github.com/popperjs/website).
|
||||
|
||||
## Why not use pure CSS?
|
||||
|
||||
CSS tooltips have accessibility and usability problems:
|
||||
|
||||
- **Clipping and overflow issues**: CSS tooltips will not be prevented from
|
||||
overflowing clipping boundaries, such as the viewport. The tooltip gets
|
||||
partially cut off or overflows if it's near the edge since there is no dynamic
|
||||
positioning logic. When using Popper, your tooltip will always be positioned
|
||||
in the right place.
|
||||
- **No flipping**: CSS tooltips will not flip to a different placement to fit
|
||||
better in view if necessary. Popper automatically flips the tooltip to make it
|
||||
fit in view as best as possible for the user.
|
||||
- **Using HTML**: Popovers containing interactive HTML are difficult or not
|
||||
possible to create without UX issues using pure CSS. Popper positions any HTML
|
||||
element – no pseudo-elements are used.
|
||||
- **No virtual positioning**: CSS tooltips cannot follow the mouse cursor or be
|
||||
- **Clipping and overflow issues**: Pure CSS poppers will not be prevented from
|
||||
overflowing clipping boundaries, such as the viewport. It will get partially
|
||||
cut off or overflows if it's near the edge since there is no dynamic
|
||||
positioning logic. When using Popper, your popper will always be positioned in
|
||||
the right place without needing manual adjustments.
|
||||
- **No flipping**: CSS poppers will not flip to a different placement to fit
|
||||
better in view if necessary. While you can manually adjust for the main axis
|
||||
overflow, this feature cannot be achieved via CSS alone. Popper automatically
|
||||
flips the tooltip to make it fit in view as best as possible for the user.
|
||||
- **No virtual positioning**: CSS poppers cannot follow the mouse cursor or be
|
||||
used as a context menu. Popper allows you to position your tooltip relative to
|
||||
any coordinates you desire.
|
||||
- **Lack of extensibility**: CSS tooltips cannot be easily extended to fit any
|
||||
- **Slower development cycle**: When pure CSS is used to position popper
|
||||
elements, the lack of dynamic positioning means they must be carefully placed
|
||||
to consider overflow on all screen sizes. In reusable component libraries,
|
||||
this means a developer can't just add the component anywhere on the page,
|
||||
because these issues need to be considered and adjusted for every time. With
|
||||
Popper, you can place your elements anywhere and they will be positioned
|
||||
correctly, without needing to consider different screen sizes, layouts, etc.
|
||||
This massively speeds up development time because this work is automatically
|
||||
offloaded to Popper.
|
||||
- **Lack of extensibility**: CSS poppers cannot be easily extended to fit any
|
||||
arbitrary use case you may need to adjust for. Popper is built with
|
||||
extensibility in mind.
|
||||
|
||||
@@ -81,6 +87,10 @@ Naive JavaScript tooltip implementations usually have the following problems:
|
||||
containers.
|
||||
- **DOM context**: They often require the tooltip move outside of its original
|
||||
DOM context because they don't handle `offsetParent` contexts.
|
||||
- **Compatibility**: Popper handles an incredible number of edge cases regarding
|
||||
different browsers and environments (mobile viewports, RTL, scrollbars enabled
|
||||
or disabled, etc.). Popper is a popular and well-maintained library, so you
|
||||
can be confident positioning will work for your users on any device.
|
||||
- **Configurability**: They often lack advanced configurability to suit any
|
||||
possible use case.
|
||||
- **Size**: They are usually relatively large in size, or require an ancient
|
||||
@@ -207,7 +217,7 @@ library is built in a modular way to allow to import only the parts you really
|
||||
need.
|
||||
|
||||
```js
|
||||
import { createPopper } from '@popperjs/core/lib/popper-lite.js';
|
||||
import { createPopperLite as createPopper } from '@popperjs/core';
|
||||
```
|
||||
|
||||
The Lite version includes the most necessary modifiers that will compute the
|
||||
@@ -221,9 +231,11 @@ The two most useful modifiers not included in Lite are `preventOverflow` and
|
||||
`flip`:
|
||||
|
||||
```js
|
||||
import { createPopper } from '@popperjs/core/lib/popper-lite.js';
|
||||
import preventOverflow from '@popperjs/core/lib/modifiers/preventOverflow.js';
|
||||
import flip from '@popperjs/core/lib/modifiers/flip.js';
|
||||
import {
|
||||
createPopperLite as createPopper,
|
||||
preventOverflow,
|
||||
flip,
|
||||
} from '@popperjs/core';
|
||||
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
@@ -236,7 +248,7 @@ createPopper(button, tooltip, {
|
||||
As you make more poppers, you may be finding yourself needing other modifiers
|
||||
provided by the library.
|
||||
|
||||
See [tree-shaking](https://popper.js.org/docs/v2/tree-shaking/) for more
|
||||
See [tree-shaking](https://popper.js.org/docs/v2/performance/#tree-shaking) for more
|
||||
information.
|
||||
|
||||
## Distribution targets
|
||||
|
||||
65
node_modules/@popperjs/core/dist/cjs/enums.js
generated
vendored
Normal file
65
node_modules/@popperjs/core/dist/cjs/enums.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
var clippingParents = 'clippingParents';
|
||||
var viewport = 'viewport';
|
||||
var popper = 'popper';
|
||||
var reference = 'reference';
|
||||
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
||||
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
||||
}, []);
|
||||
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
||||
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
||||
}, []); // modifiers that need to read the DOM
|
||||
|
||||
var beforeRead = 'beforeRead';
|
||||
var read = 'read';
|
||||
var afterRead = 'afterRead'; // pure-logic modifiers
|
||||
|
||||
var beforeMain = 'beforeMain';
|
||||
var main = 'main';
|
||||
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
||||
|
||||
var beforeWrite = 'beforeWrite';
|
||||
var write = 'write';
|
||||
var afterWrite = 'afterWrite';
|
||||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||||
|
||||
exports.afterMain = afterMain;
|
||||
exports.afterRead = afterRead;
|
||||
exports.afterWrite = afterWrite;
|
||||
exports.auto = auto;
|
||||
exports.basePlacements = basePlacements;
|
||||
exports.beforeMain = beforeMain;
|
||||
exports.beforeRead = beforeRead;
|
||||
exports.beforeWrite = beforeWrite;
|
||||
exports.bottom = bottom;
|
||||
exports.clippingParents = clippingParents;
|
||||
exports.end = end;
|
||||
exports.left = left;
|
||||
exports.main = main;
|
||||
exports.modifierPhases = modifierPhases;
|
||||
exports.placements = placements;
|
||||
exports.popper = popper;
|
||||
exports.read = read;
|
||||
exports.reference = reference;
|
||||
exports.right = right;
|
||||
exports.start = start;
|
||||
exports.top = top;
|
||||
exports.variationPlacements = variationPlacements;
|
||||
exports.viewport = viewport;
|
||||
exports.write = write;
|
||||
//# sourceMappingURL=enums.js.map
|
||||
3
node_modules/@popperjs/core/dist/cjs/enums.js.flow
generated
vendored
Normal file
3
node_modules/@popperjs/core/dist/cjs/enums.js.flow
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// @flow
|
||||
|
||||
export * from '../../lib/enums.js'
|
||||
1
node_modules/@popperjs/core/dist/cjs/enums.js.map
generated
vendored
Normal file
1
node_modules/@popperjs/core/dist/cjs/enums.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"enums.js","sources":["../../src/enums.js"],"sourcesContent":["// @flow\nexport const top: 'top' = 'top';\nexport const bottom: 'bottom' = 'bottom';\nexport const right: 'right' = 'right';\nexport const left: 'left' = 'left';\nexport const auto: 'auto' = 'auto';\nexport type BasePlacement =\n | typeof top\n | typeof bottom\n | typeof right\n | typeof left;\nexport const basePlacements: Array<BasePlacement> = [top, bottom, right, left];\n\nexport const start: 'start' = 'start';\nexport const end: 'end' = 'end';\nexport type Variation = typeof start | typeof end;\n\nexport const clippingParents: 'clippingParents' = 'clippingParents';\nexport const viewport: 'viewport' = 'viewport';\nexport type Boundary = Element | Array<Element> | typeof clippingParents;\nexport type RootBoundary = typeof viewport | 'document';\n\nexport const popper: 'popper' = 'popper';\nexport const reference: 'reference' = 'reference';\nexport type Context = typeof popper | typeof reference;\n\nexport type VariationPlacement =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'right-start'\n | 'right-end'\n | 'left-start'\n | 'left-end';\nexport type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';\nexport type ComputedPlacement = VariationPlacement | BasePlacement;\nexport type Placement = AutoPlacement | BasePlacement | VariationPlacement;\n\nexport const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(\n (acc: Array<VariationPlacement>, placement: BasePlacement) =>\n acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),\n []\n);\nexport const placements: Array<Placement> = [...basePlacements, auto].reduce(\n (\n acc: Array<Placement>,\n placement: BasePlacement | typeof auto\n ): Array<Placement> =>\n acc.concat([\n placement,\n (`${placement}-${start}`: any),\n (`${placement}-${end}`: any),\n ]),\n []\n);\n\n// modifiers that need to read the DOM\nexport const beforeRead: 'beforeRead' = 'beforeRead';\nexport const read: 'read' = 'read';\nexport const afterRead: 'afterRead' = 'afterRead';\n// pure-logic modifiers\nexport const beforeMain: 'beforeMain' = 'beforeMain';\nexport const main: 'main' = 'main';\nexport const afterMain: 'afterMain' = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nexport const beforeWrite: 'beforeWrite' = 'beforeWrite';\nexport const write: 'write' = 'write';\nexport const afterWrite: 'afterWrite' = 'afterWrite';\nexport const modifierPhases: Array<ModifierPhases> = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite,\n];\n\nexport type ModifierPhases =\n | typeof beforeRead\n | typeof read\n | typeof afterRead\n | typeof beforeMain\n | typeof main\n | typeof afterMain\n | typeof beforeWrite\n | typeof write\n | typeof afterWrite;\n"],"names":["top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","concat","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases"],"mappings":";;;;;;;;IACaA,GAAU,GAAG;IACbC,MAAgB,GAAG;IACnBC,KAAc,GAAG;IACjBC,IAAY,GAAG;IACfC,IAAY,GAAG;IAMfC,cAAoC,GAAG,CAACL,GAAD,EAAMC,MAAN,EAAcC,KAAd,EAAqBC,IAArB;IAEvCG,KAAc,GAAG;IACjBC,GAAU,GAAG;IAGbC,eAAkC,GAAG;IACrCC,QAAoB,GAAG;IAIvBC,MAAgB,GAAG;IACnBC,SAAsB,GAAG;IAgBzBC,mBAA8C,gBAAGP,cAAc,CAACQ,MAAf,CAC5D,UAACC,GAAD,EAAiCC,SAAjC;AAAA,SACED,GAAG,CAACE,MAAJ,CAAW,CAAKD,SAAL,SAAkBT,KAAlB,EAAqCS,SAArC,SAAkDR,GAAlD,CAAX,CADF;AAAA,CAD4D,EAG5D,EAH4D;IAKjDU,UAA4B,gBAAG,UAAIZ,cAAJ,GAAoBD,IAApB,GAA0BS,MAA1B,CAC1C,UACEC,GADF,EAEEC,SAFF;AAAA,SAIED,GAAG,CAACE,MAAJ,CAAW,CACTD,SADS,EAELA,SAFK,SAEQT,KAFR,EAGLS,SAHK,SAGQR,GAHR,CAAX,CAJF;AAAA,CAD0C,EAU1C,EAV0C;;IAc/BW,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,WAA0B,GAAG;IAC7BC,KAAc,GAAG;IACjBC,UAAwB,GAAG;IAC3BC,cAAqC,GAAG,CACnDT,UADmD,EAEnDC,IAFmD,EAGnDC,SAHmD,EAInDC,UAJmD,EAKnDC,IALmD,EAMnDC,SANmD,EAOnDC,WAPmD,EAQnDC,KARmD,EASnDC,UATmD;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
476
node_modules/@popperjs/core/dist/cjs/popper-base.js
generated
vendored
476
node_modules/@popperjs/core/dist/cjs/popper-base.js
generated
vendored
@@ -1,37 +1,102 @@
|
||||
/**
|
||||
* @popperjs/core v2.4.4 - MIT License
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function getBoundingClientRect(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
x: rect.left,
|
||||
y: rect.top
|
||||
};
|
||||
}
|
||||
|
||||
/*:: import type { Window } from '../types'; */
|
||||
|
||||
/*:: declare function getWindow(node: Node | Window): Window; */
|
||||
function getWindow(node) {
|
||||
if (node == null) {
|
||||
return window;
|
||||
}
|
||||
|
||||
if (node.toString() !== '[object Window]') {
|
||||
var ownerDocument = node.ownerDocument;
|
||||
return ownerDocument ? ownerDocument.defaultView : window;
|
||||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function isShadowRoot(node) {
|
||||
// IE 11 has no ShadowRoot
|
||||
if (typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var OwnElement = getWindow(node).ShadowRoot;
|
||||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
var max = Math.max;
|
||||
var min = Math.min;
|
||||
var round = Math.round;
|
||||
|
||||
function getUAString() {
|
||||
var uaData = navigator.userAgentData;
|
||||
|
||||
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
||||
return uaData.brands.map(function (item) {
|
||||
return item.brand + "/" + item.version;
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
return navigator.userAgent;
|
||||
}
|
||||
|
||||
function isLayoutViewport() {
|
||||
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
|
||||
var clientRect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (includeScale && isHTMLElement(element)) {
|
||||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
||||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
||||
}
|
||||
|
||||
var _ref = isElement(element) ? getWindow(element) : window,
|
||||
visualViewport = _ref.visualViewport;
|
||||
|
||||
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
||||
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
||||
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
||||
var width = clientRect.width / scaleX;
|
||||
var height = clientRect.height / scaleY;
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
top: y,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
left: x,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
function getWindowScroll(node) {
|
||||
var win = getWindow(node);
|
||||
var scrollLeft = win.pageXOffset;
|
||||
@@ -42,22 +107,6 @@ function getWindowScroll(node) {
|
||||
};
|
||||
}
|
||||
|
||||
/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
|
||||
Element); */
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
|
||||
HTMLElement); */
|
||||
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function getHTMLElementScroll(element) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
@@ -78,8 +127,9 @@ function getNodeName(element) {
|
||||
}
|
||||
|
||||
function getDocumentElement(element) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
return (isElement(element) ? element.ownerDocument : element.document).documentElement;
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
||||
element.document) || window.document).documentElement;
|
||||
}
|
||||
|
||||
function getWindowScrollBarX(element) {
|
||||
@@ -107,16 +157,24 @@ function isScrollParent(element) {
|
||||
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
||||
}
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement);
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
@@ -133,7 +191,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent);
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
@@ -149,14 +207,28 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
|
||||
function getLayoutRect(element) {
|
||||
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
||||
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
||||
|
||||
var width = element.offsetWidth;
|
||||
var height = element.offsetHeight;
|
||||
|
||||
if (Math.abs(clientRect.width - width) <= 1) {
|
||||
width = clientRect.width;
|
||||
}
|
||||
|
||||
if (Math.abs(clientRect.height - height) <= 1) {
|
||||
height = clientRect.height;
|
||||
}
|
||||
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: element.offsetWidth,
|
||||
height: element.offsetHeight
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
|
||||
@@ -165,12 +237,13 @@ function getParentNode(element) {
|
||||
return element;
|
||||
}
|
||||
|
||||
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
// $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[prop-missing]
|
||||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||||
element.parentNode || // DOM Element detected
|
||||
// $FlowFixMe: need a better way to handle this...
|
||||
element.host || // ShadowRoot detected
|
||||
// $FlowFixMe: HTMLElement is a Node
|
||||
element.parentNode || ( // DOM Element detected
|
||||
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||||
getDocumentElement(element) // fallback
|
||||
|
||||
);
|
||||
@@ -178,7 +251,7 @@ function getParentNode(element) {
|
||||
|
||||
function getScrollParent(node) {
|
||||
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return node.ownerDocument.body;
|
||||
}
|
||||
|
||||
@@ -192,21 +265,23 @@ function getScrollParent(node) {
|
||||
/*
|
||||
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
||||
until we get to the top window object. This list is what we attach scroll listeners
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
reference element's position.
|
||||
*/
|
||||
|
||||
function listScrollParents(element, list) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
var scrollParent = getScrollParent(element);
|
||||
var isBody = getNodeName(scrollParent) === 'body';
|
||||
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
||||
var win = getWindow(scrollParent);
|
||||
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
||||
var updatedList = list.concat(target);
|
||||
return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
|
||||
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
||||
updatedList.concat(listScrollParents(getParentNode(target)));
|
||||
}
|
||||
|
||||
@@ -220,29 +295,36 @@ function getTrueOffsetParent(element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var offsetParent = element.offsetParent;
|
||||
|
||||
if (offsetParent) {
|
||||
var html = getDocumentElement(offsetParent);
|
||||
|
||||
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
return offsetParent;
|
||||
return element.offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var isFirefox = /firefox/i.test(getUAString());
|
||||
var isIE = /Trident/i.test(getUAString());
|
||||
|
||||
if (isIE && isHTMLElement(element)) {
|
||||
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
||||
var elementCss = getComputedStyle(element);
|
||||
|
||||
if (elementCss.position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
if (isShadowRoot(currentNode)) {
|
||||
currentNode = currentNode.host;
|
||||
}
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
@@ -262,7 +344,7 @@ function getOffsetParent(element) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
||||
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -273,7 +355,6 @@ var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
@@ -354,113 +435,12 @@ function debounce(fn) {
|
||||
};
|
||||
}
|
||||
|
||||
function format(str) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return [].concat(args).reduce(function (p, c) {
|
||||
return p.replace(/%s/, c);
|
||||
}, str);
|
||||
}
|
||||
|
||||
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
||||
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
||||
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
||||
function validateModifiers(modifiers) {
|
||||
modifiers.forEach(function (modifier) {
|
||||
Object.keys(modifier).forEach(function (key) {
|
||||
switch (key) {
|
||||
case 'name':
|
||||
if (typeof modifier.name !== 'string') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'enabled':
|
||||
if (typeof modifier.enabled !== 'boolean') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
||||
}
|
||||
|
||||
case 'phase':
|
||||
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'fn':
|
||||
if (typeof modifier.fn !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'effect':
|
||||
if (typeof modifier.effect !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requires':
|
||||
if (!Array.isArray(modifier.requires)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requiresIfExists':
|
||||
if (!Array.isArray(modifier.requiresIfExists)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'options':
|
||||
case 'data':
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
||||
return "\"" + s + "\"";
|
||||
}).join(', ') + "; but \"" + key + "\" was provided.");
|
||||
}
|
||||
|
||||
modifier.requires && modifier.requires.forEach(function (requirement) {
|
||||
if (modifiers.find(function (mod) {
|
||||
return mod.name === requirement;
|
||||
}) == null) {
|
||||
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function uniqueBy(arr, fn) {
|
||||
var identifiers = new Set();
|
||||
return arr.filter(function (item) {
|
||||
var identifier = fn(item);
|
||||
|
||||
if (!identifiers.has(identifier)) {
|
||||
identifiers.add(identifier);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getBasePlacement(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
|
||||
function mergeByName(modifiers) {
|
||||
var merged = modifiers.reduce(function (merged, current) {
|
||||
var existing = merged[current.name];
|
||||
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
|
||||
options: Object.assign(Object.assign({}, existing.options), current.options),
|
||||
data: Object.assign(Object.assign({}, existing.data), current.data)
|
||||
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
||||
options: Object.assign({}, existing.options, current.options),
|
||||
data: Object.assign({}, existing.data, current.data)
|
||||
}) : current;
|
||||
return merged;
|
||||
}, {}); // IE11 does not support Object.values
|
||||
@@ -470,31 +450,21 @@ function mergeByName(modifiers) {
|
||||
});
|
||||
}
|
||||
|
||||
function getViewportRect(element) {
|
||||
function getViewportRect(element, strategy) {
|
||||
var win = getWindow(element);
|
||||
var html = getDocumentElement(element);
|
||||
var visualViewport = win.visualViewport;
|
||||
var width = html.clientWidth;
|
||||
var height = html.clientHeight;
|
||||
var x = 0;
|
||||
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
||||
// can be obscured underneath it.
|
||||
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
||||
// if it isn't open, so if this isn't available, the popper will be detected
|
||||
// to overflow the bottom of the screen too early.
|
||||
var y = 0;
|
||||
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
||||
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
||||
// errors due to floating point numbers, so we need to check precision.
|
||||
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
||||
// Feature detection fails in mobile emulation mode in Chrome.
|
||||
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
||||
// 0.001
|
||||
// Fallback here: "Not Safari" userAgent
|
||||
height = visualViewport.height;
|
||||
var layoutViewport = isLayoutViewport();
|
||||
|
||||
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
||||
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
@@ -511,16 +481,18 @@ function getViewportRect(element) {
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
function getDocumentRect(element) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = element.ownerDocument.body;
|
||||
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -532,19 +504,18 @@ function getDocumentRect(element) {
|
||||
}
|
||||
|
||||
function contains(parent, child) {
|
||||
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
|
||||
var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (isShadow) {
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe: need a better way to handle this...
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
@@ -556,7 +527,7 @@ function contains(parent, child) {
|
||||
}
|
||||
|
||||
function rectToClientRect(rect) {
|
||||
return Object.assign(Object.assign({}, rect), {}, {
|
||||
return Object.assign({}, rect, {
|
||||
left: rect.x,
|
||||
top: rect.y,
|
||||
right: rect.x + rect.width,
|
||||
@@ -564,8 +535,8 @@ function rectToClientRect(rect) {
|
||||
});
|
||||
}
|
||||
|
||||
function getInnerBoundingClientRect(element) {
|
||||
var rect = getBoundingClientRect(element);
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
@@ -577,8 +548,8 @@ function getInnerBoundingClientRect(element) {
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
@@ -591,7 +562,7 @@ function getClippingParents(element) {
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe: https://github.com/facebook/flow/issues/1414
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
@@ -601,18 +572,18 @@ function getClippingParents(element) {
|
||||
// clipping parents
|
||||
|
||||
|
||||
function getClippingRect(element, boundary, rootBoundary) {
|
||||
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||||
accRect.top = Math.max(rect.top, accRect.top);
|
||||
accRect.right = Math.min(rect.right, accRect.right);
|
||||
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
||||
accRect.left = Math.max(rect.left, accRect.left);
|
||||
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
@@ -620,6 +591,10 @@ function getClippingRect(element, boundary, rootBoundary) {
|
||||
return clippingRect;
|
||||
}
|
||||
|
||||
function getBasePlacement(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
|
||||
function getVariation(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
@@ -681,11 +656,11 @@ function computeOffsets(_ref) {
|
||||
|
||||
switch (variation) {
|
||||
case start:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
|
||||
case end:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -703,7 +678,7 @@ function getFreshSideObject() {
|
||||
}
|
||||
|
||||
function mergePaddingObject(paddingObject) {
|
||||
return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
|
||||
return Object.assign({}, getFreshSideObject(), paddingObject);
|
||||
}
|
||||
|
||||
function expandToHashMap(value, keys) {
|
||||
@@ -721,6 +696,8 @@ function detectOverflow(state, options) {
|
||||
var _options = options,
|
||||
_options$placement = _options.placement,
|
||||
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
||||
_options$strategy = _options.strategy,
|
||||
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
||||
_options$boundary = _options.boundary,
|
||||
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
||||
_options$rootBoundary = _options.rootBoundary,
|
||||
@@ -733,18 +710,17 @@ function detectOverflow(state, options) {
|
||||
padding = _options$padding === void 0 ? 0 : _options$padding;
|
||||
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
||||
var altContext = elementContext === popper ? reference : popper;
|
||||
var referenceElement = state.elements.reference;
|
||||
var popperRect = state.rects.popper;
|
||||
var element = state.elements[altBoundary ? altContext : elementContext];
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
||||
var referenceClientRect = getBoundingClientRect(referenceElement);
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
||||
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
||||
var popperOffsets = computeOffsets({
|
||||
reference: referenceClientRect,
|
||||
element: popperRect,
|
||||
strategy: 'absolute',
|
||||
placement: placement
|
||||
});
|
||||
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
||||
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
||||
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
||||
// 0 or negative = within the clipping rect
|
||||
|
||||
@@ -768,8 +744,6 @@ function detectOverflow(state, options) {
|
||||
return overflowOffsets;
|
||||
}
|
||||
|
||||
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
||||
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
@@ -804,7 +778,7 @@ function popperGenerator(generatorOptions) {
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
@@ -817,9 +791,10 @@ function popperGenerator(generatorOptions) {
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(options) {
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
@@ -830,42 +805,7 @@ function popperGenerator(generatorOptions) {
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
}); // Validate the provided modifiers so that the consumer will get warned
|
||||
// if one of the modifiers is invalid for any reason
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
||||
var name = _ref.name;
|
||||
return name;
|
||||
});
|
||||
validateModifiers(modifiers);
|
||||
|
||||
if (getBasePlacement(state.options.placement) === auto) {
|
||||
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name === 'flip';
|
||||
});
|
||||
|
||||
if (!flipModifier) {
|
||||
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
var _getComputedStyle = getComputedStyle(popper),
|
||||
marginTop = _getComputedStyle.marginTop,
|
||||
marginRight = _getComputedStyle.marginRight,
|
||||
marginBottom = _getComputedStyle.marginBottom,
|
||||
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
||||
// cause bugs with positioning, so we'll warn the consumer
|
||||
|
||||
|
||||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
||||
return parseFloat(margin);
|
||||
})) {
|
||||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
@@ -885,10 +825,6 @@ function popperGenerator(generatorOptions) {
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
@@ -911,18 +847,8 @@ function popperGenerator(generatorOptions) {
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
var __debug_loops__ = 0;
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
__debug_loops__ += 1;
|
||||
|
||||
if (__debug_loops__ > 100) {
|
||||
console.error(INFINITE_LOOP_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
@@ -960,10 +886,6 @@ function popperGenerator(generatorOptions) {
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -978,11 +900,11 @@ function popperGenerator(generatorOptions) {
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref3) {
|
||||
var name = _ref3.name,
|
||||
_ref3$options = _ref3.options,
|
||||
options = _ref3$options === void 0 ? {} : _ref3$options,
|
||||
effect = _ref3.effect;
|
||||
state.orderedModifiers.forEach(function (_ref) {
|
||||
var name = _ref.name,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === void 0 ? {} : _ref$options,
|
||||
effect = _ref.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
|
||||
2
node_modules/@popperjs/core/dist/cjs/popper-base.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/cjs/popper-base.js.map
generated
vendored
File diff suppressed because one or more lines are too long
595
node_modules/@popperjs/core/dist/cjs/popper-lite.js
generated
vendored
595
node_modules/@popperjs/core/dist/cjs/popper-lite.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@popperjs/core/dist/cjs/popper-lite.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/cjs/popper-lite.js.map
generated
vendored
File diff suppressed because one or more lines are too long
715
node_modules/@popperjs/core/dist/cjs/popper.js
generated
vendored
715
node_modules/@popperjs/core/dist/cjs/popper.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@popperjs/core/dist/cjs/popper.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/cjs/popper.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -2,19 +2,11 @@ import getCompositeRect from "./dom-utils/getCompositeRect.js";
|
||||
import getLayoutRect from "./dom-utils/getLayoutRect.js";
|
||||
import listScrollParents from "./dom-utils/listScrollParents.js";
|
||||
import getOffsetParent from "./dom-utils/getOffsetParent.js";
|
||||
import getComputedStyle from "./dom-utils/getComputedStyle.js";
|
||||
import orderModifiers from "./utils/orderModifiers.js";
|
||||
import debounce from "./utils/debounce.js";
|
||||
import validateModifiers from "./utils/validateModifiers.js";
|
||||
import uniqueBy from "./utils/uniqueBy.js";
|
||||
import getBasePlacement from "./utils/getBasePlacement.js";
|
||||
import mergeByName from "./utils/mergeByName.js";
|
||||
import detectOverflow from "./utils/detectOverflow.js";
|
||||
import { isElement } from "./dom-utils/instanceOf.js";
|
||||
import { auto } from "./enums.js";
|
||||
export * from "./enums.js";
|
||||
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
||||
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
@@ -49,7 +41,7 @@ export function popperGenerator(generatorOptions) {
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
@@ -62,9 +54,10 @@ export function popperGenerator(generatorOptions) {
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(options) {
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
@@ -75,42 +68,7 @@ export function popperGenerator(generatorOptions) {
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
}); // Validate the provided modifiers so that the consumer will get warned
|
||||
// if one of the modifiers is invalid for any reason
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
||||
var name = _ref.name;
|
||||
return name;
|
||||
});
|
||||
validateModifiers(modifiers);
|
||||
|
||||
if (getBasePlacement(state.options.placement) === auto) {
|
||||
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name === 'flip';
|
||||
});
|
||||
|
||||
if (!flipModifier) {
|
||||
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
var _getComputedStyle = getComputedStyle(popper),
|
||||
marginTop = _getComputedStyle.marginTop,
|
||||
marginRight = _getComputedStyle.marginRight,
|
||||
marginBottom = _getComputedStyle.marginBottom,
|
||||
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
||||
// cause bugs with positioning, so we'll warn the consumer
|
||||
|
||||
|
||||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
||||
return parseFloat(margin);
|
||||
})) {
|
||||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
@@ -130,10 +88,6 @@ export function popperGenerator(generatorOptions) {
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
@@ -156,18 +110,8 @@ export function popperGenerator(generatorOptions) {
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
var __debug_loops__ = 0;
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
__debug_loops__ += 1;
|
||||
|
||||
if (__debug_loops__ > 100) {
|
||||
console.error(INFINITE_LOOP_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
@@ -205,10 +149,6 @@ export function popperGenerator(generatorOptions) {
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -223,11 +163,11 @@ export function popperGenerator(generatorOptions) {
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref3) {
|
||||
var name = _ref3.name,
|
||||
_ref3$options = _ref3.options,
|
||||
options = _ref3$options === void 0 ? {} : _ref3$options,
|
||||
effect = _ref3.effect;
|
||||
state.orderedModifiers.forEach(function (_ref) {
|
||||
var name = _ref.name,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === void 0 ? {} : _ref$options,
|
||||
effect = _ref.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
8
node_modules/@popperjs/core/dist/esm/dom-utils/contains.js
generated
vendored
8
node_modules/@popperjs/core/dist/esm/dom-utils/contains.js
generated
vendored
@@ -1,17 +1,17 @@
|
||||
import { isShadowRoot } from "./instanceOf.js";
|
||||
export default function contains(parent, child) {
|
||||
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
|
||||
var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (isShadow) {
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe: need a better way to handle this...
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
|
||||
48
node_modules/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js
generated
vendored
48
node_modules/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js
generated
vendored
@@ -1,13 +1,41 @@
|
||||
export default function getBoundingClientRect(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
import { isElement, isHTMLElement } from "./instanceOf.js";
|
||||
import { round } from "../utils/math.js";
|
||||
import getWindow from "./getWindow.js";
|
||||
import isLayoutViewport from "./isLayoutViewport.js";
|
||||
export default function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
|
||||
var clientRect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (includeScale && isHTMLElement(element)) {
|
||||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
||||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
||||
}
|
||||
|
||||
var _ref = isElement(element) ? getWindow(element) : window,
|
||||
visualViewport = _ref.visualViewport;
|
||||
|
||||
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
||||
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
||||
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
||||
var width = clientRect.width / scaleX;
|
||||
var height = clientRect.height / scaleY;
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
x: rect.left,
|
||||
y: rect.top
|
||||
width: width,
|
||||
height: height,
|
||||
top: y,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
left: x,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
25
node_modules/@popperjs/core/dist/esm/dom-utils/getClippingRect.js
generated
vendored
25
node_modules/@popperjs/core/dist/esm/dom-utils/getClippingRect.js
generated
vendored
@@ -11,9 +11,10 @@ import getParentNode from "./getParentNode.js";
|
||||
import contains from "./contains.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import rectToClientRect from "../utils/rectToClientRect.js";
|
||||
import { max, min } from "../utils/math.js";
|
||||
|
||||
function getInnerBoundingClientRect(element) {
|
||||
var rect = getBoundingClientRect(element);
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
@@ -25,8 +26,8 @@ function getInnerBoundingClientRect(element) {
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
@@ -39,7 +40,7 @@ function getClippingParents(element) {
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe: https://github.com/facebook/flow/issues/1414
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
@@ -49,18 +50,18 @@ function getClippingParents(element) {
|
||||
// clipping parents
|
||||
|
||||
|
||||
export default function getClippingRect(element, boundary, rootBoundary) {
|
||||
export default function getClippingRect(element, boundary, rootBoundary, strategy) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||||
accRect.top = Math.max(rect.top, accRect.top);
|
||||
accRect.right = Math.min(rect.right, accRect.right);
|
||||
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
||||
accRect.left = Math.max(rect.left, accRect.left);
|
||||
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
|
||||
18
node_modules/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js
generated
vendored
18
node_modules/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js
generated
vendored
@@ -4,17 +4,27 @@ import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import isScrollParent from "./isScrollParent.js"; // Returns the composite rect of an element relative to its offsetParent.
|
||||
import isScrollParent from "./isScrollParent.js";
|
||||
import { round } from "../utils/math.js";
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
export default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement);
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
@@ -31,7 +41,7 @@ export default function getCompositeRect(elementOrVirtualElement, offsetParent,
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent);
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
|
||||
5
node_modules/@popperjs/core/dist/esm/dom-utils/getDocumentElement.js
generated
vendored
5
node_modules/@popperjs/core/dist/esm/dom-utils/getDocumentElement.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
import { isElement } from "./instanceOf.js";
|
||||
export default function getDocumentElement(element) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
return (isElement(element) ? element.ownerDocument : element.document).documentElement;
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
||||
element.document) || window.document).documentElement;
|
||||
}
|
||||
13
node_modules/@popperjs/core/dist/esm/dom-utils/getDocumentRect.js
generated
vendored
13
node_modules/@popperjs/core/dist/esm/dom-utils/getDocumentRect.js
generated
vendored
@@ -1,20 +1,23 @@
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getWindowScroll from "./getWindowScroll.js"; // Gets the entire size of the scrollable document area, even extending outside
|
||||
import getWindowScroll from "./getWindowScroll.js";
|
||||
import { max } from "../utils/math.js"; // Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
export default function getDocumentRect(element) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = element.ownerDocument.body;
|
||||
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
21
node_modules/@popperjs/core/dist/esm/dom-utils/getLayoutRect.js
generated
vendored
21
node_modules/@popperjs/core/dist/esm/dom-utils/getLayoutRect.js
generated
vendored
@@ -1,10 +1,25 @@
|
||||
// Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
import getBoundingClientRect from "./getBoundingClientRect.js"; // Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
|
||||
export default function getLayoutRect(element) {
|
||||
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
||||
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
||||
|
||||
var width = element.offsetWidth;
|
||||
var height = element.offsetHeight;
|
||||
|
||||
if (Math.abs(clientRect.width - width) <= 1) {
|
||||
width = clientRect.width;
|
||||
}
|
||||
|
||||
if (Math.abs(clientRect.height - height) <= 1) {
|
||||
height = clientRect.height;
|
||||
}
|
||||
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: element.offsetWidth,
|
||||
height: element.offsetHeight
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
37
node_modules/@popperjs/core/dist/esm/dom-utils/getOffsetParent.js
generated
vendored
37
node_modules/@popperjs/core/dist/esm/dom-utils/getOffsetParent.js
generated
vendored
@@ -1,10 +1,10 @@
|
||||
import getWindow from "./getWindow.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import { isHTMLElement, isShadowRoot } from "./instanceOf.js";
|
||||
import isTableElement from "./isTableElement.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getUAString from "../utils/userAgent.js";
|
||||
|
||||
function getTrueOffsetParent(element) {
|
||||
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
||||
@@ -12,29 +12,36 @@ function getTrueOffsetParent(element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var offsetParent = element.offsetParent;
|
||||
|
||||
if (offsetParent) {
|
||||
var html = getDocumentElement(offsetParent);
|
||||
|
||||
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
return offsetParent;
|
||||
return element.offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var isFirefox = /firefox/i.test(getUAString());
|
||||
var isIE = /Trident/i.test(getUAString());
|
||||
|
||||
if (isIE && isHTMLElement(element)) {
|
||||
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
||||
var elementCss = getComputedStyle(element);
|
||||
|
||||
if (elementCss.position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
if (isShadowRoot(currentNode)) {
|
||||
currentNode = currentNode.host;
|
||||
}
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
@@ -54,7 +61,7 @@ export default function getOffsetParent(element) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
||||
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
12
node_modules/@popperjs/core/dist/esm/dom-utils/getParentNode.js
generated
vendored
12
node_modules/@popperjs/core/dist/esm/dom-utils/getParentNode.js
generated
vendored
@@ -1,16 +1,18 @@
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import { isShadowRoot } from "./instanceOf.js";
|
||||
export default function getParentNode(element) {
|
||||
if (getNodeName(element) === 'html') {
|
||||
return element;
|
||||
}
|
||||
|
||||
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
// $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[prop-missing]
|
||||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||||
element.parentNode || // DOM Element detected
|
||||
// $FlowFixMe: need a better way to handle this...
|
||||
element.host || // ShadowRoot detected
|
||||
// $FlowFixMe: HTMLElement is a Node
|
||||
element.parentNode || ( // DOM Element detected
|
||||
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||||
getDocumentElement(element) // fallback
|
||||
|
||||
);
|
||||
|
||||
2
node_modules/@popperjs/core/dist/esm/dom-utils/getScrollParent.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/dom-utils/getScrollParent.js
generated
vendored
@@ -4,7 +4,7 @@ import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
export default function getScrollParent(node) {
|
||||
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return node.ownerDocument.body;
|
||||
}
|
||||
|
||||
|
||||
21
node_modules/@popperjs/core/dist/esm/dom-utils/getViewportRect.js
generated
vendored
21
node_modules/@popperjs/core/dist/esm/dom-utils/getViewportRect.js
generated
vendored
@@ -1,31 +1,22 @@
|
||||
import getWindow from "./getWindow.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
export default function getViewportRect(element) {
|
||||
import isLayoutViewport from "./isLayoutViewport.js";
|
||||
export default function getViewportRect(element, strategy) {
|
||||
var win = getWindow(element);
|
||||
var html = getDocumentElement(element);
|
||||
var visualViewport = win.visualViewport;
|
||||
var width = html.clientWidth;
|
||||
var height = html.clientHeight;
|
||||
var x = 0;
|
||||
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
||||
// can be obscured underneath it.
|
||||
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
||||
// if it isn't open, so if this isn't available, the popper will be detected
|
||||
// to overflow the bottom of the screen too early.
|
||||
var y = 0;
|
||||
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
||||
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
||||
// errors due to floating point numbers, so we need to check precision.
|
||||
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
||||
// Feature detection fails in mobile emulation mode in Chrome.
|
||||
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
||||
// 0.001
|
||||
// Fallback here: "Not Safari" userAgent
|
||||
height = visualViewport.height;
|
||||
var layoutViewport = isLayoutViewport();
|
||||
|
||||
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
||||
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
|
||||
9
node_modules/@popperjs/core/dist/esm/dom-utils/getWindow.js
generated
vendored
9
node_modules/@popperjs/core/dist/esm/dom-utils/getWindow.js
generated
vendored
@@ -1,10 +1,11 @@
|
||||
/*:: import type { Window } from '../types'; */
|
||||
|
||||
/*:: declare function getWindow(node: Node | Window): Window; */
|
||||
export default function getWindow(node) {
|
||||
if (node == null) {
|
||||
return window;
|
||||
}
|
||||
|
||||
if (node.toString() !== '[object Window]') {
|
||||
var ownerDocument = node.ownerDocument;
|
||||
return ownerDocument ? ownerDocument.defaultView : window;
|
||||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
||||
17
node_modules/@popperjs/core/dist/esm/dom-utils/instanceOf.js
generated
vendored
17
node_modules/@popperjs/core/dist/esm/dom-utils/instanceOf.js
generated
vendored
@@ -1,18 +1,23 @@
|
||||
import getWindow from "./getWindow.js";
|
||||
/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
|
||||
Element); */
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
|
||||
HTMLElement); */
|
||||
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
export { isElement, isHTMLElement };
|
||||
function isShadowRoot(node) {
|
||||
// IE 11 has no ShadowRoot
|
||||
if (typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var OwnElement = getWindow(node).ShadowRoot;
|
||||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
export { isElement, isHTMLElement, isShadowRoot };
|
||||
4
node_modules/@popperjs/core/dist/esm/dom-utils/isLayoutViewport.js
generated
vendored
Normal file
4
node_modules/@popperjs/core/dist/esm/dom-utils/isLayoutViewport.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import getUAString from "../utils/userAgent.js";
|
||||
export default function isLayoutViewport() {
|
||||
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
||||
}
|
||||
9
node_modules/@popperjs/core/dist/esm/dom-utils/listScrollParents.js
generated
vendored
9
node_modules/@popperjs/core/dist/esm/dom-utils/listScrollParents.js
generated
vendored
@@ -1,25 +1,26 @@
|
||||
import getScrollParent from "./getScrollParent.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import getWindow from "./getWindow.js";
|
||||
import isScrollParent from "./isScrollParent.js";
|
||||
/*
|
||||
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
||||
until we get to the top window object. This list is what we attach scroll listeners
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
reference element's position.
|
||||
*/
|
||||
|
||||
export default function listScrollParents(element, list) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
var scrollParent = getScrollParent(element);
|
||||
var isBody = getNodeName(scrollParent) === 'body';
|
||||
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
||||
var win = getWindow(scrollParent);
|
||||
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
||||
var updatedList = list.concat(target);
|
||||
return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
|
||||
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
||||
updatedList.concat(listScrollParents(getParentNode(target)));
|
||||
}
|
||||
259
node_modules/@popperjs/core/dist/esm/index.js
generated
vendored
259
node_modules/@popperjs/core/dist/esm/index.js
generated
vendored
@@ -1,259 +1,8 @@
|
||||
import getCompositeRect from "./dom-utils/getCompositeRect.js";
|
||||
import getLayoutRect from "./dom-utils/getLayoutRect.js";
|
||||
import listScrollParents from "./dom-utils/listScrollParents.js";
|
||||
import getOffsetParent from "./dom-utils/getOffsetParent.js";
|
||||
import getComputedStyle from "./dom-utils/getComputedStyle.js";
|
||||
import orderModifiers from "./utils/orderModifiers.js";
|
||||
import debounce from "./utils/debounce.js";
|
||||
import validateModifiers from "./utils/validateModifiers.js";
|
||||
import uniqueBy from "./utils/uniqueBy.js";
|
||||
import getBasePlacement from "./utils/getBasePlacement.js";
|
||||
import mergeByName from "./utils/mergeByName.js";
|
||||
import detectOverflow from "./utils/detectOverflow.js";
|
||||
import { isElement } from "./dom-utils/instanceOf.js";
|
||||
import { auto } from "./enums.js";
|
||||
export * from "./enums.js";
|
||||
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
||||
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
strategy: 'absolute'
|
||||
};
|
||||
export * from "./modifiers/index.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
function areValidElements() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
export { popperGenerator, detectOverflow, createPopper as createPopperBase } from "./createPopper.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
return !args.some(function (element) {
|
||||
return !(element && typeof element.getBoundingClientRect === 'function');
|
||||
});
|
||||
}
|
||||
export { createPopper } from "./popper.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export function popperGenerator(generatorOptions) {
|
||||
if (generatorOptions === void 0) {
|
||||
generatorOptions = {};
|
||||
}
|
||||
|
||||
var _generatorOptions = generatorOptions,
|
||||
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
||||
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
||||
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
||||
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
||||
return function createPopper(reference, popper, options) {
|
||||
if (options === void 0) {
|
||||
options = defaultOptions;
|
||||
}
|
||||
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
popper: popper
|
||||
},
|
||||
attributes: {},
|
||||
styles: {}
|
||||
};
|
||||
var effectCleanupFns = [];
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(options) {
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
}; // Orders the modifiers based on their dependencies and `phase`
|
||||
// properties
|
||||
|
||||
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
}); // Validate the provided modifiers so that the consumer will get warned
|
||||
// if one of the modifiers is invalid for any reason
|
||||
|
||||
if (false) {
|
||||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
||||
var name = _ref.name;
|
||||
return name;
|
||||
});
|
||||
validateModifiers(modifiers);
|
||||
|
||||
if (getBasePlacement(state.options.placement) === auto) {
|
||||
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name === 'flip';
|
||||
});
|
||||
|
||||
if (!flipModifier) {
|
||||
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
var _getComputedStyle = getComputedStyle(popper),
|
||||
marginTop = _getComputedStyle.marginTop,
|
||||
marginRight = _getComputedStyle.marginRight,
|
||||
marginBottom = _getComputedStyle.marginBottom,
|
||||
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
||||
// cause bugs with positioning, so we'll warn the consumer
|
||||
|
||||
|
||||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
||||
return parseFloat(margin);
|
||||
})) {
|
||||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
// Sync update – it will always be executed, even if not necessary. This
|
||||
// is useful for low frequency updates where sync behavior simplifies the
|
||||
// logic.
|
||||
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
||||
// prefer the async Popper#update method
|
||||
forceUpdate: function forceUpdate() {
|
||||
if (isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _state$elements = state.elements,
|
||||
reference = _state$elements.reference,
|
||||
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (false) {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
|
||||
state.rects = {
|
||||
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
||||
popper: getLayoutRect(popper)
|
||||
}; // Modifiers have the ability to reset the current update cycle. The
|
||||
// most common use case for this is the `flip` modifier changing the
|
||||
// placement, which then needs to re-run all the modifiers, because the
|
||||
// logic was previously ran for the previous placement and is therefore
|
||||
// stale/incorrect
|
||||
|
||||
state.reset = false;
|
||||
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
||||
// is filled with the initial data specified by the modifier. This means
|
||||
// it doesn't persist and is fresh on each update.
|
||||
// To ensure persistent data, use `${name}#persistent`
|
||||
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
var __debug_loops__ = 0;
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (false) {
|
||||
__debug_loops__ += 1;
|
||||
|
||||
if (__debug_loops__ > 100) {
|
||||
console.error(INFINITE_LOOP_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
var _state$orderedModifie = state.orderedModifiers[index],
|
||||
fn = _state$orderedModifie.fn,
|
||||
_state$orderedModifie2 = _state$orderedModifie.options,
|
||||
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
||||
name = _state$orderedModifie.name;
|
||||
|
||||
if (typeof fn === 'function') {
|
||||
state = fn({
|
||||
state: state,
|
||||
options: _options,
|
||||
name: name,
|
||||
instance: instance
|
||||
}) || state;
|
||||
}
|
||||
}
|
||||
},
|
||||
// Async and optimistically optimized update – it will not be executed if
|
||||
// not necessary (debounced to run at most once-per-tick)
|
||||
update: debounce(function () {
|
||||
return new Promise(function (resolve) {
|
||||
instance.forceUpdate();
|
||||
resolve(state);
|
||||
});
|
||||
}),
|
||||
destroy: function destroy() {
|
||||
cleanupModifierEffects();
|
||||
isDestroyed = true;
|
||||
}
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (false) {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
instance.setOptions(options).then(function (state) {
|
||||
if (!isDestroyed && options.onFirstUpdate) {
|
||||
options.onFirstUpdate(state);
|
||||
}
|
||||
}); // Modifiers have the ability to execute arbitrary code before the first
|
||||
// update cycle runs. They will be executed in the same order as the update
|
||||
// cycle. This is useful when a modifier adds some persistent data that
|
||||
// other modifiers need to use, but the modifier is run after the dependent
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref3) {
|
||||
var name = _ref3.name,
|
||||
_ref3$options = _ref3.options,
|
||||
options = _ref3$options === void 0 ? {} : _ref3$options,
|
||||
effect = _ref3.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
state: state,
|
||||
name: name,
|
||||
instance: instance,
|
||||
options: options
|
||||
});
|
||||
|
||||
var noopFn = function noopFn() {};
|
||||
|
||||
effectCleanupFns.push(cleanupFn || noopFn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupModifierEffects() {
|
||||
effectCleanupFns.forEach(function (fn) {
|
||||
return fn();
|
||||
});
|
||||
effectCleanupFns = [];
|
||||
}
|
||||
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
export var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export { detectOverflow };
|
||||
export { createPopper as createPopperLite } from "./popper-lite.js";
|
||||
8
node_modules/@popperjs/core/dist/esm/modifiers/applyStyles.js
generated
vendored
8
node_modules/@popperjs/core/dist/esm/modifiers/applyStyles.js
generated
vendored
@@ -13,7 +13,7 @@ function applyStyles(_ref) {
|
||||
return;
|
||||
} // Flow doesn't support to extend this property, but it's the most
|
||||
// effective way to apply styles to an HTMLElement
|
||||
// $FlowFixMe
|
||||
// $FlowFixMe[cannot-write]
|
||||
|
||||
|
||||
Object.assign(element.style, style);
|
||||
@@ -44,6 +44,7 @@ function effect(_ref2) {
|
||||
reference: {}
|
||||
};
|
||||
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||||
state.styles = initialStyles;
|
||||
|
||||
if (state.elements.arrow) {
|
||||
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||||
@@ -62,10 +63,7 @@ function effect(_ref2) {
|
||||
|
||||
if (!isHTMLElement(element) || !getNodeName(element)) {
|
||||
return;
|
||||
} // Flow doesn't support to extend this property, but it's the most
|
||||
// effective way to apply styles to an HTMLElement
|
||||
// $FlowFixMe
|
||||
|
||||
}
|
||||
|
||||
Object.assign(element.style, style);
|
||||
Object.keys(attributes).forEach(function (attribute) {
|
||||
|
||||
37
node_modules/@popperjs/core/dist/esm/modifiers/arrow.js
generated
vendored
37
node_modules/@popperjs/core/dist/esm/modifiers/arrow.js
generated
vendored
@@ -3,17 +3,24 @@ import getLayoutRect from "../dom-utils/getLayoutRect.js";
|
||||
import contains from "../dom-utils/contains.js";
|
||||
import getOffsetParent from "../dom-utils/getOffsetParent.js";
|
||||
import getMainAxisFromPlacement from "../utils/getMainAxisFromPlacement.js";
|
||||
import within from "../utils/within.js";
|
||||
import { within } from "../utils/within.js";
|
||||
import mergePaddingObject from "../utils/mergePaddingObject.js";
|
||||
import expandToHashMap from "../utils/expandToHashMap.js";
|
||||
import { left, right, basePlacements, top, bottom } from "../enums.js";
|
||||
import { isHTMLElement } from "../dom-utils/instanceOf.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
import { left, right, basePlacements, top, bottom } from "../enums.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
var toPaddingObject = function toPaddingObject(padding, state) {
|
||||
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
||||
placement: state.placement
|
||||
})) : padding;
|
||||
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
||||
};
|
||||
|
||||
function arrow(_ref) {
|
||||
var _state$modifiersData$;
|
||||
|
||||
var state = _ref.state,
|
||||
name = _ref.name;
|
||||
name = _ref.name,
|
||||
options = _ref.options;
|
||||
var arrowElement = state.elements.arrow;
|
||||
var popperOffsets = state.modifiersData.popperOffsets;
|
||||
var basePlacement = getBasePlacement(state.placement);
|
||||
@@ -25,7 +32,7 @@ function arrow(_ref) {
|
||||
return;
|
||||
}
|
||||
|
||||
var paddingObject = state.modifiersData[name + "#persistent"].padding;
|
||||
var paddingObject = toPaddingObject(options.padding, state);
|
||||
var arrowRect = getLayoutRect(arrowElement);
|
||||
var minProp = axis === 'y' ? top : left;
|
||||
var maxProp = axis === 'y' ? bottom : right;
|
||||
@@ -47,12 +54,9 @@ function arrow(_ref) {
|
||||
|
||||
function effect(_ref2) {
|
||||
var state = _ref2.state,
|
||||
options = _ref2.options,
|
||||
name = _ref2.name;
|
||||
options = _ref2.options;
|
||||
var _options$element = options.element,
|
||||
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
|
||||
_options$padding = options.padding,
|
||||
padding = _options$padding === void 0 ? 0 : _options$padding;
|
||||
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
||||
|
||||
if (arrowElement == null) {
|
||||
return;
|
||||
@@ -67,24 +71,11 @@ function effect(_ref2) {
|
||||
}
|
||||
}
|
||||
|
||||
if (false) {
|
||||
if (!isHTMLElement(arrowElement)) {
|
||||
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
if (!contains(state.elements.popper, arrowElement)) {
|
||||
if (false) {
|
||||
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
state.elements.arrow = arrowElement;
|
||||
state.modifiersData[name + "#persistent"] = {
|
||||
padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
|
||||
};
|
||||
} // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
|
||||
|
||||
109
node_modules/@popperjs/core/dist/esm/modifiers/computeStyles.js
generated
vendored
109
node_modules/@popperjs/core/dist/esm/modifiers/computeStyles.js
generated
vendored
@@ -1,9 +1,11 @@
|
||||
import { top, left, right, bottom } from "../enums.js";
|
||||
import { top, left, right, bottom, end } from "../enums.js";
|
||||
import getOffsetParent from "../dom-utils/getOffsetParent.js";
|
||||
import getWindow from "../dom-utils/getWindow.js";
|
||||
import getDocumentElement from "../dom-utils/getDocumentElement.js";
|
||||
import getComputedStyle from "../dom-utils/getComputedStyle.js";
|
||||
import getBasePlacement from "../utils/getBasePlacement.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
import getBasePlacement from "../utils/getBasePlacement.js";
|
||||
import getVariation from "../utils/getVariation.js";
|
||||
import { round } from "../utils/math.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
var unsetSides = {
|
||||
top: 'auto',
|
||||
@@ -14,14 +16,13 @@ var unsetSides = {
|
||||
// Zooming can change the DPR, but it seems to report a value that will
|
||||
// cleanly divide the values into the appropriate subpixels.
|
||||
|
||||
function roundOffsets(_ref) {
|
||||
function roundOffsetsByDPR(_ref, win) {
|
||||
var x = _ref.x,
|
||||
y = _ref.y;
|
||||
var win = window;
|
||||
var dpr = win.devicePixelRatio || 1;
|
||||
return {
|
||||
x: Math.round(x * dpr) / dpr || 0,
|
||||
y: Math.round(y * dpr) / dpr || 0
|
||||
x: round(x * dpr) / dpr || 0,
|
||||
y: round(y * dpr) / dpr || 0
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,15 +32,28 @@ export function mapToStyles(_ref2) {
|
||||
var popper = _ref2.popper,
|
||||
popperRect = _ref2.popperRect,
|
||||
placement = _ref2.placement,
|
||||
variation = _ref2.variation,
|
||||
offsets = _ref2.offsets,
|
||||
position = _ref2.position,
|
||||
gpuAcceleration = _ref2.gpuAcceleration,
|
||||
adaptive = _ref2.adaptive;
|
||||
adaptive = _ref2.adaptive,
|
||||
roundOffsets = _ref2.roundOffsets,
|
||||
isFixed = _ref2.isFixed;
|
||||
var _offsets$x = offsets.x,
|
||||
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
||||
_offsets$y = offsets.y,
|
||||
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
||||
|
||||
var _roundOffsets = roundOffsets(offsets),
|
||||
x = _roundOffsets.x,
|
||||
y = _roundOffsets.y;
|
||||
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
||||
x: x,
|
||||
y: y
|
||||
}) : {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
x = _ref3.x;
|
||||
y = _ref3.y;
|
||||
var hasX = offsets.hasOwnProperty('x');
|
||||
var hasY = offsets.hasOwnProperty('y');
|
||||
var sideX = left;
|
||||
@@ -48,23 +62,34 @@ export function mapToStyles(_ref2) {
|
||||
|
||||
if (adaptive) {
|
||||
var offsetParent = getOffsetParent(popper);
|
||||
var heightProp = 'clientHeight';
|
||||
var widthProp = 'clientWidth';
|
||||
|
||||
if (offsetParent === getWindow(popper)) {
|
||||
offsetParent = getDocumentElement(popper);
|
||||
} // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
||||
|
||||
/*:: offsetParent = (offsetParent: Element); */
|
||||
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
||||
heightProp = 'scrollHeight';
|
||||
widthProp = 'scrollWidth';
|
||||
}
|
||||
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
||||
|
||||
|
||||
if (placement === top) {
|
||||
offsetParent = offsetParent;
|
||||
|
||||
if (placement === top || (placement === left || placement === right) && variation === end) {
|
||||
sideY = bottom;
|
||||
y -= offsetParent.clientHeight - popperRect.height;
|
||||
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
||||
offsetParent[heightProp];
|
||||
y -= offsetY - popperRect.height;
|
||||
y *= gpuAcceleration ? 1 : -1;
|
||||
}
|
||||
|
||||
if (placement === left) {
|
||||
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
||||
sideX = right;
|
||||
x -= offsetParent.clientWidth - popperRect.width;
|
||||
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
||||
offsetParent[widthProp];
|
||||
x -= offsetX - popperRect.width;
|
||||
x *= gpuAcceleration ? 1 : -1;
|
||||
}
|
||||
}
|
||||
@@ -73,57 +98,63 @@ export function mapToStyles(_ref2) {
|
||||
position: position
|
||||
}, adaptive && unsetSides);
|
||||
|
||||
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
||||
x: x,
|
||||
y: y
|
||||
}, getWindow(popper)) : {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
x = _ref4.x;
|
||||
y = _ref4.y;
|
||||
|
||||
if (gpuAcceleration) {
|
||||
var _Object$assign;
|
||||
|
||||
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
||||
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
||||
}
|
||||
|
||||
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
||||
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
||||
}
|
||||
|
||||
function computeStyles(_ref3) {
|
||||
var state = _ref3.state,
|
||||
options = _ref3.options;
|
||||
function computeStyles(_ref5) {
|
||||
var state = _ref5.state,
|
||||
options = _ref5.options;
|
||||
var _options$gpuAccelerat = options.gpuAcceleration,
|
||||
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
||||
_options$adaptive = options.adaptive,
|
||||
adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
|
||||
|
||||
if (false) {
|
||||
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
|
||||
|
||||
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
||||
return transitionProperty.indexOf(property) >= 0;
|
||||
})) {
|
||||
console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
||||
_options$roundOffsets = options.roundOffsets,
|
||||
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
||||
var commonStyles = {
|
||||
placement: getBasePlacement(state.placement),
|
||||
variation: getVariation(state.placement),
|
||||
popper: state.elements.popper,
|
||||
popperRect: state.rects.popper,
|
||||
gpuAcceleration: gpuAcceleration
|
||||
gpuAcceleration: gpuAcceleration,
|
||||
isFixed: state.options.strategy === 'fixed'
|
||||
};
|
||||
|
||||
if (state.modifiersData.popperOffsets != null) {
|
||||
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
|
||||
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
||||
offsets: state.modifiersData.popperOffsets,
|
||||
position: state.options.strategy,
|
||||
adaptive: adaptive
|
||||
adaptive: adaptive,
|
||||
roundOffsets: roundOffsets
|
||||
})));
|
||||
}
|
||||
|
||||
if (state.modifiersData.arrow != null) {
|
||||
state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
|
||||
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
||||
offsets: state.modifiersData.arrow,
|
||||
position: 'absolute',
|
||||
adaptive: false
|
||||
adaptive: false,
|
||||
roundOffsets: roundOffsets
|
||||
})));
|
||||
}
|
||||
|
||||
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
|
||||
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
||||
'data-popper-placement': state.placement
|
||||
});
|
||||
} // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
2
node_modules/@popperjs/core/dist/esm/modifiers/hide.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/modifiers/hide.js
generated
vendored
@@ -45,7 +45,7 @@ function hide(_ref) {
|
||||
isReferenceHidden: isReferenceHidden,
|
||||
hasPopperEscaped: hasPopperEscaped
|
||||
};
|
||||
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
|
||||
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
||||
'data-popper-reference-hidden': isReferenceHidden,
|
||||
'data-popper-escaped': hasPopperEscaped
|
||||
});
|
||||
|
||||
9
node_modules/@popperjs/core/dist/esm/modifiers/index.js
generated
vendored
Normal file
9
node_modules/@popperjs/core/dist/esm/modifiers/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { default as applyStyles } from "./applyStyles.js";
|
||||
export { default as arrow } from "./arrow.js";
|
||||
export { default as computeStyles } from "./computeStyles.js";
|
||||
export { default as eventListeners } from "./eventListeners.js";
|
||||
export { default as flip } from "./flip.js";
|
||||
export { default as hide } from "./hide.js";
|
||||
export { default as offset } from "./offset.js";
|
||||
export { default as popperOffsets } from "./popperOffsets.js";
|
||||
export { default as preventOverflow } from "./preventOverflow.js";
|
||||
5
node_modules/@popperjs/core/dist/esm/modifiers/offset.js
generated
vendored
5
node_modules/@popperjs/core/dist/esm/modifiers/offset.js
generated
vendored
@@ -1,10 +1,11 @@
|
||||
import getBasePlacement from "../utils/getBasePlacement.js";
|
||||
import { top, left, right, placements } from "../enums.js";
|
||||
import { top, left, right, placements } from "../enums.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export function distanceAndSkiddingToXY(placement, rects, offset) {
|
||||
var basePlacement = getBasePlacement(placement);
|
||||
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
||||
|
||||
var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
|
||||
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
||||
placement: placement
|
||||
})) : offset,
|
||||
skidding = _ref[0],
|
||||
|
||||
45
node_modules/@popperjs/core/dist/esm/modifiers/preventOverflow.js
generated
vendored
45
node_modules/@popperjs/core/dist/esm/modifiers/preventOverflow.js
generated
vendored
@@ -2,12 +2,13 @@ import { top, left, right, bottom, start } from "../enums.js";
|
||||
import getBasePlacement from "../utils/getBasePlacement.js";
|
||||
import getMainAxisFromPlacement from "../utils/getMainAxisFromPlacement.js";
|
||||
import getAltAxis from "../utils/getAltAxis.js";
|
||||
import within from "../utils/within.js";
|
||||
import { within, withinMaxClamp } from "../utils/within.js";
|
||||
import getLayoutRect from "../dom-utils/getLayoutRect.js";
|
||||
import getOffsetParent from "../dom-utils/getOffsetParent.js";
|
||||
import detectOverflow from "../utils/detectOverflow.js";
|
||||
import getVariation from "../utils/getVariation.js";
|
||||
import getFreshSideObject from "../utils/getFreshSideObject.js";
|
||||
import { min as mathMin, max as mathMax } from "../utils/math.js";
|
||||
|
||||
function preventOverflow(_ref) {
|
||||
var state = _ref.state,
|
||||
@@ -39,9 +40,17 @@ function preventOverflow(_ref) {
|
||||
var popperOffsets = state.modifiersData.popperOffsets;
|
||||
var referenceRect = state.rects.reference;
|
||||
var popperRect = state.rects.popper;
|
||||
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
|
||||
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
||||
placement: state.placement
|
||||
})) : tetherOffset;
|
||||
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
||||
mainAxis: tetherOffsetValue,
|
||||
altAxis: tetherOffsetValue
|
||||
} : Object.assign({
|
||||
mainAxis: 0,
|
||||
altAxis: 0
|
||||
}, tetherOffsetValue);
|
||||
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
||||
var data = {
|
||||
x: 0,
|
||||
y: 0
|
||||
@@ -52,12 +61,14 @@ function preventOverflow(_ref) {
|
||||
}
|
||||
|
||||
if (checkMainAxis) {
|
||||
var _offsetModifierState$;
|
||||
|
||||
var mainSide = mainAxis === 'y' ? top : left;
|
||||
var altSide = mainAxis === 'y' ? bottom : right;
|
||||
var len = mainAxis === 'y' ? 'height' : 'width';
|
||||
var offset = popperOffsets[mainAxis];
|
||||
var min = popperOffsets[mainAxis] + overflow[mainSide];
|
||||
var max = popperOffsets[mainAxis] - overflow[altSide];
|
||||
var min = offset + overflow[mainSide];
|
||||
var max = offset - overflow[altSide];
|
||||
var additive = tether ? -popperRect[len] / 2 : 0;
|
||||
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
||||
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
||||
@@ -77,30 +88,42 @@ function preventOverflow(_ref) {
|
||||
// width or height)
|
||||
|
||||
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
||||
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
|
||||
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
|
||||
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
||||
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
||||
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
||||
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
||||
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
|
||||
var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
|
||||
var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
|
||||
var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
|
||||
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
||||
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
||||
var tetherMax = offset + maxOffset - offsetModifierValue;
|
||||
var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);
|
||||
popperOffsets[mainAxis] = preventedOffset;
|
||||
data[mainAxis] = preventedOffset - offset;
|
||||
}
|
||||
|
||||
if (checkAltAxis) {
|
||||
var _offsetModifierState$2;
|
||||
|
||||
var _mainSide = mainAxis === 'x' ? top : left;
|
||||
|
||||
var _altSide = mainAxis === 'x' ? bottom : right;
|
||||
|
||||
var _offset = popperOffsets[altAxis];
|
||||
|
||||
var _len = altAxis === 'y' ? 'height' : 'width';
|
||||
|
||||
var _min = _offset + overflow[_mainSide];
|
||||
|
||||
var _max = _offset - overflow[_altSide];
|
||||
|
||||
var _preventedOffset = within(_min, _offset, _max);
|
||||
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
||||
|
||||
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
||||
|
||||
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
||||
|
||||
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
||||
|
||||
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
||||
|
||||
popperOffsets[altAxis] = _preventedOffset;
|
||||
data[altAxis] = _preventedOffset - _offset;
|
||||
|
||||
2
node_modules/@popperjs/core/dist/esm/popper-base.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/popper-base.js
generated
vendored
@@ -1,3 +1,3 @@
|
||||
import { createPopper, popperGenerator, detectOverflow } from "./index.js";
|
||||
import { createPopper, popperGenerator, detectOverflow } from "./createPopper.js";
|
||||
// eslint-disable-next-line import/no-unused-modules
|
||||
export { createPopper, popperGenerator, detectOverflow };
|
||||
2
node_modules/@popperjs/core/dist/esm/popper-lite.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/popper-lite.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import { popperGenerator, detectOverflow } from "./index.js";
|
||||
import { popperGenerator, detectOverflow } from "./createPopper.js";
|
||||
import eventListeners from "./modifiers/eventListeners.js";
|
||||
import popperOffsets from "./modifiers/popperOffsets.js";
|
||||
import computeStyles from "./modifiers/computeStyles.js";
|
||||
|
||||
8
node_modules/@popperjs/core/dist/esm/popper.js
generated
vendored
8
node_modules/@popperjs/core/dist/esm/popper.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import { popperGenerator, detectOverflow } from "./index.js";
|
||||
import { popperGenerator, detectOverflow } from "./createPopper.js";
|
||||
import eventListeners from "./modifiers/eventListeners.js";
|
||||
import popperOffsets from "./modifiers/popperOffsets.js";
|
||||
import computeStyles from "./modifiers/computeStyles.js";
|
||||
@@ -13,4 +13,8 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
||||
defaultModifiers: defaultModifiers
|
||||
}); // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export { createPopper, popperGenerator, defaultModifiers, detectOverflow };
|
||||
export { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export { createPopper as createPopperLite } from "./popper-lite.js"; // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export * from "./modifiers/index.js";
|
||||
13
node_modules/@popperjs/core/dist/esm/utils/computeAutoPlacement.js
generated
vendored
13
node_modules/@popperjs/core/dist/esm/utils/computeAutoPlacement.js
generated
vendored
@@ -2,10 +2,6 @@ import getVariation from "./getVariation.js";
|
||||
import { variationPlacements, basePlacements, placements as allPlacements } from "../enums.js";
|
||||
import detectOverflow from "./detectOverflow.js";
|
||||
import getBasePlacement from "./getBasePlacement.js";
|
||||
|
||||
/*:: type OverflowsMap = { [ComputedPlacement]: number }; */
|
||||
|
||||
/*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
|
||||
export default function computeAutoPlacement(state, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
@@ -22,19 +18,14 @@ export default function computeAutoPlacement(state, options) {
|
||||
var variation = getVariation(placement);
|
||||
var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
||||
return getVariation(placement) === variation;
|
||||
}) : basePlacements; // $FlowFixMe
|
||||
|
||||
}) : basePlacements;
|
||||
var allowedPlacements = placements.filter(function (placement) {
|
||||
return allowedAutoPlacements.indexOf(placement) >= 0;
|
||||
});
|
||||
|
||||
if (allowedPlacements.length === 0) {
|
||||
allowedPlacements = placements;
|
||||
|
||||
if (false) {
|
||||
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
|
||||
}
|
||||
} // $FlowFixMe: Flow seems to have problems with two array unions...
|
||||
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
||||
|
||||
|
||||
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
||||
|
||||
4
node_modules/@popperjs/core/dist/esm/utils/computeOffsets.js
generated
vendored
4
node_modules/@popperjs/core/dist/esm/utils/computeOffsets.js
generated
vendored
@@ -55,11 +55,11 @@ export default function computeOffsets(_ref) {
|
||||
|
||||
switch (variation) {
|
||||
case start:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
|
||||
case end:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
11
node_modules/@popperjs/core/dist/esm/utils/detectOverflow.js
generated
vendored
11
node_modules/@popperjs/core/dist/esm/utils/detectOverflow.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
import getBoundingClientRect from "../dom-utils/getBoundingClientRect.js";
|
||||
import getClippingRect from "../dom-utils/getClippingRect.js";
|
||||
import getDocumentElement from "../dom-utils/getDocumentElement.js";
|
||||
import getBoundingClientRect from "../dom-utils/getBoundingClientRect.js";
|
||||
import computeOffsets from "./computeOffsets.js";
|
||||
import rectToClientRect from "./rectToClientRect.js";
|
||||
import { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from "../enums.js";
|
||||
@@ -16,6 +16,8 @@ export default function detectOverflow(state, options) {
|
||||
var _options = options,
|
||||
_options$placement = _options.placement,
|
||||
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
||||
_options$strategy = _options.strategy,
|
||||
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
||||
_options$boundary = _options.boundary,
|
||||
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
||||
_options$rootBoundary = _options.rootBoundary,
|
||||
@@ -28,18 +30,17 @@ export default function detectOverflow(state, options) {
|
||||
padding = _options$padding === void 0 ? 0 : _options$padding;
|
||||
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
||||
var altContext = elementContext === popper ? reference : popper;
|
||||
var referenceElement = state.elements.reference;
|
||||
var popperRect = state.rects.popper;
|
||||
var element = state.elements[altBoundary ? altContext : elementContext];
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
||||
var referenceClientRect = getBoundingClientRect(referenceElement);
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
||||
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
||||
var popperOffsets = computeOffsets({
|
||||
reference: referenceClientRect,
|
||||
element: popperRect,
|
||||
strategy: 'absolute',
|
||||
placement: placement
|
||||
});
|
||||
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
||||
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
||||
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
||||
// 0 or negative = within the clipping rect
|
||||
|
||||
|
||||
9
node_modules/@popperjs/core/dist/esm/utils/format.js
generated
vendored
9
node_modules/@popperjs/core/dist/esm/utils/format.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
export default function format(str) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return [].concat(args).reduce(function (p, c) {
|
||||
return p.replace(/%s/, c);
|
||||
}, str);
|
||||
}
|
||||
3
node_modules/@popperjs/core/dist/esm/utils/math.js
generated
vendored
Normal file
3
node_modules/@popperjs/core/dist/esm/utils/math.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export var max = Math.max;
|
||||
export var min = Math.min;
|
||||
export var round = Math.round;
|
||||
6
node_modules/@popperjs/core/dist/esm/utils/mergeByName.js
generated
vendored
6
node_modules/@popperjs/core/dist/esm/utils/mergeByName.js
generated
vendored
@@ -1,9 +1,9 @@
|
||||
export default function mergeByName(modifiers) {
|
||||
var merged = modifiers.reduce(function (merged, current) {
|
||||
var existing = merged[current.name];
|
||||
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
|
||||
options: Object.assign(Object.assign({}, existing.options), current.options),
|
||||
data: Object.assign(Object.assign({}, existing.data), current.data)
|
||||
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
||||
options: Object.assign({}, existing.options, current.options),
|
||||
data: Object.assign({}, existing.data, current.data)
|
||||
}) : current;
|
||||
return merged;
|
||||
}, {}); // IE11 does not support Object.values
|
||||
|
||||
2
node_modules/@popperjs/core/dist/esm/utils/mergePaddingObject.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/utils/mergePaddingObject.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import getFreshSideObject from "./getFreshSideObject.js";
|
||||
export default function mergePaddingObject(paddingObject) {
|
||||
return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
|
||||
return Object.assign({}, getFreshSideObject(), paddingObject);
|
||||
}
|
||||
2
node_modules/@popperjs/core/dist/esm/utils/rectToClientRect.js
generated
vendored
2
node_modules/@popperjs/core/dist/esm/utils/rectToClientRect.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
export default function rectToClientRect(rect) {
|
||||
return Object.assign(Object.assign({}, rect), {}, {
|
||||
return Object.assign({}, rect, {
|
||||
left: rect.x,
|
||||
top: rect.y,
|
||||
right: rect.x + rect.width,
|
||||
|
||||
11
node_modules/@popperjs/core/dist/esm/utils/userAgent.js
generated
vendored
Normal file
11
node_modules/@popperjs/core/dist/esm/utils/userAgent.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export default function getUAString() {
|
||||
var uaData = navigator.userAgentData;
|
||||
|
||||
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
||||
return uaData.brands.map(function (item) {
|
||||
return item.brand + "/" + item.version;
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
return navigator.userAgent;
|
||||
}
|
||||
76
node_modules/@popperjs/core/dist/esm/utils/validateModifiers.js
generated
vendored
76
node_modules/@popperjs/core/dist/esm/utils/validateModifiers.js
generated
vendored
@@ -1,76 +0,0 @@
|
||||
import format from "./format.js";
|
||||
import { modifierPhases } from "../enums.js";
|
||||
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
||||
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
||||
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
||||
export default function validateModifiers(modifiers) {
|
||||
modifiers.forEach(function (modifier) {
|
||||
Object.keys(modifier).forEach(function (key) {
|
||||
switch (key) {
|
||||
case 'name':
|
||||
if (typeof modifier.name !== 'string') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'enabled':
|
||||
if (typeof modifier.enabled !== 'boolean') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
||||
}
|
||||
|
||||
case 'phase':
|
||||
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'fn':
|
||||
if (typeof modifier.fn !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'effect':
|
||||
if (typeof modifier.effect !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requires':
|
||||
if (!Array.isArray(modifier.requires)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requiresIfExists':
|
||||
if (!Array.isArray(modifier.requiresIfExists)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'options':
|
||||
case 'data':
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
||||
return "\"" + s + "\"";
|
||||
}).join(', ') + "; but \"" + key + "\" was provided.");
|
||||
}
|
||||
|
||||
modifier.requires && modifier.requires.forEach(function (requirement) {
|
||||
if (modifiers.find(function (mod) {
|
||||
return mod.name === requirement;
|
||||
}) == null) {
|
||||
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
9
node_modules/@popperjs/core/dist/esm/utils/within.js
generated
vendored
9
node_modules/@popperjs/core/dist/esm/utils/within.js
generated
vendored
@@ -1,3 +1,8 @@
|
||||
export default function within(min, value, max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
import { max as mathMax, min as mathMin } from "./math.js";
|
||||
export function within(min, value, max) {
|
||||
return mathMax(min, mathMin(value, max));
|
||||
}
|
||||
export function withinMaxClamp(min, value, max) {
|
||||
var v = within(min, value, max);
|
||||
return v > max ? max : v;
|
||||
}
|
||||
71
node_modules/@popperjs/core/dist/umd/enums.js
generated
vendored
Normal file
71
node_modules/@popperjs/core/dist/umd/enums.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Popper = {}));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
var clippingParents = 'clippingParents';
|
||||
var viewport = 'viewport';
|
||||
var popper = 'popper';
|
||||
var reference = 'reference';
|
||||
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
||||
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
||||
}, []);
|
||||
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
||||
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
||||
}, []); // modifiers that need to read the DOM
|
||||
|
||||
var beforeRead = 'beforeRead';
|
||||
var read = 'read';
|
||||
var afterRead = 'afterRead'; // pure-logic modifiers
|
||||
|
||||
var beforeMain = 'beforeMain';
|
||||
var main = 'main';
|
||||
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
||||
|
||||
var beforeWrite = 'beforeWrite';
|
||||
var write = 'write';
|
||||
var afterWrite = 'afterWrite';
|
||||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||||
|
||||
exports.afterMain = afterMain;
|
||||
exports.afterRead = afterRead;
|
||||
exports.afterWrite = afterWrite;
|
||||
exports.auto = auto;
|
||||
exports.basePlacements = basePlacements;
|
||||
exports.beforeMain = beforeMain;
|
||||
exports.beforeRead = beforeRead;
|
||||
exports.beforeWrite = beforeWrite;
|
||||
exports.bottom = bottom;
|
||||
exports.clippingParents = clippingParents;
|
||||
exports.end = end;
|
||||
exports.left = left;
|
||||
exports.main = main;
|
||||
exports.modifierPhases = modifierPhases;
|
||||
exports.placements = placements;
|
||||
exports.popper = popper;
|
||||
exports.read = read;
|
||||
exports.reference = reference;
|
||||
exports.right = right;
|
||||
exports.start = start;
|
||||
exports.top = top;
|
||||
exports.variationPlacements = variationPlacements;
|
||||
exports.viewport = viewport;
|
||||
exports.write = write;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=enums.js.map
|
||||
1
node_modules/@popperjs/core/dist/umd/enums.js.map
generated
vendored
Normal file
1
node_modules/@popperjs/core/dist/umd/enums.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"enums.js","sources":["../../src/enums.js"],"sourcesContent":["// @flow\nexport const top: 'top' = 'top';\nexport const bottom: 'bottom' = 'bottom';\nexport const right: 'right' = 'right';\nexport const left: 'left' = 'left';\nexport const auto: 'auto' = 'auto';\nexport type BasePlacement =\n | typeof top\n | typeof bottom\n | typeof right\n | typeof left;\nexport const basePlacements: Array<BasePlacement> = [top, bottom, right, left];\n\nexport const start: 'start' = 'start';\nexport const end: 'end' = 'end';\nexport type Variation = typeof start | typeof end;\n\nexport const clippingParents: 'clippingParents' = 'clippingParents';\nexport const viewport: 'viewport' = 'viewport';\nexport type Boundary = Element | Array<Element> | typeof clippingParents;\nexport type RootBoundary = typeof viewport | 'document';\n\nexport const popper: 'popper' = 'popper';\nexport const reference: 'reference' = 'reference';\nexport type Context = typeof popper | typeof reference;\n\nexport type VariationPlacement =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'right-start'\n | 'right-end'\n | 'left-start'\n | 'left-end';\nexport type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';\nexport type ComputedPlacement = VariationPlacement | BasePlacement;\nexport type Placement = AutoPlacement | BasePlacement | VariationPlacement;\n\nexport const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(\n (acc: Array<VariationPlacement>, placement: BasePlacement) =>\n acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),\n []\n);\nexport const placements: Array<Placement> = [...basePlacements, auto].reduce(\n (\n acc: Array<Placement>,\n placement: BasePlacement | typeof auto\n ): Array<Placement> =>\n acc.concat([\n placement,\n (`${placement}-${start}`: any),\n (`${placement}-${end}`: any),\n ]),\n []\n);\n\n// modifiers that need to read the DOM\nexport const beforeRead: 'beforeRead' = 'beforeRead';\nexport const read: 'read' = 'read';\nexport const afterRead: 'afterRead' = 'afterRead';\n// pure-logic modifiers\nexport const beforeMain: 'beforeMain' = 'beforeMain';\nexport const main: 'main' = 'main';\nexport const afterMain: 'afterMain' = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nexport const beforeWrite: 'beforeWrite' = 'beforeWrite';\nexport const write: 'write' = 'write';\nexport const afterWrite: 'afterWrite' = 'afterWrite';\nexport const modifierPhases: Array<ModifierPhases> = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite,\n];\n\nexport type ModifierPhases =\n | typeof beforeRead\n | typeof read\n | typeof afterRead\n | typeof beforeMain\n | typeof main\n | typeof afterMain\n | typeof beforeWrite\n | typeof write\n | typeof afterWrite;\n"],"names":["top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","concat","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases"],"mappings":";;;;;;;;;;MACaA,GAAU,GAAG;MACbC,MAAgB,GAAG;MACnBC,KAAc,GAAG;MACjBC,IAAY,GAAG;MACfC,IAAY,GAAG;MAMfC,cAAoC,GAAG,CAACL,GAAD,EAAMC,MAAN,EAAcC,KAAd,EAAqBC,IAArB;MAEvCG,KAAc,GAAG;MACjBC,GAAU,GAAG;MAGbC,eAAkC,GAAG;MACrCC,QAAoB,GAAG;MAIvBC,MAAgB,GAAG;MACnBC,SAAsB,GAAG;MAgBzBC,mBAA8C,gBAAGP,cAAc,CAACQ,MAAf,CAC5D,UAACC,GAAD,EAAiCC,SAAjC;EAAA,SACED,GAAG,CAACE,MAAJ,CAAW,CAAKD,SAAL,SAAkBT,KAAlB,EAAqCS,SAArC,SAAkDR,GAAlD,CAAX,CADF;EAAA,CAD4D,EAG5D,EAH4D;MAKjDU,UAA4B,gBAAG,UAAIZ,cAAJ,GAAoBD,IAApB,GAA0BS,MAA1B,CAC1C,UACEC,GADF,EAEEC,SAFF;EAAA,SAIED,GAAG,CAACE,MAAJ,CAAW,CACTD,SADS,EAELA,SAFK,SAEQT,KAFR,EAGLS,SAHK,SAGQR,GAHR,CAAX,CAJF;EAAA,CAD0C,EAU1C,EAV0C;;MAc/BW,UAAwB,GAAG;MAC3BC,IAAY,GAAG;MACfC,SAAsB,GAAG;;MAEzBC,UAAwB,GAAG;MAC3BC,IAAY,GAAG;MACfC,SAAsB,GAAG;;MAEzBC,WAA0B,GAAG;MAC7BC,KAAc,GAAG;MACjBC,UAAwB,GAAG;MAC3BC,cAAqC,GAAG,CACnDT,UADmD,EAEnDC,IAFmD,EAGnDC,SAHmD,EAInDC,UAJmD,EAKnDC,IALmD,EAMnDC,SANmD,EAOnDC,WAPmD,EAQnDC,KARmD,EASnDC,UATmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
6
node_modules/@popperjs/core/dist/umd/enums.min.js
generated
vendored
Normal file
6
node_modules/@popperjs/core/dist/umd/enums.min.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,(function(e){"use strict";var t="bottom",r="right",o="left",n="auto",a=["top",t,r,o],i="start",f="end",p=a.reduce((function(e,t){return e.concat([t+"-"+i,t+"-"+f])}),[]),c=[].concat(a,[n]).reduce((function(e,t){return e.concat([t,t+"-"+i,t+"-"+f])}),[]),d="beforeRead",s="read",u="afterRead",l="beforeMain",b="main",m="afterMain",P="beforeWrite",g="write",h="afterWrite",v=[d,s,u,l,b,m,P,g,h];e.afterMain=m,e.afterRead=u,e.afterWrite=h,e.auto=n,e.basePlacements=a,e.beforeMain=l,e.beforeRead=d,e.beforeWrite=P,e.bottom=t,e.clippingParents="clippingParents",e.end=f,e.left=o,e.main=b,e.modifierPhases=v,e.placements=c,e.popper="popper",e.read=s,e.reference="reference",e.right=r,e.start=i,e.top="top",e.variationPlacements=p,e.viewport="viewport",e.write=g,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
//# sourceMappingURL=enums.min.js.map
|
||||
3
node_modules/@popperjs/core/dist/umd/enums.min.js.flow
generated
vendored
Normal file
3
node_modules/@popperjs/core/dist/umd/enums.min.js.flow
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// @flow
|
||||
|
||||
export * from '../../lib/enums.js'
|
||||
1
node_modules/@popperjs/core/dist/umd/enums.min.js.map
generated
vendored
Normal file
1
node_modules/@popperjs/core/dist/umd/enums.min.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"enums.min.js","sources":["../../src/enums.js"],"sourcesContent":["// @flow\nexport const top: 'top' = 'top';\nexport const bottom: 'bottom' = 'bottom';\nexport const right: 'right' = 'right';\nexport const left: 'left' = 'left';\nexport const auto: 'auto' = 'auto';\nexport type BasePlacement =\n | typeof top\n | typeof bottom\n | typeof right\n | typeof left;\nexport const basePlacements: Array<BasePlacement> = [top, bottom, right, left];\n\nexport const start: 'start' = 'start';\nexport const end: 'end' = 'end';\nexport type Variation = typeof start | typeof end;\n\nexport const clippingParents: 'clippingParents' = 'clippingParents';\nexport const viewport: 'viewport' = 'viewport';\nexport type Boundary = Element | Array<Element> | typeof clippingParents;\nexport type RootBoundary = typeof viewport | 'document';\n\nexport const popper: 'popper' = 'popper';\nexport const reference: 'reference' = 'reference';\nexport type Context = typeof popper | typeof reference;\n\nexport type VariationPlacement =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'right-start'\n | 'right-end'\n | 'left-start'\n | 'left-end';\nexport type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';\nexport type ComputedPlacement = VariationPlacement | BasePlacement;\nexport type Placement = AutoPlacement | BasePlacement | VariationPlacement;\n\nexport const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(\n (acc: Array<VariationPlacement>, placement: BasePlacement) =>\n acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),\n []\n);\nexport const placements: Array<Placement> = [...basePlacements, auto].reduce(\n (\n acc: Array<Placement>,\n placement: BasePlacement | typeof auto\n ): Array<Placement> =>\n acc.concat([\n placement,\n (`${placement}-${start}`: any),\n (`${placement}-${end}`: any),\n ]),\n []\n);\n\n// modifiers that need to read the DOM\nexport const beforeRead: 'beforeRead' = 'beforeRead';\nexport const read: 'read' = 'read';\nexport const afterRead: 'afterRead' = 'afterRead';\n// pure-logic modifiers\nexport const beforeMain: 'beforeMain' = 'beforeMain';\nexport const main: 'main' = 'main';\nexport const afterMain: 'afterMain' = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nexport const beforeWrite: 'beforeWrite' = 'beforeWrite';\nexport const write: 'write' = 'write';\nexport const afterWrite: 'afterWrite' = 'afterWrite';\nexport const modifierPhases: Array<ModifierPhases> = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite,\n];\n\nexport type ModifierPhases =\n | typeof beforeRead\n | typeof read\n | typeof afterRead\n | typeof beforeMain\n | typeof main\n | typeof afterMain\n | typeof beforeWrite\n | typeof write\n | typeof afterWrite;\n"],"names":["bottom","right","left","auto","basePlacements","start","end","variationPlacements","reduce","acc","placement","concat","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases"],"mappings":";;;;kPAEaA,EAAmB,SACnBC,EAAiB,QACjBC,EAAe,OACfC,EAAe,OAMfC,EAAuC,CAV1B,MAUgCJ,EAAQC,EAAOC,GAE5DG,EAAiB,QACjBC,EAAa,MAyBbC,EAAiDH,EAAeI,QAC3E,SAACC,EAAgCC,UAC/BD,EAAIE,OAAO,CAAKD,MAAaL,EAAmBK,MAAaJ,MAC/D,IAEWM,EAA+B,UAAIR,GAAgBD,IAAMK,QACpE,SACEC,EACAC,UAEAD,EAAIE,OAAO,CACTD,EACIA,MAAaL,EACbK,MAAaJ,MAErB,IAIWO,EAA2B,aAC3BC,EAAe,OACfC,EAAyB,YAEzBC,EAA2B,aAC3BC,EAAe,OACfC,EAAyB,YAEzBC,EAA6B,cAC7BC,EAAiB,QACjBC,EAA2B,aAC3BC,EAAwC,CACnDT,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,qJA7DgD,uFAKlB,8BACM,sCAtBZ,yCAiBU"}
|
||||
478
node_modules/@popperjs/core/dist/umd/popper-base.js
generated
vendored
478
node_modules/@popperjs/core/dist/umd/popper-base.js
generated
vendored
@@ -1,39 +1,104 @@
|
||||
/**
|
||||
* @popperjs/core v2.4.4 - MIT License
|
||||
* @popperjs/core v2.11.8 - MIT License
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = global || self, factory(global.Popper = {}));
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Popper = {}));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
function getBoundingClientRect(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
x: rect.left,
|
||||
y: rect.top
|
||||
};
|
||||
}
|
||||
|
||||
/*:: import type { Window } from '../types'; */
|
||||
|
||||
/*:: declare function getWindow(node: Node | Window): Window; */
|
||||
function getWindow(node) {
|
||||
if (node == null) {
|
||||
return window;
|
||||
}
|
||||
|
||||
if (node.toString() !== '[object Window]') {
|
||||
var ownerDocument = node.ownerDocument;
|
||||
return ownerDocument ? ownerDocument.defaultView : window;
|
||||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function isShadowRoot(node) {
|
||||
// IE 11 has no ShadowRoot
|
||||
if (typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var OwnElement = getWindow(node).ShadowRoot;
|
||||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
var max = Math.max;
|
||||
var min = Math.min;
|
||||
var round = Math.round;
|
||||
|
||||
function getUAString() {
|
||||
var uaData = navigator.userAgentData;
|
||||
|
||||
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
||||
return uaData.brands.map(function (item) {
|
||||
return item.brand + "/" + item.version;
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
return navigator.userAgent;
|
||||
}
|
||||
|
||||
function isLayoutViewport() {
|
||||
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
|
||||
var clientRect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (includeScale && isHTMLElement(element)) {
|
||||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
||||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
||||
}
|
||||
|
||||
var _ref = isElement(element) ? getWindow(element) : window,
|
||||
visualViewport = _ref.visualViewport;
|
||||
|
||||
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
||||
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
||||
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
||||
var width = clientRect.width / scaleX;
|
||||
var height = clientRect.height / scaleY;
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
top: y,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
left: x,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
|
||||
function getWindowScroll(node) {
|
||||
var win = getWindow(node);
|
||||
var scrollLeft = win.pageXOffset;
|
||||
@@ -44,22 +109,6 @@
|
||||
};
|
||||
}
|
||||
|
||||
/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
|
||||
Element); */
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
|
||||
HTMLElement); */
|
||||
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function getHTMLElementScroll(element) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
@@ -80,8 +129,9 @@
|
||||
}
|
||||
|
||||
function getDocumentElement(element) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
return (isElement(element) ? element.ownerDocument : element.document).documentElement;
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
||||
element.document) || window.document).documentElement;
|
||||
}
|
||||
|
||||
function getWindowScrollBarX(element) {
|
||||
@@ -109,16 +159,24 @@
|
||||
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
||||
}
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement);
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
@@ -135,7 +193,7 @@
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent);
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
@@ -151,14 +209,28 @@
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
|
||||
function getLayoutRect(element) {
|
||||
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
||||
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
||||
|
||||
var width = element.offsetWidth;
|
||||
var height = element.offsetHeight;
|
||||
|
||||
if (Math.abs(clientRect.width - width) <= 1) {
|
||||
width = clientRect.width;
|
||||
}
|
||||
|
||||
if (Math.abs(clientRect.height - height) <= 1) {
|
||||
height = clientRect.height;
|
||||
}
|
||||
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: element.offsetWidth,
|
||||
height: element.offsetHeight
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
|
||||
@@ -167,12 +239,13 @@
|
||||
return element;
|
||||
}
|
||||
|
||||
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
// $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[prop-missing]
|
||||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||||
element.parentNode || // DOM Element detected
|
||||
// $FlowFixMe: need a better way to handle this...
|
||||
element.host || // ShadowRoot detected
|
||||
// $FlowFixMe: HTMLElement is a Node
|
||||
element.parentNode || ( // DOM Element detected
|
||||
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||||
getDocumentElement(element) // fallback
|
||||
|
||||
);
|
||||
@@ -180,7 +253,7 @@
|
||||
|
||||
function getScrollParent(node) {
|
||||
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return node.ownerDocument.body;
|
||||
}
|
||||
|
||||
@@ -194,21 +267,23 @@
|
||||
/*
|
||||
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
||||
until we get to the top window object. This list is what we attach scroll listeners
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
||||
reference element's position.
|
||||
*/
|
||||
|
||||
function listScrollParents(element, list) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
var scrollParent = getScrollParent(element);
|
||||
var isBody = getNodeName(scrollParent) === 'body';
|
||||
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
||||
var win = getWindow(scrollParent);
|
||||
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
||||
var updatedList = list.concat(target);
|
||||
return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
|
||||
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
||||
updatedList.concat(listScrollParents(getParentNode(target)));
|
||||
}
|
||||
|
||||
@@ -222,29 +297,36 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
var offsetParent = element.offsetParent;
|
||||
|
||||
if (offsetParent) {
|
||||
var html = getDocumentElement(offsetParent);
|
||||
|
||||
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
return offsetParent;
|
||||
return element.offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var isFirefox = /firefox/i.test(getUAString());
|
||||
var isIE = /Trident/i.test(getUAString());
|
||||
|
||||
if (isIE && isHTMLElement(element)) {
|
||||
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
||||
var elementCss = getComputedStyle(element);
|
||||
|
||||
if (elementCss.position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
if (isShadowRoot(currentNode)) {
|
||||
currentNode = currentNode.host;
|
||||
}
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
@@ -264,7 +346,7 @@
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
||||
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -275,7 +357,6 @@
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
@@ -356,113 +437,12 @@
|
||||
};
|
||||
}
|
||||
|
||||
function format(str) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return [].concat(args).reduce(function (p, c) {
|
||||
return p.replace(/%s/, c);
|
||||
}, str);
|
||||
}
|
||||
|
||||
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
||||
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
||||
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
||||
function validateModifiers(modifiers) {
|
||||
modifiers.forEach(function (modifier) {
|
||||
Object.keys(modifier).forEach(function (key) {
|
||||
switch (key) {
|
||||
case 'name':
|
||||
if (typeof modifier.name !== 'string') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'enabled':
|
||||
if (typeof modifier.enabled !== 'boolean') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
||||
}
|
||||
|
||||
case 'phase':
|
||||
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'fn':
|
||||
if (typeof modifier.fn !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'effect':
|
||||
if (typeof modifier.effect !== 'function') {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requires':
|
||||
if (!Array.isArray(modifier.requires)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'requiresIfExists':
|
||||
if (!Array.isArray(modifier.requiresIfExists)) {
|
||||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'options':
|
||||
case 'data':
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
||||
return "\"" + s + "\"";
|
||||
}).join(', ') + "; but \"" + key + "\" was provided.");
|
||||
}
|
||||
|
||||
modifier.requires && modifier.requires.forEach(function (requirement) {
|
||||
if (modifiers.find(function (mod) {
|
||||
return mod.name === requirement;
|
||||
}) == null) {
|
||||
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function uniqueBy(arr, fn) {
|
||||
var identifiers = new Set();
|
||||
return arr.filter(function (item) {
|
||||
var identifier = fn(item);
|
||||
|
||||
if (!identifiers.has(identifier)) {
|
||||
identifiers.add(identifier);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getBasePlacement(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
|
||||
function mergeByName(modifiers) {
|
||||
var merged = modifiers.reduce(function (merged, current) {
|
||||
var existing = merged[current.name];
|
||||
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
|
||||
options: Object.assign(Object.assign({}, existing.options), current.options),
|
||||
data: Object.assign(Object.assign({}, existing.data), current.data)
|
||||
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
||||
options: Object.assign({}, existing.options, current.options),
|
||||
data: Object.assign({}, existing.data, current.data)
|
||||
}) : current;
|
||||
return merged;
|
||||
}, {}); // IE11 does not support Object.values
|
||||
@@ -472,31 +452,21 @@
|
||||
});
|
||||
}
|
||||
|
||||
function getViewportRect(element) {
|
||||
function getViewportRect(element, strategy) {
|
||||
var win = getWindow(element);
|
||||
var html = getDocumentElement(element);
|
||||
var visualViewport = win.visualViewport;
|
||||
var width = html.clientWidth;
|
||||
var height = html.clientHeight;
|
||||
var x = 0;
|
||||
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
||||
// can be obscured underneath it.
|
||||
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
||||
// if it isn't open, so if this isn't available, the popper will be detected
|
||||
// to overflow the bottom of the screen too early.
|
||||
var y = 0;
|
||||
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
||||
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
||||
// errors due to floating point numbers, so we need to check precision.
|
||||
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
||||
// Feature detection fails in mobile emulation mode in Chrome.
|
||||
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
||||
// 0.001
|
||||
// Fallback here: "Not Safari" userAgent
|
||||
height = visualViewport.height;
|
||||
var layoutViewport = isLayoutViewport();
|
||||
|
||||
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
||||
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
@@ -513,16 +483,18 @@
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
function getDocumentRect(element) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = element.ownerDocument.body;
|
||||
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -534,19 +506,18 @@
|
||||
}
|
||||
|
||||
function contains(parent, child) {
|
||||
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
|
||||
var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (isShadow) {
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe: need a better way to handle this...
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
@@ -558,7 +529,7 @@
|
||||
}
|
||||
|
||||
function rectToClientRect(rect) {
|
||||
return Object.assign(Object.assign({}, rect), {}, {
|
||||
return Object.assign({}, rect, {
|
||||
left: rect.x,
|
||||
top: rect.y,
|
||||
right: rect.x + rect.width,
|
||||
@@ -566,8 +537,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
function getInnerBoundingClientRect(element) {
|
||||
var rect = getBoundingClientRect(element);
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
@@ -579,8 +550,8 @@
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
@@ -593,7 +564,7 @@
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe: https://github.com/facebook/flow/issues/1414
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
@@ -603,18 +574,18 @@
|
||||
// clipping parents
|
||||
|
||||
|
||||
function getClippingRect(element, boundary, rootBoundary) {
|
||||
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||||
accRect.top = Math.max(rect.top, accRect.top);
|
||||
accRect.right = Math.min(rect.right, accRect.right);
|
||||
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
||||
accRect.left = Math.max(rect.left, accRect.left);
|
||||
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
@@ -622,6 +593,10 @@
|
||||
return clippingRect;
|
||||
}
|
||||
|
||||
function getBasePlacement(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
|
||||
function getVariation(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
@@ -683,11 +658,11 @@
|
||||
|
||||
switch (variation) {
|
||||
case start:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
|
||||
case end:
|
||||
offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
|
||||
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -705,7 +680,7 @@
|
||||
}
|
||||
|
||||
function mergePaddingObject(paddingObject) {
|
||||
return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
|
||||
return Object.assign({}, getFreshSideObject(), paddingObject);
|
||||
}
|
||||
|
||||
function expandToHashMap(value, keys) {
|
||||
@@ -723,6 +698,8 @@
|
||||
var _options = options,
|
||||
_options$placement = _options.placement,
|
||||
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
||||
_options$strategy = _options.strategy,
|
||||
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
||||
_options$boundary = _options.boundary,
|
||||
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
||||
_options$rootBoundary = _options.rootBoundary,
|
||||
@@ -735,18 +712,17 @@
|
||||
padding = _options$padding === void 0 ? 0 : _options$padding;
|
||||
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
||||
var altContext = elementContext === popper ? reference : popper;
|
||||
var referenceElement = state.elements.reference;
|
||||
var popperRect = state.rects.popper;
|
||||
var element = state.elements[altBoundary ? altContext : elementContext];
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
||||
var referenceClientRect = getBoundingClientRect(referenceElement);
|
||||
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
||||
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
||||
var popperOffsets = computeOffsets({
|
||||
reference: referenceClientRect,
|
||||
element: popperRect,
|
||||
strategy: 'absolute',
|
||||
placement: placement
|
||||
});
|
||||
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
||||
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
||||
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
||||
// 0 or negative = within the clipping rect
|
||||
|
||||
@@ -770,8 +746,6 @@
|
||||
return overflowOffsets;
|
||||
}
|
||||
|
||||
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
||||
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
@@ -806,7 +780,7 @@
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
@@ -819,9 +793,10 @@
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(options) {
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
@@ -832,42 +807,7 @@
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
}); // Validate the provided modifiers so that the consumer will get warned
|
||||
// if one of the modifiers is invalid for any reason
|
||||
|
||||
{
|
||||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
||||
var name = _ref.name;
|
||||
return name;
|
||||
});
|
||||
validateModifiers(modifiers);
|
||||
|
||||
if (getBasePlacement(state.options.placement) === auto) {
|
||||
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name === 'flip';
|
||||
});
|
||||
|
||||
if (!flipModifier) {
|
||||
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
var _getComputedStyle = getComputedStyle(popper),
|
||||
marginTop = _getComputedStyle.marginTop,
|
||||
marginRight = _getComputedStyle.marginRight,
|
||||
marginBottom = _getComputedStyle.marginBottom,
|
||||
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
||||
// cause bugs with positioning, so we'll warn the consumer
|
||||
|
||||
|
||||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
||||
return parseFloat(margin);
|
||||
})) {
|
||||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
@@ -887,10 +827,6 @@
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
{
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
@@ -913,18 +849,8 @@
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
var __debug_loops__ = 0;
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
{
|
||||
__debug_loops__ += 1;
|
||||
|
||||
if (__debug_loops__ > 100) {
|
||||
console.error(INFINITE_LOOP_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
@@ -962,10 +888,6 @@
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
{
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -980,11 +902,11 @@
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref3) {
|
||||
var name = _ref3.name,
|
||||
_ref3$options = _ref3.options,
|
||||
options = _ref3$options === void 0 ? {} : _ref3$options,
|
||||
effect = _ref3.effect;
|
||||
state.orderedModifiers.forEach(function (_ref) {
|
||||
var name = _ref.name,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === void 0 ? {} : _ref$options,
|
||||
effect = _ref.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
|
||||
2
node_modules/@popperjs/core/dist/umd/popper-base.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper-base.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@popperjs/core/dist/umd/popper-base.min.js
generated
vendored
4
node_modules/@popperjs/core/dist/umd/popper-base.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@popperjs/core/dist/umd/popper-base.min.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper-base.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
597
node_modules/@popperjs/core/dist/umd/popper-lite.js
generated
vendored
597
node_modules/@popperjs/core/dist/umd/popper-lite.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@popperjs/core/dist/umd/popper-lite.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper-lite.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@popperjs/core/dist/umd/popper-lite.min.js
generated
vendored
4
node_modules/@popperjs/core/dist/umd/popper-lite.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@popperjs/core/dist/umd/popper-lite.min.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper-lite.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
717
node_modules/@popperjs/core/dist/umd/popper.js
generated
vendored
717
node_modules/@popperjs/core/dist/umd/popper.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@popperjs/core/dist/umd/popper.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@popperjs/core/dist/umd/popper.min.js
generated
vendored
4
node_modules/@popperjs/core/dist/umd/popper.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@popperjs/core/dist/umd/popper.min.js.map
generated
vendored
2
node_modules/@popperjs/core/dist/umd/popper.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@popperjs/core/lib/dom-utils/contains.d.ts
generated
vendored
1
node_modules/@popperjs/core/lib/dom-utils/contains.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export default function contains(parent: Element, child: Element): boolean;
|
||||
23
node_modules/@popperjs/core/lib/dom-utils/contains.js
generated
vendored
23
node_modules/@popperjs/core/lib/dom-utils/contains.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
export default function contains(parent, child) {
|
||||
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
|
||||
var isShadow = Boolean(child.getRootNode && child.getRootNode().host); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (isShadow) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
} while (next);
|
||||
} // Give up, the result is false
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
24
node_modules/@popperjs/core/lib/dom-utils/contains.js.flow
generated
vendored
24
node_modules/@popperjs/core/lib/dom-utils/contains.js.flow
generated
vendored
@@ -1,24 +0,0 @@
|
||||
// @flow
|
||||
export default function contains(parent: Element, child: Element) {
|
||||
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
|
||||
const isShadow = Boolean(child.getRootNode && child.getRootNode().host);
|
||||
|
||||
// First, attempt with faster native method
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
}
|
||||
// then fallback to custom implementation with Shadow DOM support
|
||||
else if (isShadow) {
|
||||
let next = child;
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
}
|
||||
// $FlowFixMe: need a better way to handle this...
|
||||
next = next.parentNode || next.host;
|
||||
} while (next);
|
||||
}
|
||||
|
||||
// Give up, the result is false
|
||||
return false;
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { ClientRectObject, VirtualElement } from "../types";
|
||||
export default function getBoundingClientRect(element: Element | VirtualElement): ClientRectObject;
|
||||
13
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
generated
vendored
13
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
export default function getBoundingClientRect(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
x: rect.left,
|
||||
y: rect.top
|
||||
};
|
||||
}
|
||||
19
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js.flow
generated
vendored
19
node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js.flow
generated
vendored
@@ -1,19 +0,0 @@
|
||||
// @flow
|
||||
import type { ClientRectObject, VirtualElement } from '../types';
|
||||
|
||||
export default function getBoundingClientRect(
|
||||
element: Element | VirtualElement
|
||||
): ClientRectObject {
|
||||
const rect = element.getBoundingClientRect();
|
||||
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
bottom: rect.bottom,
|
||||
left: rect.left,
|
||||
x: rect.left,
|
||||
y: rect.top,
|
||||
};
|
||||
}
|
||||
3
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.d.ts
generated
vendored
3
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import { ClientRectObject } from "../types";
|
||||
import { Boundary, RootBoundary } from "../enums";
|
||||
export default function getClippingRect(element: Element, boundary: Boundary, rootBoundary: RootBoundary): ClientRectObject;
|
||||
69
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
generated
vendored
69
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
generated
vendored
@@ -1,69 +0,0 @@
|
||||
import { viewport } from "../enums.js";
|
||||
import getViewportRect from "./getViewportRect.js";
|
||||
import getDocumentRect from "./getDocumentRect.js";
|
||||
import listScrollParents from "./listScrollParents.js";
|
||||
import getOffsetParent from "./getOffsetParent.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isElement, isHTMLElement } from "./instanceOf.js";
|
||||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import contains from "./contains.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import rectToClientRect from "../utils/rectToClientRect.js";
|
||||
|
||||
function getInnerBoundingClientRect(element) {
|
||||
var rect = getBoundingClientRect(element);
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
rect.right = rect.left + element.clientWidth;
|
||||
rect.width = element.clientWidth;
|
||||
rect.height = element.clientHeight;
|
||||
rect.x = rect.left;
|
||||
rect.y = rect.top;
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
|
||||
|
||||
function getClippingParents(element) {
|
||||
var clippingParents = listScrollParents(getParentNode(element));
|
||||
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
||||
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
||||
});
|
||||
} // Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping parents
|
||||
|
||||
|
||||
export default function getClippingRect(element, boundary, rootBoundary) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||||
accRect.top = Math.max(rect.top, accRect.top);
|
||||
accRect.right = Math.min(rect.right, accRect.right);
|
||||
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
||||
accRect.left = Math.max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
clippingRect.y = clippingRect.top;
|
||||
return clippingRect;
|
||||
}
|
||||
100
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js.flow
generated
vendored
100
node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js.flow
generated
vendored
@@ -1,100 +0,0 @@
|
||||
// @flow
|
||||
import type { ClientRectObject } from '../types';
|
||||
import type { Boundary, RootBoundary } from '../enums';
|
||||
import { viewport } from '../enums';
|
||||
import getViewportRect from './getViewportRect';
|
||||
import getDocumentRect from './getDocumentRect';
|
||||
import listScrollParents from './listScrollParents';
|
||||
import getOffsetParent from './getOffsetParent';
|
||||
import getDocumentElement from './getDocumentElement';
|
||||
import getComputedStyle from './getComputedStyle';
|
||||
import { isElement, isHTMLElement } from './instanceOf';
|
||||
import getBoundingClientRect from './getBoundingClientRect';
|
||||
import getParentNode from './getParentNode';
|
||||
import contains from './contains';
|
||||
import getNodeName from './getNodeName';
|
||||
import rectToClientRect from '../utils/rectToClientRect';
|
||||
|
||||
function getInnerBoundingClientRect(element: Element) {
|
||||
const rect = getBoundingClientRect(element);
|
||||
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
rect.right = rect.left + element.clientWidth;
|
||||
rect.width = element.clientWidth;
|
||||
rect.height = element.clientHeight;
|
||||
rect.x = rect.left;
|
||||
rect.y = rect.top;
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(
|
||||
element: Element,
|
||||
clippingParent: Element | RootBoundary
|
||||
): ClientRectObject {
|
||||
return clippingParent === viewport
|
||||
? rectToClientRect(getViewportRect(element))
|
||||
: isHTMLElement(clippingParent)
|
||||
? getInnerBoundingClientRect(clippingParent)
|
||||
: rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
}
|
||||
|
||||
// A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
function getClippingParents(element: Element): Array<Element> {
|
||||
const clippingParents = listScrollParents(getParentNode(element));
|
||||
const canEscapeClipping =
|
||||
['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
||||
const clipperElement =
|
||||
canEscapeClipping && isHTMLElement(element)
|
||||
? getOffsetParent(element)
|
||||
: element;
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// $FlowFixMe: https://github.com/facebook/flow/issues/1414
|
||||
return clippingParents.filter(
|
||||
(clippingParent) =>
|
||||
isElement(clippingParent) &&
|
||||
contains(clippingParent, clipperElement) &&
|
||||
getNodeName(clippingParent) !== 'body'
|
||||
);
|
||||
}
|
||||
|
||||
// Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping parents
|
||||
export default function getClippingRect(
|
||||
element: Element,
|
||||
boundary: Boundary,
|
||||
rootBoundary: RootBoundary
|
||||
): ClientRectObject {
|
||||
const mainClippingParents =
|
||||
boundary === 'clippingParents'
|
||||
? getClippingParents(element)
|
||||
: [].concat(boundary);
|
||||
const clippingParents = [...mainClippingParents, rootBoundary];
|
||||
const firstClippingParent = clippingParents[0];
|
||||
|
||||
const clippingRect = clippingParents.reduce((accRect, clippingParent) => {
|
||||
const rect = getClientRectFromMixedType(element, clippingParent);
|
||||
|
||||
accRect.top = Math.max(rect.top, accRect.top);
|
||||
accRect.right = Math.min(rect.right, accRect.right);
|
||||
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
||||
accRect.left = Math.max(rect.left, accRect.left);
|
||||
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
clippingRect.y = clippingRect.top;
|
||||
|
||||
return clippingRect;
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Rect, VirtualElement, Window } from "../types";
|
||||
export default function getCompositeRect(elementOrVirtualElement: Element | VirtualElement, offsetParent: Element | Window, isFixed?: boolean): Rect;
|
||||
48
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
generated
vendored
48
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
generated
vendored
@@ -1,48 +0,0 @@
|
||||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getNodeScroll from "./getNodeScroll.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import isScrollParent from "./isScrollParent.js"; // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
export default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement);
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
var offsets = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
||||
isScrollParent(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||||
y: rect.top + scroll.scrollTop - offsets.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
49
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js.flow
generated
vendored
49
node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js.flow
generated
vendored
@@ -1,49 +0,0 @@
|
||||
// @flow
|
||||
import type { Rect, VirtualElement, Window } from '../types';
|
||||
import getBoundingClientRect from './getBoundingClientRect';
|
||||
import getNodeScroll from './getNodeScroll';
|
||||
import getNodeName from './getNodeName';
|
||||
import { isHTMLElement } from './instanceOf';
|
||||
import getWindowScrollBarX from './getWindowScrollBarX';
|
||||
import getDocumentElement from './getDocumentElement';
|
||||
import isScrollParent from './isScrollParent';
|
||||
|
||||
// Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
export default function getCompositeRect(
|
||||
elementOrVirtualElement: Element | VirtualElement,
|
||||
offsetParent: Element | Window,
|
||||
isFixed: boolean = false
|
||||
): Rect {
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const rect = getBoundingClientRect(elementOrVirtualElement);
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
|
||||
let scroll = { scrollLeft: 0, scrollTop: 0 };
|
||||
let offsets = { x: 0, y: 0 };
|
||||
|
||||
if (isOffsetParentAnElement || (!isOffsetParentAnElement && !isFixed)) {
|
||||
if (
|
||||
getNodeName(offsetParent) !== 'body' ||
|
||||
// https://github.com/popperjs/popper-core/issues/1078
|
||||
isScrollParent(documentElement)
|
||||
) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||||
y: rect.top + scroll.scrollTop - offsets.y,
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
};
|
||||
}
|
||||
1
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.d.ts
generated
vendored
1
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export default function getComputedStyle(element: Element): CSSStyleDeclaration;
|
||||
4
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
generated
vendored
4
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
import getWindow from "./getWindow.js";
|
||||
export default function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
8
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js.flow
generated
vendored
8
node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js.flow
generated
vendored
@@ -1,8 +0,0 @@
|
||||
// @flow
|
||||
import getWindow from './getWindow';
|
||||
|
||||
export default function getComputedStyle(
|
||||
element: Element
|
||||
): CSSStyleDeclaration {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Window } from "../types";
|
||||
export default function getDocumentElement(element: Element | Window): HTMLElement;
|
||||
5
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
generated
vendored
5
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
import { isElement } from "./instanceOf.js";
|
||||
export default function getDocumentElement(element) {
|
||||
// $FlowFixMe: assume body is always available
|
||||
return (isElement(element) ? element.ownerDocument : element.document).documentElement;
|
||||
}
|
||||
11
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js.flow
generated
vendored
11
node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js.flow
generated
vendored
@@ -1,11 +0,0 @@
|
||||
// @flow
|
||||
import { isElement } from './instanceOf';
|
||||
import type { Window } from '../types';
|
||||
|
||||
export default function getDocumentElement(
|
||||
element: Element | Window
|
||||
): HTMLElement {
|
||||
// $FlowFixMe: assume body is always available
|
||||
return (isElement(element) ? element.ownerDocument : element.document)
|
||||
.documentElement;
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Rect } from "../types";
|
||||
export default function getDocumentRect(element: HTMLElement): Rect;
|
||||
26
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
generated
vendored
26
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getWindowScroll from "./getWindowScroll.js"; // Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
export default function getDocumentRect(element) {
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = element.ownerDocument.body;
|
||||
var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
||||
36
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js.flow
generated
vendored
36
node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js.flow
generated
vendored
@@ -1,36 +0,0 @@
|
||||
// @flow
|
||||
import type { Rect } from '../types';
|
||||
import getDocumentElement from './getDocumentElement';
|
||||
import getComputedStyle from './getComputedStyle';
|
||||
import getWindowScrollBarX from './getWindowScrollBarX';
|
||||
import getWindowScroll from './getWindowScroll';
|
||||
|
||||
// Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
export default function getDocumentRect(element: HTMLElement): Rect {
|
||||
const html = getDocumentElement(element);
|
||||
const winScroll = getWindowScroll(element);
|
||||
const body = element.ownerDocument.body;
|
||||
|
||||
const width = Math.max(
|
||||
html.scrollWidth,
|
||||
html.clientWidth,
|
||||
body ? body.scrollWidth : 0,
|
||||
body ? body.clientWidth : 0
|
||||
);
|
||||
const height = Math.max(
|
||||
html.scrollHeight,
|
||||
html.clientHeight,
|
||||
body ? body.scrollHeight : 0,
|
||||
body ? body.clientHeight : 0
|
||||
);
|
||||
|
||||
let x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
const y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return { width, height, x, y };
|
||||
}
|
||||
4
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.d.ts
generated
vendored
4
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
export default function getHTMLElementScroll(element: HTMLElement): {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
};
|
||||
6
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
generated
vendored
6
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
export default function getHTMLElementScroll(element) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
8
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js.flow
generated
vendored
8
node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js.flow
generated
vendored
@@ -1,8 +0,0 @@
|
||||
// @flow
|
||||
|
||||
export default function getHTMLElementScroll(element: HTMLElement) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop,
|
||||
};
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Rect } from "../types";
|
||||
export default function getLayoutRect(element: HTMLElement): Rect;
|
||||
10
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
generated
vendored
10
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
// Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
export default function getLayoutRect(element) {
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: element.offsetWidth,
|
||||
height: element.offsetHeight
|
||||
};
|
||||
}
|
||||
13
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js.flow
generated
vendored
13
node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js.flow
generated
vendored
@@ -1,13 +0,0 @@
|
||||
// @flow
|
||||
import type { Rect } from '../types';
|
||||
|
||||
// Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
export default function getLayoutRect(element: HTMLElement): Rect {
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: element.offsetWidth,
|
||||
height: element.offsetHeight,
|
||||
};
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getNodeName.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getNodeName.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Window } from "../types";
|
||||
export default function getNodeName(element: (Node | null | undefined) | Window): string | null | undefined;
|
||||
3
node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
generated
vendored
3
node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export default function getNodeName(element) {
|
||||
return element ? (element.nodeName || '').toLowerCase() : null;
|
||||
}
|
||||
6
node_modules/@popperjs/core/lib/dom-utils/getNodeName.js.flow
generated
vendored
6
node_modules/@popperjs/core/lib/dom-utils/getNodeName.js.flow
generated
vendored
@@ -1,6 +0,0 @@
|
||||
// @flow
|
||||
import type { Window } from '../types';
|
||||
|
||||
export default function getNodeName(element: ?Node | Window): ?string {
|
||||
return element ? (element.nodeName || '').toLowerCase() : null;
|
||||
}
|
||||
2
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.d.ts
generated
vendored
2
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import { Window } from "../types";
|
||||
export default function getNodeScroll(node: Node | Window): any;
|
||||
11
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
generated
vendored
11
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
import getWindowScroll from "./getWindowScroll.js";
|
||||
import getWindow from "./getWindow.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getHTMLElementScroll from "./getHTMLElementScroll.js";
|
||||
export default function getNodeScroll(node) {
|
||||
if (node === getWindow(node) || !isHTMLElement(node)) {
|
||||
return getWindowScroll(node);
|
||||
} else {
|
||||
return getHTMLElementScroll(node);
|
||||
}
|
||||
}
|
||||
14
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js.flow
generated
vendored
14
node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js.flow
generated
vendored
@@ -1,14 +0,0 @@
|
||||
// @flow
|
||||
import getWindowScroll from './getWindowScroll';
|
||||
import getWindow from './getWindow';
|
||||
import { isHTMLElement } from './instanceOf';
|
||||
import getHTMLElementScroll from './getHTMLElementScroll';
|
||||
import type { Window } from '../types';
|
||||
|
||||
export default function getNodeScroll(node: Node | Window) {
|
||||
if (node === getWindow(node) || !isHTMLElement(node)) {
|
||||
return getWindowScroll(node);
|
||||
} else {
|
||||
return getHTMLElementScroll(node);
|
||||
}
|
||||
}
|
||||
1
node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.d.ts
generated
vendored
1
node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export default function getOffsetParent(element: Element): any;
|
||||
62
node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
generated
vendored
62
node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
generated
vendored
@@ -1,62 +0,0 @@
|
||||
import getWindow from "./getWindow.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import isTableElement from "./isTableElement.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
|
||||
function getTrueOffsetParent(element) {
|
||||
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
||||
getComputedStyle(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var offsetParent = element.offsetParent;
|
||||
|
||||
if (offsetParent) {
|
||||
var html = getDocumentElement(offsetParent);
|
||||
|
||||
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
return offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
|
||||
|
||||
export default function getOffsetParent(element) {
|
||||
var window = getWindow(element);
|
||||
var offsetParent = getTrueOffsetParent(element);
|
||||
|
||||
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
||||
return window;
|
||||
}
|
||||
|
||||
return offsetParent || getContainingBlock(element) || window;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user