Skip to content

Commit

Permalink
Bumped version to 4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed Jul 13, 2019
1 parent cddb5aa commit 87a45eb
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 4.1.3
- Ensuring Cash can be bundled correctly via WebPack
- $.fn.toggle: ensuring each element is toggled independently
- TypeScript: ensuring some useful internal types are exported
- TypeScript: made types a little more forgiving

### Version 4.1.2
- Avoiding publishing unnecessary files to NPM

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ If you're migrating from jQuery be sure to read our [migration guide](https://gi

## Usage

Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.2/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/[email protected].2/dist/cash.min.js) and use it like this:
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.3/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/[email protected].3/dist/cash.min.js) and use it like this:

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.2/cash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.3/cash.min.js"></script>
<script>
$(function () {
$('html').addClass ( 'dom-loaded' );
Expand Down
9 changes: 5 additions & 4 deletions dist/cash.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
interface Cash {
[index: number]: EleAll;
[index: number]: EleLoose;
length: number;
splice(start: number, deleteCount?: number): Ele[];
splice(start: number, deleteCount: number, ...items: Ele[]): Ele[];
Expand All @@ -12,7 +12,7 @@ declare type plainObject = {
};
declare type falsy = undefined | null | false | 0 | '';
declare type Ele = Window | Document | HTMLElement | Element | Node;
declare type EleAll = Window & Document & HTMLElement & Element & Node;
declare type EleLoose = Window & Document & HTMLElement & Element & Node;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
declare type Comparator = string | Ele | Cash | ((this: Ele, index: number, ele: Ele) => boolean);
declare type Context = Document | HTMLElement | Element;
Expand Down Expand Up @@ -40,7 +40,7 @@ interface Cash {
}
declare type MapCallback<T> = (this: T, index: number, ele: T) => Ele;
interface Cash {
map(callback: MapCallback<Ele>): Cash;
map(callback: MapCallback<EleLoose>): Cash;
}
interface Cash {
slice(start?: number, end?: number): Cash;
Expand All @@ -53,7 +53,7 @@ interface CashStatic {
each<T>(arr: ArrayLike<T>, callback: EachCallback<T>): void;
}
interface Cash {
each(callback: EachCallback<Ele>): this;
each(callback: EachCallback<EleLoose>): this;
}
interface Cash {
removeProp(prop: string): this;
Expand Down Expand Up @@ -304,3 +304,4 @@ interface Cash {
siblings(comparator?: Comparator): Cash;
}
export default cash;
export { Cash, Ele as Element, Selector, Comparator, Context };
5 changes: 3 additions & 2 deletions dist/cash.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ function isHidden(ele) {
}
Cash.prototype.toggle = function (force) {
return this.each((i, ele) => {
force = force !== undefined ? force : isHidden(ele);
if (force) {
const show = force !== undefined ? force : isHidden(ele);
if (show) {
ele.style.display = '';
if (isHidden(ele)) {
ele.style.display = getDefaultDisplay(ele.tagName);
Expand Down Expand Up @@ -1015,4 +1015,5 @@ Cash.prototype.siblings = function (comparator) {
// @priority -100
// @require ./cash.ts
export default cash;
export { Cash };

4 changes: 2 additions & 2 deletions dist/cash.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ function isHidden(ele) {

Cash.prototype.toggle = function (force) {
return this.each(function (i, ele) {
force = force !== undefined ? force : isHidden(ele);
var show = force !== undefined ? force : isHidden(ele);

if (force) {
if (show) {
ele.style.display = '';

if (isHidden(ele)) {
Expand Down
2 changes: 1 addition & 1 deletion dist/cash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions dist/cash.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

interface Cash {
[index: number]: EleAll;
length: number;
splice ( start: number, deleteCount?: number ): Ele[];
splice ( start: number, deleteCount: number, ...items: Ele[] ): Ele[];
[index: number]: EleLoose,
length: number,
splice ( start: number, deleteCount?: number ): Ele[],
splice ( start: number, deleteCount: number, ...items: Ele[] ): Ele[]
}

interface CashStatic {
fn: Cash;
fn: Cash
}

type plainObject = { [index: string]: any };
type falsy = undefined | null | false | 0 | '';

type Ele = Window | Document | HTMLElement | Element | Node;
type EleAll = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278
type EleLoose = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean);
type Context = Document | HTMLElement | Element;
Expand Down Expand Up @@ -173,10 +173,10 @@ Cash.prototype.last = function ( this: Cash ) {
type MapCallback<T> = ( this: T, index: number, ele: T ) => Ele;

interface Cash {
map ( callback: MapCallback<Ele> ): Cash;
map ( callback: MapCallback<EleLoose> ): Cash;
}

Cash.prototype.map = function ( this: Cash, callback: MapCallback<Ele> ) {
Cash.prototype.map = function ( this: Cash, callback: MapCallback<EleLoose> ) {
return cash ( map.call ( this, ( ele: Ele, i: number ) => callback.call ( ele, i, ele ) ) );
};

Expand Down Expand Up @@ -237,10 +237,10 @@ cash.each = each;
// @require core/each.ts

interface Cash {
each ( callback: EachCallback<Ele> ): this;
each ( callback: EachCallback<EleLoose> ): this;
}

Cash.prototype.each = function ( this: Cash, callback: EachCallback<Ele> ) {
Cash.prototype.each = function ( this: Cash, callback: EachCallback<EleLoose> ) {
each ( this, callback );
return this;
};
Expand Down Expand Up @@ -1074,9 +1074,9 @@ Cash.prototype.toggle = function ( this: Cash, force?: boolean ) {

return this.each ( ( i, ele ) => {

force = force !== undefined ? force : isHidden ( ele );
const show = force !== undefined ? force : isHidden ( ele );

if ( force ) {
if ( show ) {

ele.style.display = '';

Expand Down Expand Up @@ -2517,3 +2517,4 @@ Cash.prototype.siblings = function ( this: Cash, comparator?: Comparator ) {
// @require ./cash.ts

export default cash;
export { Cash, Ele as Element, Selector, Comparator, Context };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cash-dom",
"description": "An absurdly small jQuery alternative for modern browsers.",
"version": "4.1.2",
"version": "4.1.3",
"license": "MIT",
"browser": "./dist/cash.js",
"main": "./dist/cash.js",
Expand Down

0 comments on commit 87a45eb

Please sign in to comment.