npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@teamteanpm2024/vel-harum-ab

v1.0.6

Published

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/) [![Socket Badge](https://socket.dev

Downloads

19

Maintainers

shivamkalsi2024shivamkalsi2024

Keywords

tacitvalidatorvariableswidththreefastkinesistypedarraysairbnbtoobjectES6higher-orderzeroencryptiondependenciesargvrapidshebangfast-clonetelephonematchAllECMAScript 2019watchinstallerwrapspinnersavatrimutilitiesMicrosoftweakmaphasCSSStyleDeclarationtextReactiveXarktypeparentcontainsprefixmkdirseslint-plugin$.extendtapawesomesauceshrinkwraplookdropglacierpromisesspeedpackage.jsonirqconsumeconstObject.valuesclass-validatorArrayansiECMAScript 2018omitjestcomputed-typesspinnerfile systemscheme-validation256.envparseasciiresolvecss lessstylelibphonenumberArrayBuffer.prototype.sliceshamECMAScript 2022Object.assignES2019json-schemaexecpersistentObject.getPrototypeOfFloat64Arraypoint-freeUint32ArrayramdatsfindLastIndexoptimistbundlertc39es6valuesjQuerylogArray.prototype.findLastIndexECMAScript 2017enderjsonschemastarterajvTypeBoxes7dom-testing-librarysymbolregular expressiontranspilecloudsearchbyteconcatMapextendmocha_.extendReflect.getPrototypeOfstyleguidegroupByECMAScript 2020jsvarreactassignenvtoolkitbalancedsymlinksrobustdescriptiondescriptormimetypesbabel-corecloudtrailObject.entriesrequestimmutableuninstallinferencegetOwnPropertyDescriptorcoerciblecharactersES2023aststreams2removeparentserrorfastcloneutilprotoECMAScript 2016es2017framerArray.prototype.filterargsemojiRFC-6455vpces5nodeimportFunction.prototype.nameframeworktoSortedstringchromeanimationwatcherpromiseES20170package managerformatdefineargumentcallbindnegative zerosignalspyyamlnpmcallboundlimitWebSocketspathgetpushcss variablecopyMapbufferprivate datatestingrmdircall-bindutilitypluginrangeerrorregular expressionsmovelimitedes-abstractstyled-componentsfastifyassertionfast-deep-copywatchFilehttpswritegdprpackagebrowserlistobjectmakedeterministicloadbalancingfantasy-landObject.keysArray.prototype.flateslintreact poseidleECMAScript 7css-in-jsreusefullchromiumUint8ClampedArrayInt32Arrayupelasticacherandomrfc4122mkdirstructuredClonecodestdderror-handlingcompileraccessibilitytouchi18nwarningindicatorbyteOffsetcloudformationttyfiltertrimLeftrmWeakSetsameValueZerorecursivecolorgetoptwebURLSearchParamsvisuales-shimsdeepcopydeepclonedeep-cloneserializationless cssmimecreateworkerdompolyfilllengthescapeArray.prototype.containspatchlazyestreeECMAScript 2021Int8ArraymatchhookformTypeScriptjasminestableECMAScript 3WebSocketlanguagedirectorygetPrototypeOfstoragegatewayObject.ishelperstyped arrayinterruptsreadforEachSeteventDispatcherclassnamefoldernamescoreprototypeconsolefpECMAScript 2015chaikeysquerykarmasanitizesanitizationYAMLgradients cssdayjsruntimedragdeleteUint16ArrayRegExp.prototype.flagsfpsconcurrencyjsdiffbreakgetintrinsicextensioncensorcurlregexpwaittrimRightRxJSloggingio-tsstatussequenceconcat[[Prototype]]configdataViewschematrimEndxhrgetterclassnamesviewmiddlewaremergefast-deep-cloneawaitpropertySymbol.toStringTagUnderscoreES2018functionssafeutil.inspectposeasyncefficientprotobuftypesargparsecheckjson-schema-validatorobjsetterprogressemrnested csssettingsdescriptorssymlinkslicetesterboundxtermcollectiontimeequalarraybufferfullwidthflatMapshimjapaneseguidutilscallbackmime-dbquotecore-jstypeerrorfast-copysettrimStartiamInt16Arrayflattengradients css3postcss-pluginentriesharmonyenumerabletasksigtermlockfileArrayBufferintrinsics3exit-codeopenformmetadataformattingexitjavascriptes2015emitreducerlook-upprotocol-bufferschinesewordbreakduplexless compilercjkpiperateUint8ArrayprettybeanstalkAsyncIteratordependency manager__proto__optimizerprivatestylesfseventscharacterhttpreduceprunesyntaxerrortypanionqueueMicrotasklesswhatwgsearchbootstrap cssArrayBuffer#sliceECMAScript 5sesmodulesSymbolagentcloudfrontapibundlingnativea11yserializerimmernametoolsbrowserslistString.prototype.trimwafhandlersbddzodeslintconfigamazontypescriptJSONpackagesmomentstylingauthstringifyiteratorreadablestreamsqsflatformskeyfindupdiffpostcssbcryptinvariantWeakMapcommanddynamodbrequirenodejsschemehasOwnes-shim APIES7filevariables in csswgetflagsisbuffersdebuggerregularwhichsortlistenersES2021circularredactCSSwalkeast-asian-widthcomparevalidationcompile lessshellsortedcloneextracloudwatchartinternalArray.prototype.includescolumncachesetImmediatearrayexpressmru3dsnssymbolsmulti-packageReactiveExtensionsES2020throatES2016connectvalidatebatchcolumnsletisConcatSpreadableoffsettraverseslotBigInt64ArrayArray.prototype.flatMaphardlinksObject.fromEntriesregexObservablecss nestingjoiquerystring@@toStringTagfindLastmatchesfigletponyfillstreamsjsonreadablees2016datemodulereact-hooksdeep-copyeslintpluginenvironmentsetPrototypeOfelectronautoprefixerarraysequalityes8performantbluebirdloggerwordwrapreact animationRegExp#flagsbootstrap lesscollection.es6curriedfastcopyPromiseESnextphoneflagtypesafeBigUint64ArraydefinePropertythrottlenumberassertstatelesspreserve-symlinksieswftermdeepassertstoStringTagoperating-systemtslibautoscalingeventEmitteroutputinternal slotl10nHyBidataviewconfigurablesharedJSON-Schemagroupcommand-lineparseraccessorlesscsscolorsyamlinstallRxdotenvtypeofauthenticationjsonpathgesturesjsdomdirtestArray.prototype.findLastreduxpasswordes2018ObservablesES2015qspropsigintdatastructurewalkingterminalwindowsnopeeventsESPushless mixinsvalueURLproxypreprocessormapreducesuperstructTypedArraysignalStyleSheetbindcryptoworkspace:*ES3real-timeECMAScript 2023endpoint6to5Array.prototype.flattenfunctionbannerpropertiesjwtoptionsharedarraybufferlrukoreanmkdirprgbstringifierimportexportmacosuser-streamsperformanceespureless.jsECMAScript 6ratelimitcryptbrowserfetchinspecteveryObjectES8jsxwaapicode pointslastfind-upStreamincludesfssimpledbclassescolourlinuxpicomatchmobilecorsFloat32Arraylinewrapbusypositivehooksrm -fryuppnpm9rdshashcssmapweaksetbabelfunctionaltoArraymonorepouuidminimalelbredux-toolkitvestchannelajaxtranspilerString.prototype.matchAllfindclireact-testing-libraryfull-widthloadingwritableparsingiterationonceunicodemixinsfromserializenegativemake dirstreamsuperagentspringqueueObject.definePropertyexpressionvalidfixed-widthES5ES2022somelinkgenericstostringtagtypedurlroute53-0typeIteratorstylesheetebstypedarraylintprocessrm -rfglobbyteLengthtakedataawsecmascriptxsssidecallreact-hook-formjson-schema-validationworkflowwatchingform-validation

Readme

@teamteanpm2024/vel-harum-ab.js

License: MIT TypeScript Socket Badge jsdelivr npm npm downloads yarn

Inspired by: jquery-match-height

matchHeight: makes the height of all selected elements exactly equal

Demo - Features - Install - Usage - Options - Data API
Advanced Usage - Changelog - License

Demo

See the @teamteanpm2024/vel-harum-ab.js demo.

@teamteanpm2024/vel-harum-ab.js screenshot

Modern browsers

In the years since this library was originally developed there have been updates to CSS that can now achieve equal heights in many situations. If you only need to support modern browsers then consider using CSS Flexbox and CSS Grid instead.

Best practice

Use this library to match height of internal elements, like title or text of teasers

Features

  • match the heights for groups of elements automatically
  • use the maximum height or define a specific target element
  • anywhere on the page and anywhere in the DOM
  • responsive (updates on window resize)
  • row aware (handles floating elements and wrapping)
  • accounts for box-sizing and mixed padding, margin, border values
  • handles images and other media (updates after loading)
  • easily removed when needed
  • data attributes API
  • tested in Edge, Chrome, Firefox

Install

CDN via jsDelivr

<script src="https://cdn.jsdelivr.net/npm/@teamteanpm2024/vel-harum-ab@latest/dist/@teamteanpm2024/vel-harum-ab.min.js" type="text/javascript"></script>

Download @teamteanpm2024/vel-harum-ab.js and include the script in your HTML file:

<script src="@teamteanpm2024/vel-harum-ab.js" type="text/javascript"></script>

You can also install using the package managers NPM.

npm install @teamteanpm2024/vel-harum-ab

modular code

import '@teamteanpm2024/vel-harum-ab'

Usage

document.body.matchHeight({elements: '.item'});

const containers = document.querySelectorAll(".items-container");
containers.forEach((container) => {			
    container.matchHeight({elements: '.item'});
});

Where options is an optional parameter.
See below for a description of the available options and defaults.

The above example will set all selected elements with the class item to the height of the tallest.
If the items are on multiple rows, the items of each row will be set to the tallest of that row (see byRow option).

Call this on the event (the plugin will automatically update on window load).
See the included test.html for many working examples.

Also see the Data API below for a simple, alternative inline usage.

Options

The default options are:

{
    elements: null,
    byRow: true,
    property: 'height',
    target: null,
    remove: null,
    attributeName: null,
    events: true,
    throttle: 80
}

Where:

  • elements is an optional string containing one or more selectors to match against. This string must be a valid CSS selector string
  • byRow is true or false to enable row detection
  • property is the CSS property name to set (e.g. 'height' or 'min-height')
  • target is an optional element to use instead of the element with maximum height
  • remove is an optional element/s to excluded
  • attributeName is an optional for use custom attribute
  • events is true or false to enable default events
  • throttle milliseconds to executed resize event, default is 80

Data API

Use the data attribute data-mh="group-name" or data-match-height="group-name" where group-name is an arbitrary string to identify which elements should be considered as a group.

<div data-mh="my-group">My text</div>
<div data-mh="my-group">Some other text</div>
<div data-mh="my-other-group">Even more text</div>
<div data-mh="my-other-group">The last bit of text</div>

All elements with the same group name will be set to the same height when the page is loaded, regardless of their position in the DOM, without any extra code required.

It's possible to use custom data attribute data-same-height="group-name"

<div data-same-height="my-group">My text</div>
<div data-same-height="my-group">Some other text</div>
<div data-same-height="my-other-group">Even more text</div>
<div data-same-height="my-other-group">The last bit of text</div>

const containers = document.querySelectorAll(".data-api-items");
containers.forEach((container) => {
    container.matchHeight({attributeName: 'data-same-height'});
});

Note that byRow will be enabled when using the data API, if you don't want this (or require other options) then use the alternative method above.

Advanced Usage

There are some additional functions and properties you should know about:

Manually trigger an update

window.dispatchEvent(new Event('resize'));

If you need to manually trigger an update of all currently set groups, for example if you've modified some content.

Row detection

You can toggle row detection by setting the byRow option, which defaults to true.
It's also possible to use the row detection function at any time:

Custom target element

const containers = document.querySelectorAll(".target-items");
containers.forEach((container) => {			
    container.matchHeight({elements: '.item-0, .item-2, .item-3', target: document.getElementById("target-item-1")});
});

Will set all selected elements to the height of the first item with class sidebar.

Custom property

const containers = document.querySelectorAll(".property-items");
containers.forEach((container) => {			
    container.matchHeight({elements: '.item', property: 'min-height'});
});

This will set the min-height property instead of the height property.

Where event a event object (DOMContentLoaded, resize, orientationchange).

Throttling resize updates

By default, the events is throttled to execute at a maximum rate of once every 80ms. Decreasing the throttle option will update your layout quicker, appearing smoother during resize, at the expense of performance. If you experience lagging or freezing during resize, you should increase the throttle option.

Manually apply match height

Manual apply, code for JavaScript framework/library (e.g. vue, react ...).

var el = document.body.matchHeight({elements: '.item'});
...
el._apply();
el._applyDataApi('data-match-height');
el._applyDataApi('data-mh');
el._applyAll();

Remove match height from elements

Reset inline style property

var el = document.body.matchHeight({elements: '.item'});
...
el._remove();

Remove events from match height elements

Remove events

var el = document.body.matchHeight({elements: '.item'});
...
el._unbind();

Known limitations

CSS transitions and animations are not supported

You should ensure that there are no transitions or other animations that will delay the height changes of the elements you are matching, including any transition: all rules. Otherwise the plugin will produce unexpected results, as animations can't be accounted for.

Vue3 Example:

import '@teamteanpm2024/vel-harum-ab';
export default {
    name: 'Example',
    data: function () {
        return {
            matchHeight: document.body.matchHeight({elements: '.item p'})
        }
    },
    beforeUnmount() {
        this.matchHeight._unbind();
    },
    mounted() {
        this.matchHeight._apply();
    },
    methods: {
        reMatch() {
            this.matchHeight._apply();
        }
    }
}

React Example:

import '@teamteanpm2024/vel-harum-ab';
class MyComponent extends Component {
    matchHeight = document.body.matchHeight({elements: '.item p'});
    componentDidMount() {
        this.matchHeight._apply();
    }
    componentWillUnmount() {
        this.matchHeight._unbind();
    }
    render() {
        return (
            ...
        );
    }
}

Not duplicate instance!

I suggest to assign element to a variable for not create multiple events instances

//Right solution
var el = document.body.matchHeight({elements: '.item'});
... json update
el._apply();

//Wrong solution
document.body.matchHeight({elements: '.item'});
... json update
document.body.matchHeight({elements: '.item'})._apply();

Changelog

To see what's new or changed in the latest version, see the changelog

License

@teamteanpm2024/vel-harum-ab.js is licensed under The MIT License (MIT) Copyright (c) 2023 Simone Miterangelis

This license is also supplied with the release and source code. As stated in the license, absolutely no warranty is provided.