-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
- attempt to fix the tree shake - update deps - bump version
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const a = "active"; | ||
export { | ||
a | ||
}; | ||
//# sourceMappingURL=activeClass-b231b21b.mjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use strict";var C=Object.defineProperty;var g=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>(g(s,typeof t!="symbol"?t+"":t,e),e);const n=require("@thednp/shorty"),a=require("@thednp/event-listener"),E=require("./fadeClass-a4944cf1.js"),l=require("./showClass-2174a6d6.js"),p=require("./dataBsDismiss-4ee313a7.js"),q=require("./base-component-f3cef043.js"),r="alert",u="Alert",L=`.${r}`,f=`[${p.dataBsDismiss}="${r}"]`,$=s=>n.getInstance(s,u),b=s=>new i(s),d=n.createCustomEvent(`close.bs.${r}`),w=n.createCustomEvent(`closed.bs.${r}`),m=s=>{const{element:t}=s;n.dispatchEvent(t,w),s._toggleEventListeners(),s.dispose(),t.remove()};class i extends q.BaseComponent{constructor(e){super(e);o(this,"dismiss");o(this,"close",()=>{const{element:e}=this;e&&n.hasClass(e,l.showClass)&&(n.dispatchEvent(e,d),d.defaultPrevented||(n.removeClass(e,l.showClass),n.hasClass(e,E.fadeClass)?n.emulateTransitionEnd(e,()=>m(this)):m(this)))});o(this,"_toggleEventListeners",e=>{const h=e?a.addListener:a.removeListener,{dismiss:c,close:v}=this;c&&h(c,n.mouseclickEvent,v)});this.dismiss=n.querySelector(f,this.element),this._toggleEventListeners(!0)}get name(){return u}dispose(){this._toggleEventListeners(),super.dispose()}}o(i,"selector",L),o(i,"init",b),o(i,"getInstance",$);module.exports=i; | ||
//# sourceMappingURL=alert.cjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export interface BaseOptions { | ||
[key: string]: any; | ||
} | ||
declare class BaseComponent { | ||
element: HTMLElement; | ||
options?: BaseOptions; | ||
/** | ||
* @param target `HTMLElement` or selector string | ||
* @param config component instance options | ||
*/ | ||
constructor(target: HTMLElement | string, config?: BaseOptions); | ||
get version(): string; | ||
get name(): string; | ||
get defaults(): {}; | ||
/** just to have something to extend from */ | ||
_toggleEventListeners: () => void; | ||
/** Removes component from target element. */ | ||
dispose(): void; | ||
} | ||
/** Creates a new Alert instance. */ | ||
export default class Alert extends BaseComponent { | ||
static selector: string; | ||
static init: <T>(element: HTMLElement) => T; | ||
static getInstance: (element: HTMLElement) => Alert | null; | ||
dismiss: HTMLElement | null; | ||
constructor(target: HTMLElement | string); | ||
/** Returns component name string. */ | ||
get name(): string; | ||
/** | ||
* Public method that hides the `.alert` element from the user, | ||
* disposes the instance once animation is complete, then | ||
* removes the element from the DOM. | ||
*/ | ||
close: () => void; | ||
/** | ||
* Toggle on / off the `click` event listener. | ||
* | ||
* @param add when `true`, event listener is added | ||
*/ | ||
_toggleEventListeners: (add?: boolean) => void; | ||
/** Remove the component from target element. */ | ||
dispose(): void; | ||
} | ||
|
||
export as namespace Alert; | ||
|
||
export {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var h = Object.defineProperty; | ||
var u = (t, s, e) => s in t ? h(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e; | ||
var o = (t, s, e) => (u(t, typeof s != "symbol" ? s + "" : s, e), e); | ||
import { createCustomEvent as d, querySelector as E, hasClass as a, dispatchEvent as p, removeClass as C, emulateTransitionEnd as L, mouseclickEvent as $, getInstance as I } from "@thednp/shorty"; | ||
import { addListener as S, removeListener as _ } from "@thednp/event-listener"; | ||
import { f as b } from "./fadeClass-0d50d035.mjs"; | ||
import { s as c } from "./showClass-f6a4d601.mjs"; | ||
import { d as B } from "./dataBsDismiss-afbfbc79.mjs"; | ||
import { B as k } from "./base-component-a56d44ba.mjs"; | ||
const i = "alert", g = "Alert", w = `.${i}`, x = `[${B}="${i}"]`, A = (t) => I(t, g), D = (t) => new n(t), l = d(`close.bs.${i}`), T = d(`closed.bs.${i}`), m = (t) => { | ||
const { element: s } = t; | ||
p(s, T), t._toggleEventListeners(), t.dispose(), s.remove(); | ||
}; | ||
class n extends k { | ||
constructor(e) { | ||
super(e); | ||
o(this, "dismiss"); | ||
// ALERT PUBLIC METHODS | ||
// ==================== | ||
/** | ||
* Public method that hides the `.alert` element from the user, | ||
* disposes the instance once animation is complete, then | ||
* removes the element from the DOM. | ||
*/ | ||
o(this, "close", () => { | ||
const { element: e } = this; | ||
e && a(e, c) && (p(e, l), l.defaultPrevented || (C(e, c), a(e, b) ? L(e, () => m(this)) : m(this))); | ||
}); | ||
/** | ||
* Toggle on / off the `click` event listener. | ||
* | ||
* @param add when `true`, event listener is added | ||
*/ | ||
o(this, "_toggleEventListeners", (e) => { | ||
const v = e ? S : _, { dismiss: r, close: f } = this; | ||
r && v(r, $, f); | ||
}); | ||
this.dismiss = E(x, this.element), this._toggleEventListeners(!0); | ||
} | ||
/** Returns component name string. */ | ||
get name() { | ||
return g; | ||
} | ||
/** Remove the component from target element. */ | ||
dispose() { | ||
this._toggleEventListeners(), super.dispose(); | ||
} | ||
} | ||
o(n, "selector", w), o(n, "init", D), o(n, "getInstance", A); | ||
export { | ||
n as default | ||
}; | ||
//# sourceMappingURL=alert.mjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var h = Object.defineProperty; | ||
var l = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t; | ||
var i = (s, e, t) => (l(s, typeof e != "symbol" ? e + "" : e, t), t); | ||
import { querySelector as m, isString as c, Data as r, ObjectKeys as a, normalizeOptions as f } from "@thednp/shorty"; | ||
const u = "5.0.13", g = u; | ||
class d { | ||
/** | ||
* @param target `HTMLElement` or selector string | ||
* @param config component instance options | ||
*/ | ||
constructor(e, t) { | ||
/** just to have something to extend from */ | ||
i(this, "_toggleEventListeners", () => { | ||
}); | ||
const n = m(e); | ||
if (!n) | ||
throw c(e) ? Error(`${this.name} Error: "${e}" is not a valid selector.`) : Error(`${this.name} Error: your target is not an instance of HTMLElement.`); | ||
const o = r.get(n, this.name); | ||
o && o._toggleEventListeners(), this.element = n, this.options = this.defaults && a(this.defaults).length ? f(n, this.defaults, t || {}, "bs") : {}, r.set(n, this.name, this); | ||
} | ||
/* istanbul ignore next */ | ||
get version() { | ||
return g; | ||
} | ||
/* istanbul ignore next */ | ||
get name() { | ||
return "BaseComponent"; | ||
} | ||
/* istanbul ignore next */ | ||
get defaults() { | ||
return {}; | ||
} | ||
/** Removes component from target element. */ | ||
dispose() { | ||
r.remove(this.element, this.name), a(this).forEach((e) => { | ||
delete this[e]; | ||
}); | ||
} | ||
} | ||
export { | ||
d as B | ||
}; | ||
//# sourceMappingURL=base-component-a56d44ba.mjs.map |