baseframe-js
Advanced tools
Comparing version 4.6.1 to 4.6.2
import parseObjectFromString from './util/parse-object-from-string'; | ||
import $visible from './util/visible'; | ||
import { elemData } from '../js/util/store'; | ||
import elemData from "./util/elemData"; | ||
import { KEYS } from './util/constants'; | ||
@@ -13,3 +13,3 @@ import $ from 'cash-dom'; | ||
focusInElems: 'a, [tabindex]', | ||
focusLeaveElems: 'a, [tabindex], select' | ||
focusLeaveElems: 'a, [tabindex], select, button' | ||
}; | ||
@@ -16,0 +16,0 @@ const escapeKey = (e, $ulParents, focusCss) => { |
@@ -5,3 +5,3 @@ import $ from 'cash-dom'; | ||
import { getHashParam } from './util/get-param'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
import updateHistoryState from './util/plugin/update-history-state'; | ||
@@ -8,0 +8,0 @@ import { noop, transitionElem } from './util/helpers'; |
import $ from 'cash-dom'; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
const VERSION = "2.0.2"; | ||
@@ -5,0 +5,0 @@ const DATA_NAME = 'EqualizeContent'; |
import $ from 'cash-dom'; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { isVisible } from './util/helpers'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
const VERSION = '2.0.1'; | ||
@@ -6,0 +6,0 @@ const DATA_NAME = 'LazyLoad'; |
import $ from 'cash-dom'; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
import trapFocus from './util/trap-focus'; | ||
@@ -5,0 +5,0 @@ import generateGUID from './util/guid-generate'; |
import $ from 'cash-dom'; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
const VERSION = "1.2.1"; | ||
@@ -5,0 +5,0 @@ const DATA_NAME = 'NavDesktop'; |
@@ -5,3 +5,3 @@ import $ from 'cash-dom'; | ||
import submenuBtn from './util/plugin/nav'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
import trapFocus from './util/trap-focus'; | ||
@@ -8,0 +8,0 @@ import { KEYS } from "./util/constants"; |
import $ from 'cash-dom'; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
const VERSION = "1.1.0"; | ||
@@ -5,0 +5,0 @@ const DATA_NAME = 'Parallax'; |
import $ from 'cash-dom'; | ||
import { elemData } from "./util/store"; | ||
import elemData from "./util/elemData"; | ||
import parseObjectFromString from './util/parse-object-from-string'; | ||
import { KEYS } from "./util/constants"; | ||
import { isMobileOS, noop } from "./util/helpers"; | ||
const VERSION = "2.3.0"; | ||
const VERSION = "2.3.1"; | ||
const EVENT_NAME = 'selectEnhance'; | ||
@@ -223,3 +223,4 @@ const DATA_NAME = 'SelectEnhance'; | ||
const _ = this; | ||
let keyInputTo; | ||
let keyInputTo = null; | ||
let changedTo = null; | ||
let keyedFound = []; | ||
@@ -232,13 +233,14 @@ _.$selectEnhance.on('keypress.' + EVENT_NAME, function (e) { | ||
_.keyedInput += keyCurr; | ||
if (keyInputTo) { | ||
clearTimeout(keyInputTo); | ||
keyInputTo = setTimeout(() => { | ||
_.keyedInput = ""; | ||
}, _.params.typeAheadDuration); | ||
if (_.keyedInput.trim()) { | ||
const rgx = RegExp(_.keyedInput.trim(), 'i'); | ||
keyedFound = [].slice.call(_.select.getElementsByTagName('option')).filter((i, el) => rgx.test(el.text)); | ||
if (keyedFound.length) { | ||
clearTimeout(keyInputTo); | ||
keyInputTo = setTimeout(() => { | ||
_.keyedInput = ""; | ||
}, _.params.typeAheadDuration); | ||
if (_.keyedInput.trim()) { | ||
const rgx = RegExp('^' + _.keyedInput.trim(), 'i'); | ||
keyedFound = [].slice.call(_.select.getElementsByTagName('option')).filter((el) => rgx.test(el.text)); | ||
if (keyedFound.length) { | ||
clearTimeout(changedTo); | ||
changedTo = setTimeout(() => { | ||
_.setSelectionState(_.optionSet.get(keyedFound[0]), false); | ||
} | ||
}, 100); | ||
} | ||
@@ -245,0 +247,0 @@ } |
@@ -5,3 +5,3 @@ import $ from 'cash-dom'; | ||
import updateHistoryState from './util/plugin/update-history-state'; | ||
import { elemData } from './util/store'; | ||
import elemData from "./util/elemData"; | ||
import { KEYS } from './util/constants'; | ||
@@ -8,0 +8,0 @@ const VERSION = "1.4.0"; |
import $ from 'cash-dom'; | ||
import getType from './helpers'; | ||
import { elemData } from './store'; | ||
import elemData from './elemData'; | ||
const checkIfParamsExist = (setParams, params, notify = true) => { | ||
@@ -5,0 +5,0 @@ for (let k in params) { |
import type { Selector } from 'cash-dom'; | ||
declare type StoreElem = ArrayLike<HTMLElement> | HTMLElement; | ||
declare global { | ||
interface Window { | ||
jQuery: any; | ||
} | ||
} | ||
export interface IStore { | ||
@@ -26,2 +21,8 @@ set(element: StoreElem, keyStore: string, data: any): void; | ||
} | ||
declare const mapData: { | ||
expose(what: boolean | 'ret'): void | WeakMap<object, any>; | ||
set(_element: StoreElem, keyStore: string, data: any): void; | ||
get(_element: StoreElem, keyStore: string): any; | ||
delete(_element: StoreElem, keyStore: string): void; | ||
}; | ||
declare const Store: { | ||
@@ -32,6 +33,6 @@ set(element: StoreElem, keyStore: string, data: any): void; | ||
}; | ||
export declare let storeFnInstalled: boolean; | ||
export declare const setStoreFnInstalled: () => boolean; | ||
declare function installStoreToLibrary(expose?: boolean): void; | ||
declare function installStoreAsDataToLibrary(expose?: boolean): void; | ||
declare function elemData(el: HTMLElement, dataName: string, data?: any, remove?: boolean): any; | ||
export default installStoreToLibrary; | ||
export { Store, installStoreAsDataToLibrary, elemData }; | ||
export { mapData, Store }; |
import $ from 'cash-dom'; | ||
import getType, { camelCase } from "./helpers"; | ||
import elemData from './elemData'; | ||
const mapData = (() => { | ||
@@ -84,3 +84,4 @@ const storeData = new WeakMap(); | ||
// one state var to check if its installed the Store method | ||
let storeFnInstalled = false; | ||
export let storeFnInstalled = false; | ||
export const setStoreFnInstalled = () => storeFnInstalled = true; | ||
function installStoreToLibrary(expose = false) { | ||
@@ -101,76 +102,3 @@ storeFnInstalled = true; | ||
} | ||
function installStoreAsDataToLibrary(expose = false) { | ||
if ('jQuery' in window) { | ||
return; | ||
} | ||
storeFnInstalled = true; | ||
if (expose) { | ||
$.extend(Store, { | ||
expose: (what) => mapData.expose(what) | ||
}); | ||
if ('expose' in Store) { | ||
$.extend({ exposeData: Store['expose'] }); | ||
} | ||
} | ||
$.fn.extend({ data(dataName, data) { | ||
let retVal = null; | ||
this.each(function () { | ||
retVal = asData(this, dataName, data) || retVal; | ||
}); | ||
return retVal; | ||
} }); | ||
$.fn.extend({ removeData(dataName) { | ||
//jquery params can be a string or an array | ||
this.each(function () { | ||
if (getType(dataName) === 'string') { | ||
Store.remove(this, dataName); | ||
} | ||
if (getType(dataName) === 'array') { | ||
dataName.forEach(d => { | ||
Store.remove(d, dataName); | ||
}); | ||
} | ||
}); | ||
} }); | ||
} | ||
function asData(el, dataName, data) { | ||
const storedData = elemData(el, dataName, data); | ||
if (storedData) { | ||
// get stored data first | ||
return storedData; | ||
} | ||
const dataSet = el.dataset ? el.dataset[camelCase(dataName)] : null; | ||
if (dataSet) { | ||
return dataSet; | ||
} | ||
} | ||
// retrieves data via the jQuery method or with the Store methods | ||
function elemData(el, dataName, data, remove) { | ||
const dataArgs = [el, dataName, data].filter(arg => !!arg); | ||
if (storeFnInstalled) { | ||
if (remove) { | ||
Store.remove(el, dataName); | ||
} | ||
else { | ||
if (dataArgs.length === 2) { | ||
return Store.get(...dataArgs); | ||
} | ||
else { | ||
Store.set(...dataArgs); | ||
} | ||
} | ||
} | ||
else { | ||
if ('jQuery' in window) { | ||
if (remove) { | ||
window.jQuery(el).removeData(dataName); | ||
} | ||
else { | ||
return window.jQuery(el).data(...dataArgs.slice(1)); | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
export default installStoreToLibrary; | ||
export { Store, installStoreAsDataToLibrary, elemData }; | ||
export { mapData, Store }; |
{ | ||
"name": "baseframe-js", | ||
"version": "4.6.1", | ||
"version": "4.6.2", | ||
"description": "A suite of useful Javascript plugins and functions to help with Front-end Development on websites", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
209669
72
3603
0