{ "name": "@sxzz/popperjs-es", "version": "2.11.7", "description": "Tooltip and Popover Positioning Engine", "main": "dist/index.js", "module": "dist/index.mjs", "unpkg": "dist/index.iife.js", "exports": { ".": { "require": "./dist/index.js", "import": "./dist/index.mjs" }, "./*": "./*" }, "types": "./index.d.ts", "author": "Federico Zivolo ", "license": "MIT", "repository": "github:popperjs/popper-core", "keywords": [ "tooltip", "popover", "dropdown", "popup", "popper", "positioning engine" ], "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" }, "files": [ "index.d.ts", "/dist", "/lib" ], "sideEffects": false, "publishConfig": { "access": "public" }, "prettier": { "semi": true, "trailingComma": "es5", "singleQuote": true, "proseWrap": "always" }, "babel": { "extends": "./.config/babel.config" }, "jest": { "preset": "./.config/jest.config" }, "eslintConfig": { "extends": "./.config/eslint.config" }, "husky": { "hooks": { "pre-commit": "pretty-quick --staged" } }, "devDependencies": { "@ampproject/rollup-plugin-closure-compiler": "^0.26.0", "@atomico/rollup-plugin-sizes": "^1.1.4", "@babel/cli": "^7.12.17", "@babel/core": "^7.12.17", "@babel/plugin-transform-flow-strip-types": "^7.12.13", "@babel/plugin-transform-runtime": "^7.12.17", "@babel/preset-env": "^7.12.17", "@fezvrasta/tsc-silent": "^1.3.0", "@khanacademy/flow-to-ts": "^0.3.0", "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-replace": "^2.3.4", "babel-eslint": "^10.0.3", "babel-jest": "^26.6.3", "babel-plugin-add-import-extension": "^1.4.4", "babel-plugin-annotate-pure-calls": "^0.4.0", "babel-plugin-dev-expression": "^0.2.2", "babel-plugin-inline-replace-variables": "^1.3.1", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "concurrently": "^5.3.0", "dotenv": "^8.2.0", "esbuild": "^0.14.38", "esbuild-plugin-flow": "^0.3.2", "eslint": "^7.20.0", "eslint-plugin-flowtype": "^5.2.2", "eslint-plugin-import": "^2.22.1", "eslint-plugin-unused-imports": "^1.1.0", "esno": "^0.14.1", "flow-bin": "^0.139.0", "flow-copy-source": "^2.0.9", "get-port-cli": "^2.0.0", "husky": "^5.0.9", "jest": "^26.6.3", "jest-environment-jsdom-sixteen": "^1.0.3", "jest-environment-puppeteer": "^4.4.0", "jest-image-snapshot": "^4.3.0", "jest-puppeteer": "^4.4.0", "pinst": "^2.1.4", "poster": "^0.0.9", "prettier": "^2.2.1", "pretty-quick": "^3.1.0", "puppeteer": "^10.4.0", "replace-in-files-cli": "^1.0.0", "rollup": "^2.70.2", "rollup-plugin-esbuild": "^4.9.1", "rollup-plugin-flow-entry": "^0.3.3", "rollup-plugin-license": "^2.2.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-visualizer": "^4.2.0", "serve": "^11.3.2", "typescript": "^4.1.5" }, "scripts": { "clean": "rimraf lib && rimraf dist && rimraf test/visual/dist", "test": "yarn test:unit && yarn test:functional", "test:unit": "jest --coverage src", "test:functional": "DEV_PORT=`get-port` jest tests/functional", "test:flow": "flow", "test:typescript": "tsc --project tests/typescript/tsconfig.json", "test:eslint": "eslint .", "dev": "NODE_ENV=dev concurrently 'yarn serve' 'yarn build:dev --watch'", "serve": "serve -l ${DEV_PORT:-5000} tests/visual", "build": "yarn clean && esmo build/build.ts && pnpm run build:typescript", "build:typescript": "rimraf dist/typescript; flow-to-ts \"src/**/*.js\" --write --inline-utility-types; tsc-silent --project .config/tsconfig.json --createSourceFile .config/createSourceFile.js --suppress @; rimraf \"src/**/*.ts\"" }, "readme": "\n

\n \"Popper\"\n

\n\n
\n

Tooltip & Popover Positioning Engine

\n
\n\n

\n \n \"npm\n \n \n \"npm\n \n \n \"Rolling\n \n

\n\n
\n\n\n**Positioning tooltips and popovers is difficult. Popper is here to help!**\n\nGiven an element, such as a button, and a tooltip element describing it, Popper\nwill automatically put the tooltip in the right place near the button.\n\nIt will position _any_ UI element that \"pops out\" from the flow of your document\nand floats near a target element. The most common example is a tooltip, but it\nalso includes popovers, drop-downs, and more. All of these can be generically\ndescribed as a \"popper\" element.\n\n## Demo\n\n[![Popper visualized](https://i.imgur.com/F7qWsmV.jpg)](https://popper.js.org)\n\n## Docs\n\n- [v2.x (latest)](https://popper.js.org/docs/v2/)\n- [v1.x](https://popper.js.org/docs/v1/)\n\nWe've created a\n[Migration Guide](https://popper.js.org/docs/v2/migration-guide/) to help you\nmigrate from Popper 1 to Popper 2.\n\nTo contribute to the Popper website and documentation, please visit the\n[dedicated repository](https://github.com/popperjs/website).\n\n## Why not use pure CSS?\n\n- **Clipping and overflow issues**: Pure CSS poppers will not be prevented from\n overflowing clipping boundaries, such as the viewport. It will get partially\n cut off or overflows if it's near the edge since there is no dynamic\n positioning logic. When using Popper, your popper will always be positioned in\n the right place without needing manual adjustments.\n- **No flipping**: CSS poppers will not flip to a different placement to fit\n better in view if necessary. While you can manually adjust for the main axis\n overflow, this feature cannot be achieved via CSS alone. Popper automatically\n flips the tooltip to make it fit in view as best as possible for the user.\n- **No virtual positioning**: CSS poppers cannot follow the mouse cursor or be\n used as a context menu. Popper allows you to position your tooltip relative to\n any coordinates you desire.\n- **Slower development cycle**: When pure CSS is used to position popper\n elements, the lack of dynamic positioning means they must be carefully placed\n to consider overflow on all screen sizes. In reusable component libraries,\n this means a developer can't just add the component anywhere on the page,\n because these issues need to be considered and adjusted for every time. With\n Popper, you can place your elements anywhere and they will be positioned\n correctly, without needing to consider different screen sizes, layouts, etc.\n This massively speeds up development time because this work is automatically\n offloaded to Popper.\n- **Lack of extensibility**: CSS poppers cannot be easily extended to fit any\n arbitrary use case you may need to adjust for. Popper is built with\n extensibility in mind.\n\n## Why Popper?\n\nWith the CSS drawbacks out of the way, we now move on to Popper in the\nJavaScript space itself.\n\nNaive JavaScript tooltip implementations usually have the following problems:\n\n- **Scrolling containers**: They don't ensure the tooltip stays with the\n reference element while scrolling when inside any number of scrolling\n containers.\n- **DOM context**: They often require the tooltip move outside of its original\n DOM context because they don't handle `offsetParent` contexts.\n- **Compatibility**: Popper handles an incredible number of edge cases regarding\n different browsers and environments (mobile viewports, RTL, scrollbars enabled\n or disabled, etc.). Popper is a popular and well-maintained library, so you\n can be confident positioning will work for your users on any device.\n- **Configurability**: They often lack advanced configurability to suit any\n possible use case.\n- **Size**: They are usually relatively large in size, or require an ancient\n jQuery dependency.\n- **Performance**: They often have runtime performance issues and update the\n tooltip position too slowly.\n\n**Popper solves all of these key problems in an elegant, performant manner.** It\nis a lightweight ~3 kB library that aims to provide a reliable and extensible\npositioning engine you can use to ensure all your popper elements are positioned\nin the right place.\n\nWhen you start writing your own popper implementation, you'll quickly run into\nall of the problems mentioned above. These widgets are incredibly common in our\nUIs; we've done the hard work figuring this out so you don't need to spend hours\nfixing and handling numerous edge cases that we already ran into while building\nthe library!\n\nPopper is used in popular libraries like Bootstrap, Foundation, Material UI, and\nmore. It's likely you've already used popper elements on the web positioned by\nPopper at some point in the past few years.\n\nSince we write UIs using powerful abstraction libraries such as React or Angular\nnowadays, you'll also be glad to know Popper can fully integrate with them and\nbe a good citizen together with your other components. Check out `react-popper`\nfor the official Popper wrapper for React.\n\n## Installation\n\n### 1. Package Manager\n\n```bash\n# With npm\nnpm i @popperjs/core\n\n# With Yarn\nyarn add @popperjs/core\n```\n\n### 2. CDN\n\n```html\n\n\n\n\n\n```\n\n### 3. Direct Download?\n\nManaging dependencies by \"directly downloading\" them and placing them into your\nsource code is not recommended for a variety of reasons, including missing out\non feat/fix updates easily. Please use a versioning management system like a CDN\nor npm/Yarn.\n\n## Usage\n\nThe most straightforward way to get started is to import Popper from the `unpkg`\nCDN, which includes all of its features. You can call the `Popper.createPopper`\nconstructor to create new popper instances.\n\nHere is a complete example:\n\n```html\n\nPopper example\n\n\n\n\n
I'm a tooltip
\n\n\n\n```\n\nVisit the [tutorial](https://popper.js.org/docs/v2/tutorial/) for an example of\nhow to build your own tooltip from scratch using Popper.\n\n### Module bundlers\n\nYou can import the `createPopper` constructor from the fully-featured file:\n\n```js\nimport { createPopper } from '@popperjs/core';\n\nconst button = document.querySelector('#button');\nconst tooltip = document.querySelector('#tooltip');\n\n// Pass the button, the tooltip, and some options, and Popper will do the\n// magic positioning for you:\ncreatePopper(button, tooltip, {\n placement: 'right',\n});\n```\n\nAll the modifiers listed in the docs menu will be enabled and \"just work\", so\nyou don't need to think about setting Popper up. The size of Popper including\nall of its features is about 5 kB minzipped, but it may grow a bit in the\nfuture.\n\n#### Popper Lite (tree-shaking)\n\nIf bundle size is important, you'll want to take advantage of tree-shaking. The\nlibrary is built in a modular way to allow to import only the parts you really\nneed.\n\n```js\nimport { createPopperLite as createPopper } from '@popperjs/core';\n```\n\nThe Lite version includes the most necessary modifiers that will compute the\noffsets of the popper, compute and add the positioning styles, and add event\nlisteners. This is close in bundle size to pure CSS tooltip libraries, and\nbehaves somewhat similarly.\n\nHowever, this does not include the features that makes Popper truly useful.\n\nThe two most useful modifiers not included in Lite are `preventOverflow` and\n`flip`:\n\n```js\nimport {\n createPopperLite as createPopper,\n preventOverflow,\n flip,\n} from '@popperjs/core';\n\nconst button = document.querySelector('#button');\nconst tooltip = document.querySelector('#tooltip');\n\ncreatePopper(button, tooltip, {\n modifiers: [preventOverflow, flip],\n});\n```\n\nAs you make more poppers, you may be finding yourself needing other modifiers\nprovided by the library.\n\nSee [tree-shaking](https://popper.js.org/docs/v2/performance/#tree-shaking) for more\ninformation.\n\n## Distribution targets\n\nPopper is distributed in 3 different versions, in 3 different file formats.\n\nThe 3 file formats are:\n\n- `esm` (works with `import` syntax — **recommended**)\n- `umd` (works with `