embla-carousel-auto-height
Advanced tools
Comparing version 6.2.0 to 7.0.0-rc01
import { AutoHeightOptionsType, OptionsType } from './Options'; | ||
import { EmblaPluginType } from 'embla-carousel'; | ||
export declare type AutoHeightType = EmblaPluginType<OptionsType>; | ||
import { CreatePluginType } from 'embla-carousel/components/Plugins'; | ||
export declare type AutoHeightType = CreatePluginType<{}, OptionsType>; | ||
declare function AutoHeight(userOptions?: AutoHeightOptionsType): AutoHeightType; | ||
@@ -5,0 +5,0 @@ declare namespace AutoHeight { |
@@ -1,5 +0,6 @@ | ||
export declare type OptionsType = { | ||
import { CreateOptionsType } from 'embla-carousel/components/Options'; | ||
export declare type OptionsType = CreateOptionsType<{ | ||
destroyHeight: CSSStyleDeclaration['height']; | ||
}; | ||
}>; | ||
export declare const defaultOptions: OptionsType; | ||
export declare type AutoHeightOptionsType = Partial<OptionsType>; |
@@ -0,2 +1,6 @@ | ||
import EmblaCarousel from 'embla-carousel'; | ||
var defaultOptions = { | ||
active: true, | ||
breakpoints: {}, | ||
destroyHeight: 'auto' | ||
@@ -6,19 +10,21 @@ }; | ||
function AutoHeight(userOptions) { | ||
var options = Object.assign({}, defaultOptions, AutoHeight.globalOptions, userOptions); | ||
var destroyHeight = options.destroyHeight; | ||
var heightEvents = ['select', 'pointerUp']; | ||
var inViewThreshold = 0.5; | ||
var optionsHandler = EmblaCarousel.optionsHandler(); | ||
var optionsBase = optionsHandler.merge(defaultOptions, AutoHeight.globalOptions); | ||
var options; | ||
var carousel; | ||
var slideBounds = []; | ||
var slideHeights = []; | ||
var heightEvents = ['select', 'pointerUp']; | ||
var inViewThreshold = 0.5; | ||
function init(embla) { | ||
carousel = embla; | ||
options = optionsHandler.atMedia(self.options); | ||
var _a = carousel.internalEngine(), | ||
options = _a.options, | ||
axis = _a.options.axis, | ||
slidesInView = _a.slidesInView, | ||
slideRects = _a.slideRects; | ||
if (options.axis === 'y') return; | ||
if (axis === 'y') return; | ||
slideBounds = slidesInView.findSlideBounds(undefined, inViewThreshold); | ||
@@ -56,3 +62,3 @@ slideHeights = slideRects.map(function (rect) { | ||
function setContainerHeight(evt) { | ||
var height = evt === 'destroy' ? destroyHeight : highestInView() + "px"; | ||
var height = evt === 'destroy' ? options.destroyHeight : "".concat(highestInView(), "px"); | ||
carousel.containerNode().style.height = height; | ||
@@ -62,4 +68,4 @@ } | ||
var self = { | ||
name: 'AutoHeight', | ||
options: options, | ||
name: 'autoHeight', | ||
options: optionsHandler.merge(optionsBase, userOptions), | ||
init: init, | ||
@@ -73,3 +79,3 @@ destroy: destroy | ||
export default AutoHeight; | ||
export { AutoHeight as default }; | ||
//# sourceMappingURL=embla-carousel-auto-height.esm.js.map |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).EmblaCarouselAutoHeight=n()}(this,(function(){"use strict";var e={destroyHeight:"auto"};function n(t){var i,o=Object.assign({},e,n.globalOptions,t),r=o.destroyHeight,s=["select","pointerUp"],u=[],f=[];function a(e){var n,t,o,s="destroy"===e?r:(n=i.internalEngine(),t=n.slidesInView,o=n.target,t.check(o.get(),u).map((function(e){return f[e]})).reduce((function(e,n){return Math.max(e,n)}),0)+"px");i.containerNode().style.height=s}return{name:"AutoHeight",options:o,init:function(e){var n=(i=e).internalEngine(),t=n.options,o=n.slidesInView,r=n.slideRects;"y"!==t.axis&&(u=o.findSlideBounds(void 0,.5),f=r.map((function(e){return e.height})),s.forEach((function(e){return i.on(e,a)})),a())},destroy:function(){s.forEach((function(e){return i.off(e,a)})),a("destroy")}}}return n.globalOptions=void 0,n})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("embla-carousel")):"function"==typeof define&&define.amd?define(["embla-carousel"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).EmblaCarouselAutoHeight=t(e.EmblaCarousel)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),o={active:!0,breakpoints:{},destroyHeight:"auto"};function i(e){var t,r,a=n.default.optionsHandler(),u=a.merge(o,i.globalOptions),s=[],f=[],l=["select","pointerUp"];function d(e){var n,o,i,a="destroy"===e?t.destroyHeight:"".concat((n=r.internalEngine(),o=n.slidesInView,i=n.target,o.check(i.get(),s).map((function(e){return f[e]})).reduce((function(e,t){return Math.max(e,t)}),0)),"px");r.containerNode().style.height=a}var c={name:"autoHeight",options:a.merge(u,e),init:function(e){r=e,t=a.atMedia(c.options);var n=r.internalEngine(),o=n.options.axis,i=n.slidesInView,u=n.slideRects;"y"!==o&&(s=i.findSlideBounds(void 0,.5),f=u.map((function(e){return e.height})),l.forEach((function(e){return r.on(e,d)})),d())},destroy:function(){l.forEach((function(e){return r.off(e,d)})),d("destroy")}};return c}return i.globalOptions=void 0,i})); |
{ | ||
"name": "embla-carousel-auto-height", | ||
"version": "6.2.0", | ||
"author": "David Cetinkaya", | ||
"version": "7.0.0-rc01", | ||
"author": "David Jerleke", | ||
"description": "An auto height plugin for Embla Carousel", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/davidcetinkaya/embla-carousel" | ||
"url": "git+https://github.com/davidjerleke/embla-carousel" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/davidcetinkaya/embla-carousel/issues" | ||
"url": "https://github.com/davidjerleke/embla-carousel/issues" | ||
}, | ||
@@ -26,5 +26,6 @@ "homepage": "https://www.embla-carousel.com", | ||
], | ||
"main": "embla-carousel-auto-height.umd.js", | ||
"unpkg": "embla-carousel-auto-height.umd.js", | ||
"main": "embla-carousel-auto-height.cjs.js", | ||
"module": "embla-carousel-auto-height.esm.js", | ||
"browser": "embla-carousel-auto-height.umd.js", | ||
"types": "index.d.ts", | ||
@@ -45,17 +46,17 @@ "sideEffects": false, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.22", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"eslint": "^7.24.0", | ||
"eslint-config-prettier": "^8.2.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"rollup": "^2.45.2", | ||
"ts-jest": "^26.5.5", | ||
"typescript": "^4.2.4" | ||
"@types/jest": "^27.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.10.2", | ||
"@typescript-eslint/parser": "^5.10.2", | ||
"eslint": "^8.8.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.5.0", | ||
"prettier": "2.5.1", | ||
"rollup": "^2.68.0", | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.5.5" | ||
}, | ||
"peerDependencies": { | ||
"embla-carousel": "6.2.0" | ||
"embla-carousel": "7.0.0-rc01" | ||
} | ||
} |
@@ -11,3 +11,3 @@ <br /> | ||
<a href="https://www.npmjs.com/package/embla-carousel-auto-height"><img src="https://img.shields.io/npm/v/embla-carousel-auto-height.svg?color=%23c1a8e2"></a> | ||
<a href="https://github.com/davidcetinkaya/embla-carousel/actions?query=workflow%3A%22Continuous+Integration%22"><img src="https://img.shields.io/github/workflow/status/davidcetinkaya/embla-carousel/Continuous%20Integration?color=%238ab4f8"></a> | ||
<a href="https://github.com/davidjerleke/embla-carousel/actions?query=workflow%3A%22Continuous+Integration%22"><img src="https://img.shields.io/github/workflow/status/davidjerleke/embla-carousel/Continuous%20Integration?color=%238ab4f8"></a> | ||
<a href="https://prettier.io"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat&color=%23c1a8e2"></a> | ||
@@ -52,4 +52,4 @@ <a href="https://bundlephobia.com/result?p=embla-carousel-auto-height@latest"><img src="https://img.shields.io/bundlephobia/minzip/embla-carousel-auto-height?color=%238ab4f8&label=gzip%20size"> | ||
<p align="center"> | ||
<sup>Copyright © 2019-present, David Cetinkaya.</sup><br> | ||
Embla is <a href="https://github.com/davidcetinkaya/embla-carousel/blob/master/LICENSE">MIT licensed</a> 💖. | ||
<sup>Copyright © 2019-present, David Jerleke.</sup><br> | ||
Embla is <a href="https://github.com/davidjerleke/embla-carousel/blob/master/LICENSE">MIT licensed</a> 💖. | ||
</p> | ||
@@ -56,0 +56,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22259
155
3
2