commit message

This commit is contained in:
Chopper
2021-05-13 11:03:32 +08:00
commit 23804939eb
2158 changed files with 149684 additions and 0 deletions

11
node_modules/popper.js/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,11 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

30
node_modules/popper.js/.github/ISSUE_TEMPLATE.md generated vendored Normal file
View File

@@ -0,0 +1,30 @@
Thanks for your interest in contributing to Popper.js!
Please, make sure to fill all the sections of the template before submitting any issue.
Issues without the required informations will be closed.
----------------
### CodePen demo
Edit this CodePen to allow the contributors to easily reproduce your problem.
http://codepen.io/FezVrasta/pen/wGqJEz
### Steps to reproduce the problem
1.
2.
3.
### What is the expected behavior?
Describe what you would have expected.
### What went wrong?
Describe what went wrong.
### Any other comments?
Any additional information.

View File

@@ -0,0 +1,8 @@
Thanks for your interest in contributing to Popper.js!
Please, make sure to fullfill the following conditions before submitting your Pull Request.
### Make sure to
1. Don't include the result of `grunt dist` inside your commits;
2. Make sure the tests are passing, you can check it running `grunt test` with Google Chrome installed;
3. Add any relevant test to cover the code you have changed and/or added;

19
node_modules/popper.js/.jsdoc generated vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"tags": {
"allowUnknownTags": true
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": false,
"monospaceLinks": false
},
"opts": {
"encoding": "utf8",
"destination": "./doc/",
"recurse": true,
"query": "value",
"private": true,
"lenient": true
}
}

22
node_modules/popper.js/.jshintrc generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"sub": true,
"undef": true,
"unused": true,
"browser": true,
"latedef": false,
"globals": {
"_": true,
"define": true,
"root": true,
"factory": true
}
}

11
node_modules/popper.js/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,11 @@
# https://git-scm.com/docs/gitignore
# https://help.github.com/articles/ignoring-files
# Example .gitignore files: https://github.com/github/gitignore
/bower_components/
/node_modules/
.DS_Store
.tmp
# When you switch branches, things can get messy
_site
.sass-cache

10
node_modules/popper.js/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,10 @@
language: node_js
node_js: 5.9.1
before_script:
- sudo apt-get install -y chromium-browser xvfb
- npm install -g grunt-cli bower
- bower install
script: grunt test-ci

95
node_modules/popper.js/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,95 @@
## v0.6.4
- 30a781e: Remove necessity of `remove` polyfill on IE
## v0.6.3
- 2e96b0e: removed arrow modifier dependency from applyStyle modifier
## v0.6.1 and v0.6.2
- v0.6.1 was bugged, DO NOT use it
- v0.6.2 fixed the previous version fixing the problem with the positioning inside fixed containers
## v0.6.0
- 0bd967e: big performance improvements (more info at #17)
## v0.5.3
- 3924aa4: fixed scroll detection on Internet Explorer 11 (and probably below)
## v0.5.2
- 6691354: fixed arrow position in particular cases
## v0.5.1
- 0a79027: Added support for a reference el that is both fixed and transformed. (thanks @hgascoigne)
## v0.5.0
- f4e3659: 3rd party modifiers now can set custom styling to poppers (prep for #52)
## v0.4.2
- 566d4e6: Forgot to update the build, sorry
## v0.4.1
- 660849a: Fix calculation of popper elements' outerSizes (thanks @rafaelverger)
## v0.4.0
- 201636a: added feature to use HTML Node as popper content. Use it defining `contentType: 'node'` and `content: yourHTMLNode` (thanks @rosskevin)
- 9503e09: make sure to not add `="undefined"` when setting attributes (#39)
- minor performance improvements
## v0.3.8
- fixed problem with NPM release
## v0.3.7
- 80aa0df: fixed #25 and #36
- 70411fd: fix object check in ie (#35) (thanks @judge)
## v0.3.6
- 83a990b: fixed #34
## v0.3.5
- c1c4168: fixed #33, error when trying to create a popper inside a `form` element.
## v0.3.4
- 7e98c14: fixed destroy method
- d811684: **BREAKING CHANGE**, renamed `trigger` to `reference`, you can now access `data.offsets.reference` instead of
`data.offsets.trigger`, and `this._reference` instead of `this._trigger`.
## v0.3.3
- 1782c39: fixed #21, problem with position of poppers when inside `fixed` parent.
## v0.3.2
- 592f4c7: revert iOS fix (it wasn't effective) - it should have fixed the repaint problems of fixed poppers during scroll
I'm still looking for a working fix.
## v0.3.1
- b0d77ff: don't apply x-placement attr if applyStyles modifier is disabled
## v0.3.0
- 5521b0d: added support for integration with React.js and Ember.js.
Now popper.js will allow you to disable DOM modifications and exposes an `onUpdate` callback you can use to export the
popper coordinates in your framework.
## v0.2.6
- 6732353: removed shared state;
## v0.2.5
- 77677f0: round top and left coordinates to prevent blur effect;
## v0.2.4
- 35bbbc6: fixed position on scroll of `fixed` poppers on Safari Mobile;
## v0.2.3
- 7a0ae40: Fixed Git URL of NPM package;
## v0.2.2
- 2a9b804: Fixed troubles with positioning when the reference element is placed inside a relative parent and the popper is placed inside the body;

62
node_modules/popper.js/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,62 @@
# Contributing to Popper.js
## Report bugs
If you find a bug, please, try to isolate the specific case and provide a fiddle on CodePen or JSFiddle to make it easy to reproduce the problem and help others finding a solution.
You can use [this CodePen](http://codepen.io/FezVrasta/pen/wGqJEz) which already includes Popper.js.
If your issue is not about a bug, please make sure to consider posting on StackOverflow instead.
Feature requests are welcome!
## Setup
Make sure to have `grunt-cli` and `bower` installed globally.
Then run:
```js
npm install
bower install
```
## Developing
## Adopt an issue
The issues with the `PR WELCOME` label are the preferred ones to adopt if you want to contribute to this project.
These issues are most likely new features or enhancements that would be nice to have but that will not be implemened by the maintainer due to lack of free time.
Other issues labelled by `HELP WANTED` should be fixed by the maintainer, but for any reason, he has problems with it and needs help from the community to continue the work on it.
When you adopt an issue, please write a comment on it to make sure that multiple people don't work on the same one.
## Test
We develop following a test driven development approach.
We have a grunt + karma + jasmine environment to unit test Popper.js
Feel free to add tests to the `/tests` folder, any JavaScript file in that folder will be executed as test.
To run tests:
```bash
npm test
```
**Note:** we use Chrome even for the tests on Travis CI, despite this, the CSS offsets of the page elements seem to be different when the tests are ran on Travis CI or on your local machine.
Due to this problem, right now we make assertions checking both the local and CI offsets.
Any suggestion to get rid of this problem is more than welcome tho.
## Build
To create a new release of Popper.js, run:
```js
grunt dist
```
The files will be automatically minified and copied in the `build` directory.
**Note:** never commit changes and builds together! Each build should have its own dedicated commit.

117
node_modules/popper.js/Gruntfile.js generated vendored Normal file
View File

@@ -0,0 +1,117 @@
'use strict';
var grunt = require('grunt');
var fs = require('fs');
var version = JSON.parse(fs.readFileSync('./package.json')).version;
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-serve');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-env');
module.exports = function(grunt) {
// comma separated list of browsers to run tests inside
var browsers = grunt.option('browsers') ? grunt.option('browsers').split(',') : ['ChromeTest'];
// Project configuration.
grunt.initConfig({
uglify: {
dist: {
options: {
sourceMap: true,
sourceMapName: 'build/popper.min.js.map',
preserveComments: /(?:license|version)/
},
files: {
'build/popper.min.js': ['build/popper.js']
}
}
},
copy: {
dist: {
nonull: true,
src: 'src/popper.js',
dest: 'build/popper.js',
}
},
jsdoc : {
dist : {
src: 'src/*.js',
dest: 'doc',
options: {
template: 'doc/template',
query: 'json'
}
}
},
karma: {
options: {
frameworks: ['jasmine'],
singleRun: true,
browsers: browsers,
customLaunchers: {
'ChromeTest': {
base: 'Chrome',
flags: ['--window-size=800,872'] // 800x800 plus karma shell
}
},
files: [
{ pattern: 'bower_components/**/*.js', included: false },
{ pattern: 'node_modules/requirejs/require.js', included: true },
{ pattern: 'src/**/*.js', included: false },
'tests/*.js',
'tests/styles/*.css'
]
},
unit: {},
local: {
singleRun: false,
}
},
jshint: {
default: ['src/**/*.js']
},
serve: {
options: {
port: 9000
}
},
usebanner: {
dist: {
options: {
replace: '\{\{version\}\}',
banner: version,
position: 'replace',
},
files: {
src: [ 'build/popper.js' ]
}
}
},
shell: {
xvfb: {
command: 'Xvfb :99 -ac -screen 0 1600x1200x24',
options: {
async: true
}
}
},
env: {
xvfb: {
DISPLAY: ':99'
}
}
});
grunt.registerTask('doc', ['jsdoc']);
grunt.registerTask('dist', [ 'copy:dist', 'usebanner:dist', 'uglify:dist']);
grunt.registerTask('test', ['jshint', 'karma:local']);
grunt.registerTask('test-ci', ['jshint', 'shell:xvfb', 'env:xvfb', 'karma:unit', 'shell:xvfb:kill']);
};

25
node_modules/popper.js/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,25 @@
The MIT License (MIT)
=====================
Copyright © 2016 Federico Zivolo and contributors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

188
node_modules/popper.js/README.md generated vendored Normal file
View File

@@ -0,0 +1,188 @@
# Popper.js
Popper.js is a library used to create poppers in web applications.
[![Build Status](https://travis-ci.org/FezVrasta/popper.js.svg?branch=master)](https://travis-ci.org/FezVrasta/popper.js)
[![npm version](https://badge.fury.io/js/popper.js.svg)](https://badge.fury.io/js/popper.js)
[![Join the chat!](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FezVrasta/popper.js)
<img src="https://raw.githubusercontent.com/FezVrasta/popper.js/master/popperjs.png" align="right" width=250>
## Wut? Poppers?
A popper is an element on the screen which "pops out" from the natural flow of your application.
Common examples of poppers are tooltips and popovers.
## So, yet another tooltip library?
Well, basically, **no**.
Popper.js is built from the ground up to being modular and fully ~~hackable~~ **customizable**.
It supports a **plugin system** you can use to add particular behaviors to your poppers.
It's **AMD** and **CommonJS** compatible and it's well documented thanks to our [JSDoc page](https://fezvrasta.github.io/popper.js/documentation.html).
## The Library
Popper.js is mostly a library with the job of making sure your popper stays near the defined reference element (if you want so).
Additionally, it provides an easy way to generate your popper element if you don't want to use one already in your DOM.
### Installation
Popper.js is available on NPM and Bower:
| Source | |
|:---------|:---------------------------------------------|
| NPM | `npm install popper.js@0 --save` |
| Bower | `bower install popper.js#~0 --save` |
| jsDelivr | `http://www.jsdelivr.com/projects/popper.js` |
> **Heads up!** We are working on the v1.0.0 release of Popper.js, make sure to install the latest v0.* if you want to stay on the stable version!
### Basic usage
Create a popper near a button:
```js
var reference = document.querySelector('.my-button');
var thePopper = new Popper(
reference,
{
content: 'My awesome popper!'
},
{
// popper options here
}
);
```
### "Advanced" usage
Given an existing popper, ask Popper.js to position it near its button
```js
var reference = document.querySelector('.my-button');
var popper = document.querySelector('.my-popper');
var anotherPopper = new Popper(
reference,
popper,
{
// popper options here
}
);
```
### Callbacks
```js
var reference = document.querySelector('.my-button');
var popper = document.querySelector('.my-popper');
var anotherPopper = new Popper(reference, popper).onCreate(instance) {
// instance is Popper.js instance
}).onUpdate(function(data) {
// data is an object containing all the informations computed by Popper.js and used to style the popper and its arrow
});
```
### React.js and Ember.js integration
If you prefer to let your framework apply the styles to your DOM objects, you can follow an approach like the one below:
```js
var reference = document.querySelector('.my-button');
var popper = document.querySelector('.my-popper');
var anotherPopper = new Popper(reference, popper, {
modifiersIgnored: ['applyStyle'] // prevent Popper.js from applying styles to your DOM
}).onUpdate(function(data) {
// export data in your framework and use its content to apply the style to your popper
});
```
You can find a fully working React.js component visiting this gist:
https://gist.github.com/FezVrasta/6533adf4358a6927b48f7478706a5f23
If you are wondering about the available options of the third argument, check out [our documentation](http://fezvrasta.github.io/popper.js/documentation.html#new_Popper_new)
Visit our [GitHub Page](https://fezvrasta.github.io/popper.js) to see a lot of examples of what you can do right now!
### Writing your own modifiers
Popper.js is based on a "plugin-like" architecture, most of the features of it are fully encapsulated "modifiers".
A modifier is a function that is called each time Popper.js needs to compute the position of the popper. For this reason, modifiers should be very performant to avoid bottlenecks.
```
// this little modifier forces the popper `top` value to be `0`
function fixToTop(data) {
data.popper.offsets.top = 0
return data;
}
```
Then, you can add your modifier to your Popper.js instance, adding it to the `modifiers` list in the options:
```
// note that the built-in modifiers are referenced using strings
// instead, your custom modifiers are passed directly as functions
new Popper(a, b, {
modifiers: [ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle', fixToTop]
})
```
Here is the `data` object content:
```
let data = {
// popper and reference elements positions
offsets: {
popper: {
top: Number,
left: Number,
width: Number,
height: Number
},
reference: {
top: Number,
left: Number,
width: Number,
height: Number
},
// here, only one of the two values will be different from `0`, depending by the placement
arrow: {
left: Number,
top: Number
}
},
// the result of the _getBoundaries method, these are the limits between the popper can be placed
boundaries: {
top: Number,
right: Number,
bottom: Number,
left: Number
},
// `top`, `left`, `bottom`, `right` + optional `end` or `start` variations
placement: String,
// the placement defined at the beginning, before any edit made by modifiers
_originalPlacement: String,
// allows you to know if the `flip` modifier have flipped the placement of the popper
flipped: Boolean,
// the node of the arrow (if any)
arrowElement: HTMLElement,
// any property defined in this object will be applied to the popper element
// here you can even override the default styles applied by Popper.js
styles: {}
}
```
## Libraries using Popper.js
Popper.js will never winthe prize for "easiest to use tooltip library", well, probably because it's not a tooltip lib. 😅
With it you can create awesome libraries without worring about the positioning problems! Some great ones using Popper.js are listed here:
- [intro-guide-js](https://github.com/johanlahti/intro-guide-js): Create guided tours of your web pages;
- [picker.js](https://github.com/GeekAb/picker.js): Modern date picker;
_Want to see your library here? Open an issue and report it._
## Notes
### Credits
I want to thank some friends and projects for the work they did:
- [@AndreaScn](https://github.com/AndreaScn) for its work on the GitHub Page and the manual testing he did during the development;
- [@vampolo](https://github.com/vampolo) for the original idea and for the name of the library;
- [Sysdig](https://github.com/Draios) for all the awesome things I learned during these years that made possible for me to write this library;
- [Tether.js](http://github.hubspot.com/tether/) for having inspired me in writing a positioning library ready for the real world;
- **you** for the star you'll give to this project and for being so awesome to give this project a try :)
### Copyright and license
Code and documentation copyright 2016 **Federico Zivolo**. Code released under the [MIT license](LICENSE.md). Docs released under Creative Commons.

22
node_modules/popper.js/bower.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "popper.js",
"description": "A kickass library to manage your poppers",
"main": "src/popper.js",
"authors": [
"Federico Zivolo & Andrea Scianò"
],
"license": "MIT",
"moduleType": [
"amd",
"es6",
"globals"
],
"homepage": "https://fezvrasta.github.io/popper.js",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

0
node_modules/popper.js/build/.gitkeep generated vendored Normal file
View File

1327
node_modules/popper.js/build/popper.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

26
node_modules/popper.js/build/popper.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/popper.js/build/popper.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

694
node_modules/popper.js/doc/documentation.json generated vendored Normal file
View File

@@ -0,0 +1,694 @@
{
"classes": [
{
"name": "Popper",
"description": "",
"extends": [],
"access": "",
"virtual": false,
"fires": "",
"constructor": {
"name": "Popper",
"description": "Create a new Popper.js instance",
"parameters": [
{
"name": "reference",
"type": [
"HTMLElement"
],
"description": "The reference element used to position the popper",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "popper",
"type": [
"HTMLElement",
"Object"
],
"description": "The HTML element used as popper, or a configuration used to generate the popper.",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "popper.tagName",
"type": [
"String"
],
"description": "The tag name of the generated popper.",
"default": "'div'",
"optional": true,
"nullable": ""
},
{
"name": "popper.classNames",
"type": [
"Array"
],
"description": "Array of classes to apply to the generated popper.",
"default": "['popper']",
"optional": true,
"nullable": ""
},
{
"name": "popper.attributes",
"type": [
"Array"
],
"description": "Array of attributes to apply, specify `attr:value` to assign a value to it.",
"default": "",
"optional": true,
"nullable": ""
},
{
"name": "popper.parent",
"type": [
"HTMLElement",
"String"
],
"description": "The parent element, given as HTMLElement or as query string.",
"default": "window.document.body",
"optional": true,
"nullable": ""
},
{
"name": "popper.content",
"type": [
"String"
],
"description": "The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.",
"default": "''",
"optional": true,
"nullable": ""
},
{
"name": "popper.contentType",
"type": [
"String"
],
"description": "If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.",
"default": "'text'",
"optional": true,
"nullable": ""
},
{
"name": "popper.arrowTagName",
"type": [
"String"
],
"description": "Same as `popper.tagName` but for the arrow element.",
"default": "'div'",
"optional": true,
"nullable": ""
},
{
"name": "popper.arrowClassNames",
"type": [
"Array"
],
"description": "Same as `popper.classNames` but for the arrow element.",
"default": "'popper__arrow'",
"optional": true,
"nullable": ""
},
{
"name": "popper.arrowAttributes",
"type": [
"String"
],
"description": "Same as `popper.attributes` but for the arrow element.",
"default": "['x-arrow']",
"optional": true,
"nullable": ""
},
{
"name": "options",
"type": [
"Object"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "options.placement",
"type": [
"String"
],
"description": "Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),\n left(-start, -end)`",
"default": "bottom",
"optional": true,
"nullable": ""
},
{
"name": "options.arrowElement",
"type": [
"HTMLElement",
"String"
],
"description": "The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of\n its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its\n reference element.\n By default, it will look for a child node of the popper with the `x-arrow` attribute.",
"default": "'[x-arrow]'",
"optional": true,
"nullable": ""
},
{
"name": "options.gpuAcceleration",
"type": [
"Boolean"
],
"description": "When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the\n browser to use the GPU to accelerate the rendering.\n If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.",
"default": "true",
"optional": true,
"nullable": ""
},
{
"name": "options.offset",
"type": [
"Number"
],
"description": "Amount of pixels the popper will be shifted (can be negative).",
"default": "0",
"optional": true,
"nullable": ""
},
{
"name": "options.boundariesElement",
"type": [
"String",
"Element"
],
"description": "The element which will define the boundaries of the popper position, the popper will never be placed outside\n of the defined boundaries (except if `keepTogether` is enabled)",
"default": "'viewport'",
"optional": true,
"nullable": ""
},
{
"name": "options.boundariesPadding",
"type": [
"Number"
],
"description": "Additional padding for the boundaries",
"default": "5",
"optional": true,
"nullable": ""
},
{
"name": "options.preventOverflowOrder",
"type": [
"Array"
],
"description": "Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,\n this means that the last ones will never overflow",
"default": "['left', 'right', 'top', 'bottom']",
"optional": true,
"nullable": ""
},
{
"name": "options.flipBehavior",
"type": [
"String",
"Array"
],
"description": "The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to\n overlap its reference element. Defining `flip` as value, the placement will be flipped on\n its axis (`right - left`, `top - bottom`).\n You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify\n how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,\n then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)",
"default": "'flip'",
"optional": true,
"nullable": ""
},
{
"name": "options.modifiers",
"type": [
"Array"
],
"description": "List of functions used to modify the data before they are applied to the popper, add your custom functions\n to this array to edit the offsets and placement.\n The function should reflect the @params and @returns of preventOverflow",
"default": "[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']",
"optional": true,
"nullable": ""
},
{
"name": "options.modifiersIgnored",
"type": [
"Array"
],
"description": "Put here any built-in modifier name you want to exclude from the modifiers list\n The function should reflect the @params and @returns of preventOverflow",
"default": "[]",
"optional": true,
"nullable": ""
},
{
"name": "options.removeOnDestroy",
"type": [
"Boolean"
],
"description": "Set to true if you want to automatically remove the popper when you call the `destroy` method.",
"default": "false",
"optional": true,
"nullable": ""
}
],
"examples": []
},
"functions": [
{
"name": "destroy",
"access": "",
"virtual": false,
"description": "Destroy the popper",
"parameters": [],
"examples": []
},
{
"name": "update",
"access": "",
"virtual": false,
"description": "Updates the position of the popper, computing the new offsets and applying the new style",
"parameters": [],
"examples": []
},
{
"name": "onCreate",
"access": "",
"virtual": false,
"description": "If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.",
"parameters": [
{
"name": "callback",
"type": [
"function"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": []
},
{
"name": "onUpdate",
"access": "",
"virtual": false,
"description": "If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations\nused to style popper and its arrow.\nNOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!",
"parameters": [
{
"name": "callback",
"type": [
"function"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": []
},
{
"name": "parse",
"access": "",
"virtual": false,
"description": "Helper used to generate poppers from a configuration file",
"parameters": [
{
"name": "config",
"type": [
"Object"
],
"description": "configuration",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"HTMLElement"
],
"description": "popper"
}
},
{
"name": "_getPosition",
"access": "",
"virtual": false,
"description": "Helper used to get the position which will be applied to the popper",
"parameters": [
{
"name": "config",
"type": [
"HTMLElement"
],
"description": "popper element",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"HTMLElement"
],
"description": "reference element"
}
},
{
"name": "_getOffsets",
"access": "private",
"virtual": false,
"description": "Get offsets to the popper",
"parameters": [
{
"name": "popper",
"type": [
"Element"
],
"description": "the popper element",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "reference",
"type": [
"Element"
],
"description": "the reference element (the popper will be relative to this)",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "An object containing the offsets which will be applied to the popper"
}
},
{
"name": "_setupEventListeners",
"access": "private",
"virtual": false,
"description": "Setup needed event listeners used to update the popper position",
"parameters": [],
"examples": []
},
{
"name": "_removeEventListeners",
"access": "private",
"virtual": false,
"description": "Remove event listeners used to update the popper position",
"parameters": [],
"examples": []
},
{
"name": "_getBoundaries",
"access": "private",
"virtual": false,
"description": "Computed the boundaries limits and return them",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "Object containing the property \"offsets\" generated by `_getOffsets`",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "padding",
"type": [
"Number"
],
"description": "Boundaries padding",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "boundariesElement",
"type": [
"Element"
],
"description": "Element used to define the boundaries",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "Coordinates of the boundaries"
}
},
{
"name": "runModifiers",
"access": "public",
"virtual": false,
"description": "Loop trough the list of modifiers and run them in order, each of them will then edit the data object",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "modifiers",
"type": [
"Array"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
},
{
"name": "ends",
"type": [
"function"
],
"description": "",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": []
},
{
"name": "isModifierRequired",
"access": "",
"virtual": false,
"description": "Helper used to know if the given modifier depends from another one.",
"parameters": [],
"examples": [],
"returns": {
"type": [
"Boolean"
],
"description": ""
}
}
],
"namespaces": [
{
"name": "modifiers",
"description": "Modifiers list",
"access": "",
"virtual": false,
"functions": [
{
"name": "Popper#modifiers.applyStyle",
"access": "",
"virtual": false,
"description": "Apply the computed styles to the popper element",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by `update` method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The same data object"
}
},
{
"name": "Popper#modifiers.shift",
"access": "",
"virtual": false,
"description": "Modifier used to shift the popper on the start or end of its reference element side",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by `update` method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
},
{
"name": "Popper#modifiers.preventOverflow",
"access": "",
"virtual": false,
"description": "Modifier used to make sure the popper does not overflows from it's boundaries",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by `update` method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
},
{
"name": "Popper#modifiers.keepTogether",
"access": "",
"virtual": false,
"description": "Modifier used to make sure the popper is always near its reference",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by _update method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
},
{
"name": "Popper#modifiers.flip",
"access": "",
"virtual": false,
"description": "Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.\nRequires the `preventOverflow` modifier before it in order to work.\n**NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by _update method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
},
{
"name": "Popper#modifiers.offset",
"access": "",
"virtual": false,
"description": "Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.\nThe offsets will shift the popper on the side of its reference element.",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by _update method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
},
{
"name": "Popper#modifiers.arrow",
"access": "",
"virtual": false,
"description": "Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element\nIt will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed",
"parameters": [
{
"name": "data",
"type": [
"Object"
],
"description": "The data object generated by _update method",
"default": "",
"optional": "",
"nullable": ""
}
],
"examples": [],
"returns": {
"type": [
"Object"
],
"description": "The data object, properly modified"
}
}
]
}
]
}
]
}

223
node_modules/popper.js/doc/template/publish.js generated vendored Normal file
View File

@@ -0,0 +1,223 @@
/*eslint no-nested-ternary:0, space-infix-ops: 0 */
/**
@overview Builds a tree-like JSON string from the doclet data.
@version 0.0.3
*/
// MODIFIED TO WRITE THE OUTPUT TO FILE
'use strict';
var path = require('jsdoc/path');
var fs = require('jsdoc/fs');
var hasOwnProp = Object.prototype.hasOwnProperty;
function graft(parentNode, childNodes, parentLongname, parentName) {
childNodes
.filter(function (element) {
return (element.memberof === parentLongname);
})
.forEach(function (element, index) {
var i,
len;
if (element.kind === 'namespace') {
if (!parentNode.namespaces) {
parentNode.namespaces = [];
}
var thisNamespace = {
'name': element.name,
'description': element.description || '',
'access': element.access || '',
'virtual': !!element.virtual
};
parentNode.namespaces.push(thisNamespace);
graft(thisNamespace, childNodes, element.longname, element.name);
}
else if (element.kind === 'mixin') {
if (!parentNode.mixins) {
parentNode.mixins = [];
}
var thisMixin = {
'name': element.name,
'description': element.description || '',
'access': element.access || '',
'virtual': !!element.virtual
};
parentNode.mixins.push(thisMixin);
graft(thisMixin, childNodes, element.longname, element.name);
}
else if (element.kind === 'function') {
if (!parentNode.functions) {
parentNode.functions = [];
}
var thisFunction = {
'name': element.name,
'access': element.access || '',
'virtual': !!element.virtual,
'description': element.description || '',
'parameters': [ ],
'examples': []
};
parentNode.functions.push(thisFunction);
if (element.returns) {
thisFunction.returns = {
'type': element.returns[0].type? element.returns[0].type.names : [],
'description': element.returns[0].description || ''
};
}
if (element.examples) {
for (i = 0, len = element.examples.length; i < len; i++) {
thisFunction.examples.push(element.examples[i]);
}
}
if (element.params) {
for (i = 0, len = element.params.length; i < len; i++) {
thisFunction.parameters.push({
'name': element.params[i].name,
'type': element.params[i].type? element.params[i].type.names : [],
'description': element.params[i].description || '',
'default': hasOwnProp.call(element.params[i], 'defaultvalue') ? element.params[i].defaultvalue.toString() : '',
'optional': typeof element.params[i].optional === 'boolean'? element.params[i].optional : '',
'nullable': typeof element.params[i].nullable === 'boolean'? element.params[i].nullable : ''
});
}
}
}
else if (element.kind === 'member') {
if (!parentNode.properties) {
parentNode.properties = [];
}
parentNode.properties.push({
'name': element.name,
'access': element.access || '',
'virtual': !!element.virtual,
'description': element.description || '',
'type': element.type? element.type : []
});
}
else if (element.kind === 'event') {
if (!parentNode.events) {
parentNode.events = [];
}
var thisEvent = {
'name': element.name,
'access': element.access || '',
'virtual': !!element.virtual,
'description': element.description || '',
'parameters': [],
'examples': []
};
parentNode.events.push(thisEvent);
if (element.returns) {
thisEvent.returns = {
'type': element.returns.type? element.returns.type.names : [],
'description': element.returns.description || ''
};
}
if (element.examples) {
for (i = 0, len = element.examples.length; i < len; i++) {
thisEvent.examples.push(element.examples[i]);
}
}
if (element.params) {
for (i = 0, len = element.params.length; i < len; i++) {
thisEvent.parameters.push({
'name': element.params[i].name,
'type': element.params[i].type? element.params[i].type.names : [],
'description': element.params[i].description || '',
'default': hasOwnProp.call(element.params[i], 'defaultvalue') ? element.params[i].defaultvalue.toString() : '',
'optional': typeof element.params[i].optional === 'boolean'? element.params[i].optional : '',
'nullable': typeof element.params[i].nullable === 'boolean'? element.params[i].nullable : ''
});
}
}
}
else if (element.kind === 'class') {
if (!parentNode.classes) {
parentNode.classes = [];
}
var thisClass = {
'name': element.name,
'description': element.classdesc || '',
'extends': element.augments || [],
'access': element.access || '',
'virtual': !!element.virtual,
'fires': element.fires || '',
'constructor': {
'name': element.name,
'description': element.description || '',
'parameters': [
],
'examples': []
}
};
parentNode.classes.push(thisClass);
if (element.examples) {
for (i = 0, len = element.examples.length; i < len; i++) {
thisClass.constructor.examples.push(element.examples[i]);
}
}
if (element.params) {
for (i = 0, len = element.params.length; i < len; i++) {
thisClass.constructor.parameters.push({
'name': element.params[i].name,
'type': element.params[i].type? element.params[i].type.names : [],
'description': element.params[i].description || '',
'default': hasOwnProp.call(element.params[i], 'defaultvalue') ? element.params[i].defaultvalue.toString() : '',
'optional': typeof element.params[i].optional === 'boolean'? element.params[i].optional : '',
'nullable': typeof element.params[i].nullable === 'boolean'? element.params[i].nullable : ''
});
}
}
graft(thisClass, childNodes, element.longname, element.name);
}
});
}
/**
@param {TAFFY} data
@param {object} opts
*/
exports.publish = function(data, opts) {
var root = {},
docs;
data({undocumented: true}).remove();
docs = data().get(); // <-- an array of Doclet objects
graft(root, docs);
var output;
if (opts.query && opts.query.format === 'xml') {
var xml = require('js2xmlparser');
output = xml('jsdoc', root);
}
else {
output = require('jsdoc/util/dumper').dump(root);
}
fs.writeFileSync(path.join(opts.destination, 'documentation.' + (opts.query.format || 'json')), output, 'utf8');
};

69
node_modules/popper.js/package.json generated vendored Normal file
View File

@@ -0,0 +1,69 @@
{
"_from": "popper.js@^0.6.4",
"_id": "popper.js@0.6.4",
"_inBundle": false,
"_integrity": "sha1-GDfEdgr1TSuyC2b5wJuSmT2Exik=",
"_location": "/popper.js",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "popper.js@^0.6.4",
"name": "popper.js",
"escapedName": "popper.js",
"rawSpec": "^0.6.4",
"saveSpec": null,
"fetchSpec": "^0.6.4"
},
"_requiredBy": [
"/uview"
],
"_resolved": "https://registry.npmjs.org/popper.js/-/popper.js-0.6.4.tgz",
"_shasum": "1837c4760af54d2bb20b66f9c09b92993d84c629",
"_spec": "popper.js@^0.6.4",
"_where": "/Users/ran/Desktop/宏业汇成/lili-shop-uniapp/node_modules/uview",
"author": {
"name": "Federico Zivolo",
"email": "federico.zivolo@gmail.com"
},
"bugs": {
"url": "https://github.com/FezVrasta/popper.js/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Andrea Scianò"
}
],
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
"description": "A kickass library to manage your poppers",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-banner": "^0.6.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^1.0.0",
"grunt-env": "^0.4.4",
"grunt-jsdoc": "^1.1.0",
"grunt-karma": "^0.12.2",
"grunt-serve": "^0.1.6",
"grunt-shell-spawn": "^0.3.10",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.2",
"karma-jasmine": "^0.3.8",
"requirejs": "^2.2.0"
},
"homepage": "https://fezvrasta.github.com/popper.js",
"license": "MIT",
"main": "src/popper.js",
"name": "popper.js",
"repository": {
"type": "git",
"url": "git+https://github.com/FezVrasta/popper.js.git"
},
"scripts": {
"test": "grunt test"
},
"version": "0.6.4"
}

BIN
node_modules/popper.js/popperjs.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

1327
node_modules/popper.js/src/popper.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

6
node_modules/popper.js/tests/.jshintrc generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"extends": "../.jshintrc",
"jasmine": true,
"debug": true,
"undef": false
}

40
node_modules/popper.js/tests/_helpers.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
function appendNewPopper(id, text, container) {
var popper = document.createElement('div');
popper.id = id;
popper.classList.add('popper');
popper.textContent = text || 'popper';
var arrow = document.createElement('div');
arrow.classList.add('popper__arrow');
arrow.setAttribute('x-arrow', '');
popper.appendChild(arrow);
(container || jasmineWrapper).appendChild(popper);
return popper;
}
function appendNewRef(id, text, container) {
var popper = document.createElement('div');
popper.id = id;
popper.classList.add('ref');
popper.textContent = text || 'reference';
(container || jasmineWrapper).appendChild(popper);
return popper;
}
/**
* Get the prefixed supported property name
* @function
* @ignore
* @argument {String} property (camelCase)
* @returns {String} prefixed property (camelCase)
*/
function getSupportedPropertyName(property) {
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
for (var i = 0; i < prefixes.length; i++) {
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
if (typeof document.body.style[toCheck] !== 'undefined') {
return toCheck;
}
}
return null;
}

19
node_modules/popper.js/tests/_setup.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
var baseTemplate = window.document.body.innerHTML;
var wrapper = document.createElement('div');
wrapper.id = 'jasmineWrapper';
document.body.appendChild(wrapper);
beforeEach(function() {
jasmineWrapper.innerHTML = '';
jasmine.addMatchers({
toBeApprox: function() {
return {
compare: function(actual, expected, within) {
within = within || 1;
return { pass: (actual >= (expected - within)) && (actual <= (expected + within)) };
}
};
}
});
});

84
node_modules/popper.js/tests/styles/test.css generated vendored Normal file
View File

@@ -0,0 +1,84 @@
#rel {
position: absolute;
color: black;
background: yellow;
top: 40vh;
left: 50vw;
padding: 30px;
}
#theEvilBoundary {
position: absolute;
top: 300px;
left: 100px;
background: red;
padding: 200px;
}
#thePopper3 {
height: 200px;
}
.ref {
display: inline-block;
background: red;
padding: 10px;
}
.popper {
background: #222;
color: white;
width: 150px;
border-radius: 2px;
box-shadow: 0 0 2px rgba(0,0,0,0.5);
padding: 5px;
}
.popper .popper__arrow {
width: 0;
height: 0;
border-style: solid;
position: absolute;
margin: 5px;
}
.popper[x-placement^="top"] {
margin-bottom: 5px;
}
.popper[x-placement^="top"] .popper__arrow {
border-width: 5px 5px 0 5px;
border-color: #222 transparent transparent transparent;
bottom: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
.popper[x-placement^="bottom"] {
margin-top: 5px;
}
.popper[x-placement^="bottom"] .popper__arrow {
border-width: 0 5px 5px 5px;
border-color: transparent transparent #222 transparent;
top: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
.popper[x-placement^="right"] {
margin-left: 5px;
}
.popper[x-placement^="right"] .popper__arrow {
border-width: 5px 5px 5px 0;
border-color: transparent #222 transparent transparent;
left: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}
.popper[x-placement^="left"] {
margin-right: 5px;
}
.popper[x-placement^="left"] .popper__arrow {
border-width: 5px 0 5px 5px;
border-color: transparent transparent transparent #222;
right: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}

470
node_modules/popper.js/tests/test-popper.js generated vendored Normal file
View File

@@ -0,0 +1,470 @@
describe('Popper.js', function() {
// define modules paths
require.config({
paths: {
popper: 'base/src/popper'
}
});
var TestPopper;
it('loads the AMD module', function(done) {
require(['popper'], function(Popper) {
TestPopper = Popper;
expect(Popper).toBeDefined();
done();
});
});
it('can access the AMD module to create a new instance', function() {
// append popper element
var popper = document.createElement('div');
popper.style.width = '100px';
popper.style.height = '100px';
jasmineWrapper.appendChild(popper);
// append trigger element
var trigger = document.createElement('div');
jasmineWrapper.appendChild(trigger);
// initialize new popper instance
var pop = new TestPopper(trigger, popper);
expect(pop).toBeDefined();
});
it('inits a bottom popper', function() {
var reference = appendNewRef(1);
var popper = appendNewPopper(2);
var pop = new TestPopper(reference, popper);
var top = popper.getBoundingClientRect().top;
expect(top).toBeApprox(51);
pop.destroy();
});
it('inits a bottom-start popper', function(done) {
var reference = appendNewRef(1);
reference.style.marginLeft = '200px';
var popper = appendNewPopper(2);
var pop = new TestPopper(reference, popper, {placement: 'bottom-start'}).onCreate(function() {
expect(popper.getBoundingClientRect().left).toBeApprox(reference.getBoundingClientRect().left);
pop.destroy();
done();
});
});
it('inits a right popper', function(done) {
var reference = appendNewRef(1);
var popper = appendNewPopper(2);
new TestPopper(reference, popper, {
placement: 'right'
}).onCreate(function(pop) {
var left = popper.getBoundingClientRect().left;
var local = 92;
var ci = 110;
expect([local, ci]).toContain(left);
pop.destroy();
done();
});
});
it('inits a popper inside a scrolling div, contained in a relative div', function(done) {
var relative = document.createElement('div');
relative.style.height = '800px';
relative.style.width = '800px';
jasmineWrapper.appendChild(relative);
var scrolling = document.createElement('div');
scrolling.style.width = '800px';
scrolling.style.height = '800px';
scrolling.style.overflow = 'auto';
relative.appendChild(scrolling);
var superHigh = document.createElement('div');
superHigh.style.width = '800px';
superHigh.style.height = '1600px';
scrolling.appendChild(superHigh);
var ref = appendNewRef(1, 'ref', superHigh);
var popper = appendNewPopper(2, 'popper', superHigh);
scrolling.scrollTop = 500;
new TestPopper(ref, popper).onCreate(function(pop) {
var top = popper.getBoundingClientRect().top;
expect(top).toBeApprox(-449);
pop.destroy();
done();
});
});
it('inits a popper inside a body, with its reference element inside a relative div', function(done) {
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
jasmineWrapper.appendChild(relative);
var ref = appendNewRef(1, 'ref', relative);
var popper = appendNewPopper(2, 'popper');
new TestPopper(ref, popper).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(63);
expect(popper.getBoundingClientRect().left).toBeApprox(5);
pop.destroy();
done();
});
});
it('inits a popper inside a scrolled body, with its reference element inside a relative div', function(done) {
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '300vh';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 800;
var ref = appendNewRef(1, 'ref', relative);
ref.style.marginTop = '200px';
var popper = appendNewPopper(2, 'popper');
new TestPopper(ref, popper).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(-800 + 263);
expect(popper.getBoundingClientRect().left).toBeApprox(5);
pop.destroy();
done();
});
});
it('inits a popper inside a scrolled body, with its reference element inside a scrolling div, wrapped in a relative div', function(done) {
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '200vh';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 800;
var scrolling = document.createElement('div');
scrolling.style.width = '800px';
scrolling.style.height = '800px';
scrolling.style.overflow = 'auto';
relative.appendChild(scrolling);
var superHigh = document.createElement('div');
superHigh.style.width = '800px';
superHigh.style.height = '1600px';
scrolling.appendChild(superHigh);
scrolling.scrollTop = 500;
var ref = appendNewRef(1, 'ref', scrolling);
ref.style.marginTop = '200px';
var popper = appendNewPopper(2, 'popper');
new TestPopper(ref, popper).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(ref.getBoundingClientRect().bottom + 5);
expect(popper.getBoundingClientRect().left).toBeApprox(5);
pop.destroy();
done();
});
});
it('inits a popper near a reference element, both inside a fixed element, inside a scrolled body', function(done) {
var fixed = document.createElement('div');
fixed.style.position = 'fixed';
fixed.style.margin = '20px';
fixed.style.height = '50px';
fixed.style.width = '100%';
jasmineWrapper.appendChild(fixed);
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '200vh';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 800;
var ref = appendNewRef(1, 'ref', fixed);
var popper = appendNewPopper(2, 'popper', fixed);
new TestPopper(ref, popper).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(83);
expect(popper.getBoundingClientRect().left).toBeApprox(5);
pop.destroy();
done();
});
});
it('inits a popper near a reference element, both inside a fixed element with CSS transforms, inside a scrolled body', function(done) {
var fixed = document.createElement('div');
fixed.style.position = 'fixed';
fixed.style.margin = '20px';
fixed.style.height = '50px';
fixed.style.width = '100%';
fixed.style.transform = 'translateX(0)';
jasmineWrapper.appendChild(fixed);
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '200vh';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 800;
var ref = appendNewRef(1, 'ref', fixed);
var popper = appendNewPopper(2, 'popper', fixed);
new TestPopper(ref, popper).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(83);
expect(popper.getBoundingClientRect().left).toBeApprox(33);
pop.destroy();
done();
});
});
it('inits a popper near a reference element, both inside a fixed element on bottom of viewport, inside a scrolled body', function(done) {
var fixed = document.createElement('div');
fixed.style.position = 'fixed';
fixed.style.bottom = '0';
fixed.style.height = '38px';
fixed.style.width = '100%';
jasmineWrapper.appendChild(fixed);
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '200vh';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 800;
var ref = appendNewRef(1, 'ref', fixed);
var popper = appendNewPopper(2, 'popper', fixed);
new TestPopper(ref, popper, { placement: 'top' }).onCreate(function(pop) {
expect(popper.getBoundingClientRect().bottom + 5).toBeApprox(ref.getBoundingClientRect().top);
expect(popper.getBoundingClientRect().left).toBeApprox(5);
expect(popper.getAttribute('x-placement')).toBe('top');
pop.destroy();
done();
});
});
it('inits a popper and destroy it using its callback', function(done) {
var reference = appendNewRef(1);
var popper = appendNewPopper(2);
new TestPopper(reference, popper).onCreate(function(pop) {
pop.destroy();
expect(popper.style.top).toBe('');
done();
});
});
it('creates a popper using the default configuration', function(done) {
var reference = appendNewRef(1);
new TestPopper(reference).onCreate(function(instance) {
expect(document.querySelectorAll('.popper').length).toBe(1);
document.body.removeChild(instance._popper);
instance.destroy();
done();
});
});
it('creates a popper using a custom configuration', function(done) {
var reference = appendNewRef(1);
new TestPopper(reference, {
content: 'something'
}).onCreate(function(instance) {
expect(instance._popper.innerText).toBe('something');
document.body.removeChild(instance._popper);
instance.destroy();
done();
});
});
it('creates a popper and sets an onUpdate callback', function(done) {
var reference = appendNewRef(1);
var pop = new TestPopper(reference, {content: 'react'}, {
modifiersIgnored: ['applyStyle']
}).onUpdate(function(data) {
expect(data.offsets.popper.top).toBeApprox(46);
document.body.removeChild(data.instance._popper);
data.instance.destroy();
done();
});
window.setTimeout(function() {
pop.update();
// simulates update
window.dispatchEvent(new Event('resize'));
}, 3000);
});
it('creates a popper when content is undefined', function(done) {
var reference = appendNewRef(1);
new TestPopper(reference).onCreate(function(instance) {
expect(instance._popper).toBeDefined();
expect(instance._popper.innerText).toBe('');
document.body.removeChild(instance._popper);
instance.destroy();
done();
});
});
it('creates a popper with an empty form as parent, then auto remove it on destroy', function(done) {
var form = document.createElement('form');
var reference = appendNewRef(1, 'ref', form);
jasmineWrapper.appendChild(form);
new TestPopper(reference, { parent: form, content: 'test'}, { removeOnDestroy: true }).onCreate(function(instance) {
expect(instance._popper).toBeDefined();
expect(instance._popper.innerText).toBe('test');
instance.destroy();
expect(document.contains(instance._popper)).toBeFalsy();
done();
});
});
it('creates a popper with a not empty form as parent, then auto remove it on destroy', function(done) {
var form = document.createElement('form');
var input = document.createElement('input');
form.appendChild(input);
var reference = appendNewRef(1, 'ref', form);
jasmineWrapper.appendChild(form);
new TestPopper(reference, { parent: form, content: 'test'}, { removeOnDestroy: true }).onCreate(function(instance) {
expect(instance._popper).toBeDefined();
expect(instance._popper.innerText).toBe('test');
instance.destroy();
expect(document.contains(instance._popper)).toBeFalsy();
done();
});
});
it('creates a popper and make sure it\'s position is correct on init', function(done) {
var reference = appendNewRef(1);
new TestPopper(
reference,
{ content: 'popper', classNames: ['none'] },
{ placement: 'right', removeOnDestroy: true }
).onCreate(function(instance) {
instance.update();
var local = 87;
var ci = 105;
expect([local, ci]).toContain(instance._popper.getBoundingClientRect().left);
instance.destroy();
done();
});
});
it('inits a popper inside a scrolled body, with its reference element inside a scrolling div, wrapped in a relative div', function(done) {
var relative = document.createElement('div');
relative.style.position = 'relative';
relative.style.margin = '20px';
relative.style.height = '200vh';
relative.style.paddingTop = '100px';
relative.style.backgroundColor = 'yellow';
jasmineWrapper.appendChild(relative);
document.body.scrollTop = 100;
var scrolling = document.createElement('div');
scrolling.style.width = '100%';
scrolling.style.height = '100vh';
scrolling.style.overflow = 'auto';
scrolling.style.backgroundColor = 'green';
relative.appendChild(scrolling);
var superHigh = document.createElement('div');
superHigh.style.width = '1px';
superHigh.style.float = 'right';
superHigh.style.height = '300vh';
scrolling.appendChild(superHigh);
scrolling.scrollTop = 100;
var ref = appendNewRef(1, 'ref', scrolling);
ref.style.width = '100px';
ref.style.height = '100px';
ref.style.marginTop = '100px';
var popper = appendNewPopper(2, 'popper', scrolling);
new TestPopper(ref, popper, { placement: 'right-start', boundariesElement: scrolling }).onCreate(function(pop) {
expect(popper.getBoundingClientRect().top).toBeApprox(ref.getBoundingClientRect().top + 5);
expect(popper.getBoundingClientRect().left).toBeApprox(153);
pop.destroy();
done();
});
});
it('creates a popper with an HTML node as content', function(done) {
var reference = appendNewRef(1);
reference.style.marginLeft = '700px';
var popperContent = document.createElement('div');
popperContent.style.width = '700px';
popperContent.innerText = 'popper';
new TestPopper(
reference,
{ contentType: 'node', content: popperContent },
{ placement: 'left', removeOnDestroy: true }
).onCreate(function(instance) {
expect(instance._popper.getBoundingClientRect().left).toBe(543);
instance.destroy();
done();
});
});
it('creates a popper with a custom modifier that should hide it', function(done) {
var reference = appendNewRef(1);
var popper = appendNewPopper(2);
function hidePopper(data) {
data.styles.display = 'none';
return data;
}
var options = {
modifiers: [hidePopper, 'applyStyle'],
};
new TestPopper(reference, popper, options).onCreate(function(pop) {
expect(popper.style.display).toBe('none');
pop.destroy();
done();
});
});
it('creates a popper with a custom modifier that set its top to 3px', function(done) {
var reference = appendNewRef(1);
var popper = appendNewPopper(2);
function hidePopper(data) {
data.styles.top = '3px';
return data;
}
var options = {
modifiers: [hidePopper, 'applyStyle'],
};
new TestPopper(reference, popper, options).onCreate(function(pop) {
expect(popper.style.top).toBe('3px');
pop.destroy();
done();
});
});
});

57
node_modules/popper.js/tests/test.html generated vendored Normal file
View File

@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<style>
.target {
background:#ff0000;
width:50px;
height:50px;
border:1px solid red;
}
.popper {
background:yellow;
width:120px;
height:120px;
}
.scrollable {
width:400px;
height:300px;
overflow:auto;
border:1px solid red;
}
.scrollable-for-scroll {
content:" ";
height:100px;
width:200px;
border:1px solid red;
}
</style>
</head>
<body>
<div class="scrollable" id="boundaries">
<div class="scrollable-for-scroll">some content before</div>
<div class="target"></div>
<div class="popper">test popper</div>
<div class="scrollable-for-scroll" style="height:500px">some content after</div>
</div>
<script src="../src/popper.js"></script>
<script>
var reference = document.querySelector('.target');
var popperElem = document.querySelector('.popper');
var thePopper = new Popper(
reference,
popperElem,
{
placement: 'right',
boundariesElement: boundaries
}
);
</script>
</body>
</html>