diff --git a/dist/animation.js b/dist/animation.js index d961d5de..2747eaf6 100644 --- a/dist/animation.js +++ b/dist/animation.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Animation */ -const MODULE_NAME="Animation";import{hasValue,isA,isPlainObject,isEmpty,isNaN,orDefault,assert,Deferred}from"./basic.js";import{warn}from"./logging.js";import{pschedule,countermand,waitForRepaint}from"./timers.js";import{applyStyles}from"./css.js";const RUNNING_TRANSITIONS=new WeakMap;export const EasingFunctions={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};export function transition(e,t=null,a=null,s=!1){const n="cssTransition";t=orDefault(t,{}),a=orDefault(a,{}),s=orDefault(s,!1,"bool"),assert(isA(e,"htmlelement"),`Animation:${n} | element is not usable`),assert(isPlainObject(t),`Animation:${n} | classChanges is not a plain object`),assert(isPlainObject(a),`Animation:${n} | styleChanges is not a plain object`);const i=new Deferred,o=RUNNING_TRANSITIONS.get(e);if(hasValue(o))if(countermand(o.timer),s){const t=new Error("interrupted");t.element=e,o.deferred.reject(t)}else o.deferred.resolve(e);RUNNING_TRANSITIONS.delete(e);const r=["transition-duration","-webkit-transition-duration","-moz-transition-duration","-o-transition-duration"],l=["transition","-webkit-transition","-moz-transition","-o-transition"],u=[...r,...l],c={property:null,value:null};if(!isEmpty(a)){let t;[r,l].forEach((e=>{t=!1,e.forEach((s=>{const n=a[s];!t&&hasValue(n)&&(t=!0,e.forEach((e=>{a[e]=n})))}))})),applyStyles(e,a)}return isEmpty(t?.remove)||[].concat(t.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),isEmpty(t?.add)||[].concat(t.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),waitForRepaint((()=>{const t=getComputedStyle(e);if(u.forEach((e=>{!hasValue(c.value)&&hasValue(t[e])&&(c.property=e,c.value=t[e])})),hasValue(c.value)){const t=c.value.match(/(^|\s)(\d+(\.\d+)?)s(\s|,|$)/g),a=c.value.match(/(^|\s)(\d+)ms(\s|,|$)/g);let s=0;(t??[]).forEach((e=>{e=parseFloat(e),isNaN(e)||(e=Math.floor(1e3*e))>s&&(s=e)})),(a??[]).forEach((e=>{e=parseInt(e,10),!isNaN(e)&&e>s&&(s=e)})),RUNNING_TRANSITIONS.set(e,{deferred:i,timer:pschedule(s,(()=>{waitForRepaint((()=>{i.resolve(e),RUNNING_TRANSITIONS.delete(e)}))}))})}else warn(`Animation:${n} | no usable transitions on element "${e}"`),i.resolve(e)})),i} +const MODULE_NAME="Animation";import{hasValue,isPlainObject,isEmpty,isNaN,isElement,orDefault,assert,Deferred}from"./basic.js";import{warn}from"./logging.js";import{pschedule,countermand,waitForRepaint}from"./timers.js";import{applyStyles}from"./css.js";const RUNNING_TRANSITIONS=new WeakMap;export const EasingFunctions={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};export function transition(e,t=null,a=null,s=!1){const n="cssTransition";t=orDefault(t,{}),a=orDefault(a,{}),s=orDefault(s,!1,"bool"),assert(isElement(e),`Animation:${n} | element is not usable`),assert(isPlainObject(t),`Animation:${n} | classChanges is not a plain object`),assert(isPlainObject(a),`Animation:${n} | styleChanges is not a plain object`);const i=new Deferred,o=RUNNING_TRANSITIONS.get(e);if(hasValue(o))if(countermand(o.timer),s){const t=new Error("interrupted");t.element=e,o.deferred.reject(t)}else o.deferred.resolve(e);RUNNING_TRANSITIONS.delete(e);const r=["transition-duration","-webkit-transition-duration","-moz-transition-duration","-o-transition-duration"],l=["transition","-webkit-transition","-moz-transition","-o-transition"],u=[...r,...l],c={property:null,value:null};if(!isEmpty(a)){let t;[r,l].forEach((e=>{t=!1,e.forEach((s=>{const n=a[s];!t&&hasValue(n)&&(t=!0,e.forEach((e=>{a[e]=n})))}))})),applyStyles(e,a)}return isEmpty(t?.remove)||[].concat(t.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),isEmpty(t?.add)||[].concat(t.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),waitForRepaint((()=>{const t=getComputedStyle(e);if(u.forEach((e=>{!hasValue(c.value)&&hasValue(t[e])&&(c.property=e,c.value=t[e])})),hasValue(c.value)){const t=c.value.match(/(^|\s)(\d+(\.\d+)?)s(\s|,|$)/g),a=c.value.match(/(^|\s)(\d+)ms(\s|,|$)/g);let s=0;(t??[]).forEach((e=>{e=parseFloat(e),isNaN(e)||(e=Math.floor(1e3*e))>s&&(s=e)})),(a??[]).forEach((e=>{e=parseInt(e,10),!isNaN(e)&&e>s&&(s=e)})),RUNNING_TRANSITIONS.set(e,{deferred:i,timer:pschedule(s,(()=>{waitForRepaint((()=>{i.resolve(e),RUNNING_TRANSITIONS.delete(e)}))}))})}else warn(`Animation:${n} | no usable transitions on element "${e}"`),i.resolve(e)})),i} //# sourceMappingURL=animation.js.map diff --git a/dist/animation.js.map b/dist/animation.js.map index 7918ae77..ff21cb7f 100644 --- a/dist/animation.js.map +++ b/dist/animation.js.map @@ -1 +1 @@ -{"version":3,"file":"animation.js","names":["MODULE_NAME","hasValue","isA","isPlainObject","isEmpty","isNaN","orDefault","assert","Deferred","warn","pschedule","countermand","waitForRepaint","applyStyles","RUNNING_TRANSITIONS","WeakMap","EasingFunctions","linear","t","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","transition","element","classChanges","styleChanges","rejectOnInterruption","__methodName__","deferred","runningTransition","get","timer","error","Error","reject","resolve","delete","transitionDurationProperties","transitionProperties","timingProperties","transitionDefinition","property","value","vendorPropertiesAdded","forEach","properties","transitionValue","remove","concat","removeClass","split","classList","trim","add","addClass","elementStyles","getComputedStyle","timingProperty","sTimings","match","msTimings","longestTiming","timing","parseFloat","Math","floor","parseInt","set"],"sources":["animation.js"],"mappings":";;;AAQA,MAAMA,YAAc,mBAMZC,SAAUC,IAAKC,cAAeC,QAASC,MAAOC,UAAWC,OAAQC,aAAe,oBAChFC,SAAW,sBACXC,UAAWC,YAAaC,mBAAqB,qBAC7CC,gBAAkB,WAM1B,MAAMC,oBAAsB,IAAIC,eAoCzB,MAAMC,gBAAkB,CAE9BC,OAASC,GAAKA,EAEdC,WAAaD,GAAKA,EAAEA,EAEpBE,YAAcF,GAAKA,GAAG,EAAEA,GAExBG,cAAgBH,GAAKA,EAAE,GAAK,EAAEA,EAAEA,GAAQ,EAAE,EAAEA,GAAGA,EAAV,EAErCI,YAAcJ,GAAKA,EAAEA,EAAEA,EAEvBK,aAAeL,KAAQA,EAAGA,EAAEA,EAAE,EAE9BM,eAAiBN,GAAKA,EAAE,GAAK,EAAEA,EAAEA,EAAEA,GAAKA,EAAE,IAAI,EAAEA,E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e,KAChC1D,gBAAe,KACdyB,EAASO,QAAQZ,GACjBlB,oBAAoB+B,OAAOb,EAAQ,GAClC,KAGL,MAtCCvB,KAAK,aAAkB2B,yCAAsDJ,MAC7EK,EAASO,QAAQZ,EAqClB,IAGMK,CACR","sourcesContent":["/*!\n * Module Animation\n */\n\n/**\n * @namespace Animation\n */\n\nconst MODULE_NAME = 'Animation';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {hasValue, isA, isPlainObject, isEmpty, isNaN, orDefault, assert, Deferred} from './basic.js';\nimport {warn} from './logging.js';\nimport {pschedule, countermand, waitForRepaint} from './timers.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst RUNNING_TRANSITIONS = new WeakMap();\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Animation:EasingFunctions\n */\n\n/**\n * A collection of all basic easing functions to be used in animations.\n * All functions here take a float parameter between 0 and 1 and return a mapped value between 0 and 1.\n *\n * Taken from: https://gist.github.com/gre/1650294\n *\n * Available functions:\n * - linear\n * - easeInQuad\n * - easeOutQuad\n * - easeInOutQuad\n * - easeInCubic\n * - easeOutCubic\n * - easeInOutCubic\n * - easeInQuart\n * - easeOutQuart\n * - easeInOutQuart\n * - easeInQuint\n * - easeOutQuint\n * - easeInOutQuint\n *\n * @memberof Animation:EasingFunctions\n * @alias EasingFunctions\n * @example\n * scrollTo(window, 1000, 0, EasingFunctions.easeInOutQuint);\n */\nexport const EasingFunctions = {\n\t// no easing, no acceleration\n\tlinear : t => t,\n\t// accelerating from zero velocity\n\teaseInQuad : t => t*t,\n\t// decelerating to zero velocity\n\teaseOutQuad : t => t*(2-t),\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuad : t => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\t// accelerating from zero velocity\n\teaseInCubic : t => t*t*t,\n\t// decelerating to zero velocity\n\teaseOutCubic : t => (--t)*t*t+1,\n\t// acceleration until halfway, then deceleration\n\teaseInOutCubic : t => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\t// accelerating from zero velocity\n\teaseInQuart : t => t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuart : t => 1-(--t)*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuart : t => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\t// accelerating from zero velocity\n\teaseInQuint : t => t*t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuint : t => 1+(--t)*t*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuint : t => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t\n};\n\n\n\n/**\n * @namespace Animation:transition\n */\n\n/**\n * This method offers the possibility to apply CSS transitions via classes and/or styles and wait for the transition\n * to finish, which results in the resolution of a Deferred.\n *\n * In general, this method remedies the pain of having to manage transitions manually in JS, entering precise ms for\n * timers waiting on conclusion of transitions.\n *\n * The general principle of this is the parsing of transition CSS attributes, which may contain transition\n * timings (transition and transition-duration) and looks for the longest currently running transition.\n * Values are excepted as milliseconds or seconds (int or float notation).\n *\n * Why would you do this, if there is something like the `animationend` event, you ask? Well, the problem is, that,\n * if the animation is interrupted or never finishes for any other reason, the event never fires. For that, there is\n * the `animationcancel` event, but that is not really robustly supported at the moment. So, in cases of complex\n * style changes, where we definitively want to have a callback when the animation has been (or would have been)\n * finished, this is still the safer option. But, for simple and small cases I'd strongly recommend using the native\n * `AnimationEvent` API.\n *\n * Calling this method successively on the same element replaces the currently running transition, normally\n * resulting in premature resolution of the Deferred and application of the newly provided changes.\n *\n * Be advised, that legacy browsers like IE11 and Edge <= 18 have problems connecting interrupted transitions,\n * especially when transition-durations change during animation, resulting in skipped or choppy animations. If you\n * experience this, try to keep timings stable during animation and chain animations without overlap.\n *\n * @param {Element} element - the element to transition, by applying class and/or style changes\n * @param {?Object} [classChanges=null] - plain object containing class changes to apply, add classes via the \"add\" key, remove them via the \"remove\" key (add has precedence over remove); values may be standard CSS class string notation or an array of standard CSS class notations\n * @param {?Object} [styleChanges=null] - plain object containing style changes to apply (via applyStyles)\n * @param {?Boolean} [rejectOnInterruption=false] - if a new transition is applied using this function while a previous transition is still running the Deferred would normally be resolved before continuing, set this to true to let the Deferred reject in that case (the rejection message is \"interrupted\", access the element using \"element)\n * @return {Deferred} resolves on transition completion or repeated call on the same element, with the resolution value being the element, rejects on repeated call on same element if rejectOnInterruption is true (the rejection message is \"interrupted\", access the element using \"element\")\n *\n * @memberof Animation:transition\n * @alias transition\n * @see applyStyles\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event\n * @example\n * transition(element, {add : 'foobar'}).then(element => { return transition(element, {remove : 'foobar'}); }).then(() => { console.log('finished'); });\n * transition(element, null, {top : 0, left : 0, background : 'pink', transition : 'all 1500ms'}).then(() => { console.log('finished'); });\n * transition(element, {add : 'foobar'}).then(() => { console.log('finished'); }).catch(error => { console.log('cancelled'); });\n */\nexport function transition(element, classChanges=null, styleChanges=null, rejectOnInterruption=false){\n\tconst __methodName__ = 'cssTransition';\n\n\tclassChanges = orDefault(classChanges, {});\n\tstyleChanges = orDefault(styleChanges, {});\n\trejectOnInterruption = orDefault(rejectOnInterruption, false, 'bool');\n\n\tassert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not usable`);\n\tassert(isPlainObject(classChanges), `${MODULE_NAME}:${__methodName__} | classChanges is not a plain object`);\n\tassert(isPlainObject(styleChanges), `${MODULE_NAME}:${__methodName__} | styleChanges is not a plain object`);\n\n\tconst\n\t\tdeferred = new Deferred(),\n\t\trunningTransition = RUNNING_TRANSITIONS.get(element)\n\t;\n\n\tif( hasValue(runningTransition) ){\n\t\tcountermand(runningTransition.timer);\n\t\tif( !rejectOnInterruption ){\n\t\t\trunningTransition.deferred.resolve(element);\n\t\t} else {\n\t\t\tconst error = new Error('interrupted');\n\t\t\terror.element = element;\n\t\t\trunningTransition.deferred.reject(error);\n\t\t}\n\t}\n\tRUNNING_TRANSITIONS.delete(element);\n\n\tconst\n\t\ttransitionDurationProperties = [\n\t\t\t'transition-duration',\n\t\t\t'-webkit-transition-duration',\n\t\t\t'-moz-transition-duration',\n\t\t\t'-o-transition-duration'\n\t\t],\n\t\ttransitionProperties = [\n\t\t\t'transition',\n\t\t\t'-webkit-transition',\n\t\t\t'-moz-transition',\n\t\t\t'-o-transition'\n\t\t],\n\t\ttimingProperties = [\n\t\t\t...transitionDurationProperties,\n\t\t\t...transitionProperties\n\t\t],\n\t\ttransitionDefinition = {\n\t\t\tproperty : null,\n\t\t\tvalue : null\n\t\t}\n\t;\n\n\tif( !isEmpty(styleChanges) ){\n\t\tlet vendorPropertiesAdded;\n\t\t[transitionDurationProperties, transitionProperties].forEach(properties => {\n\t\t\tvendorPropertiesAdded = false;\n\t\t\tproperties.forEach(property => {\n\t\t\t\tconst transitionValue = styleChanges[property];\n\t\t\t\tif( !vendorPropertiesAdded && hasValue(transitionValue) ){\n\t\t\t\t\tvendorPropertiesAdded = true;\n\t\t\t\t\tproperties.forEach(property => {\n\t\t\t\t\t\tstyleChanges[property] = transitionValue;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tapplyStyles(element, styleChanges);\n\t}\n\n\tif( !isEmpty(classChanges?.remove) ){\n\t\t[].concat(classChanges.remove).forEach(removeClass => {\n\t\t\t`${removeClass}`.split(' ').forEach(removeClass => {\n\t\t\t\telement.classList.remove(removeClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\tif( !isEmpty(classChanges?.add) ){\n\t\t[].concat(classChanges.add).forEach(addClass => {\n\t\t\t`${addClass}`.split(' ').forEach(addClass => {\n\t\t\t\telement.classList.add(addClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\twaitForRepaint(() => {\n\t\tconst elementStyles = getComputedStyle(element);\n\t\ttimingProperties.forEach(timingProperty => {\n\t\t\tif( !hasValue(transitionDefinition.value) && hasValue(elementStyles[timingProperty]) ){\n\t\t\t\ttransitionDefinition.property = timingProperty;\n\t\t\t\ttransitionDefinition.value = elementStyles[timingProperty];\n\t\t\t}\n\t\t});\n\n\t\tif( !hasValue(transitionDefinition.value) ){\n\t\t\twarn(`${MODULE_NAME}:${__methodName__} | no usable transitions on element \"${element}\"`);\n\t\t\tdeferred.resolve(element);\n\t\t} else {\n\t\t\tconst\n\t\t\t\tsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+(\\.\\d+)?)s(\\s|,|$)/g),\n\t\t\t\tmsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+)ms(\\s|,|$)/g)\n\t\t\t;\n\t\t\tlet\tlongestTiming = 0;\n\n\t\t\t(sTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseFloat(timing);\n\n\t\t\t\tif( !isNaN(timing) ){\n\t\t\t\t\ttiming = Math.floor(timing * 1000);\n\n\t\t\t\t\tif( timing > longestTiming ){\n\t\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t(msTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseInt(timing, 10);\n\n\t\t\t\tif( !isNaN(timing) && (timing > longestTiming) ){\n\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tRUNNING_TRANSITIONS.set(element, {\n\t\t\t\tdeferred,\n\t\t\t\ttimer : pschedule(longestTiming, () => {\n\t\t\t\t\twaitForRepaint(() => {\n\t\t\t\t\t\tdeferred.resolve(element);\n\t\t\t\t\t\tRUNNING_TRANSITIONS.delete(element);\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t});\n\n\treturn deferred;\n}\n"]} \ No newline at end of file +{"version":3,"file":"animation.js","names":["MODULE_NAME","hasValue","isPlainObject","isEmpty","isNaN","isElement","orDefault","assert","Deferred","warn","pschedule","countermand","waitForRepaint","applyStyles","RUNNING_TRANSITIONS","WeakMap","EasingFunctions","linear","t","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","transition","element","classChanges","styleChanges","rejectOnInterruption","__methodName__","deferred","runningTransition","get","timer","error","Error","reject","resolve","delete","transitionDurationProperties","transitionProperties","timingProperties","transitionDefinition","property","value","vendorPropertiesAdded","forEach","properties","transitionValue","remove","concat","removeClass","split","classList","trim","add","addClass","elementStyles","getComputedStyle","timingProperty","sTimings","match","msTimings","longestTiming","timing","parseFloat","Math","floor","parseInt","set"],"sources":["animation.js"],"mappings":";;;AAQA,MAAMA,YAAc,mBAMZC,SAAUC,cAAeC,QAASC,MAAOC,UAAWC,UAAWC,OAAQC,aAAe,oBACtFC,SAAW,sBACXC,UAAWC,YAAaC,mBAAqB,qBAC7CC,gBAAkB,WAM1B,MAAMC,oBAAsB,IAAIC,eAoCzB,MAAMC,gBAAkB,CAE9BC,OAASC,GAAKA,EAEdC,WAAaD,GAAKA,EAAEA,EAEpBE,YAAcF,GAAKA,GAAG,EAAEA,GAExBG,cAAgBH,GAAKA,EAAE,GAAK,EAAEA,EAAEA,GAAQ,EAAE,EAAEA,GAAGA,EAAV,EAErCI,YAAcJ,GAAKA,EAAEA,EAAEA,EAEvBK,aAAeL,KAAQA,EAAGA,EAAEA,EAAE,EAE9BM,eAAiBN,GAAKA,EAAE,GAAK,EAAEA,EAAEA,EAAEA,GAAKA,EAAE,IAAI,EAAEA,EAAE,IAAI,EAAEA,EAAE,GAAG,EAE7DO,YAAcP,GAAKA,EAAEA,EAAEA,EAAEA,EAEzBQ,aAAeR,GAAK,KAAKA,EAAGA,EAAEA,EAAEA,EAEhCS,eAAiBT,GAAKA,EAAE,GAAK,EAAEA,EAAEA,EAAEA,EAAEA,EAAI,EAAE,IAAKA,EAAGA,EAAEA,EAAEA,EAEvDU,YAAcV,GAAKA,EAAEA,EAAE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B,QAAQ8B,GAAcuB,SAC1B,GAAGC,OAAOxB,EAAauB,QAAQH,SAAQK,IACtC,GAAGA,IAAcC,MAAM,KAAKN,SAAQK,IACnC1B,EAAQ4B,UAAUJ,OAAOE,EAAYG,OAAO,GAC3C,IAIC1D,QAAQ8B,GAAc6B,MAC1B,GAAGL,OAAOxB,EAAa6B,KAAKT,SAAQU,IACnC,GAAGA,IAAWJ,MAAM,KAAKN,SAAQU,IAChC/B,EAAQ4B,UAAUE,IAAIC,EAASF,OAAO,GACrC,IAIJjD,gBAAe,KACd,MAAMoD,EAAgBC,iBAAiBjC,GAQvC,GAPAgB,EAAiBK,SAAQa,KACnBjE,SAASgD,EAAqBE,QAAUlD,SAAS+D,EAAcE,MACnEjB,EAAqBC,SAAWgB,EAChCjB,EAAqBE,MAAQa,EAAcE,GAC5C,IAGIjE,SAASgD,EAAqBE,OAG5B,CACN,MACCgB,EAAWlB,EAAqBE,MAAMiB,MAAM,iCAC5CC,EAAYpB,EAAqBE,MAAMiB,MAAM,0BAE9C,IAAIE,EAAgB,GAEnBH,GAAY,IAAId,SAAQkB,IACxBA,EAASC,WAAWD,GAEfnE,MAAMmE,KACVA,EAASE,KAAKC,MAAe,IAATH,IAEPD,IACZA,EAAgBC,EAElB,KAGAF,GAAa,IAAIhB,SAAQkB,IACzBA,EAASI,SAASJ,EAAQ,KAErBnE,MAAMmE,IAAYA,EAASD,IAC/BA,EAAgBC,EACjB,IAGDzD,oBAAoB8D,IAAI5C,EAAS,CAChCK,WACAG,MAAQ9B,UAAU4D,GAAe,KAChC1D,gBAAe,KACdyB,EAASO,QAAQZ,GACjBlB,oBAAoB+B,OAAOb,EAAQ,GAClC,KAGL,MAtCCvB,KAAK,aAAkB2B,yCAAsDJ,MAC7EK,EAASO,QAAQZ,EAqClB,IAGMK,CACR","sourcesContent":["/*!\n * Module Animation\n */\n\n/**\n * @namespace Animation\n */\n\nconst MODULE_NAME = 'Animation';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {hasValue, isPlainObject, isEmpty, isNaN, isElement, orDefault, assert, Deferred} from './basic.js';\nimport {warn} from './logging.js';\nimport {pschedule, countermand, waitForRepaint} from './timers.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst RUNNING_TRANSITIONS = new WeakMap();\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Animation:EasingFunctions\n */\n\n/**\n * A collection of all basic easing functions to be used in animations.\n * All functions here take a float parameter between 0 and 1 and return a mapped value between 0 and 1.\n *\n * Taken from: https://gist.github.com/gre/1650294\n *\n * Available functions:\n * - linear\n * - easeInQuad\n * - easeOutQuad\n * - easeInOutQuad\n * - easeInCubic\n * - easeOutCubic\n * - easeInOutCubic\n * - easeInQuart\n * - easeOutQuart\n * - easeInOutQuart\n * - easeInQuint\n * - easeOutQuint\n * - easeInOutQuint\n *\n * @memberof Animation:EasingFunctions\n * @alias EasingFunctions\n * @example\n * scrollTo(window, 1000, 0, EasingFunctions.easeInOutQuint);\n */\nexport const EasingFunctions = {\n\t// no easing, no acceleration\n\tlinear : t => t,\n\t// accelerating from zero velocity\n\teaseInQuad : t => t*t,\n\t// decelerating to zero velocity\n\teaseOutQuad : t => t*(2-t),\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuad : t => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\t// accelerating from zero velocity\n\teaseInCubic : t => t*t*t,\n\t// decelerating to zero velocity\n\teaseOutCubic : t => (--t)*t*t+1,\n\t// acceleration until halfway, then deceleration\n\teaseInOutCubic : t => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\t// accelerating from zero velocity\n\teaseInQuart : t => t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuart : t => 1-(--t)*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuart : t => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\t// accelerating from zero velocity\n\teaseInQuint : t => t*t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuint : t => 1+(--t)*t*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuint : t => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t\n};\n\n\n\n/**\n * @namespace Animation:transition\n */\n\n/**\n * This method offers the possibility to apply CSS transitions via classes and/or styles and wait for the transition\n * to finish, which results in the resolution of a Deferred.\n *\n * In general, this method remedies the pain of having to manage transitions manually in JS, entering precise ms for\n * timers waiting on conclusion of transitions.\n *\n * The general principle of this is the parsing of transition CSS attributes, which may contain transition\n * timings (transition and transition-duration) and looks for the longest currently running transition.\n * Values are excepted as milliseconds or seconds (int or float notation).\n *\n * Why would you do this, if there is something like the `animationend` event, you ask? Well, the problem is, that,\n * if the animation is interrupted or never finishes for any other reason, the event never fires. For that, there is\n * the `animationcancel` event, but that is not really robustly supported at the moment. So, in cases of complex\n * style changes, where we definitively want to have a callback when the animation has been (or would have been)\n * finished, this is still the safer option. But, for simple and small cases I'd strongly recommend using the native\n * `AnimationEvent` API.\n *\n * Calling this method successively on the same element replaces the currently running transition, normally\n * resulting in premature resolution of the Deferred and application of the newly provided changes.\n *\n * Be advised, that legacy browsers like IE11 and Edge <= 18 have problems connecting interrupted transitions,\n * especially when transition-durations change during animation, resulting in skipped or choppy animations. If you\n * experience this, try to keep timings stable during animation and chain animations without overlap.\n *\n * @param {Element} element - the element to transition, by applying class and/or style changes\n * @param {?Object} [classChanges=null] - plain object containing class changes to apply, add classes via the \"add\" key, remove them via the \"remove\" key (add has precedence over remove); values may be standard CSS class string notation or an array of standard CSS class notations\n * @param {?Object} [styleChanges=null] - plain object containing style changes to apply (via applyStyles)\n * @param {?Boolean} [rejectOnInterruption=false] - if a new transition is applied using this function while a previous transition is still running the Deferred would normally be resolved before continuing, set this to true to let the Deferred reject in that case (the rejection message is \"interrupted\", access the element using \"element)\n * @return {Deferred} resolves on transition completion or repeated call on the same element, with the resolution value being the element, rejects on repeated call on same element if rejectOnInterruption is true (the rejection message is \"interrupted\", access the element using \"element\")\n *\n * @memberof Animation:transition\n * @alias transition\n * @see applyStyles\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event\n * @example\n * transition(element, {add : 'foobar'}).then(element => { return transition(element, {remove : 'foobar'}); }).then(() => { console.log('finished'); });\n * transition(element, null, {top : 0, left : 0, background : 'pink', transition : 'all 1500ms'}).then(() => { console.log('finished'); });\n * transition(element, {add : 'foobar'}).then(() => { console.log('finished'); }).catch(error => { console.log('cancelled'); });\n */\nexport function transition(element, classChanges=null, styleChanges=null, rejectOnInterruption=false){\n\tconst __methodName__ = 'cssTransition';\n\n\tclassChanges = orDefault(classChanges, {});\n\tstyleChanges = orDefault(styleChanges, {});\n\trejectOnInterruption = orDefault(rejectOnInterruption, false, 'bool');\n\n\tassert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not usable`);\n\tassert(isPlainObject(classChanges), `${MODULE_NAME}:${__methodName__} | classChanges is not a plain object`);\n\tassert(isPlainObject(styleChanges), `${MODULE_NAME}:${__methodName__} | styleChanges is not a plain object`);\n\n\tconst\n\t\tdeferred = new Deferred(),\n\t\trunningTransition = RUNNING_TRANSITIONS.get(element)\n\t;\n\n\tif( hasValue(runningTransition) ){\n\t\tcountermand(runningTransition.timer);\n\t\tif( !rejectOnInterruption ){\n\t\t\trunningTransition.deferred.resolve(element);\n\t\t} else {\n\t\t\tconst error = new Error('interrupted');\n\t\t\terror.element = element;\n\t\t\trunningTransition.deferred.reject(error);\n\t\t}\n\t}\n\tRUNNING_TRANSITIONS.delete(element);\n\n\tconst\n\t\ttransitionDurationProperties = [\n\t\t\t'transition-duration',\n\t\t\t'-webkit-transition-duration',\n\t\t\t'-moz-transition-duration',\n\t\t\t'-o-transition-duration'\n\t\t],\n\t\ttransitionProperties = [\n\t\t\t'transition',\n\t\t\t'-webkit-transition',\n\t\t\t'-moz-transition',\n\t\t\t'-o-transition'\n\t\t],\n\t\ttimingProperties = [\n\t\t\t...transitionDurationProperties,\n\t\t\t...transitionProperties\n\t\t],\n\t\ttransitionDefinition = {\n\t\t\tproperty : null,\n\t\t\tvalue : null\n\t\t}\n\t;\n\n\tif( !isEmpty(styleChanges) ){\n\t\tlet vendorPropertiesAdded;\n\t\t[transitionDurationProperties, transitionProperties].forEach(properties => {\n\t\t\tvendorPropertiesAdded = false;\n\t\t\tproperties.forEach(property => {\n\t\t\t\tconst transitionValue = styleChanges[property];\n\t\t\t\tif( !vendorPropertiesAdded && hasValue(transitionValue) ){\n\t\t\t\t\tvendorPropertiesAdded = true;\n\t\t\t\t\tproperties.forEach(property => {\n\t\t\t\t\t\tstyleChanges[property] = transitionValue;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tapplyStyles(element, styleChanges);\n\t}\n\n\tif( !isEmpty(classChanges?.remove) ){\n\t\t[].concat(classChanges.remove).forEach(removeClass => {\n\t\t\t`${removeClass}`.split(' ').forEach(removeClass => {\n\t\t\t\telement.classList.remove(removeClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\tif( !isEmpty(classChanges?.add) ){\n\t\t[].concat(classChanges.add).forEach(addClass => {\n\t\t\t`${addClass}`.split(' ').forEach(addClass => {\n\t\t\t\telement.classList.add(addClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\twaitForRepaint(() => {\n\t\tconst elementStyles = getComputedStyle(element);\n\t\ttimingProperties.forEach(timingProperty => {\n\t\t\tif( !hasValue(transitionDefinition.value) && hasValue(elementStyles[timingProperty]) ){\n\t\t\t\ttransitionDefinition.property = timingProperty;\n\t\t\t\ttransitionDefinition.value = elementStyles[timingProperty];\n\t\t\t}\n\t\t});\n\n\t\tif( !hasValue(transitionDefinition.value) ){\n\t\t\twarn(`${MODULE_NAME}:${__methodName__} | no usable transitions on element \"${element}\"`);\n\t\t\tdeferred.resolve(element);\n\t\t} else {\n\t\t\tconst\n\t\t\t\tsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+(\\.\\d+)?)s(\\s|,|$)/g),\n\t\t\t\tmsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+)ms(\\s|,|$)/g)\n\t\t\t;\n\t\t\tlet\tlongestTiming = 0;\n\n\t\t\t(sTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseFloat(timing);\n\n\t\t\t\tif( !isNaN(timing) ){\n\t\t\t\t\ttiming = Math.floor(timing * 1000);\n\n\t\t\t\t\tif( timing > longestTiming ){\n\t\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t(msTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseInt(timing, 10);\n\n\t\t\t\tif( !isNaN(timing) && (timing > longestTiming) ){\n\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tRUNNING_TRANSITIONS.set(element, {\n\t\t\t\tdeferred,\n\t\t\t\ttimer : pschedule(longestTiming, () => {\n\t\t\t\t\twaitForRepaint(() => {\n\t\t\t\t\t\tdeferred.resolve(element);\n\t\t\t\t\t\tRUNNING_TRANSITIONS.delete(element);\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t});\n\n\treturn deferred;\n}\n"]} \ No newline at end of file diff --git a/dist/arrays.js b/dist/arrays.js index 48b6ebea..948a2b47 100644 --- a/dist/arrays.js +++ b/dist/arrays.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Arrays diff --git a/dist/basic.js b/dist/basic.js index 71199d91..a91a16ca 100644 --- a/dist/basic.js +++ b/dist/basic.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Basic */ -const MODULE_NAME="Basic";import{log,warn}from"./logging.js";export function assert(t,e){if(!t)throw e=orDefault(e,"assert exception: assertion failed","str"),new Error(e)}export function attempt(t){assert(isA(t,"function"),"Basic:attempt | closure is no function");try{t()}catch(t){return!1}return!0}export function hasValue(){let t=!0;return Array.from(arguments).forEach((e=>{t&&=null!=e})),t}export function size(t,e=!0){if(isA(t?.values,"function"))return Array.from(t.values()).length;let r;switch(getType(t)){case"array":r=t.length;break;case"set":case"map":r=t.size;break;case"iterator":r=Array.from(t).length;break;case"string":r=e?[...t].length:t.length;break;case"object":r=Object.values(t).length;break;default:r=null}return r}export function isEmpty(){let t=!0,e=[void 0,null,"",0];return Array.from(arguments).forEach((t=>{isA(t?.__additionalEmptyValues__,"array")&&(e=e.concat(t.__additionalEmptyValues__))})),e=Array.from(new Set(e)),Array.from(arguments).forEach((r=>{t&&!isA(r?.__additionalEmptyValues__,"array")&&(t=e.includes(r),t||(t=0===size(r)))})),t}export function hasMembers(t,e,r=!1){e=orDefault(e,[],"arr"),r=orDefault(r,!1,"bool");let n=!0;return e.forEach((e=>{hasValue(t[`${e}`])||(r&&log().info(`Basic:hasMembers | missing member ${e}`),n=!1)})),n}export function orDefault(t,e,r=null,n=null){return n=hasValue(n)?[].concat(n):[],hasValue(r)?!isA(r,"function")&&["str","string","int","integer","bool","boolean","float","arr","array"].includes(`${r.toLowerCase()}`)?(r=`${r}`.toLowerCase(),["str","string"].includes(r)?r=function(t){return`${t}`}:["int","integer"].includes(r)?r=function(t){return parseInt(t,10)}:["bool","boolean"].includes(r)?r=function(t){return!!t}:"float"===r?r=function(t){return parseFloat(t)}:["arr","array"].includes(r)&&(r=function(t){return[].concat(t)})):isA(r,"function")||(r=function(t){return t}):r=function(t){return t},!hasValue(t)||n.includes(t)?e:r(t)}export function getType(t){if(!hasValue(t))return`${t}`.toLowerCase();const e=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();return"generatorfunction"===e?"function":"document"===e?"htmldocument":"element"===e||/^html.*element$/.test(e)?"htmlelement":/^.*iterator$/.test(e)?"iterator":e.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)?e:"object"==typeof t||"function"==typeof t?"object":typeof t}export function isA(t,e){return["undefined","null","boolean","number","bigint","string","symbol","function","object","array","date","error","generator","iterator","regexp","set","weakset","map","weakmap","htmldocument","htmlelement","nodelist","window"].includes(`${e}`.toLowerCase())?getType(t)===`${e}`.toLowerCase():(warn(`Basic:isA | "${e}" is not a recognized type`),!1)}export function isInt(t){return parseInt(t,10)===t}export function isFloat(t){return parseFloat(t)===t}export function isPlainObject(t){return isA(t,"object")&&hasValue(t)&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)}export function isNaN(t,e=!0){return(e=orDefault(e,!0,"bool"))?t!=t:isNaN(t)}export function isEventTarget(t){return hasValue(t)&&isA(t.addEventListener,"function")&&isA(t.removeEventListener,"function")&&isA(t.dispatchEvent,"function")}export function isSelector(t){t=orDefault(t,0,"str");const e=document.createDocumentFragment();try{e.querySelector(t)}catch(t){return!1}return!0}export function isPotentialId(t,e="",r="[1-9][0-9]*",n="",s=!0){t=`${t}`,e=orDefault(e,"","str"),r=orDefault(r,"[1-9][0-9]*","str"),n=orDefault(n,"","str");const o=t=>`${t}`.replace(/([\-\[\]\/{}()*+?.\\^$|])/g,"\\$&");let i;i=(s=orDefault(s,!0,"bool"))?new RegExp(`^${o(e)}(${r})${o(n)}$`):new RegExp(`^${e}(${r})${n}$`);const a=i.exec(t);return!!hasValue(a)&&a[1]}export function minMax(t,e,r){return assert(t<=r,"Basic:minMax | min can not be larger than max"),er?r:e}export class Deferred{constructor(){const t="fulfilled",e="rejected";this.resolve=null,this.reject=null,this.provision=null,this.status="pending",this.isSettled=()=>[t,e].includes(this.status),this.promise=new Promise(((r,n)=>{this.resolve=e=>{this.status=t,r(e)},this.reject=t=>{this.status=e,n(t)}}))}then(t){return this.promise.then(t)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}}export class Observable{constructor(t){this.__className__="Observable",this._value=t,this._subscriptions=[]}getValue(){return this._value}setValue(t,e=!1){const r=this._value,n=r!==t;this._value=t,(n||e)&&this._subscriptions.forEach((e=>e(t,r)))}subscribe(t){return assert(isA(t,"function"),`Basic:${this.__className__}.subscribe | subscription must be function`),this._subscriptions.indexOf(t)<0&&(this._subscriptions=[...this._subscriptions,t]),t}unsubscribe(t){this._subscriptions=this._subscriptions.filter((e=>e!==t))}toString(){return`${this._value}`}} +const MODULE_NAME="Basic";import{log,warn}from"./logging.js";export function assert(t,e){if(!t)throw e=orDefault(e,"assert exception: assertion failed","str"),new Error(e)}export function attempt(t){assert(isA(t,"function"),"Basic:attempt | closure is no function");try{t()}catch(t){return!1}return!0}export function hasValue(){let t=!0;return Array.from(arguments).forEach((e=>{t&&=null!=e})),t}export function size(t,e=!0){if(isA(t?.values,"function"))return Array.from(t.values()).length;let r;switch(getType(t)){case"array":r=t.length;break;case"set":case"map":r=t.size;break;case"iterator":r=Array.from(t).length;break;case"string":r=e?[...t].length:t.length;break;case"object":r=Object.values(t).length;break;default:r=null}return r}export function isEmpty(){let t=!0,e=[void 0,null,"",0];return Array.from(arguments).forEach((t=>{isA(t?.__additionalEmptyValues__,"array")&&(e=e.concat(t.__additionalEmptyValues__))})),e=Array.from(new Set(e)),Array.from(arguments).forEach((r=>{t&&!isA(r?.__additionalEmptyValues__,"array")&&(t=e.includes(r),t||(t=0===size(r)))})),t}export function hasMembers(t,e,r=!1){e=orDefault(e,[],"arr"),r=orDefault(r,!1,"bool");let n=!0;return e.forEach((e=>{hasValue(t[`${e}`])||(r&&log().info(`Basic:hasMembers | missing member ${e}`),n=!1)})),n}export function orDefault(t,e,r=null,n=null){return n=hasValue(n)?[].concat(n):[],hasValue(r)?!isA(r,"function")&&["str","string","int","integer","bool","boolean","float","arr","array"].includes(`${r.toLowerCase()}`)?(r=`${r}`.toLowerCase(),["str","string"].includes(r)?r=function(t){return`${t}`}:["int","integer"].includes(r)?r=function(t){return parseInt(t,10)}:["bool","boolean"].includes(r)?r=function(t){return!!t}:"float"===r?r=function(t){return parseFloat(t)}:["arr","array"].includes(r)&&(r=function(t){return[].concat(t)})):isA(r,"function")||(r=function(t){return t}):r=function(t){return t},!hasValue(t)||n.includes(t)?e:r(t)}export function getType(t){if(!hasValue(t))return`${t}`.toLowerCase();const e=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();return"generatorfunction"===e?"function":"document"===e?"htmldocument":"element"===e||/^html.*element$/.test(e)?"htmlelement":/^.*iterator$/.test(e)?"iterator":e.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)?e:"object"==typeof t||"function"==typeof t?"object":typeof t}export function isA(t,e){return["undefined","null","boolean","number","bigint","string","symbol","function","object","array","date","error","generator","iterator","regexp","set","weakset","map","weakmap","htmldocument","htmlelement","nodelist","window"].includes(`${e}`.toLowerCase())?getType(t)===`${e}`.toLowerCase():(warn(`Basic:isA | "${e}" is not a recognized type`),!1)}export function isInt(t){return parseInt(t,10)===t}export function isFloat(t){return parseFloat(t)===t}export function isPlainObject(t){return isA(t,"object")&&hasValue(t)&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)}export function isNaN(t,e=!0){return(e=orDefault(e,!0,"bool"))?t!=t:isNaN(t)}export function isElement(t){return isA(t,"htmlelement")}export function isEventTarget(t){return hasValue(t)&&isA(t.addEventListener,"function")&&isA(t.removeEventListener,"function")&&isA(t.dispatchEvent,"function")}export function isSelector(t){t=orDefault(t,0,"str");const e=document.createDocumentFragment();try{e.querySelector(t)}catch(t){return!1}return!0}export function isPotentialId(t,e="",r="[1-9][0-9]*",n="",s=!0){t=`${t}`,e=orDefault(e,"","str"),r=orDefault(r,"[1-9][0-9]*","str"),n=orDefault(n,"","str");const o=t=>`${t}`.replace(/([\-\[\]\/{}()*+?.\\^$|])/g,"\\$&");let i;i=(s=orDefault(s,!0,"bool"))?new RegExp(`^${o(e)}(${r})${o(n)}$`):new RegExp(`^${e}(${r})${n}$`);const a=i.exec(t);return!!hasValue(a)&&a[1]}export function minMax(t,e,r){return assert(t<=r,"Basic:minMax | min can not be larger than max"),er?r:e}export class Deferred{constructor(){const t="fulfilled",e="rejected";this.resolve=null,this.reject=null,this.provision=null,this.status="pending",this.isSettled=()=>[t,e].includes(this.status),this.promise=new Promise(((r,n)=>{this.resolve=e=>{this.status=t,r(e)},this.reject=t=>{this.status=e,n(t)}}))}then(t){return this.promise.then(t)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}}export class Observable{constructor(t){this.__className__="Observable",this._value=t,this._subscriptions=[]}getValue(){return this._value}setValue(t,e=!1){const r=this._value,n=r!==t;this._value=t,(n||e)&&this._subscriptions.forEach((e=>e(t,r)))}subscribe(t){return assert(isA(t,"function"),`Basic:${this.__className__}.subscribe | subscription must be function`),this._subscriptions.indexOf(t)<0&&(this._subscriptions=[...this._subscriptions,t]),t}unsubscribe(t){this._subscriptions=this._subscriptions.filter((e=>e!==t))}toString(){return`${this._value}`}} //# sourceMappingURL=basic.js.map diff --git a/dist/basic.js.map b/dist/basic.js.map index 9aab52a4..5c4ebcd4 100644 --- a/dist/basic.js.map +++ b/dist/basic.js.map @@ -1 +1 @@ -{"version":3,"file":"basic.js","names":["MODULE_NAME","log","warn","assert","condition","message","orDefault","Error","attempt","closure","isA","ex","hasValue","res","Array","from","arguments","forEach","value","size","target","countStringCharacters","values","length","getType","Object","isEmpty","emptyValues","undefined","obj","__additionalEmptyValues__","concat","Set","includes","hasMembers","memberNames","verbose","memberName","info","expression","defaultValue","caster","additionalEmptyValues","toLowerCase","parseInt","parseFloat","deepType","prototype","toString","call","slice","test","match","type","isInt","intVal","isFloat","floatVal","isPlainObject","constructor","isNaN","checkForIdentity","isEventTarget","addEventListener","removeEventListener","dispatchEvent","isSelector","fragment","document","createDocumentFragment","querySelector","isPotentialId","prefix","idRex","postfix","maskFixes","mask","str","replace","rex","RegExp","matches","exec","minMax","min","max","Deferred","STATUS_FULFILLED","STATUS_REJECTED","this","resolve","reject","provision","status","isSettled","promise","Promise","resolution","rejection","then","f","catch","finally","Observable","initialValue","__className__","_value","_subscriptions","getValue","setValue","newValue","force","oldValue","isNewValue","s","subscribe","subscription","indexOf","unsubscribe","filter"],"sources":["basic.js"],"mappings":";;;AAQA,MAAMA,YAAc,eAMZC,IAAKC,SAAW,sBA0BjB,SAASC,OAAOC,EAAWC,GACjC,IAAKD,EAEJ,MADAC,EAAUC,UAAUD,EAAS,qCAAsC,OAC7D,IAAIE,MAAMF,EAElB,QA0BO,SAASG,QAAQC,GACvBN,OAAOO,IAAID,EAAS,YAAa,0CAEjC,IACCA,GAGD,CAFE,MAAME,GACP,OAAO,CACR,CAEA,OAAO,CACR,QAuBO,SAASC,WACf,IAAIC,GAAM,EAMV,OAJAC,MAAMC,KAAKC,WAAWC,SAAQC,IAC7BL,IAAQ,MAAEK,CAAyC,IAG7CL,CACR,QA+CO,SAASM,KAAKC,EAAQC,GAAsB,GAClD,GAAIX,IAAIU,GAAQE,OAAQ,YAAc,OAAOR,MAAMC,KAAKK,EAAOE,UAAUC,OAEzE,IAAIV,EACJ,OAAQW,QAAQJ,IACf,IAAK,QACJP,EAAMO,EAAOG,OACd,MAEA,IAAK,MACL,IAAK,MACJV,EAAMO,EAAOD,KACd,MAEA,IAAK,WACJN,EAAMC,MAAMC,KAAKK,GAAQG,OAC1B,MAEA,IAAK,SAEJV,EAAMQ,EAAwB,IAAID,GAAQG,OAASH,EAAOG,OAC3D,MAEA,IAAK,SACJV,EAAMY,OAAOH,OAAOF,GAAQG,OAC7B,MAEA,QACCV,EAAM,KAIR,OAAOA,CACR,QA2BO,SAASa,UACf,IACCb,GAAM,EACNc,EAAc,MAACC,EAAW,KAAM,GAAI,GAoBrC,OAjBAd,MAAMC,KAAKC,WAAWC,SAAQY,IACzBnB,IAAImB,GAAKC,0BAA2B,WACvCH,EAAcA,EAAYI,OAAOF,EAAIC,2BACtC,IAEDH,EAAcb,MAAMC,KAAK,IAAIiB,IAAIL,IAEjCb,MAAMC,KAAK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AEAE,QAAQF,GACP,OAAOX,KAAKM,QAAQO,QAAQF,EAC7B,SAiCM,MAAMG,WACZ5C,YAAY6C,GACXf,KAAKgB,cAAgB,aACrBhB,KAAKiB,OAASF,EACdf,KAAKkB,eAAiB,EACvB,CAEAC,WACC,OAAOnB,KAAKiB,MACb,CAEAG,SAASC,EAAUC,GAAM,GACxB,MACCC,EAAWvB,KAAKiB,OAChBO,EAAaD,IAAaF,EAE3BrB,KAAKiB,OAASI,GACVG,GAAcF,IACjBtB,KAAKkB,eAAe1F,SAAQiG,GAAKA,EAAEJ,EAAUE,IAE/C,CAEAG,UAAUC,GAMT,OAJAjH,OAAOO,IAAI0G,EAAc,YAAa,SAAkB3B,KAAKgB,2DACzDhB,KAAKkB,eAAeU,QAAQD,GAAgB,IAC/C3B,KAAKkB,eAAiB,IAAIlB,KAAKkB,eAAgBS,IAEzCA,CACR,CAEAE,YAAYF,GACX3B,KAAKkB,eAAiBlB,KAAKkB,eAAeY,QAAOL,GAAKA,IAAME,GAC7D,CAEApE,WACC,MAAO,GAAGyC,KAAKiB,QAChB","sourcesContent":["/*!\n * Module Basic\n */\n\n/**\n * @namespace Basic\n */\n\nconst MODULE_NAME = 'Basic';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {log, warn} from './logging.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Basic:assert\n */\n\n/**\n * Classical assert method. If condition is falsy, throw assert exception.\n *\n * @param {Boolean} condition - defines if an assertion is successful\n * @param {?String} [message='assert exception: assertion failed'] - to display if assertion fails\n * @throws assert exception\n *\n * @memberof Basic:assert\n * @alias assert\n * @example\n * function set(name, value){\n * assert(name.length > 0);\n * assert(isPlainObject(value), 'error: value must be plain object');\n * ...\n * }\n */\nexport function assert(condition, message){\n\tif( !condition ){\n\t\tmessage = orDefault(message, 'assert exception: assertion failed', 'str');\n\t\tthrow new Error(message);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:attempt\n */\n\n/**\n * Attempt to compute contents of closure and catch all occurring exceptions.\n * The boolean result tells you if the operation was successful or not.\n *\n * This is most helpful, when used to test value conversions or other atomic/singluar operations, where it\n * just is important if something isolated works or not.\n *\n * Do not encapsulate complex code in the closure and mind recursively occurring exceptions!\n *\n * @param {Function} closure - the code to test\n * @throws error if closure is not a function\n * @returns {Boolean} true if no exception occurred\n *\n * @memberof Basic:attempt\n * @alias attempt\n * @example\n * if( !attempt(function(){ foobar(); }) ){ console.log('foobar cannot be executed!'); }\n */\nexport function attempt(closure){\n\tassert(isA(closure, 'function'), `${MODULE_NAME}:attempt | closure is no function`);\n\n\ttry {\n\t\tclosure();\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:hasValue\n */\n\n/**\n * Check if variable(s) is set, by being neither undefined nor null.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are set\n *\n * @memberof Basic:hasValue\n * @alias hasValue\n * @example\n * function set(name, value){\n * if( hasValue(name, value) ){\n * ...\n * }\n * }\n */\nexport function hasValue(){\n\tlet res = true;\n\n\tArray.from(arguments).forEach(value => {\n\t\tres &&= ((value !== undefined) && (value !== null));\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:size\n */\n\n/**\n * Determine the (value) size of a collection.\n *\n * A collection is an object with countable values:\n * - Arrays return their length\n * - Sets and Maps return their size\n * - Strings return their (character) length\n * - Iterators return the length of their value list\n * - Objects return the length of their value list\n * - any object implementing .values() returns the length of the returned value list\n *\n * @param {Object|Array|Set|Map|String|Iterable} target - a collection to determine the (value) size of\n * @param {?Boolean} [countStringCharacters=true] - if we want to determine the length of a string, we'd normally like to count actual characters, but length normally returns the technical length counting more than one for unicode chars, set this to \"false\" to use technical length instead of characters\n * @returns {Number|null} the size of the collection or null if no size could be determined\n *\n * @memberof Basic:size\n * @alias size\n * @example\n * size('日本国💩👻');\n * => 5\n * size('日本国💩👻', false);\n * => 7\n * size({a : 1, b : new Date(), c : [1, 2, 3]});\n * => 3\n * size(['test', 'test', 'test']);\n * => 3\n * size(new Set(['test1', 'test2', 'test3']));\n * => 3\n * size(new Set(['test1', 'test2', 'test3']).values());\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]));\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]).values());\n * => 3\n * size(null);\n * => null\n * size(undefined);\n * => null\n */\nexport function size(target, countStringCharacters=true){\n\tif( isA(target?.values, 'function') ) return Array.from(target.values()).length;\n\n\tlet res;\n\tswitch( getType(target) ){\n\t\tcase 'array':\n\t\t\tres = target.length;\n\t\tbreak;\n\n\t\tcase 'set':\n\t\tcase 'map':\n\t\t\tres = target.size;\n\t\tbreak;\n\n\t\tcase 'iterator':\n\t\t\tres = Array.from(target).length;\n\t\tbreak;\n\n\t\tcase 'string':\n\t\t\t// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description\n\t\t\tres = countStringCharacters ? [...target].length : target.length;\n\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tres = Object.values(target).length;\n\t\tbreak;\n\n\t\tdefault:\n\t\t\tres = null;\n\t\tbreak;\n\t}\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:isEmpty\n */\n\n/**\n * Check if variable(s) contain non-empty value\n * (not undefined, null, '', 0, [], {} or an empty Set/Map).\n *\n * You can supply additional non-empty values by providing an object having the key \"__additionalEmptyValues__\" as\n * any single parameter. Multiple occurrences will be merged.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are empty\n *\n * @memberof Basic:isEmpty\n * @alias isEmpty\n * @example\n * function set(name, value){\n * if( isEmpty(fooBar) || isEmpty({'__additionalEmptyValues__' : [false, '0']}, someArray, someSet, someString, value) ){\n * ...\n * }\n * }\n */\nexport function isEmpty(){\n\tlet\n\t\tres = true,\n\t\temptyValues = [undefined, null, '', 0]\n\t;\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\temptyValues = emptyValues.concat(obj.__additionalEmptyValues__);\n\t\t}\n\t});\n\temptyValues = Array.from(new Set(emptyValues));\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( res && !isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\tres = emptyValues.includes(obj);\n\n\t\t\tif( !res ){\n\t\t\t\tres = (size(obj) === 0);\n\t\t\t}\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:hasMembers\n */\n\n/**\n * \"Validates\" an object in a very basic way by checking if all given members are present and are not nullish.\n *\n * @param {Object} obj - the object to check\n * @param {String[]} memberNames - the names of the members to check\n * @param {Boolean} [verbose=false] - defines if method should output missing members to console\n * @returns {Boolean} all memberNames present and not nullish\n *\n * @memberof Basic:hasMembers\n * @alias hasMembers\n * @example\n * function pat(kitten){\n * if( hasMembers(kitten, ['fluff', 'meow', 'scratch']) ){\n * ...\n * }\n * }\n */\nexport function hasMembers(obj, memberNames, verbose=false){\n\tmemberNames = orDefault(memberNames, [], 'arr');\n\tverbose = orDefault(verbose, false, 'bool');\n\n\tlet res = true;\n\n\tmemberNames.forEach(memberName => {\n\t\tif( !hasValue(obj[`${memberName}`]) ){\n\t\t\tif( verbose ){\n\t\t\t\tlog().info(`${MODULE_NAME}:hasMembers | missing member ${memberName}`);\n\t\t\t}\n\n\t\t\tres = false;\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:orDefault\n */\n\n/**\n * If an expression returns a non-value (undefined or null), use the default value instead.\n * Define a caster name, to force expression result/value into certain data type.\n *\n * @param {*} expression - the expression to evaluate\n * @param {*} defaultValue - the default value to use if the expression is considered empty\n * @param {?(String|Function)} [caster=null] - either a default caster by name ('str', 'string', 'int', 'integer', 'bool', 'boolean', 'float', 'arr', 'array') or a function getting the value and returning the transformed value\n * @param {?Array} [additionalEmptyValues=null] - if set, provides a list of additional values to be considered empty, apart from undefined and null\n * @returns {*} expression of defaultValue\n *\n * @memberof Basic:orDefault\n * @alias orDefault\n * @example\n * function set(name, value){\n * name = orDefault(name, 'kittens!', 'string', ['', 'none']);\n * value = orDefault(value, 42, 'int');\n * }\n */\nexport function orDefault(expression, defaultValue, caster=null, additionalEmptyValues=null){\n\tif( hasValue(additionalEmptyValues) ){\n\t\tadditionalEmptyValues = [].concat(additionalEmptyValues);\n\t} else {\n\t\tadditionalEmptyValues = [];\n\t}\n\n\tif( hasValue(caster) ){\n\t\tif(\n\t\t\t!isA(caster, 'function')\n\t\t\t&& ([\n\t\t\t\t'str', 'string',\n\t\t\t\t'int', 'integer',\n\t\t\t\t'bool', 'boolean',\n\t\t\t\t'float',\n\t\t\t\t'arr', 'array'\n\t\t\t].includes(`${caster.toLowerCase()}`))\n\t\t){\n\t\t\tcaster = `${caster}`.toLowerCase();\n\n\t\t\tif( ['str', 'string'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return `${value}`; };\n\t\t\t} else if( ['int', 'integer'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return parseInt(value, 10); };\n\t\t\t} else if( ['bool', 'boolean'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return !!value; };\n\t\t\t} else if( caster === 'float' ){\n\t\t\t\tcaster = function(value){ return parseFloat(value); };\n\t\t\t} else if( ['arr', 'array'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return [].concat(value); };\n\t\t\t}\n\t\t} else if( !isA(caster, 'function') ){\n\t\t\tcaster = function(value){ return value; };\n\t\t}\n\t} else {\n\t\tcaster = function(value){ return value; };\n\t}\n\n\tif( !hasValue(expression) || (additionalEmptyValues.includes(expression)) ){\n\t\treturn defaultValue;\n\t} else {\n\t\treturn caster(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:getType\n */\n\n/**\n * Prod-ready type detection for values, expanding on flawed typeof functionality, roughly following\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof, but expanding on\n * useful frontend types like \"htmldocument\", \"htmlelement\" and \"nodelist\"\n *\n * Types:\n * - \"undefined\"\n * - \"null\"\n * - \"boolean\"\n * - \"number\"\n * - \"bigint\"\n * - \"string\"\n * - \"symbol\"\n * - \"function\"\n * - \"object\"\n * - \"array\"\n * - \"date\"\n * - \"error\"\n * - \"generator\"\n * - \"iterator\"\n * - \"regexp\"\n * - \"set\"\n * - \"weakset\"\n * - \"map\"\n * - \"weakmap\"\n * - \"htmldocument\"\n * - \"htmlelement\"\n * - \"nodelist\"\n * - \"window\"\n *\n * @param {*} [value] - variable to check the type of\n * @returns {String} the value type in lower case\n *\n * @memberof Basic:getType\n * @alias getType\n * @example\n * if( getType(cb) === 'function' ){\n * ...\n * }\n */\nexport function getType(value) {\n\tif( !hasValue(value) ) return `${value}`.toLowerCase();\n\n\tconst deepType = Object.prototype.toString.call(value).slice(8,-1).toLowerCase();\n\n\tif( deepType === 'generatorfunction' ) return 'function';\n\tif( deepType === 'document' ) return 'htmldocument';\n\tif( deepType === 'element' ) return 'htmlelement';\n\tif( /^html.*element$/.test(deepType) ) return 'htmlelement';\n\tif( /^.*iterator$/.test(deepType) ) return 'iterator';\n\n\treturn deepType.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)\n\t\t? deepType\n\t\t: ((typeof value === 'object') || (typeof value === 'function')) ? 'object' : typeof value\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isA\n */\n\n/**\n * Short form of \"getType\"-method with a more compact syntax.\n * Can identify all types listed in getType.\n *\n * @param {*} value - variable to check the type of\n * @param {String} type - the name of the type to check for, has to be a standard JS-type, is case insensitive\n * @returns {Boolean} target has type\n *\n * @memberof Basic:isA\n * @alias isA\n * @see getType\n * @example\n * let stringBool = (isA(test, 'boolean') && test) ? 'true' : 'false';\n */\nexport function isA(value, type){\n\tif(\n\t\t[\n\t\t\t'undefined',\n\t\t\t'null',\n\t\t\t'boolean',\n\t\t\t'number',\n\t\t\t'bigint',\n\t\t\t'string',\n\t\t\t'symbol',\n\t\t\t'function',\n\t\t\t'object',\n\t\t\t'array',\n\t\t\t'date',\n\t\t\t'error',\n\t\t\t'generator',\n\t\t\t'iterator',\n\t\t\t'regexp',\n\t\t\t'set',\n\t\t\t'weakset',\n\t\t\t'map',\n\t\t\t'weakmap',\n\t\t\t'htmldocument',\n\t\t\t'htmlelement',\n\t\t\t'nodelist',\n\t\t\t'window'\n\t\t].includes(`${type}`.toLowerCase())\n\t){\n\t\treturn getType(value) === `${type}`.toLowerCase();\n\t} else {\n\t\twarn(`${MODULE_NAME}:isA | \"${type}\" is not a recognized type`);\n\t\treturn false;\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isInt\n */\n\n/**\n * Returns if a value is truly a real integer value and not just an int-parsable value for example.\n * Since JS only knows the data type \"number\" all numbers are usable as floats by default, but not the\n * other way round.\n *\n * @param {*} intVal - the value the check\n * @returns {Boolean} true if intVal is a true integer value\n *\n * @memberof Basic:isInt\n * @alias isInt\n * @example\n * if( !isInt(val) ){\n * val = parseInt(val, 10);\n * }\n */\nexport function isInt(intVal){\n\treturn parseInt(intVal, 10) === intVal;\n}\n\n\n\n/**\n * @namespace Basic:isFloat\n */\n\n/**\n * Returns if a value is a numeric value, usable as a float number in any calculation.\n * Any number that fulfills isInt, is also considered a valid float, which lies in JS's\n * nature of not differentiating ints and floats by putting them both into a \"number\"-type.\n * So ints are always floats, but not necessarily the other way round.\n *\n * @param {*} floatVal - the value to check\n * @returns {Boolean} true if floatVal is usable in a float context\n *\n * @memberof Basic:isFloat\n * @alias isFloat\n * @example\n * if( !isFloat(val) ){\n * alert('val can not be calculated with!');\n * }\n */\nexport function isFloat(floatVal){\n\treturn parseFloat(floatVal) === floatVal;\n}\n\n\n\n/**\n * @namespace Basic:isPlainObject\n */\n\n/**\n * Returns if a value is an object literal, so so-called \"plain object.\n * A plain object is something like \"{hello : 'world'}\".\n *\n * This might especially be helpful when dealing with JSON configs, so quickly check if\n * something might even be parsed JSON (which in most cases is a plain object in js).\n *\n * Be aware that this function cannot differentiate between constructor-based simple objects and\n * plain objects declared inline. So, if someone took on the work to instantiate a base object and assign\n * properties either in a function or a constructor, we accept that as a plain object.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value seems to be a plain object\n *\n * @memberof Basic:isPlainObject\n * @alias isPlainObject\n * @example\n * const isParameterConfigObject = isPlainObject(param);\n */\nexport function isPlainObject(value){\n\treturn isA(value, 'object')\n\t\t&& hasValue(value)\n\t\t&& (value.constructor === Object)\n\t\t&& Object.prototype.toString.call(value) === '[object Object]'\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isNaN\n */\n\n/**\n * Returns if an expression is NaN or not.\n * This method employs two different approaches:\n * By default it really checks if the expression is the _value_ NaN or not, this being a valid JS-value for something.\n * In JS this gets checked by comparing an expression with itself on identity, since NaN is the only value not being\n * identical to itself. If you set checkForIdentity to false, this method will use the standard JS-isNaN, which\n * inspects the expression, tries to cast or parse a number from it and returns the result.\n *\n * @param {*} expression - the expression to check\n * @param {Boolean} [checkForIdentity=true] - set to false if you want to use default JS-functionality\n * @returns {Boolean} true if expression is NaN\n *\n * @memberof Basic:isNaN\n * @alias isNaN\n * @example\n * if( !isNaN(suspiciousCalculatedValue) ){\n * return suspiciousCalculatedValue * 3;\n * }\n */\nexport function isNaN(expression, checkForIdentity=true){\n\tcheckForIdentity = orDefault(checkForIdentity, true, 'bool');\n\n\tif( checkForIdentity ){\n\t\treturn expression !== expression;\n\t} else {\n\t\treturn isNaN(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isEventTarget\n */\n\n/**\n * Returns if a value is an EventTarget, which means that it is able to dispatch and receive events.\n * This is determined via duck-typing and not via class inheritance check, since this method is not\n * about type-safety, but the question if we can use the target for events, which is simply determined\n * by three essential object methods: addEventListener, removeEventListener and dispatchEvent. All\n * objects supporting these are fine with us.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value supports event methods\n *\n * @memberof Basic:isEventTarget\n * @alias isEventTarget\n * @example\n * if( isEventTarget(target) ){\n * target.dispatchEvent(new CustomEvent('foobar'));\n * }\n */\nexport function isEventTarget(value){\n\treturn hasValue(value)\n\t\t&& isA(value.addEventListener, 'function')\n\t\t&& isA(value.removeEventListener, 'function')\n\t\t&& isA(value.dispatchEvent, 'function')\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isSelector\n */\n\n/**\n * Returns if a value is a valid selector, usable in methods such as querySelector\n * and querySelectorAll.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is a valid selector\n *\n * @memberof Basic:isSelector\n * @alias isSelector\n * @example\n * if( isSelector(selector) ){\n * document.querySelector(selector)?.style.setProperty('color', 'red');\n * }\n */\nexport function isSelector(value){\n\t// almost all values like \"null\", \"undefined\" and \"NaN\" are accepted querySelectors, numbers are not\n\tvalue = orDefault(value, 0, 'str');\n\n\tconst fragment = document.createDocumentFragment();\n\n\ttry {\n\t\tfragment.querySelector(value);\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:isPotentialId\n */\n\n/**\n * Determines if a given value is potentially a valid id for something, because it matches a format of given\n * prefix, postfix and id regex. \"Potential\", because we can only assume by the format, we do not actually know\n * if the id really matches anything like a database entry for example.\n *\n * @param {(String|Number)} value - the value to test, will be stringified\n * @param {?String} [prefix=''] - a prefix for the id\n * @param {?String} [idRex='[1-9][0-9]*'] - the regex string to use to identify the id part of the value\n * @param {?String} [postfix=''] - a postfix for the id\n * @param {?Boolean} [maskFixes=true] - usually, prefixes are not treated as regexes and are automatically masked, if you'd like to define complex pre- and postfixes using regexes, set this to false\n * @returns {String|Boolean} if value is potential id according to format, the id is returned as a string (still usable as a truthy value), otherwise the return value is false\n *\n * @memberof Basic:isPotentialId\n * @alias isPotentialId\n * @example\n * if( isPotentialId(id, 'test_(', '[0-9]+', ')') ){\n * createJsonRequest(`/backend/${id}`).then(() => { alert('done'); });\n * }\n */\nexport function isPotentialId(value, prefix='', idRex='[1-9][0-9]*', postfix='', maskFixes=true){\n\tvalue = `${value}`;\n\tprefix = orDefault(prefix, '', 'str');\n\tidRex = orDefault(idRex, '[1-9][0-9]*', 'str');\n\tpostfix = orDefault(postfix, '', 'str');\n\tmaskFixes = orDefault(maskFixes, true, 'bool');\n\n\tconst mask = str => `${str}`.replace(/([\\-\\[\\]\\/{}()*+?.\\\\^$|])/g, \"\\\\$&\");\n\n\tlet rex;\n\tif( maskFixes ){\n\t\trex = new RegExp(`^${mask(prefix)}(${idRex})${mask(postfix)}$`);\n\t} else {\n\t\trex = new RegExp(`^${prefix}(${idRex})${postfix}$`);\n\t}\n\n\tconst matches = rex.exec(value);\n\treturn hasValue(matches) ? matches[1] : false;\n}\n\n\n\n/**\n * @namespace Basic:minMax\n */\n\n/**\n * Checks if a value is within bounds of a minimum and maximum and returns\n * the value or the upper or lower bound respectively.\n *\n * Accepts all values comparable with > and <.\n *\n * @param {*} min - the lower bound\n * @param {*} value - the value to check\n * @param {*} max - the upper bound\n * @throws error if min is not smaller than max\n * @returns {*} value, min or max\n *\n * @memberof Basic:minMax\n * @alias minMax\n * @example\n * let croppedVal = minMax(-100, value, 100);\n */\nexport function minMax(min, value, max){\n\tassert(min <= max, `${MODULE_NAME}:minMax | min can not be larger than max`);\n\n\treturn (value < min)\n\t\t? min\n\t\t: (\n\t\t\t(value > max)\n\t\t\t\t? max\n\t\t\t\t: value\n\t\t)\n\t;\n}\n\n\n\n/**\n * @namespace Basic:Deferred\n */\n\n/**\n * @typedef Deferred\n * @type {Object}\n * @property {Promise} promise - the wrapped promise\n * @property {Function} resolve - resolves the wrapped promise with given value\n * @property {Function} reject - rejects the wrapped promise with given error\n * @property {Function} then - defines a success handler for the wrapped promise and returns its result\n * @property {Function} catch - defines an error handler for the wrapped promise and returns its result\n * @property {Function} finally - defines a \"settled\" handler for the wrapped promise and returns its result\n * @property {String} status - holds the current resolution status, can either be \"pending\", \"fulfilled\" or \"rejected\"\n * @property {Function} isSettled - returns true, if the Deferred is either \"fulfilled\" or \"rejected\"\n * @property {?*} [provision=null] - may contain (a) provisional value(s) to use for a newly instantiated Deferred, before it has resolved to the actual value(s)\n */\n\n/**\n * Class that wraps a Promise, to allow resolving and rejecting outside the\n * Promise's function scope. This allows for decoupled handling of states and\n * handling promises as references in a distributed context, like a class, where\n * a Deferred might then represent an async state.\n *\n * Deferreds also provide accessible status information, normal Promises do not have.\n * Accessing the \"status\" property returns the current status, being either \"pending\",\n * \"fulfilled\" or \"rejected\". You may also check if the Deferred has been settled via\n * \"isSettled()\". If you want to provide a preliminary result, available before the\n * promise has settled, you may set this result as a payload using the \"provision\" property.\n *\n * This follows ideas by jQuery and Q Promises:\n * - https://api.jquery.com/jQuery.Deferred/\n * - https://github.com/kriskowal/q/wiki/Coming-from-jQuery#deferreds-promises-resolvers\n *\n * Keep in mind, that Promises might need a polyfill such as core-js.\n *\n * @memberof Basic:Deferred\n * @name Deferred\n * @example\n * const doStuff = new Deferred();\n * doStuff.provision = 'provisional value';\n * doStuff\n * .then(value => { alert(`yeah, ready with \"${value}\"!`); })\n * .catch(error => { console.error(error); })\n * .finally(() => { console.info('has been settled); })\n * ;\n * if( foobar === 42 ){\n * doStuff.resolve(42);\n * } else {\n * doStuff.reject(new Error('not 42!'));\n * }\n * console.info(doStuff.status);\n */\nexport class Deferred {\n\tconstructor(){\n\t\tconst\n\t\t\tSTATUS_PENDING = 'pending',\n\t\t\tSTATUS_FULFILLED = 'fulfilled',\n\t\t\tSTATUS_REJECTED = 'rejected'\n\t\t;\n\t\tthis.resolve = null;\n\t\tthis.reject = null;\n\t\tthis.provision = null;\n\t\tthis.status = STATUS_PENDING;\n\t\tthis.isSettled = () => [STATUS_FULFILLED, STATUS_REJECTED].includes(this.status);\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolution => {\n\t\t\t\tthis.status = STATUS_FULFILLED;\n\t\t\t\tresolve(resolution);\n\t\t\t};\n\t\t\tthis.reject = rejection => {\n\t\t\t\tthis.status = STATUS_REJECTED;\n\t\t\t\treject(rejection);\n\t\t\t};\n\t\t});\n\t}\n\n\tthen(f){\n\t\treturn this.promise.then(f);\n\t}\n\n\tcatch(f){\n\t\treturn this.promise.catch(f);\n\t}\n\n\tfinally(f){\n\t\treturn this.promise.finally(f);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:Observable\n */\n\n/**\n * @typedef Observable\n * @type {Object}\n * @property {Function} getValue - returns the current value\n * @property {Function} setValue - sets a new value, which will subsequently trigger all subscriptions\n * @property {Function} subscribe - register a given function to be executed on any value change, the subscription receives the new and the old value on each execution, returns the subscription value, which can later be used to unsubscribe again\n * @property {Function} unsubscribe - removes a given subscription again, use subscription value returned by subscribe here\n */\n\n/**\n * A class offering the bare minimum feature set to observe a value and subscribe to future value changes.\n * No automatic magic going on here, this simply follows a basic subscription pattern, where each subscription is\n * a function, being called with a newly set value. This closely resembles the kind of observables knockout is using.\n *\n * @memberof Basic:Observable\n * @name Observable\n * @example\n * const status = new Observable('ok');\n * const subscription = status.subscribe(s => {\n * console.log(`status changed to: ${s}`);\n * });\n * status.setValue('oh noez');\n * status.unsubscribe(subscription);\n */\nexport class Observable {\n\tconstructor(initialValue){\n\t\tthis.__className__ = 'Observable';\n\t\tthis._value = initialValue;\n\t\tthis._subscriptions = [];\n\t}\n\n\tgetValue(){\n\t\treturn this._value;\n\t}\n\n\tsetValue(newValue, force=false){\n\t\tconst\n\t\t\toldValue = this._value,\n\t\t\tisNewValue = oldValue !== newValue\n\t\t;\n\t\tthis._value = newValue;\n\t\tif( isNewValue || force ){\n\t\t\tthis._subscriptions.forEach(s => s(newValue, oldValue));\n\t\t}\n\t}\n\n\tsubscribe(subscription){\n\t\tconst __methodName__ = 'subscribe';\n\t\tassert(isA(subscription, 'function'), `${MODULE_NAME}:${this.__className__}.${__methodName__} | subscription must be function`);\n\t\tif( this._subscriptions.indexOf(subscription) < 0 ){\n\t\t\tthis._subscriptions = [...this._subscriptions, subscription];\n\t\t}\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(subscription){\n\t\tthis._subscriptions = this._subscriptions.filter(s => s !== subscription);\n\t}\n\n\ttoString(){\n\t\treturn `${this._value}`;\n\t}\n}\n"]} \ No newline at end of file +{"version":3,"file":"basic.js","names":["MODULE_NAME","log","warn","assert","condition","message","orDefault","Error","attempt","closure","isA","ex","hasValue","res","Array","from","arguments","forEach","value","size","target","countStringCharacters","values","length","getType","Object","isEmpty","emptyValues","undefined","obj","__additionalEmptyValues__","concat","Set","includes","hasMembers","memberNames","verbose","memberName","info","expression","defaultValue","caster","additionalEmptyValues","toLowerCase","parseInt","parseFloat","deepType","prototype","toString","call","slice","test","match","type","isInt","intVal","isFloat","floatVal","isPlainObject","constructor","isNaN","checkForIdentity","isElement","isEventTarget","addEventListener","removeEventListener","dispatchEvent","isSelector","fragment","document","createDocumentFragment","querySelector","isPotentialId","prefix","idRex","postfix","maskFixes","mask","str","replace","rex","RegExp","matches","exec","minMax","min","max","Deferred","STATUS_FULFILLED","STATUS_REJECTED","this","resolve","reject","provision","status","isSettled","promise","Promise","resolution","rejection","then","f","catch","finally","Observable","initialValue","__className__","_value","_subscriptions","getValue","setValue","newValue","force","oldValue","isNewValue","s","subscribe","subscription","indexOf","unsubscribe","filter"],"sources":["basic.js"],"mappings":";;;AAQA,MAAMA,YAAc,eAMZC,IAAKC,SAAW,sBA0BjB,SAASC,OAAOC,EAAWC,GACjC,IAAKD,EAEJ,MADAC,EAAUC,UAAUD,EAAS,qCAAsC,OAC7D,IAAIE,MAAMF,EAElB,QA0BO,SAASG,QAAQC,GACvBN,OAAOO,IAAID,EAAS,YAAa,0CAEjC,IACCA,GAGD,CAFE,MAAME,GACP,OAAO,CACR,CAEA,OAAO,CACR,QAuBO,SAASC,WACf,IAAIC,GAAM,EAMV,OAJAC,MAAMC,KAAKC,WAAWC,SAAQC,IAC7BL,IAAQ,MAAEK,CAAyC,IAG7CL,CACR,QA+CO,SAASM,KAAKC,EAAQC,GAA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lB,KAAKkB,eAAgBS,IAEzCA,CACR,CAEAE,YAAYF,GACX3B,KAAKkB,eAAiBlB,KAAKkB,eAAeY,QAAOL,GAAKA,IAAME,GAC7D,CAEArE,WACC,MAAO,GAAG0C,KAAKiB,QAChB","sourcesContent":["/*!\n * Module Basic\n */\n\n/**\n * @namespace Basic\n */\n\nconst MODULE_NAME = 'Basic';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {log, warn} from './logging.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Basic:assert\n */\n\n/**\n * Classical assert method. If condition is falsy, throw assert exception.\n *\n * @param {Boolean} condition - defines if an assertion is successful\n * @param {?String} [message='assert exception: assertion failed'] - to display if assertion fails\n * @throws assert exception\n *\n * @memberof Basic:assert\n * @alias assert\n * @example\n * function set(name, value){\n * assert(name.length > 0);\n * assert(isPlainObject(value), 'error: value must be plain object');\n * ...\n * }\n */\nexport function assert(condition, message){\n\tif( !condition ){\n\t\tmessage = orDefault(message, 'assert exception: assertion failed', 'str');\n\t\tthrow new Error(message);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:attempt\n */\n\n/**\n * Attempt to compute contents of closure and catch all occurring exceptions.\n * The boolean result tells you if the operation was successful or not.\n *\n * This is most helpful, when used to test value conversions or other atomic/singluar operations, where it\n * just is important if something isolated works or not.\n *\n * Do not encapsulate complex code in the closure and mind recursively occurring exceptions!\n *\n * @param {Function} closure - the code to test\n * @throws error if closure is not a function\n * @returns {Boolean} true if no exception occurred\n *\n * @memberof Basic:attempt\n * @alias attempt\n * @example\n * if( !attempt(function(){ foobar(); }) ){ console.log('foobar cannot be executed!'); }\n */\nexport function attempt(closure){\n\tassert(isA(closure, 'function'), `${MODULE_NAME}:attempt | closure is no function`);\n\n\ttry {\n\t\tclosure();\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:hasValue\n */\n\n/**\n * Check if variable(s) is set, by being neither undefined nor null.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are set\n *\n * @memberof Basic:hasValue\n * @alias hasValue\n * @example\n * function set(name, value){\n * if( hasValue(name, value) ){\n * ...\n * }\n * }\n */\nexport function hasValue(){\n\tlet res = true;\n\n\tArray.from(arguments).forEach(value => {\n\t\tres &&= ((value !== undefined) && (value !== null));\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:size\n */\n\n/**\n * Determine the (value) size of a collection.\n *\n * A collection is an object with countable values:\n * - Arrays return their length\n * - Sets and Maps return their size\n * - Strings return their (character) length\n * - Iterators return the length of their value list\n * - Objects return the length of their value list\n * - any object implementing .values() returns the length of the returned value list\n *\n * @param {Object|Array|Set|Map|String|Iterable} target - a collection to determine the (value) size of\n * @param {?Boolean} [countStringCharacters=true] - if we want to determine the length of a string, we'd normally like to count actual characters, but length normally returns the technical length counting more than one for unicode chars, set this to \"false\" to use technical length instead of characters\n * @returns {Number|null} the size of the collection or null if no size could be determined\n *\n * @memberof Basic:size\n * @alias size\n * @example\n * size('日本国💩👻');\n * => 5\n * size('日本国💩👻', false);\n * => 7\n * size({a : 1, b : new Date(), c : [1, 2, 3]});\n * => 3\n * size(['test', 'test', 'test']);\n * => 3\n * size(new Set(['test1', 'test2', 'test3']));\n * => 3\n * size(new Set(['test1', 'test2', 'test3']).values());\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]));\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]).values());\n * => 3\n * size(null);\n * => null\n * size(undefined);\n * => null\n */\nexport function size(target, countStringCharacters=true){\n\tif( isA(target?.values, 'function') ) return Array.from(target.values()).length;\n\n\tlet res;\n\tswitch( getType(target) ){\n\t\tcase 'array':\n\t\t\tres = target.length;\n\t\tbreak;\n\n\t\tcase 'set':\n\t\tcase 'map':\n\t\t\tres = target.size;\n\t\tbreak;\n\n\t\tcase 'iterator':\n\t\t\tres = Array.from(target).length;\n\t\tbreak;\n\n\t\tcase 'string':\n\t\t\t// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description\n\t\t\tres = countStringCharacters ? [...target].length : target.length;\n\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tres = Object.values(target).length;\n\t\tbreak;\n\n\t\tdefault:\n\t\t\tres = null;\n\t\tbreak;\n\t}\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:isEmpty\n */\n\n/**\n * Check if variable(s) contain non-empty value\n * (not undefined, null, '', 0, [], {} or an empty Set/Map).\n *\n * You can supply additional non-empty values by providing an object having the key \"__additionalEmptyValues__\" as\n * any single parameter. Multiple occurrences will be merged.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are empty\n *\n * @memberof Basic:isEmpty\n * @alias isEmpty\n * @example\n * function set(name, value){\n * if( isEmpty(fooBar) || isEmpty({'__additionalEmptyValues__' : [false, '0']}, someArray, someSet, someString, value) ){\n * ...\n * }\n * }\n */\nexport function isEmpty(){\n\tlet\n\t\tres = true,\n\t\temptyValues = [undefined, null, '', 0]\n\t;\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\temptyValues = emptyValues.concat(obj.__additionalEmptyValues__);\n\t\t}\n\t});\n\temptyValues = Array.from(new Set(emptyValues));\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( res && !isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\tres = emptyValues.includes(obj);\n\n\t\t\tif( !res ){\n\t\t\t\tres = (size(obj) === 0);\n\t\t\t}\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:hasMembers\n */\n\n/**\n * \"Validates\" an object in a very basic way by checking if all given members are present and are not nullish.\n *\n * @param {Object} obj - the object to check\n * @param {String[]} memberNames - the names of the members to check\n * @param {Boolean} [verbose=false] - defines if method should output missing members to console\n * @returns {Boolean} all memberNames present and not nullish\n *\n * @memberof Basic:hasMembers\n * @alias hasMembers\n * @example\n * function pat(kitten){\n * if( hasMembers(kitten, ['fluff', 'meow', 'scratch']) ){\n * ...\n * }\n * }\n */\nexport function hasMembers(obj, memberNames, verbose=false){\n\tmemberNames = orDefault(memberNames, [], 'arr');\n\tverbose = orDefault(verbose, false, 'bool');\n\n\tlet res = true;\n\n\tmemberNames.forEach(memberName => {\n\t\tif( !hasValue(obj[`${memberName}`]) ){\n\t\t\tif( verbose ){\n\t\t\t\tlog().info(`${MODULE_NAME}:hasMembers | missing member ${memberName}`);\n\t\t\t}\n\n\t\t\tres = false;\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:orDefault\n */\n\n/**\n * If an expression returns a non-value (undefined or null), use the default value instead.\n * Define a caster name, to force expression result/value into certain data type.\n *\n * @param {*} expression - the expression to evaluate\n * @param {*} defaultValue - the default value to use if the expression is considered empty\n * @param {?(String|Function)} [caster=null] - either a default caster by name ('str', 'string', 'int', 'integer', 'bool', 'boolean', 'float', 'arr', 'array') or a function getting the value and returning the transformed value\n * @param {?Array} [additionalEmptyValues=null] - if set, provides a list of additional values to be considered empty, apart from undefined and null\n * @returns {*} expression of defaultValue\n *\n * @memberof Basic:orDefault\n * @alias orDefault\n * @example\n * function set(name, value){\n * name = orDefault(name, 'kittens!', 'string', ['', 'none']);\n * value = orDefault(value, 42, 'int');\n * }\n */\nexport function orDefault(expression, defaultValue, caster=null, additionalEmptyValues=null){\n\tif( hasValue(additionalEmptyValues) ){\n\t\tadditionalEmptyValues = [].concat(additionalEmptyValues);\n\t} else {\n\t\tadditionalEmptyValues = [];\n\t}\n\n\tif( hasValue(caster) ){\n\t\tif(\n\t\t\t!isA(caster, 'function')\n\t\t\t&& ([\n\t\t\t\t'str', 'string',\n\t\t\t\t'int', 'integer',\n\t\t\t\t'bool', 'boolean',\n\t\t\t\t'float',\n\t\t\t\t'arr', 'array'\n\t\t\t].includes(`${caster.toLowerCase()}`))\n\t\t){\n\t\t\tcaster = `${caster}`.toLowerCase();\n\n\t\t\tif( ['str', 'string'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return `${value}`; };\n\t\t\t} else if( ['int', 'integer'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return parseInt(value, 10); };\n\t\t\t} else if( ['bool', 'boolean'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return !!value; };\n\t\t\t} else if( caster === 'float' ){\n\t\t\t\tcaster = function(value){ return parseFloat(value); };\n\t\t\t} else if( ['arr', 'array'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return [].concat(value); };\n\t\t\t}\n\t\t} else if( !isA(caster, 'function') ){\n\t\t\tcaster = function(value){ return value; };\n\t\t}\n\t} else {\n\t\tcaster = function(value){ return value; };\n\t}\n\n\tif( !hasValue(expression) || (additionalEmptyValues.includes(expression)) ){\n\t\treturn defaultValue;\n\t} else {\n\t\treturn caster(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:getType\n */\n\n/**\n * Prod-ready type detection for values, expanding on flawed typeof functionality, roughly following\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof, but expanding on\n * useful frontend types like \"htmldocument\", \"htmlelement\" and \"nodelist\"\n *\n * Types:\n * - \"undefined\"\n * - \"null\"\n * - \"boolean\"\n * - \"number\"\n * - \"bigint\"\n * - \"string\"\n * - \"symbol\"\n * - \"function\"\n * - \"object\"\n * - \"array\"\n * - \"date\"\n * - \"error\"\n * - \"generator\"\n * - \"iterator\"\n * - \"regexp\"\n * - \"set\"\n * - \"weakset\"\n * - \"map\"\n * - \"weakmap\"\n * - \"htmldocument\"\n * - \"htmlelement\"\n * - \"nodelist\"\n * - \"window\"\n *\n * @param {*} [value] - variable to check the type of\n * @returns {String} the value type in lower case\n *\n * @memberof Basic:getType\n * @alias getType\n * @example\n * if( getType(cb) === 'function' ){\n * ...\n * }\n */\nexport function getType(value) {\n\tif( !hasValue(value) ) return `${value}`.toLowerCase();\n\n\tconst deepType = Object.prototype.toString.call(value).slice(8,-1).toLowerCase();\n\n\tif( deepType === 'generatorfunction' ) return 'function';\n\tif( deepType === 'document' ) return 'htmldocument';\n\tif( deepType === 'element' ) return 'htmlelement';\n\tif( /^html.*element$/.test(deepType) ) return 'htmlelement';\n\tif( /^.*iterator$/.test(deepType) ) return 'iterator';\n\n\treturn deepType.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)\n\t\t? deepType\n\t\t: ((typeof value === 'object') || (typeof value === 'function')) ? 'object' : typeof value\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isA\n */\n\n/**\n * Short form of \"getType\"-method with a more compact syntax.\n * Can identify all types listed in getType.\n *\n * @param {*} value - variable to check the type of\n * @param {String} type - the name of the type to check for, has to be a standard JS-type, is case insensitive\n * @returns {Boolean} target has type\n *\n * @memberof Basic:isA\n * @alias isA\n * @see getType\n * @example\n * let stringBool = (isA(test, 'boolean') && test) ? 'true' : 'false';\n */\nexport function isA(value, type){\n\tif(\n\t\t[\n\t\t\t'undefined',\n\t\t\t'null',\n\t\t\t'boolean',\n\t\t\t'number',\n\t\t\t'bigint',\n\t\t\t'string',\n\t\t\t'symbol',\n\t\t\t'function',\n\t\t\t'object',\n\t\t\t'array',\n\t\t\t'date',\n\t\t\t'error',\n\t\t\t'generator',\n\t\t\t'iterator',\n\t\t\t'regexp',\n\t\t\t'set',\n\t\t\t'weakset',\n\t\t\t'map',\n\t\t\t'weakmap',\n\t\t\t'htmldocument',\n\t\t\t'htmlelement',\n\t\t\t'nodelist',\n\t\t\t'window'\n\t\t].includes(`${type}`.toLowerCase())\n\t){\n\t\treturn getType(value) === `${type}`.toLowerCase();\n\t} else {\n\t\twarn(`${MODULE_NAME}:isA | \"${type}\" is not a recognized type`);\n\t\treturn false;\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isInt\n */\n\n/**\n * Returns if a value is truly a real integer value and not just an int-parsable value for example.\n * Since JS only knows the data type \"number\" all numbers are usable as floats by default, but not the\n * other way round.\n *\n * @param {*} intVal - the value the check\n * @returns {Boolean} true if intVal is a true integer value\n *\n * @memberof Basic:isInt\n * @alias isInt\n * @example\n * if( !isInt(val) ){\n * val = parseInt(val, 10);\n * }\n */\nexport function isInt(intVal){\n\treturn parseInt(intVal, 10) === intVal;\n}\n\n\n\n/**\n * @namespace Basic:isFloat\n */\n\n/**\n * Returns if a value is a numeric value, usable as a float number in any calculation.\n * Any number that fulfills isInt, is also considered a valid float, which lies in JS's\n * nature of not differentiating ints and floats by putting them both into a \"number\"-type.\n * So ints are always floats, but not necessarily the other way round.\n *\n * @param {*} floatVal - the value to check\n * @returns {Boolean} true if floatVal is usable in a float context\n *\n * @memberof Basic:isFloat\n * @alias isFloat\n * @example\n * if( !isFloat(val) ){\n * alert('val can not be calculated with!');\n * }\n */\nexport function isFloat(floatVal){\n\treturn parseFloat(floatVal) === floatVal;\n}\n\n\n\n/**\n * @namespace Basic:isPlainObject\n */\n\n/**\n * Returns if a value is an object literal, so so-called \"plain object.\n * A plain object is something like \"{hello : 'world'}\".\n *\n * This might especially be helpful when dealing with JSON configs, so quickly check if\n * something might even be parsed JSON (which in most cases is a plain object in js).\n *\n * Be aware that this function cannot differentiate between constructor-based simple objects and\n * plain objects declared inline. So, if someone took on the work to instantiate a base object and assign\n * properties either in a function or a constructor, we accept that as a plain object.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value seems to be a plain object\n *\n * @memberof Basic:isPlainObject\n * @alias isPlainObject\n * @example\n * const isParameterConfigObject = isPlainObject(param);\n */\nexport function isPlainObject(value){\n\treturn isA(value, 'object')\n\t\t&& hasValue(value)\n\t\t&& (value.constructor === Object)\n\t\t&& Object.prototype.toString.call(value) === '[object Object]'\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isNaN\n */\n\n/**\n * Returns if an expression is NaN or not.\n * This method employs two different approaches:\n * By default it really checks if the expression is the _value_ NaN or not, this being a valid JS-value for something.\n * In JS this gets checked by comparing an expression with itself on identity, since NaN is the only value not being\n * identical to itself. If you set checkForIdentity to false, this method will use the standard JS-isNaN, which\n * inspects the expression, tries to cast or parse a number from it and returns the result.\n *\n * @param {*} expression - the expression to check\n * @param {Boolean} [checkForIdentity=true] - set to false if you want to use default JS-functionality\n * @returns {Boolean} true if expression is NaN\n *\n * @memberof Basic:isNaN\n * @alias isNaN\n * @example\n * if( !isNaN(suspiciousCalculatedValue) ){\n * return suspiciousCalculatedValue * 3;\n * }\n */\nexport function isNaN(expression, checkForIdentity=true){\n\tcheckForIdentity = orDefault(checkForIdentity, true, 'bool');\n\n\tif( checkForIdentity ){\n\t\treturn expression !== expression;\n\t} else {\n\t\treturn isNaN(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isElement\n */\n\n/**\n * Returns if a value is an HTML element.\n * Be aware, that this explicitly means an element, not necessarily any node.\n * So text nodes, comments and such do not qualify.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is an HTML element\n *\n * @memberof Basic:isElement\n * @alias isElement\n * @example\n * if( isElement(target) ){\n * target.classList.add('foo');\n * }\n */\nexport function isElement(value){\n\treturn isA(value, 'htmlelement');\n}\n\n\n\n/**\n * @namespace Basic:isEventTarget\n */\n\n/**\n * Returns if a value is an EventTarget, which means that it is able to dispatch and receive events.\n * This is determined via duck-typing and not via class inheritance check, since this method is not\n * about type-safety, but the question if we can use the target for events, which is simply determined\n * by three essential object methods: addEventListener, removeEventListener and dispatchEvent. All\n * objects supporting these are fine with us.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value supports event methods\n *\n * @memberof Basic:isEventTarget\n * @alias isEventTarget\n * @example\n * if( isEventTarget(target) ){\n * target.dispatchEvent(new CustomEvent('foobar'));\n * }\n */\nexport function isEventTarget(value){\n\treturn hasValue(value)\n\t\t&& isA(value.addEventListener, 'function')\n\t\t&& isA(value.removeEventListener, 'function')\n\t\t&& isA(value.dispatchEvent, 'function')\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isSelector\n */\n\n/**\n * Returns if a value is a valid selector, usable in methods such as querySelector\n * and querySelectorAll.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is a valid selector\n *\n * @memberof Basic:isSelector\n * @alias isSelector\n * @example\n * if( isSelector(selector) ){\n * document.querySelector(selector)?.style.setProperty('color', 'red');\n * }\n */\nexport function isSelector(value){\n\t// almost all values like \"null\", \"undefined\" and \"NaN\" are accepted querySelectors, numbers are not\n\tvalue = orDefault(value, 0, 'str');\n\n\tconst fragment = document.createDocumentFragment();\n\n\ttry {\n\t\tfragment.querySelector(value);\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:isPotentialId\n */\n\n/**\n * Determines if a given value is potentially a valid id for something, because it matches a format of given\n * prefix, postfix and id regex. \"Potential\", because we can only assume by the format, we do not actually know\n * if the id really matches anything like a database entry for example.\n *\n * @param {(String|Number)} value - the value to test, will be stringified\n * @param {?String} [prefix=''] - a prefix for the id\n * @param {?String} [idRex='[1-9][0-9]*'] - the regex string to use to identify the id part of the value\n * @param {?String} [postfix=''] - a postfix for the id\n * @param {?Boolean} [maskFixes=true] - usually, prefixes are not treated as regexes and are automatically masked, if you'd like to define complex pre- and postfixes using regexes, set this to false\n * @returns {String|Boolean} if value is potential id according to format, the id is returned as a string (still usable as a truthy value), otherwise the return value is false\n *\n * @memberof Basic:isPotentialId\n * @alias isPotentialId\n * @example\n * if( isPotentialId(id, 'test_(', '[0-9]+', ')') ){\n * createJsonRequest(`/backend/${id}`).then(() => { alert('done'); });\n * }\n */\nexport function isPotentialId(value, prefix='', idRex='[1-9][0-9]*', postfix='', maskFixes=true){\n\tvalue = `${value}`;\n\tprefix = orDefault(prefix, '', 'str');\n\tidRex = orDefault(idRex, '[1-9][0-9]*', 'str');\n\tpostfix = orDefault(postfix, '', 'str');\n\tmaskFixes = orDefault(maskFixes, true, 'bool');\n\n\tconst mask = str => `${str}`.replace(/([\\-\\[\\]\\/{}()*+?.\\\\^$|])/g, \"\\\\$&\");\n\n\tlet rex;\n\tif( maskFixes ){\n\t\trex = new RegExp(`^${mask(prefix)}(${idRex})${mask(postfix)}$`);\n\t} else {\n\t\trex = new RegExp(`^${prefix}(${idRex})${postfix}$`);\n\t}\n\n\tconst matches = rex.exec(value);\n\treturn hasValue(matches) ? matches[1] : false;\n}\n\n\n\n/**\n * @namespace Basic:minMax\n */\n\n/**\n * Checks if a value is within bounds of a minimum and maximum and returns\n * the value or the upper or lower bound respectively.\n *\n * Accepts all values comparable with > and <.\n *\n * @param {*} min - the lower bound\n * @param {*} value - the value to check\n * @param {*} max - the upper bound\n * @throws error if min is not smaller than max\n * @returns {*} value, min or max\n *\n * @memberof Basic:minMax\n * @alias minMax\n * @example\n * let croppedVal = minMax(-100, value, 100);\n */\nexport function minMax(min, value, max){\n\tassert(min <= max, `${MODULE_NAME}:minMax | min can not be larger than max`);\n\n\treturn (value < min)\n\t\t? min\n\t\t: (\n\t\t\t(value > max)\n\t\t\t\t? max\n\t\t\t\t: value\n\t\t)\n\t;\n}\n\n\n\n/**\n * @namespace Basic:Deferred\n */\n\n/**\n * @typedef Deferred\n * @type {Object}\n * @property {Promise} promise - the wrapped promise\n * @property {Function} resolve - resolves the wrapped promise with given value\n * @property {Function} reject - rejects the wrapped promise with given error\n * @property {Function} then - defines a success handler for the wrapped promise and returns its result\n * @property {Function} catch - defines an error handler for the wrapped promise and returns its result\n * @property {Function} finally - defines a \"settled\" handler for the wrapped promise and returns its result\n * @property {String} status - holds the current resolution status, can either be \"pending\", \"fulfilled\" or \"rejected\"\n * @property {Function} isSettled - returns true, if the Deferred is either \"fulfilled\" or \"rejected\"\n * @property {?*} [provision=null] - may contain (a) provisional value(s) to use for a newly instantiated Deferred, before it has resolved to the actual value(s)\n */\n\n/**\n * Class that wraps a Promise, to allow resolving and rejecting outside the\n * Promise's function scope. This allows for decoupled handling of states and\n * handling promises as references in a distributed context, like a class, where\n * a Deferred might then represent an async state.\n *\n * Deferreds also provide accessible status information, normal Promises do not have.\n * Accessing the \"status\" property returns the current status, being either \"pending\",\n * \"fulfilled\" or \"rejected\". You may also check if the Deferred has been settled via\n * \"isSettled()\". If you want to provide a preliminary result, available before the\n * promise has settled, you may set this result as a payload using the \"provision\" property.\n *\n * This follows ideas by jQuery and Q Promises:\n * - https://api.jquery.com/jQuery.Deferred/\n * - https://github.com/kriskowal/q/wiki/Coming-from-jQuery#deferreds-promises-resolvers\n *\n * Keep in mind, that Promises might need a polyfill such as core-js.\n *\n * @memberof Basic:Deferred\n * @name Deferred\n * @example\n * const doStuff = new Deferred();\n * doStuff.provision = 'provisional value';\n * doStuff\n * .then(value => { alert(`yeah, ready with \"${value}\"!`); })\n * .catch(error => { console.error(error); })\n * .finally(() => { console.info('has been settled); })\n * ;\n * if( foobar === 42 ){\n * doStuff.resolve(42);\n * } else {\n * doStuff.reject(new Error('not 42!'));\n * }\n * console.info(doStuff.status);\n */\nexport class Deferred {\n\tconstructor(){\n\t\tconst\n\t\t\tSTATUS_PENDING = 'pending',\n\t\t\tSTATUS_FULFILLED = 'fulfilled',\n\t\t\tSTATUS_REJECTED = 'rejected'\n\t\t;\n\t\tthis.resolve = null;\n\t\tthis.reject = null;\n\t\tthis.provision = null;\n\t\tthis.status = STATUS_PENDING;\n\t\tthis.isSettled = () => [STATUS_FULFILLED, STATUS_REJECTED].includes(this.status);\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolution => {\n\t\t\t\tthis.status = STATUS_FULFILLED;\n\t\t\t\tresolve(resolution);\n\t\t\t};\n\t\t\tthis.reject = rejection => {\n\t\t\t\tthis.status = STATUS_REJECTED;\n\t\t\t\treject(rejection);\n\t\t\t};\n\t\t});\n\t}\n\n\tthen(f){\n\t\treturn this.promise.then(f);\n\t}\n\n\tcatch(f){\n\t\treturn this.promise.catch(f);\n\t}\n\n\tfinally(f){\n\t\treturn this.promise.finally(f);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:Observable\n */\n\n/**\n * @typedef Observable\n * @type {Object}\n * @property {Function} getValue - returns the current value\n * @property {Function} setValue - sets a new value, which will subsequently trigger all subscriptions\n * @property {Function} subscribe - register a given function to be executed on any value change, the subscription receives the new and the old value on each execution, returns the subscription value, which can later be used to unsubscribe again\n * @property {Function} unsubscribe - removes a given subscription again, use subscription value returned by subscribe here\n */\n\n/**\n * A class offering the bare minimum feature set to observe a value and subscribe to future value changes.\n * No automatic magic going on here, this simply follows a basic subscription pattern, where each subscription is\n * a function, being called with a newly set value. This closely resembles the kind of observables knockout is using.\n *\n * @memberof Basic:Observable\n * @name Observable\n * @example\n * const status = new Observable('ok');\n * const subscription = status.subscribe(s => {\n * console.log(`status changed to: ${s}`);\n * });\n * status.setValue('oh noez');\n * status.unsubscribe(subscription);\n */\nexport class Observable {\n\tconstructor(initialValue){\n\t\tthis.__className__ = 'Observable';\n\t\tthis._value = initialValue;\n\t\tthis._subscriptions = [];\n\t}\n\n\tgetValue(){\n\t\treturn this._value;\n\t}\n\n\tsetValue(newValue, force=false){\n\t\tconst\n\t\t\toldValue = this._value,\n\t\t\tisNewValue = oldValue !== newValue\n\t\t;\n\t\tthis._value = newValue;\n\t\tif( isNewValue || force ){\n\t\t\tthis._subscriptions.forEach(s => s(newValue, oldValue));\n\t\t}\n\t}\n\n\tsubscribe(subscription){\n\t\tconst __methodName__ = 'subscribe';\n\t\tassert(isA(subscription, 'function'), `${MODULE_NAME}:${this.__className__}.${__methodName__} | subscription must be function`);\n\t\tif( this._subscriptions.indexOf(subscription) < 0 ){\n\t\t\tthis._subscriptions = [...this._subscriptions, subscription];\n\t\t}\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(subscription){\n\t\tthis._subscriptions = this._subscriptions.filter(s => s !== subscription);\n\t}\n\n\ttoString(){\n\t\treturn `${this._value}`;\n\t}\n}\n"]} \ No newline at end of file diff --git a/dist/context.js b/dist/context.js index 1a4f70dc..ce45043b 100644 --- a/dist/context.js +++ b/dist/context.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Context diff --git a/dist/cookies.js b/dist/cookies.js index 3ac1ff65..a1f0bd0e 100644 --- a/dist/cookies.js +++ b/dist/cookies.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Cookies diff --git a/dist/css.js b/dist/css.js index 73b3f05a..2fdf60c0 100644 --- a/dist/css.js +++ b/dist/css.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module CSS */ -const MODULE_NAME="CSS";import{assert,isA,orDefault,isPlainObject,hasValue,isNaN}from"./basic.js";import{maskForRegEx}from"./strings.js";export function applyStyles(e,t,r=!1,s=!1){const l="applyStyles";r=orDefault(r,!1,"bool"),s=orDefault(s,!1,"bool"),assert(isA(e,"htmlelement"),`CSS:${l} | element is not an html element`),assert(isPlainObject(t),`CSS:${l} | styles must be a plain object`);const o=["-webkit-","-moz-","-ms-","-o-","-khtml-"];return r&&Object.entries({...t}).forEach((([e,r])=>{o.forEach((s=>{t[s+e]="transition"===e?r.replace("transform",`${s}transform`):r}))})),Object.entries({...t}).forEach((([r,s])=>{isA(s,"number")&&0!==s?(t[r]=`${s}px`,e.style.setProperty(r,t[r])):hasValue(s)?(t[r]=`${s}`,e.style.setProperty(r,t[r])):(o.forEach((s=>{delete t[s+r],e.style.removeProperty(s+r)})),delete t[r],e.style.removeProperty(r))})),s?e.style:t}export function cssValueToNumber(e){return parseFloat(orDefault(e,"","str"))}export function cssUrlValueToUrl(e,t=null,r=null){e=orDefault(e,"","str"),t=orDefault(t,null,"str"),r=orDefault(r,null,"str");const s=new RegExp("(?:^|\\s|,)url\\((?:'|\")?([^'\"\\n\\r\\t]+)(?:'|\")?\\)","gmi"),l=[];let o;for(;null!==(o=s.exec(e));)o=o[1],hasValue(t,r)&&(o=o.replace(new RegExp(`^${maskForRegEx(t)}`),r)),l.push(o);return 1===l.length?l[0]:l.length>1?l:null}export function remByPx(e,t="html"){if(e=cssValueToNumber(e),t=orDefault(t,"html"),isA(t,"htmlelement"))t=cssValueToNumber(t.style.getPropertyValue("font-size"));else{const e=cssValueToNumber(t);if(isNaN(e)){const e=document.querySelector(t);assert(hasValue(e),"CSS:remByPx | selector does not return element"),t=cssValueToNumber(e.style.getPropertyValue("font-size"))}else t=e}const r=e/t;return 0===t||isNaN(r)?null:`${r}rem`} +const MODULE_NAME="CSS";import{assert,isA,orDefault,isPlainObject,isElement,hasValue,isNaN}from"./basic.js";import{maskForRegEx}from"./strings.js";export function applyStyles(e,t,r=!1,s=!1){const l="applyStyles";r=orDefault(r,!1,"bool"),s=orDefault(s,!1,"bool"),assert(isElement(e),`CSS:${l} | element is not an html element`),assert(isPlainObject(t),`CSS:${l} | styles must be a plain object`);const o=["-webkit-","-moz-","-ms-","-o-","-khtml-"];return r&&Object.entries({...t}).forEach((([e,r])=>{o.forEach((s=>{t[s+e]="transition"===e?r.replace("transform",`${s}transform`):r}))})),Object.entries({...t}).forEach((([r,s])=>{isA(s,"number")&&0!==s?(t[r]=`${s}px`,e.style.setProperty(r,t[r])):hasValue(s)?(t[r]=`${s}`,e.style.setProperty(r,t[r])):(o.forEach((s=>{delete t[s+r],e.style.removeProperty(s+r)})),delete t[r],e.style.removeProperty(r))})),s?e.style:t}export function cssValueToNumber(e){return parseFloat(orDefault(e,"","str"))}export function cssUrlValueToUrl(e,t=null,r=null){e=orDefault(e,"","str"),t=orDefault(t,null,"str"),r=orDefault(r,null,"str");const s=new RegExp("(?:^|\\s|,)url\\((?:'|\")?([^'\"\\n\\r\\t]+)(?:'|\")?\\)","gmi"),l=[];let o;for(;null!==(o=s.exec(e));)o=o[1],hasValue(t,r)&&(o=o.replace(new RegExp(`^${maskForRegEx(t)}`),r)),l.push(o);return 1===l.length?l[0]:l.length>1?l:null}export function remByPx(e,t="html"){if(e=cssValueToNumber(e),t=orDefault(t,"html"),isElement(t))t=cssValueToNumber(t.style.getPropertyValue("font-size"));else{const e=cssValueToNumber(t);if(isNaN(e)){const e=document.querySelector(t);assert(hasValue(e),"CSS:remByPx | selector does not return element"),t=cssValueToNumber(e.style.getPropertyValue("font-size"))}else t=e}const r=e/t;return 0===t||isNaN(r)?null:`${r}rem`} //# sourceMappingURL=css.js.map diff --git a/dist/css.js.map b/dist/css.js.map index a3dc1b5c..3e835c9a 100644 --- a/dist/css.js.map +++ b/dist/css.js.map @@ -1 +1 @@ -{"version":3,"file":"css.js","names":["MODULE_NAME","assert","isA","orDefault","isPlainObject","hasValue","isNaN","maskForRegEx","applyStyles","element","styles","crossBrowser","returnCssStyleDeclaration","__methodName__","vendorPrefixes","Object","entries","forEach","cssKey","cssValue","vendorPrefix","replace","style","setProperty","removeProperty","cssValueToNumber","value","parseFloat","cssUrlValueToUrl","urlValue","baseUrl","baseUrlSubstitution","urlValueRex","RegExp","matches","match","exec","push","length","remByPx","px","initial","getPropertyValue","document","querySelector","remVal"],"sources":["css.js"],"mappings":";;;AAQA,MAAMA,YAAc,aAMZC,OAAQC,IAAKC,UAAWC,cAAeC,SAAUC,UAAY,oBAC7DC,iBAAmB,sBA6CpB,SAASC,YAAYC,EAASC,EAAQC,GAAa,EAAOC,GAA0B,GAC1F,MAAMC,EAAiB,cAEvBF,EAAeR,UAAUQ,GAAc,EAAO,QAC9CC,EAA4BT,UAAUS,GAA2B,EAAO,QAExEX,OAAOC,IAAIO,EAAS,eAAgB,OAAkBI,sCACtDZ,OAAOG,cAAcM,GAAS,OAAkBG,qCAEhD,MAAMC,EAAiB,CAAC,WAAY,QAAS,OAAQ,MAAO,WA+B5D,OA7BIH,GACHI,OAAOC,QAAQ,IAAIN,IAASO,SAAQ,EAAEC,EAAQC,MAC7CL,EAAeG,SAAQG,IAErBV,EAAOU,EAAaF,GADP,eAAXA,EAC4BC,EAASE,QAAQ,YAAa,GAAGD,cAEjCD,CAC/B,GACC,IAIJ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AAMjB,EAAUkC,SAASC,cAAcH,GACvCxC,OAAOI,SAASI,GAAU,kDAC1BgC,EAAUhB,iBAAiBhB,EAAQa,MAAMoB,iBAAiB,aAC3D,MACCD,EAAUf,CAEZ,CAEA,MAAMmB,EAASL,EAAKC,EAEpB,OAAiB,IAAZA,GAAmBnC,MAAMuC,GAGtB,KAFA,GAAGA,MAIZ","sourcesContent":["/*!\n * Module CSS\n */\n\n/**\n * @namespace CSS\n */\n\nconst MODULE_NAME = 'CSS';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {assert, isA, orDefault, isPlainObject, hasValue, isNaN} from './basic.js';\nimport {maskForRegEx} from './strings.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace CSS:applyStyles\n */\n\n/**\n * Applies CSS definitions to an HTMLElement, by providing a plain object of property-value-pairs.\n * Properties may be written as default CSS kebab-case properties such as \"margin-left\" or as JS\n * camel-cased versions such as \"marginLeft\".\n *\n * Providing a real JS number without a unit will be treated as a pixel value, so defining \"'line-height' : 0\" will\n * actually result in a 1px line-height. To actually set a unit-less value, just set the value as a string:\n * \"'line-height' : '0'\".\n *\n * Generally all CSS values are usually strings (this is also the way JS handles this),\n * treating plain numbers as pixels is just a convenience feature, since pixels are most likely to be\n * calculated values, where it is bothersome and error-prone to add the \"px\" all the time.\n *\n * To remove a property, just set the value to a nullish value. Deleting a property also tries to remove all\n * vendor prefixed variants.\n *\n * This function uses CSSStyleDeclaration.setProperty instead of direct style assignments. This means, that the\n * browser itself decides which value to apply, based on the support of the property. This means, the style object\n * will not be polluted with vendor stuff the browser does not support, but this also means, that all non-standard\n * properties might be refused. If you really need to set something out of spec, use direct style assignment instead.\n *\n * @param {HTMLElement} element - the element to apply the styles to, use null or undefined as value to remove a prop\n * @param {Object} styles - the styles to apply, provided as a plain object, defining property-value-pairs\n * @param {?Boolean} [crossBrowser=false] - set this to true, to automatically generate vendor-prefixed versions of all provided properties\n * @param {?Boolean} [returnCssStyleDeclaration=false] - set this to true, return the CSSStyleDeclaration of the element after the style application, rather than the plain object\n * @throws error if element is not an HTMLElement\n * @throws error if styles is not a plain object\n * @returns {Object|CSSStyleDeclaration} the applied/active styles\n *\n * @memberof CSS:applyStyles\n * @alias applyStyles\n * @example\n * applyStyles(document.body, {backgroundColor : red, transition : 'all 200ms'}, true);\n * applyStyles(document.querySelector('main'), {'font-family' : 'serif'}, false, true);\n */\nexport function applyStyles(element, styles, crossBrowser=false, returnCssStyleDeclaration=false){\n\tconst __methodName__ = 'applyStyles';\n\n\tcrossBrowser = orDefault(crossBrowser, false, 'bool');\n\treturnCssStyleDeclaration = orDefault(returnCssStyleDeclaration, false, 'bool');\n\n\tassert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not an html element`);\n\tassert(isPlainObject(styles), `${MODULE_NAME}:${__methodName__} | styles must be a plain object`);\n\n\tconst vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];\n\n\tif( crossBrowser ){\n\t\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tif(cssKey === 'transition'){\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue.replace('transform', `${vendorPrefix}transform`);\n\t\t\t\t} else {\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\tif( isA(cssValue, 'number') && (cssValue !== 0) ){\n\t\t\tstyles[cssKey] = `${cssValue}px`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t} else if( !hasValue(cssValue) ){\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tdelete styles[vendorPrefix+cssKey];\n\t\t\t\telement.style.removeProperty(vendorPrefix+cssKey);\n\t\t\t});\n\t\t\tdelete styles[cssKey];\n\t\t\telement.style.removeProperty(cssKey);\n\t\t} else {\n\t\t\tstyles[cssKey] = `${cssValue}`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t}\n\t});\n\n\treturn returnCssStyleDeclaration ? element.style : styles;\n}\n\n\n\n/**\n * @namespace CSS:cssValueToNumber\n */\n\n/**\n * Converts a CSS-value to a number without unit. If the base number is an integer the result will also\n * be an integer, float values will also be converted correctly.\n *\n * @param {String} value - the css-value to convert\n * @returns {Number|NaN} true number representation of the given value or NaN if the value is not parsable\n *\n * @memberof CSS:cssValueToNumber\n * @alias cssValueToNumber\n * @example\n * document.querySelector('main').style.setProperty('width', '99vh');\n * cssValueToNumber(document.querySelector('main').style.getPropertyValue('width'));\n * => 99\n */\nexport function cssValueToNumber(value){\n\treturn parseFloat(orDefault(value, '', 'str'));\n}\n\n\n\n/**\n * @namespace CSS:cssUrlValueToUrl\n */\n\n/**\n * Converts a CSS-URL-value (\"url('/foo/bar/baz.jpg')\") to a plain URL usable in requests or src-attributes.\n *\n * @param {String} urlValue - the URL-value from CSS\n * @param {?String} [baseUrl=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace here\n * @param {?String} [baseUrlSubstitution=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace the baseUrl with here\n * @returns {String|Array|null} the extracted URL (or list of URLs if value contained several) with substitutions (if defined) or null if no URL-values were found\n *\n * @memberof CSS:cssUrlValueToUrl\n * @alias cssUrlValueToUrl\n * @example\n * cssUrlValueToUrl('url(\"https://foobar.com/test.jpg\")', 'https://foobar.com', '..');\n * => '../test.jpg'\n * cssUrlValueToUrl(`url(/foo/bar),\n * url('https://google.de') url(\"test.jpg\"),url(omg.svg)\n * url(http://lol.com)`)\n * => ['/foo/bar', 'https://google.com', 'test.jpg', 'omg.svg', 'http://lol.com']\n */\nexport function cssUrlValueToUrl(urlValue, baseUrl=null, baseUrlSubstitution=null){\n\turlValue = orDefault(urlValue, '', 'str');\n\tbaseUrl = orDefault(baseUrl, null, 'str');\n\tbaseUrlSubstitution = orDefault(baseUrlSubstitution, null, 'str');\n\n\tconst\n\t\turlValueRex = new RegExp('(?:^|\\\\s|,)url\\\\((?:\\'|\")?([^\\'\"\\\\n\\\\r\\\\t]+)(?:\\'|\")?\\\\)', 'gmi'),\n\t\tmatches = []\n\t;\n\n\tlet match;\n\twhile( (match = urlValueRex.exec(urlValue)) !== null ){\n\t\tmatch = match[1];\n\t\tif( hasValue(baseUrl, baseUrlSubstitution) ){\n\t\t\tmatch = match.replace(new RegExp(`^${maskForRegEx(baseUrl)}`), baseUrlSubstitution);\n\t\t}\n\t\tmatches.push(match);\n\t}\n\n\tif( matches.length === 1 ){\n\t\treturn matches[0];\n\t} else if( matches.length > 1 ){\n\t\treturn matches;\n\t} else {\n\t\treturn null;\n\t}\n}\n\n\n\n/**\n * @namespace CSS:remByPx\n */\n\n/**\n * Calculates a rem value based on a given px value.\n * As a default this method takes the font-size (supposedly being in px) of the html-container.\n * You can overwrite this behaviour by setting initial to a number to use as a base px value or\n * to a string, which then defines a new selector for an element to get the initial font-size from.\n * You can also provide an HTMLElement directly, but keep in mind that the element's font size definition\n * has to be in pixels, to make this work.\n *\n * In most cases you will have to define the initial value via a constant or a selector to a container\n * with non-changing font-size, since you can never be sure which relative font-size applies atm, even on first\n * call, after dom ready, since responsive definitions might already be active, returning a viewport-specific\n * size.\n *\n * @param {Number} px - the pixel value to convert to rem\n * @param {?(Number|String|HTMLElement)} [initial='html'] - either a pixel value to use as a conversion base, a selector for an element to get the initial font-size from or the element itself; keep in mind, that the element's font-size definition has to be in px\n * @throws error if given selector in initial does not return an element\n * @returns {String|null} the rem value string to use in a css definition or null if the value could not be calculated\n *\n * @memberof CSS:remByPx\n * @alias remByPx\n * @example\n * remByPx(20, 16);\n * => '1.25rem'\n * remByPx('100px', 'p.has-base-fontsize');\n */\nexport function remByPx(px, initial='html'){\n\tpx = cssValueToNumber(px);\n\tinitial = orDefault(initial, 'html');\n\n\tif( isA(initial, 'htmlelement') ){\n\t\tinitial = cssValueToNumber(initial.style.getPropertyValue('font-size'));\n\t} else {\n\t\tconst value = cssValueToNumber(initial);\n\t\tif( isNaN(value) ){\n\t\t\tconst element = document.querySelector(initial);\n\t\t\tassert(hasValue(element), `${MODULE_NAME}:remByPx | selector does not return element`);\n\t\t\tinitial = cssValueToNumber(element.style.getPropertyValue('font-size'));\n\t\t} else {\n\t\t\tinitial = value;\n\t\t}\n\t}\n\n\tconst remVal = px / initial;\n\n\tif( (initial !== 0) && !isNaN(remVal) ){\n\t\treturn `${remVal}rem`;\n\t} else {\n\t\treturn null;\n\t}\n}\n"]} \ No newline at end of file +{"version":3,"file":"css.js","names":["MODULE_NAME","assert","isA","orDefault","isPlainObject","isElement","hasValue","isNaN","maskForRegEx","applyStyles","element","styles","crossBrowser","returnCssStyleDeclaration","__methodName__","vendorPrefixes","Object","entries","forEach","cssKey","cssValue","vendorPrefix","replace","style","setProperty","removeProperty","cssValueToNumber","value","parseFloat","cssUrlValueToUrl","urlValue","baseUrl","baseUrlSubstitution","urlValueRex","RegExp","matches","match","exec","push","length","remByPx","px","initial","getPropertyValue","document","querySelector","remVal"],"sources":["css.js"],"mappings":";;;AAQA,MAAMA,YAAc,aAMZC,OAAQC,IAAKC,UAAWC,cAAeC,UAAWC,SAAUC,UAAY,oBACxEC,iBAAmB,sBA6CpB,SAASC,YAAYC,EAASC,EAAQC,GAAa,EAAOC,GAA0B,GAC1F,MAAMC,EAAiB,cAEvBF,EAAeT,UAAUS,GAAc,EAAO,QAC9CC,EAA4BV,UAAUU,GAA2B,EAAO,QAExEZ,OAAOI,UAAUK,GAAU,OAAkBI,sCAC7Cb,OAAOG,cAAcO,GAAS,OAAkBG,qCAEhD,MAAMC,EAAiB,CAAC,WAAY,QAAS,OAAQ,MAAO,WA+B5D,OA7BIH,GACHI,OAAOC,QAAQ,IAAIN,IAASO,SAAQ,EAAEC,EAAQC,MAC7CL,EAAeG,SAAQG,IAErBV,EAAOU,EAAaF,GADP,eAAX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AAQD,iBAAiBgB,GAC/B,GAAInC,MAAMoB,GAAQ,CACjB,MAAMjB,EAAUkC,SAASC,cAAcH,GACvCzC,OAAOK,SAASI,GAAU,kDAC1BgC,EAAUhB,iBAAiBhB,EAAQa,MAAMoB,iBAAiB,aAC3D,MACCD,EAAUf,CAEZ,CAEA,MAAMmB,EAASL,EAAKC,EAEpB,OAAiB,IAAZA,GAAmBnC,MAAMuC,GAGtB,KAFA,GAAGA,MAIZ","sourcesContent":["/*!\n * Module CSS\n */\n\n/**\n * @namespace CSS\n */\n\nconst MODULE_NAME = 'CSS';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {assert, isA, orDefault, isPlainObject, isElement, hasValue, isNaN} from './basic.js';\nimport {maskForRegEx} from './strings.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace CSS:applyStyles\n */\n\n/**\n * Applies CSS definitions to an HTMLElement, by providing a plain object of property-value-pairs.\n * Properties may be written as default CSS kebab-case properties such as \"margin-left\" or as JS\n * camel-cased versions such as \"marginLeft\".\n *\n * Providing a real JS number without a unit will be treated as a pixel value, so defining \"'line-height' : 0\" will\n * actually result in a 1px line-height. To actually set a unit-less value, just set the value as a string:\n * \"'line-height' : '0'\".\n *\n * Generally all CSS values are usually strings (this is also the way JS handles this),\n * treating plain numbers as pixels is just a convenience feature, since pixels are most likely to be\n * calculated values, where it is bothersome and error-prone to add the \"px\" all the time.\n *\n * To remove a property, just set the value to a nullish value. Deleting a property also tries to remove all\n * vendor prefixed variants.\n *\n * This function uses CSSStyleDeclaration.setProperty instead of direct style assignments. This means, that the\n * browser itself decides which value to apply, based on the support of the property. This means, the style object\n * will not be polluted with vendor stuff the browser does not support, but this also means, that all non-standard\n * properties might be refused. If you really need to set something out of spec, use direct style assignment instead.\n *\n * @param {HTMLElement} element - the element to apply the styles to, use null or undefined as value to remove a prop\n * @param {Object} styles - the styles to apply, provided as a plain object, defining property-value-pairs\n * @param {?Boolean} [crossBrowser=false] - set this to true, to automatically generate vendor-prefixed versions of all provided properties\n * @param {?Boolean} [returnCssStyleDeclaration=false] - set this to true, return the CSSStyleDeclaration of the element after the style application, rather than the plain object\n * @throws error if element is not an HTMLElement\n * @throws error if styles is not a plain object\n * @returns {Object|CSSStyleDeclaration} the applied/active styles\n *\n * @memberof CSS:applyStyles\n * @alias applyStyles\n * @example\n * applyStyles(document.body, {backgroundColor : red, transition : 'all 200ms'}, true);\n * applyStyles(document.querySelector('main'), {'font-family' : 'serif'}, false, true);\n */\nexport function applyStyles(element, styles, crossBrowser=false, returnCssStyleDeclaration=false){\n\tconst __methodName__ = 'applyStyles';\n\n\tcrossBrowser = orDefault(crossBrowser, false, 'bool');\n\treturnCssStyleDeclaration = orDefault(returnCssStyleDeclaration, false, 'bool');\n\n\tassert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not an html element`);\n\tassert(isPlainObject(styles), `${MODULE_NAME}:${__methodName__} | styles must be a plain object`);\n\n\tconst vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];\n\n\tif( crossBrowser ){\n\t\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tif(cssKey === 'transition'){\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue.replace('transform', `${vendorPrefix}transform`);\n\t\t\t\t} else {\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\tif( isA(cssValue, 'number') && (cssValue !== 0) ){\n\t\t\tstyles[cssKey] = `${cssValue}px`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t} else if( !hasValue(cssValue) ){\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tdelete styles[vendorPrefix+cssKey];\n\t\t\t\telement.style.removeProperty(vendorPrefix+cssKey);\n\t\t\t});\n\t\t\tdelete styles[cssKey];\n\t\t\telement.style.removeProperty(cssKey);\n\t\t} else {\n\t\t\tstyles[cssKey] = `${cssValue}`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t}\n\t});\n\n\treturn returnCssStyleDeclaration ? element.style : styles;\n}\n\n\n\n/**\n * @namespace CSS:cssValueToNumber\n */\n\n/**\n * Converts a CSS-value to a number without unit. If the base number is an integer the result will also\n * be an integer, float values will also be converted correctly.\n *\n * @param {String} value - the css-value to convert\n * @returns {Number|NaN} true number representation of the given value or NaN if the value is not parsable\n *\n * @memberof CSS:cssValueToNumber\n * @alias cssValueToNumber\n * @example\n * document.querySelector('main').style.setProperty('width', '99vh');\n * cssValueToNumber(document.querySelector('main').style.getPropertyValue('width'));\n * => 99\n */\nexport function cssValueToNumber(value){\n\treturn parseFloat(orDefault(value, '', 'str'));\n}\n\n\n\n/**\n * @namespace CSS:cssUrlValueToUrl\n */\n\n/**\n * Converts a CSS-URL-value (\"url('/foo/bar/baz.jpg')\") to a plain URL usable in requests or src-attributes.\n *\n * @param {String} urlValue - the URL-value from CSS\n * @param {?String} [baseUrl=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace here\n * @param {?String} [baseUrlSubstitution=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace the baseUrl with here\n * @returns {String|Array|null} the extracted URL (or list of URLs if value contained several) with substitutions (if defined) or null if no URL-values were found\n *\n * @memberof CSS:cssUrlValueToUrl\n * @alias cssUrlValueToUrl\n * @example\n * cssUrlValueToUrl('url(\"https://foobar.com/test.jpg\")', 'https://foobar.com', '..');\n * => '../test.jpg'\n * cssUrlValueToUrl(`url(/foo/bar),\n * url('https://google.de') url(\"test.jpg\"),url(omg.svg)\n * url(http://lol.com)`)\n * => ['/foo/bar', 'https://google.com', 'test.jpg', 'omg.svg', 'http://lol.com']\n */\nexport function cssUrlValueToUrl(urlValue, baseUrl=null, baseUrlSubstitution=null){\n\turlValue = orDefault(urlValue, '', 'str');\n\tbaseUrl = orDefault(baseUrl, null, 'str');\n\tbaseUrlSubstitution = orDefault(baseUrlSubstitution, null, 'str');\n\n\tconst\n\t\turlValueRex = new RegExp('(?:^|\\\\s|,)url\\\\((?:\\'|\")?([^\\'\"\\\\n\\\\r\\\\t]+)(?:\\'|\")?\\\\)', 'gmi'),\n\t\tmatches = []\n\t;\n\n\tlet match;\n\twhile( (match = urlValueRex.exec(urlValue)) !== null ){\n\t\tmatch = match[1];\n\t\tif( hasValue(baseUrl, baseUrlSubstitution) ){\n\t\t\tmatch = match.replace(new RegExp(`^${maskForRegEx(baseUrl)}`), baseUrlSubstitution);\n\t\t}\n\t\tmatches.push(match);\n\t}\n\n\tif( matches.length === 1 ){\n\t\treturn matches[0];\n\t} else if( matches.length > 1 ){\n\t\treturn matches;\n\t} else {\n\t\treturn null;\n\t}\n}\n\n\n\n/**\n * @namespace CSS:remByPx\n */\n\n/**\n * Calculates a rem value based on a given px value.\n * As a default this method takes the font-size (supposedly being in px) of the html-container.\n * You can overwrite this behaviour by setting initial to a number to use as a base px value or\n * to a string, which then defines a new selector for an element to get the initial font-size from.\n * You can also provide an HTMLElement directly, but keep in mind that the element's font size definition\n * has to be in pixels, to make this work.\n *\n * In most cases you will have to define the initial value via a constant or a selector to a container\n * with non-changing font-size, since you can never be sure which relative font-size applies atm, even on first\n * call, after dom ready, since responsive definitions might already be active, returning a viewport-specific\n * size.\n *\n * @param {Number} px - the pixel value to convert to rem\n * @param {?(Number|String|HTMLElement)} [initial='html'] - either a pixel value to use as a conversion base, a selector for an element to get the initial font-size from or the element itself; keep in mind, that the element's font-size definition has to be in px\n * @throws error if given selector in initial does not return an element\n * @returns {String|null} the rem value string to use in a css definition or null if the value could not be calculated\n *\n * @memberof CSS:remByPx\n * @alias remByPx\n * @example\n * remByPx(20, 16);\n * => '1.25rem'\n * remByPx('100px', 'p.has-base-fontsize');\n */\nexport function remByPx(px, initial='html'){\n\tpx = cssValueToNumber(px);\n\tinitial = orDefault(initial, 'html');\n\n\tif( isElement(initial) ){\n\t\tinitial = cssValueToNumber(initial.style.getPropertyValue('font-size'));\n\t} else {\n\t\tconst value = cssValueToNumber(initial);\n\t\tif( isNaN(value) ){\n\t\t\tconst element = document.querySelector(initial);\n\t\t\tassert(hasValue(element), `${MODULE_NAME}:remByPx | selector does not return element`);\n\t\t\tinitial = cssValueToNumber(element.style.getPropertyValue('font-size'));\n\t\t} else {\n\t\t\tinitial = value;\n\t\t}\n\t}\n\n\tconst remVal = px / initial;\n\n\tif( (initial !== 0) && !isNaN(remVal) ){\n\t\treturn `${remVal}rem`;\n\t} else {\n\t\treturn null;\n\t}\n}\n"]} \ No newline at end of file diff --git a/dist/elements.js b/dist/elements.js index 28f1d8d8..5b05c6fd 100644 --- a/dist/elements.js +++ b/dist/elements.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Elements */ -const MODULE_NAME="Elements";import{orDefault,isA,isPlainObject,isSelector,hasValue,assert,size,Deferred}from"./basic.js";import{randomUuid}from"./random.js";import{clone}from"./objects.js";import{onDomReady}from"./events.js";import{applyStyles}from"./css.js";const NOT_AN_HTMLELEMENT_ERROR="given node/target is not an HTMLElement";let BROWSER_HAS_CSS_SCOPE_SUPPORT;try{document.querySelector(":scope *")}catch(e){BROWSER_HAS_CSS_SCOPE_SUPPORT=!1}export function createNode(e,t=null,n=null){e=orDefault(e,"span","str").trim(),t=isPlainObject(t)?t:null,n=orDefault(n,null,"str");const s=document.createElement("div");/^<[^\/][^<>]*>/.test(e)&&/<\/[^<>\/]+>$/.test(e)?s.innerHTML=e:s.appendChild(document.createElement(e));const r=s.firstChild;if(s.removeChild(r),hasValue(t))for(let e in t)r.setAttribute(e,`${t[e]}`);return hasValue(n)&&(r.textContent=n),r}export function insertNode(e,t,n="beforeend"){switch(assert(isA(e,"htmlelement"),`Elements.insertNode | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(t,"htmlelement")||(t=createNode(`${t}`)),n){case"beforebegin":case"before":n="beforebegin";break;case"afterend":case"after":n="afterend";break;case"afterbegin":case"prepend":n="afterbegin";break;default:n="beforeend"}return e.insertAdjacentElement(n,t),t}export function replaceNode(e,t){const n="replaceNode";return assert(isA(e,"htmlelement"),`Elements.${n} | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(t,"htmlelement")||(t=createNode(`${t}`)),assert(isA(e.parentNode,"htmlelement"),`Elements.${n} | given target does not have a parent)`),insertNode(e,t,"after"),e.parentNode.removeChild(e),t}export function defineNode(e,t,n=null){const s="defineNode";assert(isA(e,"htmlelement"),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isPlainObject(t),`Elements:${s} | definitions is not a plain object`);const r="<-";return isA(n,"htmlelement")&&Array.from(n.attributes).forEach((e=>{(t[e.name]===r||!hasValue(t[e.name])&&(t["data*"]===r&&e.name.startsWith("data-")||t["on*"]===r&&e.name.startsWith("on")))&&(t[e.name]=e.value),(t[`+${e.name}`]===r||!hasValue(t[`+${e.name}`])&&(t["+data*"]===r&&e.name.startsWith("data-")||t["+on*"]===r&&e.name.startsWith("on")))&&(hasValue(t[`+${e.name}`])&&t[`+${e.name}`]!==r||(t[`+${e.name}`]=""),t[`+${e.name}`]+=e.value)})),delete t["data*"],delete t["+data*"],delete t["on*"],delete t["+on*"],Object.keys(t).forEach((e=>{t[e]===r&&delete t[e]})),Object.keys(t).sort().reverse().forEach((n=>{const s=t[n],r=n.startsWith("+");r&&(n=n.slice(1)),n.endsWith("*")&&(n=n.slice(0,-1)),"class"===n?(r||e.setAttribute("class",""),[].concat(s).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(`${t.trim()}`)}))}))):"style"===n?(r||e.setAttribute("style",""),[].concat(s).forEach((t=>{if(!isPlainObject(t)){const e=`${t}`.split(";"),n={};e.forEach((e=>{let[t,s]=e.split(":");t=t.trim(),hasValue(s)&&(s=s.trim(),s=s.endsWith(";")?s.slice(0,-1):s,n[t]=s)})),t=n}hasValue(t)&&applyStyles(e,t)}))):r?e.setAttribute(n,`${e.getAttribute(n)??""}${s}`):e.setAttribute(n,`${s}`)})),e}export function getTextContent(e,t=!1){if(t=orDefault(t,!1,"bool"),isA(e,"string")&&(e=createNode(e)),assert(isA(e,"htmlelement"),"Elements:getTextContent | target is neither node nor markup"),t){let t="";return e.childNodes.forEach((e=>{3===e.nodeType&&(t+=e.textContent)})),t}return e.textContent}export function isInDom(e){return assert(isA(e,"htmlelement"),`Elements:isInDom | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(document.contains,"function")?document.contains(e):document.body.contains(e)}export function getData(e,t=null){t=orDefault(t,null,"arr"),assert(isA(e,"htmlelement"),`Elements:getData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n={};return hasValue(t)?t.forEach((t=>{let s=e.getAttribute(`data-${t}`);if(hasValue(s))try{n[t]=JSON.parse(s)}catch(e){n[t]=s}})):Array.from(e.attributes).forEach((e=>{if(e.name.startsWith("data-")){const t=e.name.replace(/^data-/,"");try{n[t]=JSON.parse(e.value)}catch(s){n[t]=e.value}}})),0===size(n)?n=null:1===t?.length&&(n=n[t[0]]??null),n}export function setData(e,t,n=null){const s="setData";assert(isA(e,"htmlelement"),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`);let r=null;hasValue(n)&&(r=`${t}`,t={[r]:n}),assert(isPlainObject(t),`Elements:${s} | dataSet is not a plain object`);const a={};return Object.entries(t).forEach((([t,n])=>{if(isA(n,"function")&&(n=n()),void 0!==n){let s,r;try{s=JSON.stringify(n),r=JSON.parse(s)}catch(e){s=`${n}`,r=s}s=s.replace(/^['"]/,"").replace(/['"]$/,"").trim(),""!==s?(a[t]=r,e.setAttribute(`data-${t}`,s)):e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))}else e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))})),hasValue(r)?r in a?a[r]:null:size(a)>0?a:null}export function removeData(e,t=null){t=orDefault(t,null,"arr"),assert(isA(e,"htmlelement"),`Elements:removeData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n=getData(e,t);return hasValue(n)?setData(e,1===t?.length?{[t[0]]:void 0}:Object.keys(n).reduce(((e,t)=>(e[t]=void 0,e)),{})):n=null,n}export function find(e,t="*",n=!1){const s=/:scope(?![\w-])/gi;if(assert(isA(e,"htmlelement"),`Elements:find | ${NOT_AN_HTMLELEMENT_ERROR}`),t=orDefault(t,"*","str").trim(),s.test(t)||(t=`:scope ${t}`),n=orDefault(n,!1,"bool"),BROWSER_HAS_CSS_SCOPE_SUPPORT)return n?e.querySelector(t):Array.from(e.querySelectorAll(t));{const r=`find-scope-${randomUuid()}`;t=t.replace(s,`[${r}]`),e.setAttribute(r,"");const a=n?e.querySelector(t):Array.from(e.querySelectorAll(t));return e.removeAttribute(r),a}}export function findOne(e,t="*"){return find(e,t,!0)}export function findTextNodes(e,t=null,n=!1){t=isA(t,"function")?t:()=>!0,n=orDefault(n,!1,"bool"),assert(isA(e,"htmlelement"),`Elements:findTextNodes | ${NOT_AN_HTMLELEMENT_ERROR}`);const s=e=>3===e.nodeType&&""!==e.textContent.trim()&&!!t(e),r=e=>s(e)?[].concat(e):Array.from(e.childNodes).reduce(((e,t)=>s(t)?e.concat(t):n?e:e.concat(r(t))),[]);return r(e)}export function prime(e,t,n=null,s="primed"){const r="prime";n=orDefault(n,{}),s=orDefault(s,"primed","str"),assert(isA(e,"htmlelement"),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(t,"function"),`Elements:${r} | init is not a function`);const a=new Deferred;return!0!==getData(e,s)?(setData(e,s,!0),onDomReady((()=>{const n=t(e);hasValue(n)&&isA(n.then,"function")&&isA(n.catch,"function")?n.then((e=>{a.resolve(e)})).catch((e=>{a.reject(e)})):a.resolve(n),setData(e,`${s}-ready`,!0)}))):a.resolve(void 0),a.then((()=>{hasValue(n.remove)&&[].concat(n.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),hasValue(n.add)&&[].concat(n.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),setData(e,`${s}-resolved`,!0)})),a}export function measureHiddenDimensions(e,t="outer",n=null,s=null){const r="measureHidden",a={offset:{width:"offsetWidth",height:"offsetHeight"},outer:{width:"offsetWidth",height:"offsetHeight"},client:{width:"clientWidth",height:"clientHeight"},inner:{width:"clientWidth",height:"clientHeight"},scroll:{width:"scrollWidth",height:"scrollHeight"}};t=a[orDefault(t,"outer","str")]??a.outer,s=orDefault(s,document.body),assert(isA(e,"htmlelement"),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(s,"htmlelement"),`Elements:${r} | context is no an htmlelement`);const o=createNode("div",{id:`sandbox-${randomUuid()}`,class:"sandbox",style:"display:block; opacity:0; visibility:hidden; pointer-events:none; position:absolute; top:-10000px; left:-10000px;"}),i=clone(e);s.appendChild(o),o.appendChild(i);const l=isSelector(n)?i.querySelector(n):i,c=l?.[t.width]??0,d=l?.[t.height]??0,u={width:c,height:d,toString:()=>`${c}x${d}`};return s.removeChild(o),u} +const MODULE_NAME="Elements";import{orDefault,isA,isPlainObject,isSelector,isElement,hasValue,assert,size,Deferred}from"./basic.js";import{randomUuid}from"./random.js";import{clone}from"./objects.js";import{onDomReady}from"./events.js";import{applyStyles}from"./css.js";const NOT_AN_HTMLELEMENT_ERROR="given node/target is not an HTMLElement";let BROWSER_HAS_CSS_SCOPE_SUPPORT;try{document.querySelector(":scope *")}catch(e){BROWSER_HAS_CSS_SCOPE_SUPPORT=!1}export function createNode(e,t=null,n=null){e=orDefault(e,"span","str").trim(),t=isPlainObject(t)?t:null,n=orDefault(n,null,"str");const s=document.createElement("div");/^<[^\/][^<>]*>/.test(e)&&/<\/[^<>\/]+>$/.test(e)?s.innerHTML=e:s.appendChild(document.createElement(e));const r=s.firstChild;if(s.removeChild(r),hasValue(t))for(let e in t)r.setAttribute(e,`${t[e]}`);return hasValue(n)&&(r.textContent=n),r}export function insertNode(e,t,n="beforeend"){switch(assert(isElement(e),`Elements.insertNode | ${NOT_AN_HTMLELEMENT_ERROR}`),isElement(t)||(t=createNode(`${t}`)),n){case"beforebegin":case"before":n="beforebegin";break;case"afterend":case"after":n="afterend";break;case"afterbegin":case"prepend":n="afterbegin";break;default:n="beforeend"}return e.insertAdjacentElement(n,t),t}export function replaceNode(e,t){const n="replaceNode";return assert(isElement(e),`Elements.${n} | ${NOT_AN_HTMLELEMENT_ERROR}`),isElement(t)||(t=createNode(`${t}`)),assert(isElement(e.parentNode),`Elements.${n} | given target does not have a parent)`),insertNode(e,t,"after"),e.parentNode.removeChild(e),t}export function defineNode(e,t,n=null){const s="defineNode";assert(isElement(e),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isPlainObject(t),`Elements:${s} | definitions is not a plain object`);const r="<-";return isElement(n)&&Array.from(n.attributes).forEach((e=>{(t[e.name]===r||!hasValue(t[e.name])&&(t["data*"]===r&&e.name.startsWith("data-")||t["on*"]===r&&e.name.startsWith("on")))&&(t[e.name]=e.value),(t[`+${e.name}`]===r||!hasValue(t[`+${e.name}`])&&(t["+data*"]===r&&e.name.startsWith("data-")||t["+on*"]===r&&e.name.startsWith("on")))&&(hasValue(t[`+${e.name}`])&&t[`+${e.name}`]!==r||(t[`+${e.name}`]=""),t[`+${e.name}`]+=e.value)})),delete t["data*"],delete t["+data*"],delete t["on*"],delete t["+on*"],Object.keys(t).forEach((e=>{t[e]===r&&delete t[e]})),Object.keys(t).sort().reverse().forEach((n=>{const s=t[n],r=n.startsWith("+");r&&(n=n.slice(1)),n.endsWith("*")&&(n=n.slice(0,-1)),"class"===n?(r||e.setAttribute("class",""),[].concat(s).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(`${t.trim()}`)}))}))):"style"===n?(r||e.setAttribute("style",""),[].concat(s).forEach((t=>{if(!isPlainObject(t)){const e=`${t}`.split(";"),n={};e.forEach((e=>{let[t,s]=e.split(":");t=t.trim(),hasValue(s)&&(s=s.trim(),s=s.endsWith(";")?s.slice(0,-1):s,n[t]=s)})),t=n}hasValue(t)&&applyStyles(e,t)}))):r?e.setAttribute(n,`${e.getAttribute(n)??""}${s}`):e.setAttribute(n,`${s}`)})),e}export function getTextContent(e,t=!1){if(t=orDefault(t,!1,"bool"),isA(e,"string")&&(e=createNode(e)),assert(isElement(e),"Elements:getTextContent | target is neither node nor markup"),t){let t="";return e.childNodes.forEach((e=>{3===e.nodeType&&(t+=e.textContent)})),t}return e.textContent}export function isInDom(e){return assert(isElement(e),`Elements:isInDom | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(document.contains,"function")?document.contains(e):document.body.contains(e)}export function getData(e,t=null){t=orDefault(t,null,"arr"),assert(isElement(e),`Elements:getData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n={};return hasValue(t)?t.forEach((t=>{let s=e.getAttribute(`data-${t}`);if(hasValue(s))try{n[t]=JSON.parse(s)}catch(e){n[t]=s}})):Array.from(e.attributes).forEach((e=>{if(e.name.startsWith("data-")){const t=e.name.replace(/^data-/,"");try{n[t]=JSON.parse(e.value)}catch(s){n[t]=e.value}}})),0===size(n)?n=null:1===t?.length&&(n=n[t[0]]??null),n}export function setData(e,t,n=null){const s="setData";assert(isElement(e),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`);let r=null;hasValue(n)&&(r=`${t}`,t={[r]:n}),assert(isPlainObject(t),`Elements:${s} | dataSet is not a plain object`);const a={};return Object.entries(t).forEach((([t,n])=>{if(isA(n,"function")&&(n=n()),void 0!==n){let s,r;try{s=JSON.stringify(n),r=JSON.parse(s)}catch(e){s=`${n}`,r=s}s=s.replace(/^['"]/,"").replace(/['"]$/,"").trim(),""!==s?(a[t]=r,e.setAttribute(`data-${t}`,s)):e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))}else e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))})),hasValue(r)?r in a?a[r]:null:size(a)>0?a:null}export function removeData(e,t=null){t=orDefault(t,null,"arr"),assert(isElement(e),`Elements:removeData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n=getData(e,t);return hasValue(n)?setData(e,1===t?.length?{[t[0]]:void 0}:Object.keys(n).reduce(((e,t)=>(e[t]=void 0,e)),{})):n=null,n}export function find(e,t="*",n=!1){const s=/:scope(?![\w-])/gi;if(assert(isElement(e),`Elements:find | ${NOT_AN_HTMLELEMENT_ERROR}`),t=orDefault(t,"*","str").trim(),s.test(t)||(t=`:scope ${t}`),n=orDefault(n,!1,"bool"),BROWSER_HAS_CSS_SCOPE_SUPPORT)return n?e.querySelector(t):Array.from(e.querySelectorAll(t));{const r=`find-scope-${randomUuid()}`;t=t.replace(s,`[${r}]`),e.setAttribute(r,"");const a=n?e.querySelector(t):Array.from(e.querySelectorAll(t));return e.removeAttribute(r),a}}export function findOne(e,t="*"){return find(e,t,!0)}export function findTextNodes(e,t=null,n=!1){t=isA(t,"function")?t:()=>!0,n=orDefault(n,!1,"bool"),assert(isElement(e),`Elements:findTextNodes | ${NOT_AN_HTMLELEMENT_ERROR}`);const s=e=>3===e.nodeType&&""!==e.textContent.trim()&&!!t(e),r=e=>s(e)?[].concat(e):Array.from(e.childNodes).reduce(((e,t)=>s(t)?e.concat(t):n?e:e.concat(r(t))),[]);return r(e)}export function prime(e,t,n=null,s="primed"){const r="prime";n=orDefault(n,{}),s=orDefault(s,"primed","str"),assert(isElement(e),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(t,"function"),`Elements:${r} | init is not a function`);const a=new Deferred;return!0!==getData(e,s)?(setData(e,s,!0),onDomReady((()=>{const n=t(e);hasValue(n)&&isA(n.then,"function")&&isA(n.catch,"function")?n.then((e=>{a.resolve(e)})).catch((e=>{a.reject(e)})):a.resolve(n),setData(e,`${s}-ready`,!0)}))):a.resolve(void 0),a.then((()=>{hasValue(n.remove)&&[].concat(n.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),hasValue(n.add)&&[].concat(n.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),setData(e,`${s}-resolved`,!0)})),a}export function measureHiddenDimensions(e,t="outer",n=null,s=null){const r="measureHidden",a={offset:{width:"offsetWidth",height:"offsetHeight"},outer:{width:"offsetWidth",height:"offsetHeight"},client:{width:"clientWidth",height:"clientHeight"},inner:{width:"clientWidth",height:"clientHeight"},scroll:{width:"scrollWidth",height:"scrollHeight"}};t=a[orDefault(t,"outer","str")]??a.outer,s=orDefault(s,document.body),assert(isElement(e),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isElement(s),`Elements:${r} | context is no an htmlelement`);const o=createNode("div",{id:`sandbox-${randomUuid()}`,class:"sandbox",style:"display:block; opacity:0; visibility:hidden; pointer-events:none; position:absolute; top:-10000px; left:-10000px;"}),i=clone(e);s.appendChild(o),o.appendChild(i);const l=isSelector(n)?i.querySelector(n):i,c=l?.[t.width]??0,d=l?.[t.height]??0,u={width:c,height:d,toString:()=>`${c}x${d}`};return s.removeChild(o),u} //# sourceMappingURL=elements.js.map diff --git a/dist/elements.js.map b/dist/elements.js.map index db331aae..fa897e6e 100644 --- a/dist/elements.js.map +++ b/dist/elements.js.map @@ -1 +1 @@ -{"version":3,"file":"elements.js","names":["MODULE_NAME","orDefault","isA","isPlainObject","isSelector","hasValue","assert","size","Deferred","randomUuid","clone","onDomReady","applyStyles","NOT_AN_HTMLELEMENT_ERROR","BROWSER_HAS_CSS_SCOPE_SUPPORT","document","querySelector","ex","createNode","tag","attributes","content","trim","outerNode","createElement","test","innerHTML","appendChild","node","firstChild","removeChild","attribute","setAttribute","textContent","insertNode","target","position","insertAdjacentElement","replaceNode","__methodName__","parentNode","defineNode","definition","boilerplateNode","inheritValue","Array","from","forEach","name","startsWith","value","Object","keys","sort","reverse","addValue","slice","endsWith","concat","split","classList","add","rules","valueObj","rule","key","prop","getAttribute","getTextContent","onlyFirstLevel","childNodes","nodeType","isInDom","contains","body","getData","properties","data","property","attributeValue","JSON","parse","replace","length","setData","dataSet","singleValue","singleKey","appliedValues","entries","undefined","stringifiedValue","getValue","stringify","hasAttribute","removeAttribute","removeData","reduce","removalDataSet","find","selector","onlyOne","scopeRex","querySelectorAll","fallbackScopeAttribute","found","findOne","findTextNodes","filter","isValidTextNode","extractTextNodes","textNodes","childNode","prime","init","classChanges","markerAttributesName","deferred","initResult","then","catch","resolution","resolve","error","reject","remove","removeClass","addClass","measureHiddenDimensions","method","context","methods","offset","width","height","outer","client","inner","scroll","sandbox","id","class","style","measureClone","dimensions","toString"],"sources":["elements.js"],"mappings":";;;AAQA,MAAMA,YAAc,kBAMZC,UAAWC,IAAKC,cAAeC,WAAYC,SAAUC,OAAQC,KAAMC,aAAe,oBAClFC,eAAiB,qBACjBC,UAAY,sBACZC,eAAiB,qBACjBC,gBAAkB,WAM1B,MAAMC,yBAA2B,0CACjC,IAAIC,8BACJ,IACCC,SAASC,cAAc,WAGxB,CAFE,MAAMC,GACPH,+BAAgC,CACjC,QA0CO,SAASI,WAAWC,EAAKC,EAAW,KAAMC,EAAQ,MACxDF,EAAMlB,UAAUkB,EAAK,OAAQ,OAAOG,OACpCF,EAAajB,cAAciB,GAAcA,EAAa,KACtDC,EAAUpB,UAAUoB,EAAS,KAAM,OAInC,MAAME,EAAYR,SAASS,cAAc,OAGxC,iBAAiBC,KAAKN,IACnB,gBAAgBM,KAAKN,GAIxBI,EAAUG,UAAYP,EAEtBI,EAAUI,YAAYZ,SAASS,cAAcL,IAG9C,MAAMS,EAAOL,EAAUM,WAGvB,GAFAN,EAAUO,YAAYF,GAElBvB,SAASe,GACZ,IAAK,IAAIW,KAAaX,EACrBQ,EAAKI,aAAaD,EAAW,GAAGX,EAAWW,MAQ7C,OAJI1B,SAASgB,KACZO,EAAKK,YAAcZ,GAGbO,C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,EAASzG,OAAO,GAClC,IAIJ8D,QAAQxD,EAAM,GAAGwF,cAAiC,EAAK,IAGjDC,CACR,QAqCO,SAASW,wBAAwBpG,EAAMqG,EAAO,QAAS7B,EAAS,KAAM8B,EAAQ,MACpF,MAAM3F,EAAiB,gBAEjB4F,EAAU,CACfC,OAAS,CAACC,MAAQ,cAAeC,OAAS,gBAC1CC,MAAQ,CAACF,MAAQ,cAAeC,OAAS,gBACzCE,OAAS,CAACH,MAAQ,cAAeC,OAAS,gBAC1CG,MAAQ,CAACJ,MAAQ,cAAeC,OAAS,gBACzCI,OAAS,CAACL,MAAQ,cAAeC,OAAS,iBAE3CL,EAASE,EAAQlI,UAAUgI,EAAQ,QAAS,SAAWE,EAAQI,MAE/DL,EAAUjI,UAAUiI,EAASnH,SAAS2D,MAEtCpE,OAAOJ,IAAI0B,EAAM,eAAgB,YAAkBW,OAAoB1B,4BACvEP,OAAOJ,IAAIgI,EAAS,eAAgB,YAAkB3F,oCAEtD,MACCoG,EAAUzH,WAAW,MAAO,CAC3B0H,GAAO,WAAWnI,eAClBoI,MAAU,UACVC,MAAU,sHAEXC,EAAerI,MAAMkB,GAGtBsG,EAAQvG,YAAYgH,GACpBA,EAAQhH,YAAYoH,GAEpB,MACC5G,EAAS/B,WAAWgG,GAAY2C,EAAa/H,cAAcoF,GAAY2C,EACvEV,EAAQlG,IAAS8F,EAAOI,QAAU,EAClCC,EAASnG,IAAS8F,EAAOK,SAAW,EACpCU,EAAa,CACZX,QACAC,SACAW,SAAQ,IAAW,GAAGZ,KAASC,KAMjC,OAFAJ,EAAQpG,YAAY6G,GAEbK,CACR","sourcesContent":["/*!\n * Module Elements\n */\n\n/**\n * @namespace Elements\n */\n\nconst MODULE_NAME = 'Elements';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {orDefault, isA, isPlainObject, isSelector, hasValue, assert, size, Deferred} from './basic.js';\nimport {randomUuid} from './random.js';\nimport {clone} from './objects.js';\nimport {onDomReady} from './events.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst NOT_AN_HTMLELEMENT_ERROR = 'given node/target is not an HTMLElement';\nlet BROWSER_HAS_CSS_SCOPE_SUPPORT;\ntry {\n\tdocument.querySelector(':scope *');\n} catch(ex){\n\tBROWSER_HAS_CSS_SCOPE_SUPPORT = false;\n}\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Elements:createNode\n */\n\n/**\n * Creates an element on the fly programmatically, based on provided name, attributes and content or markup,\n * without inserting it into the DOM.\n *\n * If you provide markup as \"tag\", make sure that there is one single root element, this method returns exactly one\n * element, not a NodeList. Also be sure to _not_ just pass HTML source from an unsecure source, since this\n * method does not deal with potential security risks.\n *\n * One thing about dynamically creating script tags with this: if you want the script is javascript and you want to\n * actually execute the script upon adding it to the dom, you cannot provide the complete tag as a source string,\n * since scripts created with innerHTML will not execute.\n * (see: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations)\n * Instead, just provide the tag name and define attributes and source via the parameters instead.\n *\n * @param {?String} [tag='span'] - tag of the element to create or markup for root element\n * @param {?Object} [attributes=null] - tag attributes as key/value-pairs, will also be added to provided markup\n * @param {?String} [content=null] - content to insert into the element as textContent, be aware, that this will replace other content in provided markup\n * @returns {HTMLElement} the created DOM-node\n *\n * @memberof Elements:createNode\n * @alias createNode\n * @example\n * document.body.appendChild(\n * createNode('div', {id : 'content', style : 'display:none;'}, 'loading...')\n * );\n * document.body.appendChild(\n * createNode('
loading...
')\n * );\n * document.body.appendChild(\n * createNode('script', {type : 'text/javascript'}, 'alert(\"Hello World\");');\n * );\n */\nexport function createNode(tag, attributes=null, content=null){\n\ttag = orDefault(tag, 'span', 'str').trim();\n\tattributes = isPlainObject(attributes) ? attributes : null;\n\tcontent = orDefault(content, null, 'str');\n\n\t// using anything more generic like template results in non-standard nodes like\n\t// diff --git a/docs/documentation/Animation_EasingFunctions.html b/docs/documentation/Animation_EasingFunctions.html index aa6d8d40..a575040e 100644 --- a/docs/documentation/Animation_EasingFunctions.html +++ b/docs/documentation/Animation_EasingFunctions.html @@ -202,13 +202,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Animation_transition.html b/docs/documentation/Animation_transition.html index 0c385415..53c8bbd8 100644 --- a/docs/documentation/Animation_transition.html +++ b/docs/documentation/Animation_transition.html @@ -444,13 +444,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Arrays.html b/docs/documentation/Arrays.html index c5a0db7d..43ad278b 100644 --- a/docs/documentation/Arrays.html +++ b/docs/documentation/Arrays.html @@ -113,13 +113,13 @@

Arrays


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Arrays_removeFrom.html b/docs/documentation/Arrays_removeFrom.html index daa81e54..c2c5c213 100644 --- a/docs/documentation/Arrays_removeFrom.html +++ b/docs/documentation/Arrays_removeFrom.html @@ -414,13 +414,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic.html b/docs/documentation/Basic.html index 4e173cf0..2990f65c 100644 --- a/docs/documentation/Basic.html +++ b/docs/documentation/Basic.html @@ -113,13 +113,13 @@

Basic


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_Deferred.html b/docs/documentation/Basic_Deferred.html index 77c11a9c..47043151 100644 --- a/docs/documentation/Basic_Deferred.html +++ b/docs/documentation/Basic_Deferred.html @@ -70,7 +70,7 @@

Basic:Deferred

Source:
@@ -159,7 +159,7 @@

(static) Def
Source:
@@ -210,13 +210,13 @@

Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_Observable.html b/docs/documentation/Basic_Observable.html index 5e475785..d24c07b0 100644 --- a/docs/documentation/Basic_Observable.html +++ b/docs/documentation/Basic_Observable.html @@ -70,7 +70,7 @@

Basic:Observable

Source:
@@ -147,7 +147,7 @@

(static) O
Source:
@@ -191,13 +191,13 @@

Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_assert.html b/docs/documentation/Basic_assert.html index 50499ca2..b6d15364 100644 --- a/docs/documentation/Basic_assert.html +++ b/docs/documentation/Basic_assert.html @@ -326,13 +326,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_attempt.html b/docs/documentation/Basic_attempt.html index f56fc435..4a0febfb 100644 --- a/docs/documentation/Basic_attempt.html +++ b/docs/documentation/Basic_attempt.html @@ -291,13 +291,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_getType.html b/docs/documentation/Basic_getType.html index 1134b830..842f4ba4 100644 --- a/docs/documentation/Basic_getType.html +++ b/docs/documentation/Basic_getType.html @@ -317,13 +317,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_hasMembers.html b/docs/documentation/Basic_hasMembers.html index 492d9fa1..e69a2012 100644 --- a/docs/documentation/Basic_hasMembers.html +++ b/docs/documentation/Basic_hasMembers.html @@ -369,13 +369,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_hasValue.html b/docs/documentation/Basic_hasValue.html index aae64b18..06ab99f9 100644 --- a/docs/documentation/Basic_hasValue.html +++ b/docs/documentation/Basic_hasValue.html @@ -293,13 +293,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isA.html b/docs/documentation/Basic_isA.html index 7ae660cd..b79a483a 100644 --- a/docs/documentation/Basic_isA.html +++ b/docs/documentation/Basic_isA.html @@ -306,13 +306,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isElement.html b/docs/documentation/Basic_isElement.html new file mode 100644 index 00000000..3f8cee9a --- /dev/null +++ b/docs/documentation/Basic_isElement.html @@ -0,0 +1,294 @@ + + + + + JSDoc: Namespace: Basic:isElement + + + + + + + + + + +
+ +

Namespace: Basic:isElement

+ + + + + + +
+ +
+ +

Basic:isElement

+ + +
+ +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

isElement(value) → {Boolean}

+ + + + + +
+

Returns if a value is an HTML element. +Be aware, that this explicitly means an element, not necessarily any node. +So text nodes, comments and such do not qualify.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +* + + + +

the value to check

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if value is an HTML element +
+ + + +
+
+ Type +
+
+ +Boolean + + +
+
+ + + + +
Example
+ +
if( isElement(target) ){
+  target.classList.add('foo');
+}
+ + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time) +
+ + + + + \ No newline at end of file diff --git a/docs/documentation/Basic_isEmpty.html b/docs/documentation/Basic_isEmpty.html index e220c647..93104db2 100644 --- a/docs/documentation/Basic_isEmpty.html +++ b/docs/documentation/Basic_isEmpty.html @@ -296,13 +296,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isEventTarget.html b/docs/documentation/Basic_isEventTarget.html index fd16df28..eacef030 100644 --- a/docs/documentation/Basic_isEventTarget.html +++ b/docs/documentation/Basic_isEventTarget.html @@ -70,7 +70,7 @@

Basic:isEventTarget

Source:
@@ -210,7 +210,7 @@
Parameters:
Source:
@@ -281,13 +281,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isFloat.html b/docs/documentation/Basic_isFloat.html index 041cbf0a..53663223 100644 --- a/docs/documentation/Basic_isFloat.html +++ b/docs/documentation/Basic_isFloat.html @@ -280,13 +280,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isInt.html b/docs/documentation/Basic_isInt.html index d3257561..190f640e 100644 --- a/docs/documentation/Basic_isInt.html +++ b/docs/documentation/Basic_isInt.html @@ -279,13 +279,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isNaN.html b/docs/documentation/Basic_isNaN.html index d3b923d7..ea3e9d8e 100644 --- a/docs/documentation/Basic_isNaN.html +++ b/docs/documentation/Basic_isNaN.html @@ -337,13 +337,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isPlainObject.html b/docs/documentation/Basic_isPlainObject.html index 54555534..c01f7f6d 100644 --- a/docs/documentation/Basic_isPlainObject.html +++ b/docs/documentation/Basic_isPlainObject.html @@ -281,13 +281,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isPotentialId.html b/docs/documentation/Basic_isPotentialId.html index e4e53087..246b5e0e 100644 --- a/docs/documentation/Basic_isPotentialId.html +++ b/docs/documentation/Basic_isPotentialId.html @@ -70,7 +70,7 @@

Basic:isPotentialId

Source:
@@ -391,7 +391,7 @@
Parameters:
Source:
@@ -465,13 +465,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_isSelector.html b/docs/documentation/Basic_isSelector.html index 649eefcd..55a9f070 100644 --- a/docs/documentation/Basic_isSelector.html +++ b/docs/documentation/Basic_isSelector.html @@ -70,7 +70,7 @@

Basic:isSelector

Source:
@@ -207,7 +207,7 @@
Parameters:
Source:
@@ -278,13 +278,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_minMax.html b/docs/documentation/Basic_minMax.html index 473c2d1e..14f8dcc7 100644 --- a/docs/documentation/Basic_minMax.html +++ b/docs/documentation/Basic_minMax.html @@ -70,7 +70,7 @@

Basic:minMax

Source:
@@ -254,7 +254,7 @@
Parameters:
Source:
@@ -335,13 +335,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_orDefault.html b/docs/documentation/Basic_orDefault.html index 4246975e..d3d2d881 100644 --- a/docs/documentation/Basic_orDefault.html +++ b/docs/documentation/Basic_orDefault.html @@ -415,13 +415,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Basic_size.html b/docs/documentation/Basic_size.html index 775a4366..149f6027 100644 --- a/docs/documentation/Basic_size.html +++ b/docs/documentation/Basic_size.html @@ -378,13 +378,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/CSS.html b/docs/documentation/CSS.html index 5f183a1b..fb8966d3 100644 --- a/docs/documentation/CSS.html +++ b/docs/documentation/CSS.html @@ -113,13 +113,13 @@

CSS


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/CSS_applyStyles.html b/docs/documentation/CSS_applyStyles.html index c41ffbca..32cbdefd 100644 --- a/docs/documentation/CSS_applyStyles.html +++ b/docs/documentation/CSS_applyStyles.html @@ -448,13 +448,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/CSS_cssUrlValueToUrl.html b/docs/documentation/CSS_cssUrlValueToUrl.html index 54d56ba9..c82073f6 100644 --- a/docs/documentation/CSS_cssUrlValueToUrl.html +++ b/docs/documentation/CSS_cssUrlValueToUrl.html @@ -384,13 +384,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/CSS_cssValueToNumber.html b/docs/documentation/CSS_cssValueToNumber.html index 52ee16c9..28fed982 100644 --- a/docs/documentation/CSS_cssValueToNumber.html +++ b/docs/documentation/CSS_cssValueToNumber.html @@ -281,13 +281,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/CSS_remByPx.html b/docs/documentation/CSS_remByPx.html index 7ff4a1cc..228bf570 100644 --- a/docs/documentation/CSS_remByPx.html +++ b/docs/documentation/CSS_remByPx.html @@ -364,13 +364,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context.html b/docs/documentation/Context.html index 7c29572c..255bc37c 100644 --- a/docs/documentation/Context.html +++ b/docs/documentation/Context.html @@ -113,13 +113,13 @@

Context


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_browserSupportsHistoryManipulation.html b/docs/documentation/Context_browserSupportsHistoryManipulation.html index ebcc4ea1..e7feb31d 100644 --- a/docs/documentation/Context_browserSupportsHistoryManipulation.html +++ b/docs/documentation/Context_browserSupportsHistoryManipulation.html @@ -229,13 +229,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_contextHasHighDpi.html b/docs/documentation/Context_contextHasHighDpi.html index 9e7bd181..595c5367 100644 --- a/docs/documentation/Context_contextHasHighDpi.html +++ b/docs/documentation/Context_contextHasHighDpi.html @@ -230,13 +230,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_detectAppleDevice.html b/docs/documentation/Context_detectAppleDevice.html index 9177a3c4..7799e392 100644 --- a/docs/documentation/Context_detectAppleDevice.html +++ b/docs/documentation/Context_detectAppleDevice.html @@ -303,13 +303,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_detectInteractionType.html b/docs/documentation/Context_detectInteractionType.html index a5303b06..50921749 100644 --- a/docs/documentation/Context_detectInteractionType.html +++ b/docs/documentation/Context_detectInteractionType.html @@ -313,13 +313,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_getBrowserLanguage.html b/docs/documentation/Context_getBrowserLanguage.html index 8850a7de..8794c2fd 100644 --- a/docs/documentation/Context_getBrowserLanguage.html +++ b/docs/documentation/Context_getBrowserLanguage.html @@ -310,13 +310,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_getBrowserLocale.html b/docs/documentation/Context_getBrowserLocale.html index d31fb3aa..d3d76122 100644 --- a/docs/documentation/Context_getBrowserLocale.html +++ b/docs/documentation/Context_getBrowserLocale.html @@ -320,13 +320,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_getBrowserScrollbarWidth.html b/docs/documentation/Context_getBrowserScrollbarWidth.html index e8d4d75e..6f145af3 100644 --- a/docs/documentation/Context_getBrowserScrollbarWidth.html +++ b/docs/documentation/Context_getBrowserScrollbarWidth.html @@ -231,13 +231,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Context_getLocale.html b/docs/documentation/Context_getLocale.html index a11d5a2f..1ee293f8 100644 --- a/docs/documentation/Context_getLocale.html +++ b/docs/documentation/Context_getLocale.html @@ -363,13 +363,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Cookies.html b/docs/documentation/Cookies.html index dc1c6930..72aefd58 100644 --- a/docs/documentation/Cookies.html +++ b/docs/documentation/Cookies.html @@ -113,13 +113,13 @@

Cookies


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Cookies_getCookie.html b/docs/documentation/Cookies_getCookie.html index a820e891..1d164907 100644 --- a/docs/documentation/Cookies_getCookie.html +++ b/docs/documentation/Cookies_getCookie.html @@ -313,13 +313,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Cookies_getCookies.html b/docs/documentation/Cookies_getCookies.html index bbc65a13..f82651eb 100644 --- a/docs/documentation/Cookies_getCookies.html +++ b/docs/documentation/Cookies_getCookies.html @@ -308,13 +308,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Cookies_removeCookie.html b/docs/documentation/Cookies_removeCookie.html index 44f1f155..c8dccb70 100644 --- a/docs/documentation/Cookies_removeCookie.html +++ b/docs/documentation/Cookies_removeCookie.html @@ -331,13 +331,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Cookies_setCookie.html b/docs/documentation/Cookies_setCookie.html index d02058e9..c5efae42 100644 --- a/docs/documentation/Cookies_setCookie.html +++ b/docs/documentation/Cookies_setCookie.html @@ -372,13 +372,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements.html b/docs/documentation/Elements.html index 74eb01a7..c7982e9f 100644 --- a/docs/documentation/Elements.html +++ b/docs/documentation/Elements.html @@ -113,13 +113,13 @@

Elements


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_createNode.html b/docs/documentation/Elements_createNode.html index 902d025b..d6c0938d 100644 --- a/docs/documentation/Elements_createNode.html +++ b/docs/documentation/Elements_createNode.html @@ -396,13 +396,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_defineNode.html b/docs/documentation/Elements_defineNode.html index 91af8b22..e3aa842f 100644 --- a/docs/documentation/Elements_defineNode.html +++ b/docs/documentation/Elements_defineNode.html @@ -413,13 +413,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_find.html b/docs/documentation/Elements_find.html index 2c75e6ce..777fff0e 100644 --- a/docs/documentation/Elements_find.html +++ b/docs/documentation/Elements_find.html @@ -421,13 +421,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_findOne.html b/docs/documentation/Elements_findOne.html index 3ea369de..dff9cef9 100644 --- a/docs/documentation/Elements_findOne.html +++ b/docs/documentation/Elements_findOne.html @@ -367,13 +367,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_findTextNodes.html b/docs/documentation/Elements_findTextNodes.html index ae21c35f..7cffdd10 100644 --- a/docs/documentation/Elements_findTextNodes.html +++ b/docs/documentation/Elements_findTextNodes.html @@ -398,13 +398,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_getData.html b/docs/documentation/Elements_getData.html index e88f0f69..93ff2389 100644 --- a/docs/documentation/Elements_getData.html +++ b/docs/documentation/Elements_getData.html @@ -385,13 +385,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_getTextContent.html b/docs/documentation/Elements_getTextContent.html index bb168263..c3eceb1c 100644 --- a/docs/documentation/Elements_getTextContent.html +++ b/docs/documentation/Elements_getTextContent.html @@ -349,13 +349,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_insertNode.html b/docs/documentation/Elements_insertNode.html index 58928269..34b04d9d 100644 --- a/docs/documentation/Elements_insertNode.html +++ b/docs/documentation/Elements_insertNode.html @@ -394,13 +394,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_isInDom.html b/docs/documentation/Elements_isInDom.html index 8b6bbf82..51ef4143 100644 --- a/docs/documentation/Elements_isInDom.html +++ b/docs/documentation/Elements_isInDom.html @@ -289,13 +289,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_measureHiddenDimensions.html b/docs/documentation/Elements_measureHiddenDimensions.html index 836e54af..4aff0930 100644 --- a/docs/documentation/Elements_measureHiddenDimensions.html +++ b/docs/documentation/Elements_measureHiddenDimensions.html @@ -444,13 +444,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_prime.html b/docs/documentation/Elements_prime.html index fce30163..4f0200ac 100644 --- a/docs/documentation/Elements_prime.html +++ b/docs/documentation/Elements_prime.html @@ -451,13 +451,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_removeData.html b/docs/documentation/Elements_removeData.html index 884a7d1f..d1b85a83 100644 --- a/docs/documentation/Elements_removeData.html +++ b/docs/documentation/Elements_removeData.html @@ -375,13 +375,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_replaceNode.html b/docs/documentation/Elements_replaceNode.html index 0f033161..c15634ac 100644 --- a/docs/documentation/Elements_replaceNode.html +++ b/docs/documentation/Elements_replaceNode.html @@ -317,13 +317,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Elements_setData.html b/docs/documentation/Elements_setData.html index 0ca3aa50..7ec0d139 100644 --- a/docs/documentation/Elements_setData.html +++ b/docs/documentation/Elements_setData.html @@ -425,13 +425,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events.html b/docs/documentation/Events.html index 95f6d71b..8b7e395a 100644 --- a/docs/documentation/Events.html +++ b/docs/documentation/Events.html @@ -113,13 +113,13 @@

Events


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_emit.html b/docs/documentation/Events_emit.html index 16eb8ca9..60853339 100644 --- a/docs/documentation/Events_emit.html +++ b/docs/documentation/Events_emit.html @@ -525,13 +525,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_emitPostMessage.html b/docs/documentation/Events_emitPostMessage.html index cc180b20..2995ed18 100644 --- a/docs/documentation/Events_emitPostMessage.html +++ b/docs/documentation/Events_emitPostMessage.html @@ -432,13 +432,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_fire.html b/docs/documentation/Events_fire.html index 6d7b2ea4..59b6624f 100644 --- a/docs/documentation/Events_fire.html +++ b/docs/documentation/Events_fire.html @@ -447,13 +447,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_off.html b/docs/documentation/Events_off.html index e9551fa3..79c71fa1 100644 --- a/docs/documentation/Events_off.html +++ b/docs/documentation/Events_off.html @@ -491,13 +491,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_offDetachedElements.html b/docs/documentation/Events_offDetachedElements.html index f89b908f..faca2d88 100644 --- a/docs/documentation/Events_offDetachedElements.html +++ b/docs/documentation/Events_offDetachedElements.html @@ -324,13 +324,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_offPostMessage.html b/docs/documentation/Events_offPostMessage.html index 3a3c90d8..a665762a 100644 --- a/docs/documentation/Events_offPostMessage.html +++ b/docs/documentation/Events_offPostMessage.html @@ -482,13 +482,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_offSwipe.html b/docs/documentation/Events_offSwipe.html index a6046234..0790beb8 100644 --- a/docs/documentation/Events_offSwipe.html +++ b/docs/documentation/Events_offSwipe.html @@ -479,13 +479,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_on.html b/docs/documentation/Events_on.html index f41f10ad..51a0aaec 100644 --- a/docs/documentation/Events_on.html +++ b/docs/documentation/Events_on.html @@ -527,13 +527,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_onDomReady.html b/docs/documentation/Events_onDomReady.html index 60ea270f..0faac49e 100644 --- a/docs/documentation/Events_onDomReady.html +++ b/docs/documentation/Events_onDomReady.html @@ -255,13 +255,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_onPostMessage.html b/docs/documentation/Events_onPostMessage.html index 5b226332..31500cb0 100644 --- a/docs/documentation/Events_onPostMessage.html +++ b/docs/documentation/Events_onPostMessage.html @@ -370,13 +370,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_onSwipe.html b/docs/documentation/Events_onSwipe.html index a452ccad..1d137abf 100644 --- a/docs/documentation/Events_onSwipe.html +++ b/docs/documentation/Events_onSwipe.html @@ -551,13 +551,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_once.html b/docs/documentation/Events_once.html index d62611f7..fe1c436d 100644 --- a/docs/documentation/Events_once.html +++ b/docs/documentation/Events_once.html @@ -487,13 +487,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_pause.html b/docs/documentation/Events_pause.html index 9465b230..6f51c239 100644 --- a/docs/documentation/Events_pause.html +++ b/docs/documentation/Events_pause.html @@ -484,13 +484,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Events_resume.html b/docs/documentation/Events_resume.html index 697a7014..1795df69 100644 --- a/docs/documentation/Events_resume.html +++ b/docs/documentation/Events_resume.html @@ -440,13 +440,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Fonts.html b/docs/documentation/Fonts.html index 006662a6..6038cb2c 100644 --- a/docs/documentation/Fonts.html +++ b/docs/documentation/Fonts.html @@ -113,13 +113,13 @@

Fonts


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Fonts_waitForWebfonts.html b/docs/documentation/Fonts_waitForWebfonts.html index 9185a7e6..ecb9d3b3 100644 --- a/docs/documentation/Fonts_waitForWebfonts.html +++ b/docs/documentation/Fonts_waitForWebfonts.html @@ -388,13 +388,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Forms.html b/docs/documentation/Forms.html index 446fd5e3..e0985d6f 100644 --- a/docs/documentation/Forms.html +++ b/docs/documentation/Forms.html @@ -113,13 +113,13 @@

Forms


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Forms_formDataToObject.html b/docs/documentation/Forms_formDataToObject.html index b41a56ab..3ec66309 100644 --- a/docs/documentation/Forms_formDataToObject.html +++ b/docs/documentation/Forms_formDataToObject.html @@ -318,13 +318,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Forms_objectToFormData.html b/docs/documentation/Forms_objectToFormData.html index 4dd3deb2..29a13248 100644 --- a/docs/documentation/Forms_objectToFormData.html +++ b/docs/documentation/Forms_objectToFormData.html @@ -309,13 +309,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Functions.html b/docs/documentation/Functions.html index b6aa6579..87e5c7a9 100644 --- a/docs/documentation/Functions.html +++ b/docs/documentation/Functions.html @@ -113,13 +113,13 @@

Functions


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Functions_debounce.html b/docs/documentation/Functions_debounce.html index cf1fbfde..ab824d57 100644 --- a/docs/documentation/Functions_debounce.html +++ b/docs/documentation/Functions_debounce.html @@ -313,13 +313,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Functions_defer.html b/docs/documentation/Functions_defer.html index 8049e1bd..fd0c5c15 100644 --- a/docs/documentation/Functions_defer.html +++ b/docs/documentation/Functions_defer.html @@ -346,13 +346,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Functions_kwargs.html b/docs/documentation/Functions_kwargs.html index 48c8efdb..52dba079 100644 --- a/docs/documentation/Functions_kwargs.html +++ b/docs/documentation/Functions_kwargs.html @@ -365,13 +365,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Functions_throttle.html b/docs/documentation/Functions_throttle.html index f52942fa..9a976f51 100644 --- a/docs/documentation/Functions_throttle.html +++ b/docs/documentation/Functions_throttle.html @@ -427,13 +427,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Images.html b/docs/documentation/Images.html index a386b888..1c6fc4b9 100644 --- a/docs/documentation/Images.html +++ b/docs/documentation/Images.html @@ -113,13 +113,13 @@

Images


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Images_loaded.html b/docs/documentation/Images_loaded.html index 4c8bbab9..ed37cd81 100644 --- a/docs/documentation/Images_loaded.html +++ b/docs/documentation/Images_loaded.html @@ -352,13 +352,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Images_preload.html b/docs/documentation/Images_preload.html index 3c1a70ab..f0635b7b 100644 --- a/docs/documentation/Images_preload.html +++ b/docs/documentation/Images_preload.html @@ -291,13 +291,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction.html b/docs/documentation/Interaction.html index 7f54340b..032f9311 100644 --- a/docs/documentation/Interaction.html +++ b/docs/documentation/Interaction.html @@ -113,13 +113,13 @@

Interaction


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_createSelection.html b/docs/documentation/Interaction_createSelection.html index 642ef9f5..b95fde67 100644 --- a/docs/documentation/Interaction_createSelection.html +++ b/docs/documentation/Interaction_createSelection.html @@ -390,13 +390,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_disableSelection.html b/docs/documentation/Interaction_disableSelection.html index 0cb6a6f8..c44353cf 100644 --- a/docs/documentation/Interaction_disableSelection.html +++ b/docs/documentation/Interaction_disableSelection.html @@ -282,13 +282,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_enableSelection.html b/docs/documentation/Interaction_enableSelection.html index f6bb44d0..42c11b7c 100644 --- a/docs/documentation/Interaction_enableSelection.html +++ b/docs/documentation/Interaction_enableSelection.html @@ -283,13 +283,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_obfuscatePrivateMailToLink.html b/docs/documentation/Interaction_obfuscatePrivateMailToLink.html index b6b0b49f..5c694b51 100644 --- a/docs/documentation/Interaction_obfuscatePrivateMailToLink.html +++ b/docs/documentation/Interaction_obfuscatePrivateMailToLink.html @@ -684,13 +684,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_obfuscatePrivateTelLink.html b/docs/documentation/Interaction_obfuscatePrivateTelLink.html index 5e06643f..85d57969 100644 --- a/docs/documentation/Interaction_obfuscatePrivateTelLink.html +++ b/docs/documentation/Interaction_obfuscatePrivateTelLink.html @@ -524,13 +524,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_removeSelections.html b/docs/documentation/Interaction_removeSelections.html index 8024261a..d817e02f 100644 --- a/docs/documentation/Interaction_removeSelections.html +++ b/docs/documentation/Interaction_removeSelections.html @@ -212,13 +212,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_setTappedState.html b/docs/documentation/Interaction_setTappedState.html index 8eb7b7e6..354413e5 100644 --- a/docs/documentation/Interaction_setTappedState.html +++ b/docs/documentation/Interaction_setTappedState.html @@ -388,13 +388,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Interaction_setupAutoTappedStates.html b/docs/documentation/Interaction_setupAutoTappedStates.html index 725c4d0f..7aa00c8c 100644 --- a/docs/documentation/Interaction_setupAutoTappedStates.html +++ b/docs/documentation/Interaction_setupAutoTappedStates.html @@ -467,13 +467,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Logging.html b/docs/documentation/Logging.html index b60c046c..aee3b610 100644 --- a/docs/documentation/Logging.html +++ b/docs/documentation/Logging.html @@ -113,13 +113,13 @@

Logging


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Logging_err.html b/docs/documentation/Logging_err.html index ce84ce86..106d81c8 100644 --- a/docs/documentation/Logging_err.html +++ b/docs/documentation/Logging_err.html @@ -271,13 +271,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Logging_log.html b/docs/documentation/Logging_log.html index 5935890f..397ad107 100644 --- a/docs/documentation/Logging_log.html +++ b/docs/documentation/Logging_log.html @@ -301,13 +301,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Logging_warn.html b/docs/documentation/Logging_warn.html index b45d7f5a..411ae357 100644 --- a/docs/documentation/Logging_warn.html +++ b/docs/documentation/Logging_warn.html @@ -270,13 +270,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Logging_xlog.html b/docs/documentation/Logging_xlog.html index f8decdaa..c4330ed9 100644 --- a/docs/documentation/Logging_xlog.html +++ b/docs/documentation/Logging_xlog.html @@ -284,13 +284,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation.html b/docs/documentation/Navigation.html index 92d2af9c..0a2a3321 100644 --- a/docs/documentation/Navigation.html +++ b/docs/documentation/Navigation.html @@ -113,13 +113,13 @@

Navigation


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_changeCurrentUrl.html b/docs/documentation/Navigation_changeCurrentUrl.html index 548eb89d..d9f4e04f 100644 --- a/docs/documentation/Navigation_changeCurrentUrl.html +++ b/docs/documentation/Navigation_changeCurrentUrl.html @@ -416,13 +416,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_offHistoryChange.html b/docs/documentation/Navigation_offHistoryChange.html index 40a2510e..f2579057 100644 --- a/docs/documentation/Navigation_offHistoryChange.html +++ b/docs/documentation/Navigation_offHistoryChange.html @@ -321,13 +321,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_onHistoryChange.html b/docs/documentation/Navigation_onHistoryChange.html index c8ef824e..122e976a 100644 --- a/docs/documentation/Navigation_onHistoryChange.html +++ b/docs/documentation/Navigation_onHistoryChange.html @@ -379,13 +379,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_openTab.html b/docs/documentation/Navigation_openTab.html index bb1fced1..5ce8baa8 100644 --- a/docs/documentation/Navigation_openTab.html +++ b/docs/documentation/Navigation_openTab.html @@ -407,13 +407,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_openWindow.html b/docs/documentation/Navigation_openWindow.html index eeeae5ac..c74f63a6 100644 --- a/docs/documentation/Navigation_openWindow.html +++ b/docs/documentation/Navigation_openWindow.html @@ -423,13 +423,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_redirect.html b/docs/documentation/Navigation_redirect.html index 45009676..f846447c 100644 --- a/docs/documentation/Navigation_redirect.html +++ b/docs/documentation/Navigation_redirect.html @@ -450,13 +450,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Navigation_reload.html b/docs/documentation/Navigation_reload.html index 4c643ec7..1293ef28 100644 --- a/docs/documentation/Navigation_reload.html +++ b/docs/documentation/Navigation_reload.html @@ -327,13 +327,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Objects.html b/docs/documentation/Objects.html index 08eb5e0e..a52ec519 100644 --- a/docs/documentation/Objects.html +++ b/docs/documentation/Objects.html @@ -113,13 +113,13 @@

Objects


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Objects_clone.html b/docs/documentation/Objects_clone.html index 422987b4..8f8d7e32 100644 --- a/docs/documentation/Objects_clone.html +++ b/docs/documentation/Objects_clone.html @@ -354,13 +354,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polling.html b/docs/documentation/Polling.html index 131c88c3..d128c41b 100644 --- a/docs/documentation/Polling.html +++ b/docs/documentation/Polling.html @@ -113,13 +113,13 @@

Polling


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polling_poll.html b/docs/documentation/Polling_poll.html index a7c735e9..7c2ba650 100644 --- a/docs/documentation/Polling_poll.html +++ b/docs/documentation/Polling_poll.html @@ -515,13 +515,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polling_unpoll.html b/docs/documentation/Polling_unpoll.html index 8ecccf9e..663b4c99 100644 --- a/docs/documentation/Polling_unpoll.html +++ b/docs/documentation/Polling_unpoll.html @@ -286,13 +286,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polyfills.html b/docs/documentation/Polyfills.html index a8288e07..95ac7d2b 100644 --- a/docs/documentation/Polyfills.html +++ b/docs/documentation/Polyfills.html @@ -113,13 +113,13 @@

Polyfills


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polyfills_polyfillArrayAt.html b/docs/documentation/Polyfills_polyfillArrayAt.html index 22611853..34a29c19 100644 --- a/docs/documentation/Polyfills_polyfillArrayAt.html +++ b/docs/documentation/Polyfills_polyfillArrayAt.html @@ -214,13 +214,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polyfills_polyfillCustomEvent.html b/docs/documentation/Polyfills_polyfillCustomEvent.html index 46fb7b4a..5c70e6ac 100644 --- a/docs/documentation/Polyfills_polyfillCustomEvent.html +++ b/docs/documentation/Polyfills_polyfillCustomEvent.html @@ -213,13 +213,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polyfills_polyfillElementMatches.html b/docs/documentation/Polyfills_polyfillElementMatches.html index a3a57f74..c813be9d 100644 --- a/docs/documentation/Polyfills_polyfillElementMatches.html +++ b/docs/documentation/Polyfills_polyfillElementMatches.html @@ -225,13 +225,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Polyfills_polyfillFetch.html b/docs/documentation/Polyfills_polyfillFetch.html index e776cb99..fe2cdb3d 100644 --- a/docs/documentation/Polyfills_polyfillFetch.html +++ b/docs/documentation/Polyfills_polyfillFetch.html @@ -287,13 +287,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Random.html b/docs/documentation/Random.html index 738c2ca6..1063e64c 100644 --- a/docs/documentation/Random.html +++ b/docs/documentation/Random.html @@ -113,13 +113,13 @@

Random


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Random_randomNumber.html b/docs/documentation/Random_randomNumber.html index d2ae5063..109fd4b2 100644 --- a/docs/documentation/Random_randomNumber.html +++ b/docs/documentation/Random_randomNumber.html @@ -436,13 +436,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Random_randomUuid.html b/docs/documentation/Random_randomUuid.html index 86d65156..9e4f5e56 100644 --- a/docs/documentation/Random_randomUuid.html +++ b/docs/documentation/Random_randomUuid.html @@ -314,13 +314,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests.html b/docs/documentation/Requests.html index 0ad5b19c..bc30bee9 100644 --- a/docs/documentation/Requests.html +++ b/docs/documentation/Requests.html @@ -113,13 +113,13 @@

Requests


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_createCssRequest.html b/docs/documentation/Requests_createCssRequest.html index d97c3bcb..206dfce2 100644 --- a/docs/documentation/Requests_createCssRequest.html +++ b/docs/documentation/Requests_createCssRequest.html @@ -406,13 +406,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_createFetchRequest.html b/docs/documentation/Requests_createFetchRequest.html index ba4b126c..bceb57af 100644 --- a/docs/documentation/Requests_createFetchRequest.html +++ b/docs/documentation/Requests_createFetchRequest.html @@ -594,13 +594,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_createHtmlRequest.html b/docs/documentation/Requests_createHtmlRequest.html index c0aacbd4..1da24932 100644 --- a/docs/documentation/Requests_createHtmlRequest.html +++ b/docs/documentation/Requests_createHtmlRequest.html @@ -408,13 +408,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_createJsRequest.html b/docs/documentation/Requests_createJsRequest.html index 1e29b316..5a943f95 100644 --- a/docs/documentation/Requests_createJsRequest.html +++ b/docs/documentation/Requests_createJsRequest.html @@ -408,13 +408,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_createJsonRequest.html b/docs/documentation/Requests_createJsonRequest.html index e6ace092..85c7e7af 100644 --- a/docs/documentation/Requests_createJsonRequest.html +++ b/docs/documentation/Requests_createJsonRequest.html @@ -397,13 +397,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Requests_visitUrl.html b/docs/documentation/Requests_visitUrl.html index e5818340..35bcf7bf 100644 --- a/docs/documentation/Requests_visitUrl.html +++ b/docs/documentation/Requests_visitUrl.html @@ -438,13 +438,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings.html b/docs/documentation/Strings.html index efe34ad5..adf1f9c3 100644 --- a/docs/documentation/Strings.html +++ b/docs/documentation/Strings.html @@ -113,13 +113,13 @@

Strings


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_concat.html b/docs/documentation/Strings_concat.html index e31f7be2..35152bf1 100644 --- a/docs/documentation/Strings_concat.html +++ b/docs/documentation/Strings_concat.html @@ -337,13 +337,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_format.html b/docs/documentation/Strings_format.html index f659d272..b94c6609 100644 --- a/docs/documentation/Strings_format.html +++ b/docs/documentation/Strings_format.html @@ -327,13 +327,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_maskForHtml.html b/docs/documentation/Strings_maskForHtml.html index 7aeba8cc..8d1d4688 100644 --- a/docs/documentation/Strings_maskForHtml.html +++ b/docs/documentation/Strings_maskForHtml.html @@ -286,13 +286,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_maskForRegEx.html b/docs/documentation/Strings_maskForRegEx.html index 7e92bece..5ea6917f 100644 --- a/docs/documentation/Strings_maskForRegEx.html +++ b/docs/documentation/Strings_maskForRegEx.html @@ -278,13 +278,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_maskForSelector.html b/docs/documentation/Strings_maskForSelector.html index 179e04f0..d67021a0 100644 --- a/docs/documentation/Strings_maskForSelector.html +++ b/docs/documentation/Strings_maskForSelector.html @@ -276,13 +276,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_replace.html b/docs/documentation/Strings_replace.html index 9841db73..be79e062 100644 --- a/docs/documentation/Strings_replace.html +++ b/docs/documentation/Strings_replace.html @@ -332,13 +332,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_slugify.html b/docs/documentation/Strings_slugify.html index 40cca08a..2eab74dc 100644 --- a/docs/documentation/Strings_slugify.html +++ b/docs/documentation/Strings_slugify.html @@ -337,13 +337,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_truncate.html b/docs/documentation/Strings_truncate.html index 846b7155..e0d71c6a 100644 --- a/docs/documentation/Strings_truncate.html +++ b/docs/documentation/Strings_truncate.html @@ -385,13 +385,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Strings_unmaskFromHtml.html b/docs/documentation/Strings_unmaskFromHtml.html index e2fa764f..83148303 100644 --- a/docs/documentation/Strings_unmaskFromHtml.html +++ b/docs/documentation/Strings_unmaskFromHtml.html @@ -285,13 +285,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers.html b/docs/documentation/Timers.html index 65e2bb7e..36d563c1 100644 --- a/docs/documentation/Timers.html +++ b/docs/documentation/Timers.html @@ -113,13 +113,13 @@

Timers


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_cancelAnimationFrame.html b/docs/documentation/Timers_cancelAnimationFrame.html index 995563fd..032360d5 100644 --- a/docs/documentation/Timers_cancelAnimationFrame.html +++ b/docs/documentation/Timers_cancelAnimationFrame.html @@ -264,13 +264,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_countermand.html b/docs/documentation/Timers_countermand.html index 550f525e..83a0a2e4 100644 --- a/docs/documentation/Timers_countermand.html +++ b/docs/documentation/Timers_countermand.html @@ -327,13 +327,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_loop.html b/docs/documentation/Timers_loop.html index 9cfe6914..e4c7bb75 100644 --- a/docs/documentation/Timers_loop.html +++ b/docs/documentation/Timers_loop.html @@ -393,13 +393,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_ploop.html b/docs/documentation/Timers_ploop.html index b4c6fed9..ce4ffc25 100644 --- a/docs/documentation/Timers_ploop.html +++ b/docs/documentation/Timers_ploop.html @@ -400,13 +400,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_pschedule.html b/docs/documentation/Timers_pschedule.html index 95502f0e..5f3512c4 100644 --- a/docs/documentation/Timers_pschedule.html +++ b/docs/documentation/Timers_pschedule.html @@ -398,13 +398,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_requestAnimationFrame.html b/docs/documentation/Timers_requestAnimationFrame.html index ed8ad7af..0ef1b7ba 100644 --- a/docs/documentation/Timers_requestAnimationFrame.html +++ b/docs/documentation/Timers_requestAnimationFrame.html @@ -299,13 +299,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_reschedule.html b/docs/documentation/Timers_reschedule.html index d7ca52fb..f6627e18 100644 --- a/docs/documentation/Timers_reschedule.html +++ b/docs/documentation/Timers_reschedule.html @@ -343,13 +343,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_schedule.html b/docs/documentation/Timers_schedule.html index 9ecafc97..99e06e0b 100644 --- a/docs/documentation/Timers_schedule.html +++ b/docs/documentation/Timers_schedule.html @@ -393,13 +393,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Timers_waitForRepaint.html b/docs/documentation/Timers_waitForRepaint.html index 3fa56386..1cd2cacd 100644 --- a/docs/documentation/Timers_waitForRepaint.html +++ b/docs/documentation/Timers_waitForRepaint.html @@ -303,13 +303,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls.html b/docs/documentation/Urls.html index f1ef69f7..d5e164a2 100644 --- a/docs/documentation/Urls.html +++ b/docs/documentation/Urls.html @@ -113,13 +113,13 @@

Urls


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_addCacheBuster.html b/docs/documentation/Urls_addCacheBuster.html index e2ebedb1..6b7c830e 100644 --- a/docs/documentation/Urls_addCacheBuster.html +++ b/docs/documentation/Urls_addCacheBuster.html @@ -342,13 +342,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_addNextParameter.html b/docs/documentation/Urls_addNextParameter.html index 6620380b..3dc52bea 100644 --- a/docs/documentation/Urls_addNextParameter.html +++ b/docs/documentation/Urls_addNextParameter.html @@ -478,13 +478,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_evaluateBaseDomain.html b/docs/documentation/Urls_evaluateBaseDomain.html index 781e7a72..c689f666 100644 --- a/docs/documentation/Urls_evaluateBaseDomain.html +++ b/docs/documentation/Urls_evaluateBaseDomain.html @@ -339,13 +339,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_urlAnchor.html b/docs/documentation/Urls_urlAnchor.html index 3b7a41d1..7b791d9f 100644 --- a/docs/documentation/Urls_urlAnchor.html +++ b/docs/documentation/Urls_urlAnchor.html @@ -342,13 +342,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_urlParameter.html b/docs/documentation/Urls_urlParameter.html index 0658caf5..549ad924 100644 --- a/docs/documentation/Urls_urlParameter.html +++ b/docs/documentation/Urls_urlParameter.html @@ -369,13 +369,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Urls_urlParameters.html b/docs/documentation/Urls_urlParameters.html index bca69e2a..53f8a330 100644 --- a/docs/documentation/Urls_urlParameters.html +++ b/docs/documentation/Urls_urlParameters.html @@ -299,13 +299,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Viewport.html b/docs/documentation/Viewport.html index 96a6c28a..62e8dba5 100644 --- a/docs/documentation/Viewport.html +++ b/docs/documentation/Viewport.html @@ -113,13 +113,13 @@

Viewport


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Viewport_isInViewport.html b/docs/documentation/Viewport_isInViewport.html index e3dabda1..711c9ec2 100644 --- a/docs/documentation/Viewport_isInViewport.html +++ b/docs/documentation/Viewport_isInViewport.html @@ -336,13 +336,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/Viewport_scrollTo.html b/docs/documentation/Viewport_scrollTo.html index e7b38df7..c5a6f7e5 100644 --- a/docs/documentation/Viewport_scrollTo.html +++ b/docs/documentation/Viewport_scrollTo.html @@ -530,13 +530,13 @@
Example

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:50 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:33 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/animation.js.html b/docs/documentation/animation.js.html index c9893f06..6704cfa1 100644 --- a/docs/documentation/animation.js.html +++ b/docs/documentation/animation.js.html @@ -40,7 +40,7 @@

Source: animation.js

//###[ IMPORTS ]######################################################################################################## -import {hasValue, isA, isPlainObject, isEmpty, isNaN, orDefault, assert, Deferred} from './basic.js'; +import {hasValue, isPlainObject, isEmpty, isNaN, isElement, orDefault, assert, Deferred} from './basic.js'; import {warn} from './logging.js'; import {pschedule, countermand, waitForRepaint} from './timers.js'; import {applyStyles} from './css.js'; @@ -168,7 +168,7 @@

Source: animation.js

styleChanges = orDefault(styleChanges, {}); rejectOnInterruption = orDefault(rejectOnInterruption, false, 'bool'); - assert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not usable`); + assert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not usable`); assert(isPlainObject(classChanges), `${MODULE_NAME}:${__methodName__} | classChanges is not a plain object`); assert(isPlainObject(styleChanges), `${MODULE_NAME}:${__methodName__} | styleChanges is not a plain object`); @@ -309,13 +309,13 @@

Source: animation.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/arrays.js.html b/docs/documentation/arrays.js.html index c917c67b..3779e4f6 100644 --- a/docs/documentation/arrays.js.html +++ b/docs/documentation/arrays.js.html @@ -158,13 +158,13 @@

Source: arrays.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/basic.js.html b/docs/documentation/basic.js.html index 7f7d3952..db01e356 100644 --- a/docs/documentation/basic.js.html +++ b/docs/documentation/basic.js.html @@ -621,6 +621,31 @@

Source: basic.js

+/** + * @namespace Basic:isElement + */ + +/** + * Returns if a value is an HTML element. + * Be aware, that this explicitly means an element, not necessarily any node. + * So text nodes, comments and such do not qualify. + * + * @param {*} value - the value to check + * @returns {Boolean} true if value is an HTML element + * + * @memberof Basic:isElement + * @alias isElement + * @example + * if( isElement(target) ){ + * target.classList.add('foo'); + * } + */ +export function isElement(value){ + return isA(value, 'htmlelement'); +} + + + /** * @namespace Basic:isEventTarget */ @@ -937,13 +962,13 @@

Source: basic.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/context.js.html b/docs/documentation/context.js.html index 5ce89dd7..bb291e14 100644 --- a/docs/documentation/context.js.html +++ b/docs/documentation/context.js.html @@ -486,13 +486,13 @@

Source: context.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/cookies.js.html b/docs/documentation/cookies.js.html index f6db727c..3ab7c353 100644 --- a/docs/documentation/cookies.js.html +++ b/docs/documentation/cookies.js.html @@ -356,13 +356,13 @@

Source: cookies.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/css.js.html b/docs/documentation/css.js.html index 91cd5812..49f33db7 100644 --- a/docs/documentation/css.js.html +++ b/docs/documentation/css.js.html @@ -40,7 +40,7 @@

Source: css.js

//###[ IMPORTS ]######################################################################################################## -import {assert, isA, orDefault, isPlainObject, hasValue, isNaN} from './basic.js'; +import {assert, isA, orDefault, isPlainObject, isElement, hasValue, isNaN} from './basic.js'; import {maskForRegEx} from './strings.js'; @@ -92,7 +92,7 @@

Source: css.js

crossBrowser = orDefault(crossBrowser, false, 'bool'); returnCssStyleDeclaration = orDefault(returnCssStyleDeclaration, false, 'bool'); - assert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not an html element`); + assert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not an html element`); assert(isPlainObject(styles), `${MODULE_NAME}:${__methodName__} | styles must be a plain object`); const vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-', '-khtml-']; @@ -240,7 +240,7 @@

Source: css.js

px = cssValueToNumber(px); initial = orDefault(initial, 'html'); - if( isA(initial, 'htmlelement') ){ + if( isElement(initial) ){ initial = cssValueToNumber(initial.style.getPropertyValue('font-size')); } else { const value = cssValueToNumber(initial); @@ -271,13 +271,13 @@

Source: css.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/elements.js.html b/docs/documentation/elements.js.html index 522f0e08..021d4ddc 100644 --- a/docs/documentation/elements.js.html +++ b/docs/documentation/elements.js.html @@ -40,7 +40,7 @@

Source: elements.js

//###[ IMPORTS ]######################################################################################################## -import {orDefault, isA, isPlainObject, isSelector, hasValue, assert, size, Deferred} from './basic.js'; +import {orDefault, isA, isPlainObject, isSelector, isElement, hasValue, assert, size, Deferred} from './basic.js'; import {randomUuid} from './random.js'; import {clone} from './objects.js'; import {onDomReady} from './events.js'; @@ -170,9 +170,9 @@

Source: elements.js

export function insertNode(target, node, position='beforeend'){ const __methodName__ = 'insertNode'; - assert(isA(target, 'htmlelement'), `${MODULE_NAME}.${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(target), `${MODULE_NAME}.${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); - if( !isA(node, 'htmlelement') ){ + if( !isElement(node) ){ node = createNode(`${node}`); } @@ -231,13 +231,13 @@

Source: elements.js

export function replaceNode(target, node){ const __methodName__ = 'replaceNode'; - assert(isA(target, 'htmlelement'), `${MODULE_NAME}.${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(target), `${MODULE_NAME}.${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); - if( !isA(node, 'htmlelement') ){ + if( !isElement(node) ){ node = createNode(`${node}`); } - assert(isA(target.parentNode, 'htmlelement'), `${MODULE_NAME}.${__methodName__} | given target does not have a parent)`); + assert(isElement(target.parentNode), `${MODULE_NAME}.${__methodName__} | given target does not have a parent)`); insertNode(target, node, 'after'); target.parentNode.removeChild(target); @@ -292,12 +292,12 @@

Source: elements.js

export function defineNode(node, definition, boilerplateNode=null){ const __methodName__ = 'defineNode'; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); assert(isPlainObject(definition), `${MODULE_NAME}:${__methodName__} | definitions is not a plain object`); const inheritValue = '<-'; - if( isA(boilerplateNode, 'htmlelement') ){ + if( isElement(boilerplateNode) ){ Array.from(boilerplateNode.attributes).forEach(attribute => { if( (definition[attribute.name] === inheritValue) @@ -440,7 +440,7 @@

Source: elements.js

target = createNode(target); } - assert(isA(target, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | target is neither node nor markup`); + assert(isElement(target), `${MODULE_NAME}:${__methodName__} | target is neither node nor markup`); if( onlyFirstLevel ){ let textContent = ''; @@ -480,7 +480,7 @@

Source: elements.js

export function isInDom(node){ const __methodName__ = 'isInDom'; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); return isA(document.contains, 'function') ? document.contains(node) : document.body.contains(node); } @@ -534,7 +534,7 @@

Source: elements.js

properties = orDefault(properties, null, 'arr'); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); let data = {}; @@ -624,7 +624,7 @@

Source: elements.js

export function setData(node, dataSet, singleValue=null){ const __methodName__ = 'setData'; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); let singleKey = null; if( hasValue(singleValue) ){ @@ -715,7 +715,7 @@

Source: elements.js

properties = orDefault(properties, null, 'arr'); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); let data = getData(node, properties); if( hasValue(data) ){ @@ -786,7 +786,7 @@

Source: elements.js

scopeRex = /:scope(?![\w-])/gi ; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); selector = orDefault(selector, '*', 'str').trim(); if( !(scopeRex.test(selector)) ){ @@ -888,7 +888,7 @@

Source: elements.js

filter = isA(filter, 'function') ? filter : () => true; onlyFirstLevel = orDefault(onlyFirstLevel, false, 'bool'); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); const textNodeType = 3, @@ -966,7 +966,7 @@

Source: elements.js

classChanges = orDefault(classChanges, {}); markerAttributesName = orDefault(markerAttributesName, 'primed', 'str'); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); assert(isA(init, 'function'), `${MODULE_NAME}:${__methodName__} | init is not a function`); const deferred = new Deferred(); @@ -1068,8 +1068,8 @@

Source: elements.js

// document.body not in function default to prevent errors on import in document-less contexts context = orDefault(context, document.body); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); - assert(isA(context, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | context is no an htmlelement`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(context), `${MODULE_NAME}:${__methodName__} | context is no an htmlelement`); const sandbox = createNode('div', { @@ -1108,13 +1108,13 @@

Source: elements.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/events.js.html b/docs/documentation/events.js.html index 6ae6d5d6..fa4ad6ad 100644 --- a/docs/documentation/events.js.html +++ b/docs/documentation/events.js.html @@ -40,7 +40,7 @@

Source: events.js

//###[ IMPORTS ]######################################################################################################## -import {assert, isA, isEventTarget, isPlainObject, orDefault, hasValue, isEmpty, isSelector} from './basic.js'; +import {assert, isA, isEventTarget, isPlainObject, isElement, orDefault, hasValue, isEmpty, isSelector} from './basic.js'; import {slugify} from './strings.js'; import {removeFrom} from './arrays.js'; import {detectInteractionType} from './context.js'; @@ -1398,7 +1398,7 @@

Source: events.js

let offCount = 0; targets.forEach(target => { - if( isA(target, 'htmlelement') && !document.body.contains(target) && EVENT_MAP.has(target) ){ + if( isElement(target) && !document.body.contains(target) && EVENT_MAP.has(target) ){ offCount++; off(target, '*'); } @@ -1791,13 +1791,13 @@

Source: events.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/fonts.js.html b/docs/documentation/fonts.js.html index a328f41b..f384caaf 100644 --- a/docs/documentation/fonts.js.html +++ b/docs/documentation/fonts.js.html @@ -161,13 +161,13 @@

Source: fonts.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/forms.js.html b/docs/documentation/forms.js.html index 1d71e063..42dd9c9f 100644 --- a/docs/documentation/forms.js.html +++ b/docs/documentation/forms.js.html @@ -230,13 +230,13 @@

Source: forms.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/functions.js.html b/docs/documentation/functions.js.html index d78b7a97..a516261c 100644 --- a/docs/documentation/functions.js.html +++ b/docs/documentation/functions.js.html @@ -278,13 +278,13 @@

Source: functions.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/global.html b/docs/documentation/global.html index b89ecb98..d0ed78c0 100644 --- a/docs/documentation/global.html +++ b/docs/documentation/global.html @@ -1702,7 +1702,7 @@
Properties:
Source:
@@ -5280,7 +5280,7 @@
Properties:
Source:
@@ -5310,13 +5310,13 @@
Properties:

- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/images.js.html b/docs/documentation/images.js.html index 82ead7d5..c72f5891 100644 --- a/docs/documentation/images.js.html +++ b/docs/documentation/images.js.html @@ -40,7 +40,7 @@

Source: images.js

//###[ IMPORTS ]######################################################################################################## -import {orDefault, isA, isPlainObject, assert, isEmpty, hasValue, Deferred} from './basic.js'; +import {orDefault, isA, isPlainObject, assert, isEmpty, isElement, hasValue, Deferred} from './basic.js'; import {waitForRepaint} from './timers.js'; @@ -221,7 +221,7 @@

Source: images.js

const src = image.src, parent = image.parentNode, - isPicture = isA(image.parentNode, 'htmlelement') ? (parent.nodeName.toLowerCase() === 'picture') : false + isPicture = isElement(image.parentNode) ? (parent.nodeName.toLowerCase() === 'picture') : false ; assert(!isEmpty(src), `${MODULE_NAME}:${__methodName__} | image has no src`); @@ -274,13 +274,13 @@

Source: images.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/index.html b/docs/documentation/index.html index 6327cc3b..9a19863c 100644 --- a/docs/documentation/index.html +++ b/docs/documentation/index.html @@ -259,13 +259,13 @@

Is This Any Good, Why Should I Use This?


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/interaction.js.html b/docs/documentation/interaction.js.html index 8bbc02e2..5bf8aaf7 100644 --- a/docs/documentation/interaction.js.html +++ b/docs/documentation/interaction.js.html @@ -40,7 +40,7 @@

Source: interaction.js

//###[ IMPORTS ]######################################################################################################## -import {assert, isA, orDefault, hasValue, Deferred} from './basic.js'; +import {assert, isA, isElement, orDefault, hasValue, Deferred} from './basic.js'; import {findTextNodes} from './elements.js'; import {applyStyles} from './css.js'; @@ -91,7 +91,7 @@

Source: interaction.js

startOffset = orDefault(startOffset, 0, 'int'); endOffset = orDefault(endOffset, 0, 'int'); - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); let selectionText, range, selection, rangeText; @@ -233,7 +233,7 @@

Source: interaction.js

export function disableSelection(node){ const __methodName__ = 'disableSelection'; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); node.onselectstart = () => false; node.unselectable = 'on'; @@ -265,7 +265,7 @@

Source: interaction.js

export function enableSelection(node){ const __methodName__ = 'disableSelection'; - assert(isA(node, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(node), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); node.onselectstart = undefined; node.unselectable = 'off'; @@ -496,7 +496,7 @@

Source: interaction.js

tappedClass = orDefault(tappedClass, 'tapped', 'str'); tappedDuration = orDefault(tappedDuration, 200, 'int'); - assert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(element), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); const deferred = new Deferred(); @@ -564,7 +564,7 @@

Source: interaction.js

tapEvents = orDefault(tapEvents, 'click', 'str'); tapEvents = [].concat(tapEvents); - assert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); + assert(isElement(element), `${MODULE_NAME}:${__methodName__} | ${NOT_AN_HTMLELEMENT_ERROR}`); tapEvents.forEach(tapEvent => { element.addEventListener(tapEvent, e => { @@ -587,13 +587,13 @@

Source: interaction.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/logging.js.html b/docs/documentation/logging.js.html index 946cfc60..3745564a 100644 --- a/docs/documentation/logging.js.html +++ b/docs/documentation/logging.js.html @@ -345,13 +345,13 @@

Source: logging.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/navigation.js.html b/docs/documentation/navigation.js.html index a28b8029..83e4d3e4 100644 --- a/docs/documentation/navigation.js.html +++ b/docs/documentation/navigation.js.html @@ -560,13 +560,13 @@

Source: navigation.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/objects.js.html b/docs/documentation/objects.js.html index fac77058..e067688b 100644 --- a/docs/documentation/objects.js.html +++ b/docs/documentation/objects.js.html @@ -214,13 +214,13 @@

Source: objects.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/polling.js.html b/docs/documentation/polling.js.html index d2f63167..2d4282db 100644 --- a/docs/documentation/polling.js.html +++ b/docs/documentation/polling.js.html @@ -228,13 +228,13 @@

Source: polling.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/polyfills.js.html b/docs/documentation/polyfills.js.html index 2d8ff674..64490649 100644 --- a/docs/documentation/polyfills.js.html +++ b/docs/documentation/polyfills.js.html @@ -183,13 +183,13 @@

Source: polyfills.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/random.js.html b/docs/documentation/random.js.html index a96b5903..83bceac2 100644 --- a/docs/documentation/random.js.html +++ b/docs/documentation/random.js.html @@ -178,13 +178,13 @@

Source: random.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/requests.js.html b/docs/documentation/requests.js.html index 9275338c..71f5749b 100644 --- a/docs/documentation/requests.js.html +++ b/docs/documentation/requests.js.html @@ -989,13 +989,13 @@

Source: requests.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/strings.js.html b/docs/documentation/strings.js.html index ec60dfd8..f9332424 100644 --- a/docs/documentation/strings.js.html +++ b/docs/documentation/strings.js.html @@ -532,13 +532,13 @@

Source: strings.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/timers.js.html b/docs/documentation/timers.js.html index 1093126f..e49062b5 100644 --- a/docs/documentation/timers.js.html +++ b/docs/documentation/timers.js.html @@ -450,13 +450,13 @@

Source: timers.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/urls.js.html b/docs/documentation/urls.js.html index 917274e4..fb990889 100644 --- a/docs/documentation/urls.js.html +++ b/docs/documentation/urls.js.html @@ -392,13 +392,13 @@

Source: urls.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/documentation/viewport.js.html b/docs/documentation/viewport.js.html index dd7171ef..3a6b6fa2 100644 --- a/docs/documentation/viewport.js.html +++ b/docs/documentation/viewport.js.html @@ -40,7 +40,7 @@

Source: viewport.js

//###[ IMPORTS ]######################################################################################################## -import {hasValue, orDefault, isA, Deferred, assert} from './basic.js'; +import {hasValue, orDefault, isA, isElement, Deferred, assert} from './basic.js'; import {EasingFunctions} from './animation.js'; import {requestAnimationFrame} from './timers.js'; @@ -150,7 +150,7 @@

Source: viewport.js

scrollEvenIfFullyInViewport = orDefault(scrollEvenIfFullyInViewport, false, 'bool'); cancelOnUserScroll = orDefault(cancelOnUserScroll, false, 'bool'); - assert(isA(element, 'htmlelement') || isA(element, 'window'), `${MODULE_NAME}:scrollTo | element unusable`); + assert(isElement(element) || isA(element, 'window'), `${MODULE_NAME}:scrollTo | element unusable`); assert(durationMs > 0, `${MODULE_NAME}:scrollTo | durationMs must be > 0`); if( !isA(EasingFunctions[easing], 'function') ){ @@ -237,13 +237,13 @@

Source: viewport.js


- Documentation generated by JSDoc 3.6.11 on Fri Jul 28 2023 12:20:49 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.11 on Wed Aug 23 2023 12:48:32 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/examples/lib/annex/dist/animation.js b/docs/examples/lib/annex/dist/animation.js index d961d5de..2747eaf6 100644 --- a/docs/examples/lib/annex/dist/animation.js +++ b/docs/examples/lib/annex/dist/animation.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Animation */ -const MODULE_NAME="Animation";import{hasValue,isA,isPlainObject,isEmpty,isNaN,orDefault,assert,Deferred}from"./basic.js";import{warn}from"./logging.js";import{pschedule,countermand,waitForRepaint}from"./timers.js";import{applyStyles}from"./css.js";const RUNNING_TRANSITIONS=new WeakMap;export const EasingFunctions={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};export function transition(e,t=null,a=null,s=!1){const n="cssTransition";t=orDefault(t,{}),a=orDefault(a,{}),s=orDefault(s,!1,"bool"),assert(isA(e,"htmlelement"),`Animation:${n} | element is not usable`),assert(isPlainObject(t),`Animation:${n} | classChanges is not a plain object`),assert(isPlainObject(a),`Animation:${n} | styleChanges is not a plain object`);const i=new Deferred,o=RUNNING_TRANSITIONS.get(e);if(hasValue(o))if(countermand(o.timer),s){const t=new Error("interrupted");t.element=e,o.deferred.reject(t)}else o.deferred.resolve(e);RUNNING_TRANSITIONS.delete(e);const r=["transition-duration","-webkit-transition-duration","-moz-transition-duration","-o-transition-duration"],l=["transition","-webkit-transition","-moz-transition","-o-transition"],u=[...r,...l],c={property:null,value:null};if(!isEmpty(a)){let t;[r,l].forEach((e=>{t=!1,e.forEach((s=>{const n=a[s];!t&&hasValue(n)&&(t=!0,e.forEach((e=>{a[e]=n})))}))})),applyStyles(e,a)}return isEmpty(t?.remove)||[].concat(t.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),isEmpty(t?.add)||[].concat(t.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),waitForRepaint((()=>{const t=getComputedStyle(e);if(u.forEach((e=>{!hasValue(c.value)&&hasValue(t[e])&&(c.property=e,c.value=t[e])})),hasValue(c.value)){const t=c.value.match(/(^|\s)(\d+(\.\d+)?)s(\s|,|$)/g),a=c.value.match(/(^|\s)(\d+)ms(\s|,|$)/g);let s=0;(t??[]).forEach((e=>{e=parseFloat(e),isNaN(e)||(e=Math.floor(1e3*e))>s&&(s=e)})),(a??[]).forEach((e=>{e=parseInt(e,10),!isNaN(e)&&e>s&&(s=e)})),RUNNING_TRANSITIONS.set(e,{deferred:i,timer:pschedule(s,(()=>{waitForRepaint((()=>{i.resolve(e),RUNNING_TRANSITIONS.delete(e)}))}))})}else warn(`Animation:${n} | no usable transitions on element "${e}"`),i.resolve(e)})),i} +const MODULE_NAME="Animation";import{hasValue,isPlainObject,isEmpty,isNaN,isElement,orDefault,assert,Deferred}from"./basic.js";import{warn}from"./logging.js";import{pschedule,countermand,waitForRepaint}from"./timers.js";import{applyStyles}from"./css.js";const RUNNING_TRANSITIONS=new WeakMap;export const EasingFunctions={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};export function transition(e,t=null,a=null,s=!1){const n="cssTransition";t=orDefault(t,{}),a=orDefault(a,{}),s=orDefault(s,!1,"bool"),assert(isElement(e),`Animation:${n} | element is not usable`),assert(isPlainObject(t),`Animation:${n} | classChanges is not a plain object`),assert(isPlainObject(a),`Animation:${n} | styleChanges is not a plain object`);const i=new Deferred,o=RUNNING_TRANSITIONS.get(e);if(hasValue(o))if(countermand(o.timer),s){const t=new Error("interrupted");t.element=e,o.deferred.reject(t)}else o.deferred.resolve(e);RUNNING_TRANSITIONS.delete(e);const r=["transition-duration","-webkit-transition-duration","-moz-transition-duration","-o-transition-duration"],l=["transition","-webkit-transition","-moz-transition","-o-transition"],u=[...r,...l],c={property:null,value:null};if(!isEmpty(a)){let t;[r,l].forEach((e=>{t=!1,e.forEach((s=>{const n=a[s];!t&&hasValue(n)&&(t=!0,e.forEach((e=>{a[e]=n})))}))})),applyStyles(e,a)}return isEmpty(t?.remove)||[].concat(t.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),isEmpty(t?.add)||[].concat(t.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),waitForRepaint((()=>{const t=getComputedStyle(e);if(u.forEach((e=>{!hasValue(c.value)&&hasValue(t[e])&&(c.property=e,c.value=t[e])})),hasValue(c.value)){const t=c.value.match(/(^|\s)(\d+(\.\d+)?)s(\s|,|$)/g),a=c.value.match(/(^|\s)(\d+)ms(\s|,|$)/g);let s=0;(t??[]).forEach((e=>{e=parseFloat(e),isNaN(e)||(e=Math.floor(1e3*e))>s&&(s=e)})),(a??[]).forEach((e=>{e=parseInt(e,10),!isNaN(e)&&e>s&&(s=e)})),RUNNING_TRANSITIONS.set(e,{deferred:i,timer:pschedule(s,(()=>{waitForRepaint((()=>{i.resolve(e),RUNNING_TRANSITIONS.delete(e)}))}))})}else warn(`Animation:${n} | no usable transitions on element "${e}"`),i.resolve(e)})),i} //# sourceMappingURL=animation.js.map diff --git a/docs/examples/lib/annex/dist/animation.js.map b/docs/examples/lib/annex/dist/animation.js.map index 7918ae77..ff21cb7f 100644 --- a/docs/examples/lib/annex/dist/animation.js.map +++ b/docs/examples/lib/annex/dist/animation.js.map @@ -1 +1 @@ -{"version":3,"file":"animation.js","names":["MODULE_NAME","hasValue","isA","isPlainObject","isEmpty","isNaN","orDefault","assert","Deferred","warn","pschedule","countermand","waitForRepaint","applyStyles","RUNNING_TRANSITIONS","WeakMap","EasingFunctions","linear","t","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","transition","element","classChanges","styleChanges","rejectOnInterruption","__methodName__","deferred","runningTransition","get","timer","error","Error","reject","resolve","delete","transitionDurationProperties","transitionProperties","timingProperties","transitionDefinition","property","value","vendorPropertiesAdded","forEach","properties","transitionValue","remove","concat","removeClass","split","classList","trim","add","addClass","elementStyles","getComputedStyle","timingProperty","sTimings","match","msTimings","longestTiming","timing","parseFloat","Math","floor","parseInt","set"],"sources":["animation.js"],"mappings":";;;AAQA,MAAMA,YAAc,mBAMZC,SAAUC,IAAKC,cAAeC,QAASC,MAAOC,UAAWC,OAAQC,aAAe,oBAChFC,SAAW,sBACXC,UAAWC,YAAaC,mBAAqB,qBAC7CC,gBAAkB,WAM1B,MAAMC,oBAAsB,IAAIC,eAoCzB,MAAMC,gBAAkB,CAE9BC,OAASC,GAAKA,EAEdC,WAAaD,GAAKA,EAAEA,EAEpBE,YAAcF,GAAKA,GAAG,EAAEA,GAExBG,cAAgBH,GAAKA,EAAE,GAAK,EAAEA,EAAEA,GAAQ,EAAE,EAAEA,GAAGA,EAAV,EAErCI,YA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AAQkB,IACzBA,EAASI,SAASJ,EAAQ,KAErBlE,MAAMkE,IAAYA,EAASD,IAC/BA,EAAgBC,EACjB,IAGDzD,oBAAoB8D,IAAI5C,EAAS,CAChCK,WACAG,MAAQ9B,UAAU4D,GAAe,KAChC1D,gBAAe,KACdyB,EAASO,QAAQZ,GACjBlB,oBAAoB+B,OAAOb,EAAQ,GAClC,KAGL,MAtCCvB,KAAK,aAAkB2B,yCAAsDJ,MAC7EK,EAASO,QAAQZ,EAqClB,IAGMK,CACR","sourcesContent":["/*!\n * Module Animation\n */\n\n/**\n * @namespace Animation\n */\n\nconst MODULE_NAME = 'Animation';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {hasValue, isA, isPlainObject, isEmpty, isNaN, orDefault, assert, Deferred} from './basic.js';\nimport {warn} from './logging.js';\nimport {pschedule, countermand, waitForRepaint} from './timers.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst RUNNING_TRANSITIONS = new WeakMap();\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Animation:EasingFunctions\n */\n\n/**\n * A collection of all basic easing functions to be used in animations.\n * All functions here take a float parameter between 0 and 1 and return a mapped value between 0 and 1.\n *\n * Taken from: https://gist.github.com/gre/1650294\n *\n * Available functions:\n * - linear\n * - easeInQuad\n * - easeOutQuad\n * - easeInOutQuad\n * - easeInCubic\n * - easeOutCubic\n * - easeInOutCubic\n * - easeInQuart\n * - easeOutQuart\n * - easeInOutQuart\n * - easeInQuint\n * - easeOutQuint\n * - easeInOutQuint\n *\n * @memberof Animation:EasingFunctions\n * @alias EasingFunctions\n * @example\n * scrollTo(window, 1000, 0, EasingFunctions.easeInOutQuint);\n */\nexport const EasingFunctions = {\n\t// no easing, no acceleration\n\tlinear : t => t,\n\t// accelerating from zero velocity\n\teaseInQuad : t => t*t,\n\t// decelerating to zero velocity\n\teaseOutQuad : t => t*(2-t),\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuad : t => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\t// accelerating from zero velocity\n\teaseInCubic : t => t*t*t,\n\t// decelerating to zero velocity\n\teaseOutCubic : t => (--t)*t*t+1,\n\t// acceleration until halfway, then deceleration\n\teaseInOutCubic : t => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\t// accelerating from zero velocity\n\teaseInQuart : t => t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuart : t => 1-(--t)*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuart : t => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\t// accelerating from zero velocity\n\teaseInQuint : t => t*t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuint : t => 1+(--t)*t*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuint : t => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t\n};\n\n\n\n/**\n * @namespace Animation:transition\n */\n\n/**\n * This method offers the possibility to apply CSS transitions via classes and/or styles and wait for the transition\n * to finish, which results in the resolution of a Deferred.\n *\n * In general, this method remedies the pain of having to manage transitions manually in JS, entering precise ms for\n * timers waiting on conclusion of transitions.\n *\n * The general principle of this is the parsing of transition CSS attributes, which may contain transition\n * timings (transition and transition-duration) and looks for the longest currently running transition.\n * Values are excepted as milliseconds or seconds (int or float notation).\n *\n * Why would you do this, if there is something like the `animationend` event, you ask? Well, the problem is, that,\n * if the animation is interrupted or never finishes for any other reason, the event never fires. For that, there is\n * the `animationcancel` event, but that is not really robustly supported at the moment. So, in cases of complex\n * style changes, where we definitively want to have a callback when the animation has been (or would have been)\n * finished, this is still the safer option. But, for simple and small cases I'd strongly recommend using the native\n * `AnimationEvent` API.\n *\n * Calling this method successively on the same element replaces the currently running transition, normally\n * resulting in premature resolution of the Deferred and application of the newly provided changes.\n *\n * Be advised, that legacy browsers like IE11 and Edge <= 18 have problems connecting interrupted transitions,\n * especially when transition-durations change during animation, resulting in skipped or choppy animations. If you\n * experience this, try to keep timings stable during animation and chain animations without overlap.\n *\n * @param {Element} element - the element to transition, by applying class and/or style changes\n * @param {?Object} [classChanges=null] - plain object containing class changes to apply, add classes via the \"add\" key, remove them via the \"remove\" key (add has precedence over remove); values may be standard CSS class string notation or an array of standard CSS class notations\n * @param {?Object} [styleChanges=null] - plain object containing style changes to apply (via applyStyles)\n * @param {?Boolean} [rejectOnInterruption=false] - if a new transition is applied using this function while a previous transition is still running the Deferred would normally be resolved before continuing, set this to true to let the Deferred reject in that case (the rejection message is \"interrupted\", access the element using \"element)\n * @return {Deferred} resolves on transition completion or repeated call on the same element, with the resolution value being the element, rejects on repeated call on same element if rejectOnInterruption is true (the rejection message is \"interrupted\", access the element using \"element\")\n *\n * @memberof Animation:transition\n * @alias transition\n * @see applyStyles\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event\n * @example\n * transition(element, {add : 'foobar'}).then(element => { return transition(element, {remove : 'foobar'}); }).then(() => { console.log('finished'); });\n * transition(element, null, {top : 0, left : 0, background : 'pink', transition : 'all 1500ms'}).then(() => { console.log('finished'); });\n * transition(element, {add : 'foobar'}).then(() => { console.log('finished'); }).catch(error => { console.log('cancelled'); });\n */\nexport function transition(element, classChanges=null, styleChanges=null, rejectOnInterruption=false){\n\tconst __methodName__ = 'cssTransition';\n\n\tclassChanges = orDefault(classChanges, {});\n\tstyleChanges = orDefault(styleChanges, {});\n\trejectOnInterruption = orDefault(rejectOnInterruption, false, 'bool');\n\n\tassert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not usable`);\n\tassert(isPlainObject(classChanges), `${MODULE_NAME}:${__methodName__} | classChanges is not a plain object`);\n\tassert(isPlainObject(styleChanges), `${MODULE_NAME}:${__methodName__} | styleChanges is not a plain object`);\n\n\tconst\n\t\tdeferred = new Deferred(),\n\t\trunningTransition = RUNNING_TRANSITIONS.get(element)\n\t;\n\n\tif( hasValue(runningTransition) ){\n\t\tcountermand(runningTransition.timer);\n\t\tif( !rejectOnInterruption ){\n\t\t\trunningTransition.deferred.resolve(element);\n\t\t} else {\n\t\t\tconst error = new Error('interrupted');\n\t\t\terror.element = element;\n\t\t\trunningTransition.deferred.reject(error);\n\t\t}\n\t}\n\tRUNNING_TRANSITIONS.delete(element);\n\n\tconst\n\t\ttransitionDurationProperties = [\n\t\t\t'transition-duration',\n\t\t\t'-webkit-transition-duration',\n\t\t\t'-moz-transition-duration',\n\t\t\t'-o-transition-duration'\n\t\t],\n\t\ttransitionProperties = [\n\t\t\t'transition',\n\t\t\t'-webkit-transition',\n\t\t\t'-moz-transition',\n\t\t\t'-o-transition'\n\t\t],\n\t\ttimingProperties = [\n\t\t\t...transitionDurationProperties,\n\t\t\t...transitionProperties\n\t\t],\n\t\ttransitionDefinition = {\n\t\t\tproperty : null,\n\t\t\tvalue : null\n\t\t}\n\t;\n\n\tif( !isEmpty(styleChanges) ){\n\t\tlet vendorPropertiesAdded;\n\t\t[transitionDurationProperties, transitionProperties].forEach(properties => {\n\t\t\tvendorPropertiesAdded = false;\n\t\t\tproperties.forEach(property => {\n\t\t\t\tconst transitionValue = styleChanges[property];\n\t\t\t\tif( !vendorPropertiesAdded && hasValue(transitionValue) ){\n\t\t\t\t\tvendorPropertiesAdded = true;\n\t\t\t\t\tproperties.forEach(property => {\n\t\t\t\t\t\tstyleChanges[property] = transitionValue;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tapplyStyles(element, styleChanges);\n\t}\n\n\tif( !isEmpty(classChanges?.remove) ){\n\t\t[].concat(classChanges.remove).forEach(removeClass => {\n\t\t\t`${removeClass}`.split(' ').forEach(removeClass => {\n\t\t\t\telement.classList.remove(removeClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\tif( !isEmpty(classChanges?.add) ){\n\t\t[].concat(classChanges.add).forEach(addClass => {\n\t\t\t`${addClass}`.split(' ').forEach(addClass => {\n\t\t\t\telement.classList.add(addClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\twaitForRepaint(() => {\n\t\tconst elementStyles = getComputedStyle(element);\n\t\ttimingProperties.forEach(timingProperty => {\n\t\t\tif( !hasValue(transitionDefinition.value) && hasValue(elementStyles[timingProperty]) ){\n\t\t\t\ttransitionDefinition.property = timingProperty;\n\t\t\t\ttransitionDefinition.value = elementStyles[timingProperty];\n\t\t\t}\n\t\t});\n\n\t\tif( !hasValue(transitionDefinition.value) ){\n\t\t\twarn(`${MODULE_NAME}:${__methodName__} | no usable transitions on element \"${element}\"`);\n\t\t\tdeferred.resolve(element);\n\t\t} else {\n\t\t\tconst\n\t\t\t\tsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+(\\.\\d+)?)s(\\s|,|$)/g),\n\t\t\t\tmsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+)ms(\\s|,|$)/g)\n\t\t\t;\n\t\t\tlet\tlongestTiming = 0;\n\n\t\t\t(sTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseFloat(timing);\n\n\t\t\t\tif( !isNaN(timing) ){\n\t\t\t\t\ttiming = Math.floor(timing * 1000);\n\n\t\t\t\t\tif( timing > longestTiming ){\n\t\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t(msTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseInt(timing, 10);\n\n\t\t\t\tif( !isNaN(timing) && (timing > longestTiming) ){\n\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tRUNNING_TRANSITIONS.set(element, {\n\t\t\t\tdeferred,\n\t\t\t\ttimer : pschedule(longestTiming, () => {\n\t\t\t\t\twaitForRepaint(() => {\n\t\t\t\t\t\tdeferred.resolve(element);\n\t\t\t\t\t\tRUNNING_TRANSITIONS.delete(element);\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t});\n\n\treturn deferred;\n}\n"]} \ No newline at end of file +{"version":3,"file":"animation.js","names":["MODULE_NAME","hasValue","isPlainObject","isEmpty","isNaN","isElement","orDefault","assert","Deferred","warn","pschedule","countermand","waitForRepaint","applyStyles","RUNNING_TRANSITIONS","WeakMap","EasingFunctions","linear","t","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","transition","element","classChanges","styleChanges","rejectOnInterruption","__methodName__","deferred","runningTransition","get","timer","error","Error","reject","resolve","delete","transitionDurationProperties","transitionProperties","timingProperties","transitionDefinition","property","value","vendorPropertiesAdded","forEach","properties","transitionValue","remove","concat","removeClass","split","classList","trim","add","addClass","elementStyles","getComputedStyle","timingProperty","sTimings","match","msTimings","longestTiming","timing","parseFloat","Math","floor","parseInt","set"],"sources":["animation.js"],"mappings":";;;AAQA,MAAMA,YAAc,mBAMZC,SAAUC,cAAeC,QAASC,MAAOC,UAAWC,UAAWC,OAAQC,aAAe,oBACtFC,SAAW,sBACXC,UAAWC,YAAaC,mBAAqB,qBAC7CC,gBAAkB,WAM1B,MAAMC,oBAAsB,IAAIC,eAoCzB,MAAMC,gBAAkB,CAE9BC,OAASC,GAAKA,EAEdC,WAAaD,GAAKA,EAAEA,EAEpBE,YAAcF,GAAKA,GAAG,EAAEA,GAExBG,cAAgBH,GAAKA,EAAE,GAAK,EAAEA,EAAEA,GAAQ,EAAE,EAAEA,GAAGA,EAAV,EAErCI,YAAcJ,GAAKA,EAAEA,EAAEA,EAEvBK,aAAeL,KAAQA,EAAGA,EAAEA,EAAE,EAE9BM,eAAiBN,GAAKA,EAAE,GAAK,EAAEA,EAAEA,EAAEA,GAAKA,EAAE,IAAI,EAAEA,EAAE,IAAI,EAAEA,EAAE,GAAG,EAE7DO,YAAcP,GAAKA,EAAEA,EAAEA,EAAEA,EAEzBQ,aAAeR,GAAK,KAAKA,EAAGA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DJ,MAC7EK,EAASO,QAAQZ,EAqClB,IAGMK,CACR","sourcesContent":["/*!\n * Module Animation\n */\n\n/**\n * @namespace Animation\n */\n\nconst MODULE_NAME = 'Animation';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {hasValue, isPlainObject, isEmpty, isNaN, isElement, orDefault, assert, Deferred} from './basic.js';\nimport {warn} from './logging.js';\nimport {pschedule, countermand, waitForRepaint} from './timers.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst RUNNING_TRANSITIONS = new WeakMap();\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Animation:EasingFunctions\n */\n\n/**\n * A collection of all basic easing functions to be used in animations.\n * All functions here take a float parameter between 0 and 1 and return a mapped value between 0 and 1.\n *\n * Taken from: https://gist.github.com/gre/1650294\n *\n * Available functions:\n * - linear\n * - easeInQuad\n * - easeOutQuad\n * - easeInOutQuad\n * - easeInCubic\n * - easeOutCubic\n * - easeInOutCubic\n * - easeInQuart\n * - easeOutQuart\n * - easeInOutQuart\n * - easeInQuint\n * - easeOutQuint\n * - easeInOutQuint\n *\n * @memberof Animation:EasingFunctions\n * @alias EasingFunctions\n * @example\n * scrollTo(window, 1000, 0, EasingFunctions.easeInOutQuint);\n */\nexport const EasingFunctions = {\n\t// no easing, no acceleration\n\tlinear : t => t,\n\t// accelerating from zero velocity\n\teaseInQuad : t => t*t,\n\t// decelerating to zero velocity\n\teaseOutQuad : t => t*(2-t),\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuad : t => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\t// accelerating from zero velocity\n\teaseInCubic : t => t*t*t,\n\t// decelerating to zero velocity\n\teaseOutCubic : t => (--t)*t*t+1,\n\t// acceleration until halfway, then deceleration\n\teaseInOutCubic : t => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\t// accelerating from zero velocity\n\teaseInQuart : t => t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuart : t => 1-(--t)*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuart : t => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\t// accelerating from zero velocity\n\teaseInQuint : t => t*t*t*t*t,\n\t// decelerating to zero velocity\n\teaseOutQuint : t => 1+(--t)*t*t*t*t,\n\t// acceleration until halfway, then deceleration\n\teaseInOutQuint : t => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t\n};\n\n\n\n/**\n * @namespace Animation:transition\n */\n\n/**\n * This method offers the possibility to apply CSS transitions via classes and/or styles and wait for the transition\n * to finish, which results in the resolution of a Deferred.\n *\n * In general, this method remedies the pain of having to manage transitions manually in JS, entering precise ms for\n * timers waiting on conclusion of transitions.\n *\n * The general principle of this is the parsing of transition CSS attributes, which may contain transition\n * timings (transition and transition-duration) and looks for the longest currently running transition.\n * Values are excepted as milliseconds or seconds (int or float notation).\n *\n * Why would you do this, if there is something like the `animationend` event, you ask? Well, the problem is, that,\n * if the animation is interrupted or never finishes for any other reason, the event never fires. For that, there is\n * the `animationcancel` event, but that is not really robustly supported at the moment. So, in cases of complex\n * style changes, where we definitively want to have a callback when the animation has been (or would have been)\n * finished, this is still the safer option. But, for simple and small cases I'd strongly recommend using the native\n * `AnimationEvent` API.\n *\n * Calling this method successively on the same element replaces the currently running transition, normally\n * resulting in premature resolution of the Deferred and application of the newly provided changes.\n *\n * Be advised, that legacy browsers like IE11 and Edge <= 18 have problems connecting interrupted transitions,\n * especially when transition-durations change during animation, resulting in skipped or choppy animations. If you\n * experience this, try to keep timings stable during animation and chain animations without overlap.\n *\n * @param {Element} element - the element to transition, by applying class and/or style changes\n * @param {?Object} [classChanges=null] - plain object containing class changes to apply, add classes via the \"add\" key, remove them via the \"remove\" key (add has precedence over remove); values may be standard CSS class string notation or an array of standard CSS class notations\n * @param {?Object} [styleChanges=null] - plain object containing style changes to apply (via applyStyles)\n * @param {?Boolean} [rejectOnInterruption=false] - if a new transition is applied using this function while a previous transition is still running the Deferred would normally be resolved before continuing, set this to true to let the Deferred reject in that case (the rejection message is \"interrupted\", access the element using \"element)\n * @return {Deferred} resolves on transition completion or repeated call on the same element, with the resolution value being the element, rejects on repeated call on same element if rejectOnInterruption is true (the rejection message is \"interrupted\", access the element using \"element\")\n *\n * @memberof Animation:transition\n * @alias transition\n * @see applyStyles\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event\n * @example\n * transition(element, {add : 'foobar'}).then(element => { return transition(element, {remove : 'foobar'}); }).then(() => { console.log('finished'); });\n * transition(element, null, {top : 0, left : 0, background : 'pink', transition : 'all 1500ms'}).then(() => { console.log('finished'); });\n * transition(element, {add : 'foobar'}).then(() => { console.log('finished'); }).catch(error => { console.log('cancelled'); });\n */\nexport function transition(element, classChanges=null, styleChanges=null, rejectOnInterruption=false){\n\tconst __methodName__ = 'cssTransition';\n\n\tclassChanges = orDefault(classChanges, {});\n\tstyleChanges = orDefault(styleChanges, {});\n\trejectOnInterruption = orDefault(rejectOnInterruption, false, 'bool');\n\n\tassert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not usable`);\n\tassert(isPlainObject(classChanges), `${MODULE_NAME}:${__methodName__} | classChanges is not a plain object`);\n\tassert(isPlainObject(styleChanges), `${MODULE_NAME}:${__methodName__} | styleChanges is not a plain object`);\n\n\tconst\n\t\tdeferred = new Deferred(),\n\t\trunningTransition = RUNNING_TRANSITIONS.get(element)\n\t;\n\n\tif( hasValue(runningTransition) ){\n\t\tcountermand(runningTransition.timer);\n\t\tif( !rejectOnInterruption ){\n\t\t\trunningTransition.deferred.resolve(element);\n\t\t} else {\n\t\t\tconst error = new Error('interrupted');\n\t\t\terror.element = element;\n\t\t\trunningTransition.deferred.reject(error);\n\t\t}\n\t}\n\tRUNNING_TRANSITIONS.delete(element);\n\n\tconst\n\t\ttransitionDurationProperties = [\n\t\t\t'transition-duration',\n\t\t\t'-webkit-transition-duration',\n\t\t\t'-moz-transition-duration',\n\t\t\t'-o-transition-duration'\n\t\t],\n\t\ttransitionProperties = [\n\t\t\t'transition',\n\t\t\t'-webkit-transition',\n\t\t\t'-moz-transition',\n\t\t\t'-o-transition'\n\t\t],\n\t\ttimingProperties = [\n\t\t\t...transitionDurationProperties,\n\t\t\t...transitionProperties\n\t\t],\n\t\ttransitionDefinition = {\n\t\t\tproperty : null,\n\t\t\tvalue : null\n\t\t}\n\t;\n\n\tif( !isEmpty(styleChanges) ){\n\t\tlet vendorPropertiesAdded;\n\t\t[transitionDurationProperties, transitionProperties].forEach(properties => {\n\t\t\tvendorPropertiesAdded = false;\n\t\t\tproperties.forEach(property => {\n\t\t\t\tconst transitionValue = styleChanges[property];\n\t\t\t\tif( !vendorPropertiesAdded && hasValue(transitionValue) ){\n\t\t\t\t\tvendorPropertiesAdded = true;\n\t\t\t\t\tproperties.forEach(property => {\n\t\t\t\t\t\tstyleChanges[property] = transitionValue;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tapplyStyles(element, styleChanges);\n\t}\n\n\tif( !isEmpty(classChanges?.remove) ){\n\t\t[].concat(classChanges.remove).forEach(removeClass => {\n\t\t\t`${removeClass}`.split(' ').forEach(removeClass => {\n\t\t\t\telement.classList.remove(removeClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\tif( !isEmpty(classChanges?.add) ){\n\t\t[].concat(classChanges.add).forEach(addClass => {\n\t\t\t`${addClass}`.split(' ').forEach(addClass => {\n\t\t\t\telement.classList.add(addClass.trim());\n\t\t\t});\n\t\t});\n\t}\n\n\twaitForRepaint(() => {\n\t\tconst elementStyles = getComputedStyle(element);\n\t\ttimingProperties.forEach(timingProperty => {\n\t\t\tif( !hasValue(transitionDefinition.value) && hasValue(elementStyles[timingProperty]) ){\n\t\t\t\ttransitionDefinition.property = timingProperty;\n\t\t\t\ttransitionDefinition.value = elementStyles[timingProperty];\n\t\t\t}\n\t\t});\n\n\t\tif( !hasValue(transitionDefinition.value) ){\n\t\t\twarn(`${MODULE_NAME}:${__methodName__} | no usable transitions on element \"${element}\"`);\n\t\t\tdeferred.resolve(element);\n\t\t} else {\n\t\t\tconst\n\t\t\t\tsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+(\\.\\d+)?)s(\\s|,|$)/g),\n\t\t\t\tmsTimings = transitionDefinition.value.match(/(^|\\s)(\\d+)ms(\\s|,|$)/g)\n\t\t\t;\n\t\t\tlet\tlongestTiming = 0;\n\n\t\t\t(sTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseFloat(timing);\n\n\t\t\t\tif( !isNaN(timing) ){\n\t\t\t\t\ttiming = Math.floor(timing * 1000);\n\n\t\t\t\t\tif( timing > longestTiming ){\n\t\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t(msTimings ?? []).forEach(timing => {\n\t\t\t\ttiming = parseInt(timing, 10);\n\n\t\t\t\tif( !isNaN(timing) && (timing > longestTiming) ){\n\t\t\t\t\tlongestTiming = timing;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tRUNNING_TRANSITIONS.set(element, {\n\t\t\t\tdeferred,\n\t\t\t\ttimer : pschedule(longestTiming, () => {\n\t\t\t\t\twaitForRepaint(() => {\n\t\t\t\t\t\tdeferred.resolve(element);\n\t\t\t\t\t\tRUNNING_TRANSITIONS.delete(element);\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t});\n\n\treturn deferred;\n}\n"]} \ No newline at end of file diff --git a/docs/examples/lib/annex/dist/arrays.js b/docs/examples/lib/annex/dist/arrays.js index 48b6ebea..948a2b47 100644 --- a/docs/examples/lib/annex/dist/arrays.js +++ b/docs/examples/lib/annex/dist/arrays.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Arrays diff --git a/docs/examples/lib/annex/dist/basic.js b/docs/examples/lib/annex/dist/basic.js index 71199d91..a91a16ca 100644 --- a/docs/examples/lib/annex/dist/basic.js +++ b/docs/examples/lib/annex/dist/basic.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Basic */ -const MODULE_NAME="Basic";import{log,warn}from"./logging.js";export function assert(t,e){if(!t)throw e=orDefault(e,"assert exception: assertion failed","str"),new Error(e)}export function attempt(t){assert(isA(t,"function"),"Basic:attempt | closure is no function");try{t()}catch(t){return!1}return!0}export function hasValue(){let t=!0;return Array.from(arguments).forEach((e=>{t&&=null!=e})),t}export function size(t,e=!0){if(isA(t?.values,"function"))return Array.from(t.values()).length;let r;switch(getType(t)){case"array":r=t.length;break;case"set":case"map":r=t.size;break;case"iterator":r=Array.from(t).length;break;case"string":r=e?[...t].length:t.length;break;case"object":r=Object.values(t).length;break;default:r=null}return r}export function isEmpty(){let t=!0,e=[void 0,null,"",0];return Array.from(arguments).forEach((t=>{isA(t?.__additionalEmptyValues__,"array")&&(e=e.concat(t.__additionalEmptyValues__))})),e=Array.from(new Set(e)),Array.from(arguments).forEach((r=>{t&&!isA(r?.__additionalEmptyValues__,"array")&&(t=e.includes(r),t||(t=0===size(r)))})),t}export function hasMembers(t,e,r=!1){e=orDefault(e,[],"arr"),r=orDefault(r,!1,"bool");let n=!0;return e.forEach((e=>{hasValue(t[`${e}`])||(r&&log().info(`Basic:hasMembers | missing member ${e}`),n=!1)})),n}export function orDefault(t,e,r=null,n=null){return n=hasValue(n)?[].concat(n):[],hasValue(r)?!isA(r,"function")&&["str","string","int","integer","bool","boolean","float","arr","array"].includes(`${r.toLowerCase()}`)?(r=`${r}`.toLowerCase(),["str","string"].includes(r)?r=function(t){return`${t}`}:["int","integer"].includes(r)?r=function(t){return parseInt(t,10)}:["bool","boolean"].includes(r)?r=function(t){return!!t}:"float"===r?r=function(t){return parseFloat(t)}:["arr","array"].includes(r)&&(r=function(t){return[].concat(t)})):isA(r,"function")||(r=function(t){return t}):r=function(t){return t},!hasValue(t)||n.includes(t)?e:r(t)}export function getType(t){if(!hasValue(t))return`${t}`.toLowerCase();const e=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();return"generatorfunction"===e?"function":"document"===e?"htmldocument":"element"===e||/^html.*element$/.test(e)?"htmlelement":/^.*iterator$/.test(e)?"iterator":e.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)?e:"object"==typeof t||"function"==typeof t?"object":typeof t}export function isA(t,e){return["undefined","null","boolean","number","bigint","string","symbol","function","object","array","date","error","generator","iterator","regexp","set","weakset","map","weakmap","htmldocument","htmlelement","nodelist","window"].includes(`${e}`.toLowerCase())?getType(t)===`${e}`.toLowerCase():(warn(`Basic:isA | "${e}" is not a recognized type`),!1)}export function isInt(t){return parseInt(t,10)===t}export function isFloat(t){return parseFloat(t)===t}export function isPlainObject(t){return isA(t,"object")&&hasValue(t)&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)}export function isNaN(t,e=!0){return(e=orDefault(e,!0,"bool"))?t!=t:isNaN(t)}export function isEventTarget(t){return hasValue(t)&&isA(t.addEventListener,"function")&&isA(t.removeEventListener,"function")&&isA(t.dispatchEvent,"function")}export function isSelector(t){t=orDefault(t,0,"str");const e=document.createDocumentFragment();try{e.querySelector(t)}catch(t){return!1}return!0}export function isPotentialId(t,e="",r="[1-9][0-9]*",n="",s=!0){t=`${t}`,e=orDefault(e,"","str"),r=orDefault(r,"[1-9][0-9]*","str"),n=orDefault(n,"","str");const o=t=>`${t}`.replace(/([\-\[\]\/{}()*+?.\\^$|])/g,"\\$&");let i;i=(s=orDefault(s,!0,"bool"))?new RegExp(`^${o(e)}(${r})${o(n)}$`):new RegExp(`^${e}(${r})${n}$`);const a=i.exec(t);return!!hasValue(a)&&a[1]}export function minMax(t,e,r){return assert(t<=r,"Basic:minMax | min can not be larger than max"),er?r:e}export class Deferred{constructor(){const t="fulfilled",e="rejected";this.resolve=null,this.reject=null,this.provision=null,this.status="pending",this.isSettled=()=>[t,e].includes(this.status),this.promise=new Promise(((r,n)=>{this.resolve=e=>{this.status=t,r(e)},this.reject=t=>{this.status=e,n(t)}}))}then(t){return this.promise.then(t)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}}export class Observable{constructor(t){this.__className__="Observable",this._value=t,this._subscriptions=[]}getValue(){return this._value}setValue(t,e=!1){const r=this._value,n=r!==t;this._value=t,(n||e)&&this._subscriptions.forEach((e=>e(t,r)))}subscribe(t){return assert(isA(t,"function"),`Basic:${this.__className__}.subscribe | subscription must be function`),this._subscriptions.indexOf(t)<0&&(this._subscriptions=[...this._subscriptions,t]),t}unsubscribe(t){this._subscriptions=this._subscriptions.filter((e=>e!==t))}toString(){return`${this._value}`}} +const MODULE_NAME="Basic";import{log,warn}from"./logging.js";export function assert(t,e){if(!t)throw e=orDefault(e,"assert exception: assertion failed","str"),new Error(e)}export function attempt(t){assert(isA(t,"function"),"Basic:attempt | closure is no function");try{t()}catch(t){return!1}return!0}export function hasValue(){let t=!0;return Array.from(arguments).forEach((e=>{t&&=null!=e})),t}export function size(t,e=!0){if(isA(t?.values,"function"))return Array.from(t.values()).length;let r;switch(getType(t)){case"array":r=t.length;break;case"set":case"map":r=t.size;break;case"iterator":r=Array.from(t).length;break;case"string":r=e?[...t].length:t.length;break;case"object":r=Object.values(t).length;break;default:r=null}return r}export function isEmpty(){let t=!0,e=[void 0,null,"",0];return Array.from(arguments).forEach((t=>{isA(t?.__additionalEmptyValues__,"array")&&(e=e.concat(t.__additionalEmptyValues__))})),e=Array.from(new Set(e)),Array.from(arguments).forEach((r=>{t&&!isA(r?.__additionalEmptyValues__,"array")&&(t=e.includes(r),t||(t=0===size(r)))})),t}export function hasMembers(t,e,r=!1){e=orDefault(e,[],"arr"),r=orDefault(r,!1,"bool");let n=!0;return e.forEach((e=>{hasValue(t[`${e}`])||(r&&log().info(`Basic:hasMembers | missing member ${e}`),n=!1)})),n}export function orDefault(t,e,r=null,n=null){return n=hasValue(n)?[].concat(n):[],hasValue(r)?!isA(r,"function")&&["str","string","int","integer","bool","boolean","float","arr","array"].includes(`${r.toLowerCase()}`)?(r=`${r}`.toLowerCase(),["str","string"].includes(r)?r=function(t){return`${t}`}:["int","integer"].includes(r)?r=function(t){return parseInt(t,10)}:["bool","boolean"].includes(r)?r=function(t){return!!t}:"float"===r?r=function(t){return parseFloat(t)}:["arr","array"].includes(r)&&(r=function(t){return[].concat(t)})):isA(r,"function")||(r=function(t){return t}):r=function(t){return t},!hasValue(t)||n.includes(t)?e:r(t)}export function getType(t){if(!hasValue(t))return`${t}`.toLowerCase();const e=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();return"generatorfunction"===e?"function":"document"===e?"htmldocument":"element"===e||/^html.*element$/.test(e)?"htmlelement":/^.*iterator$/.test(e)?"iterator":e.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)?e:"object"==typeof t||"function"==typeof t?"object":typeof t}export function isA(t,e){return["undefined","null","boolean","number","bigint","string","symbol","function","object","array","date","error","generator","iterator","regexp","set","weakset","map","weakmap","htmldocument","htmlelement","nodelist","window"].includes(`${e}`.toLowerCase())?getType(t)===`${e}`.toLowerCase():(warn(`Basic:isA | "${e}" is not a recognized type`),!1)}export function isInt(t){return parseInt(t,10)===t}export function isFloat(t){return parseFloat(t)===t}export function isPlainObject(t){return isA(t,"object")&&hasValue(t)&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)}export function isNaN(t,e=!0){return(e=orDefault(e,!0,"bool"))?t!=t:isNaN(t)}export function isElement(t){return isA(t,"htmlelement")}export function isEventTarget(t){return hasValue(t)&&isA(t.addEventListener,"function")&&isA(t.removeEventListener,"function")&&isA(t.dispatchEvent,"function")}export function isSelector(t){t=orDefault(t,0,"str");const e=document.createDocumentFragment();try{e.querySelector(t)}catch(t){return!1}return!0}export function isPotentialId(t,e="",r="[1-9][0-9]*",n="",s=!0){t=`${t}`,e=orDefault(e,"","str"),r=orDefault(r,"[1-9][0-9]*","str"),n=orDefault(n,"","str");const o=t=>`${t}`.replace(/([\-\[\]\/{}()*+?.\\^$|])/g,"\\$&");let i;i=(s=orDefault(s,!0,"bool"))?new RegExp(`^${o(e)}(${r})${o(n)}$`):new RegExp(`^${e}(${r})${n}$`);const a=i.exec(t);return!!hasValue(a)&&a[1]}export function minMax(t,e,r){return assert(t<=r,"Basic:minMax | min can not be larger than max"),er?r:e}export class Deferred{constructor(){const t="fulfilled",e="rejected";this.resolve=null,this.reject=null,this.provision=null,this.status="pending",this.isSettled=()=>[t,e].includes(this.status),this.promise=new Promise(((r,n)=>{this.resolve=e=>{this.status=t,r(e)},this.reject=t=>{this.status=e,n(t)}}))}then(t){return this.promise.then(t)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}}export class Observable{constructor(t){this.__className__="Observable",this._value=t,this._subscriptions=[]}getValue(){return this._value}setValue(t,e=!1){const r=this._value,n=r!==t;this._value=t,(n||e)&&this._subscriptions.forEach((e=>e(t,r)))}subscribe(t){return assert(isA(t,"function"),`Basic:${this.__className__}.subscribe | subscription must be function`),this._subscriptions.indexOf(t)<0&&(this._subscriptions=[...this._subscriptions,t]),t}unsubscribe(t){this._subscriptions=this._subscriptions.filter((e=>e!==t))}toString(){return`${this._value}`}} //# sourceMappingURL=basic.js.map diff --git a/docs/examples/lib/annex/dist/basic.js.map b/docs/examples/lib/annex/dist/basic.js.map index 9aab52a4..5c4ebcd4 100644 --- a/docs/examples/lib/annex/dist/basic.js.map +++ b/docs/examples/lib/annex/dist/basic.js.map @@ -1 +1 @@ -{"version":3,"file":"basic.js","names":["MODULE_NAME","log","warn","assert","condition","message","orDefault","Error","attempt","closure","isA","ex","hasValue","res","Array","from","arguments","forEach","value","size","target","countStringCharacters","values","length","getType","Object","isEmpty","emptyValues","undefined","obj","__additionalEmptyValues__","concat","Set","includes","hasMembers","memberNames","verbose","memberName","info","expression","defaultValue","caster","additionalEmptyValues","toLowerCase","parseInt","parseFloat","deepType","prototype","toString","call","slice","test","match","type","isInt","intVal","isFloat","floatVal","isPlainObject","constructor","isNaN","checkForIdentity","isEventTarget","addEventListener","removeEventListener","dispatchEvent","isSelector","fragment","document","createDocumentFragment","querySelector","isPotentialId","prefix","idRex","postfix","maskFixes","mask","str","replace","rex","RegExp","matches","exec","minMax","min","max","Deferred","STATUS_FULFILLED","STATUS_REJECTED","this","resolve","reject","provision","status","isSettled","promise","Promise","resolution","rejection","then","f","catch","finally","Observable","initialValue","__className__","_value","_subscriptions","getValue","setValue","newValue","force","oldValue","isNewValue","s","subscribe","subscription","indexOf","unsubscribe","filter"],"sources":["basic.js"],"mappings":";;;AAQA,MAAMA,YAAc,eAMZC,IAAKC,SAAW,sBA0BjB,SAASC,OAAOC,EAAWC,GACjC,IAAKD,EAEJ,MADAC,EAAUC,UAAUD,EAAS,qCAAsC,OAC7D,IAAIE,MAAMF,EAElB,QA0BO,SAASG,QAAQC,GACvBN,OAAOO,IAAID,EAAS,YAAa,0CAEjC,IACCA,GAGD,CAFE,MAAME,GACP,OAAO,CACR,CAEA,OAAO,CACR,QAuBO,SAASC,WACf,IAAIC,GAAM,EAMV,OAJAC,MAAMC,KAAKC,WAAWC,SAAQC,IAC7BL,IAAQ,MAAEK,CAAyC,IAG7CL,CACR,QA+CO,SAASM,KAAKC,EAAQC,GAAsB,GAClD,GAAIX,IAAIU,GAAQE,OAAQ,YAAc,OAAOR,MAAMC,KAAKK,EAAOE,UAAUC,OAEzE,IAAIV,EACJ,OAAQW,QAAQJ,IACf,IAAK,QACJP,EAAMO,EAAOG,OACd,MAEA,IAAK,MACL,IAAK,MACJV,EAAMO,EAAOD,KACd,MAEA,IAAK,WACJN,EAAMC,MAAMC,KAAKK,GAAQG,OAC1B,MAEA,IAAK,SAEJV,EAAMQ,EAAwB,IAAID,GAAQG,OAASH,EAAOG,OAC3D,MAEA,IAAK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ACP,EAAkBC,GAAiBvD,SAASwD,KAAKI,QACzEJ,KAAKM,QAAU,IAAIC,SAAQ,CAACN,EAASC,KACpCF,KAAKC,QAAUO,IACdR,KAAKI,OAASN,EACdG,EAAQO,EAAW,EAEpBR,KAAKE,OAASO,IACbT,KAAKI,OAASL,EACdG,EAAOO,EAAU,CACjB,GAEH,CAEAC,KAAKC,GACJ,OAAOX,KAAKM,QAAQI,KAAKC,EAC1B,CAEAC,MAAMD,GACL,OAAOX,KAAKM,QAAQM,MAAMD,EAC3B,CAEAE,QAAQF,GACP,OAAOX,KAAKM,QAAQO,QAAQF,EAC7B,SAiCM,MAAMG,WACZ5C,YAAY6C,GACXf,KAAKgB,cAAgB,aACrBhB,KAAKiB,OAASF,EACdf,KAAKkB,eAAiB,EACvB,CAEAC,WACC,OAAOnB,KAAKiB,MACb,CAEAG,SAASC,EAAUC,GAAM,GACxB,MACCC,EAAWvB,KAAKiB,OAChBO,EAAaD,IAAaF,EAE3BrB,KAAKiB,OAASI,GACVG,GAAcF,IACjBtB,KAAKkB,eAAe1F,SAAQiG,GAAKA,EAAEJ,EAAUE,IAE/C,CAEAG,UAAUC,GAMT,OAJAjH,OAAOO,IAAI0G,EAAc,YAAa,SAAkB3B,KAAKgB,2DACzDhB,KAAKkB,eAAeU,QAAQD,GAAgB,IAC/C3B,KAAKkB,eAAiB,IAAIlB,KAAKkB,eAAgBS,IAEzCA,CACR,CAEAE,YAAYF,GACX3B,KAAKkB,eAAiBlB,KAAKkB,eAAeY,QAAOL,GAAKA,IAAME,GAC7D,CAEApE,WACC,MAAO,GAAGyC,KAAKiB,QAChB","sourcesContent":["/*!\n * Module Basic\n */\n\n/**\n * @namespace Basic\n */\n\nconst MODULE_NAME = 'Basic';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {log, warn} from './logging.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Basic:assert\n */\n\n/**\n * Classical assert method. If condition is falsy, throw assert exception.\n *\n * @param {Boolean} condition - defines if an assertion is successful\n * @param {?String} [message='assert exception: assertion failed'] - to display if assertion fails\n * @throws assert exception\n *\n * @memberof Basic:assert\n * @alias assert\n * @example\n * function set(name, value){\n * assert(name.length > 0);\n * assert(isPlainObject(value), 'error: value must be plain object');\n * ...\n * }\n */\nexport function assert(condition, message){\n\tif( !condition ){\n\t\tmessage = orDefault(message, 'assert exception: assertion failed', 'str');\n\t\tthrow new Error(message);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:attempt\n */\n\n/**\n * Attempt to compute contents of closure and catch all occurring exceptions.\n * The boolean result tells you if the operation was successful or not.\n *\n * This is most helpful, when used to test value conversions or other atomic/singluar operations, where it\n * just is important if something isolated works or not.\n *\n * Do not encapsulate complex code in the closure and mind recursively occurring exceptions!\n *\n * @param {Function} closure - the code to test\n * @throws error if closure is not a function\n * @returns {Boolean} true if no exception occurred\n *\n * @memberof Basic:attempt\n * @alias attempt\n * @example\n * if( !attempt(function(){ foobar(); }) ){ console.log('foobar cannot be executed!'); }\n */\nexport function attempt(closure){\n\tassert(isA(closure, 'function'), `${MODULE_NAME}:attempt | closure is no function`);\n\n\ttry {\n\t\tclosure();\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:hasValue\n */\n\n/**\n * Check if variable(s) is set, by being neither undefined nor null.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are set\n *\n * @memberof Basic:hasValue\n * @alias hasValue\n * @example\n * function set(name, value){\n * if( hasValue(name, value) ){\n * ...\n * }\n * }\n */\nexport function hasValue(){\n\tlet res = true;\n\n\tArray.from(arguments).forEach(value => {\n\t\tres &&= ((value !== undefined) && (value !== null));\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:size\n */\n\n/**\n * Determine the (value) size of a collection.\n *\n * A collection is an object with countable values:\n * - Arrays return their length\n * - Sets and Maps return their size\n * - Strings return their (character) length\n * - Iterators return the length of their value list\n * - Objects return the length of their value list\n * - any object implementing .values() returns the length of the returned value list\n *\n * @param {Object|Array|Set|Map|String|Iterable} target - a collection to determine the (value) size of\n * @param {?Boolean} [countStringCharacters=true] - if we want to determine the length of a string, we'd normally like to count actual characters, but length normally returns the technical length counting more than one for unicode chars, set this to \"false\" to use technical length instead of characters\n * @returns {Number|null} the size of the collection or null if no size could be determined\n *\n * @memberof Basic:size\n * @alias size\n * @example\n * size('日本国💩👻');\n * => 5\n * size('日本国💩👻', false);\n * => 7\n * size({a : 1, b : new Date(), c : [1, 2, 3]});\n * => 3\n * size(['test', 'test', 'test']);\n * => 3\n * size(new Set(['test1', 'test2', 'test3']));\n * => 3\n * size(new Set(['test1', 'test2', 'test3']).values());\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]));\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]).values());\n * => 3\n * size(null);\n * => null\n * size(undefined);\n * => null\n */\nexport function size(target, countStringCharacters=true){\n\tif( isA(target?.values, 'function') ) return Array.from(target.values()).length;\n\n\tlet res;\n\tswitch( getType(target) ){\n\t\tcase 'array':\n\t\t\tres = target.length;\n\t\tbreak;\n\n\t\tcase 'set':\n\t\tcase 'map':\n\t\t\tres = target.size;\n\t\tbreak;\n\n\t\tcase 'iterator':\n\t\t\tres = Array.from(target).length;\n\t\tbreak;\n\n\t\tcase 'string':\n\t\t\t// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description\n\t\t\tres = countStringCharacters ? [...target].length : target.length;\n\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tres = Object.values(target).length;\n\t\tbreak;\n\n\t\tdefault:\n\t\t\tres = null;\n\t\tbreak;\n\t}\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:isEmpty\n */\n\n/**\n * Check if variable(s) contain non-empty value\n * (not undefined, null, '', 0, [], {} or an empty Set/Map).\n *\n * You can supply additional non-empty values by providing an object having the key \"__additionalEmptyValues__\" as\n * any single parameter. Multiple occurrences will be merged.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are empty\n *\n * @memberof Basic:isEmpty\n * @alias isEmpty\n * @example\n * function set(name, value){\n * if( isEmpty(fooBar) || isEmpty({'__additionalEmptyValues__' : [false, '0']}, someArray, someSet, someString, value) ){\n * ...\n * }\n * }\n */\nexport function isEmpty(){\n\tlet\n\t\tres = true,\n\t\temptyValues = [undefined, null, '', 0]\n\t;\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\temptyValues = emptyValues.concat(obj.__additionalEmptyValues__);\n\t\t}\n\t});\n\temptyValues = Array.from(new Set(emptyValues));\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( res && !isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\tres = emptyValues.includes(obj);\n\n\t\t\tif( !res ){\n\t\t\t\tres = (size(obj) === 0);\n\t\t\t}\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:hasMembers\n */\n\n/**\n * \"Validates\" an object in a very basic way by checking if all given members are present and are not nullish.\n *\n * @param {Object} obj - the object to check\n * @param {String[]} memberNames - the names of the members to check\n * @param {Boolean} [verbose=false] - defines if method should output missing members to console\n * @returns {Boolean} all memberNames present and not nullish\n *\n * @memberof Basic:hasMembers\n * @alias hasMembers\n * @example\n * function pat(kitten){\n * if( hasMembers(kitten, ['fluff', 'meow', 'scratch']) ){\n * ...\n * }\n * }\n */\nexport function hasMembers(obj, memberNames, verbose=false){\n\tmemberNames = orDefault(memberNames, [], 'arr');\n\tverbose = orDefault(verbose, false, 'bool');\n\n\tlet res = true;\n\n\tmemberNames.forEach(memberName => {\n\t\tif( !hasValue(obj[`${memberName}`]) ){\n\t\t\tif( verbose ){\n\t\t\t\tlog().info(`${MODULE_NAME}:hasMembers | missing member ${memberName}`);\n\t\t\t}\n\n\t\t\tres = false;\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:orDefault\n */\n\n/**\n * If an expression returns a non-value (undefined or null), use the default value instead.\n * Define a caster name, to force expression result/value into certain data type.\n *\n * @param {*} expression - the expression to evaluate\n * @param {*} defaultValue - the default value to use if the expression is considered empty\n * @param {?(String|Function)} [caster=null] - either a default caster by name ('str', 'string', 'int', 'integer', 'bool', 'boolean', 'float', 'arr', 'array') or a function getting the value and returning the transformed value\n * @param {?Array} [additionalEmptyValues=null] - if set, provides a list of additional values to be considered empty, apart from undefined and null\n * @returns {*} expression of defaultValue\n *\n * @memberof Basic:orDefault\n * @alias orDefault\n * @example\n * function set(name, value){\n * name = orDefault(name, 'kittens!', 'string', ['', 'none']);\n * value = orDefault(value, 42, 'int');\n * }\n */\nexport function orDefault(expression, defaultValue, caster=null, additionalEmptyValues=null){\n\tif( hasValue(additionalEmptyValues) ){\n\t\tadditionalEmptyValues = [].concat(additionalEmptyValues);\n\t} else {\n\t\tadditionalEmptyValues = [];\n\t}\n\n\tif( hasValue(caster) ){\n\t\tif(\n\t\t\t!isA(caster, 'function')\n\t\t\t&& ([\n\t\t\t\t'str', 'string',\n\t\t\t\t'int', 'integer',\n\t\t\t\t'bool', 'boolean',\n\t\t\t\t'float',\n\t\t\t\t'arr', 'array'\n\t\t\t].includes(`${caster.toLowerCase()}`))\n\t\t){\n\t\t\tcaster = `${caster}`.toLowerCase();\n\n\t\t\tif( ['str', 'string'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return `${value}`; };\n\t\t\t} else if( ['int', 'integer'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return parseInt(value, 10); };\n\t\t\t} else if( ['bool', 'boolean'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return !!value; };\n\t\t\t} else if( caster === 'float' ){\n\t\t\t\tcaster = function(value){ return parseFloat(value); };\n\t\t\t} else if( ['arr', 'array'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return [].concat(value); };\n\t\t\t}\n\t\t} else if( !isA(caster, 'function') ){\n\t\t\tcaster = function(value){ return value; };\n\t\t}\n\t} else {\n\t\tcaster = function(value){ return value; };\n\t}\n\n\tif( !hasValue(expression) || (additionalEmptyValues.includes(expression)) ){\n\t\treturn defaultValue;\n\t} else {\n\t\treturn caster(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:getType\n */\n\n/**\n * Prod-ready type detection for values, expanding on flawed typeof functionality, roughly following\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof, but expanding on\n * useful frontend types like \"htmldocument\", \"htmlelement\" and \"nodelist\"\n *\n * Types:\n * - \"undefined\"\n * - \"null\"\n * - \"boolean\"\n * - \"number\"\n * - \"bigint\"\n * - \"string\"\n * - \"symbol\"\n * - \"function\"\n * - \"object\"\n * - \"array\"\n * - \"date\"\n * - \"error\"\n * - \"generator\"\n * - \"iterator\"\n * - \"regexp\"\n * - \"set\"\n * - \"weakset\"\n * - \"map\"\n * - \"weakmap\"\n * - \"htmldocument\"\n * - \"htmlelement\"\n * - \"nodelist\"\n * - \"window\"\n *\n * @param {*} [value] - variable to check the type of\n * @returns {String} the value type in lower case\n *\n * @memberof Basic:getType\n * @alias getType\n * @example\n * if( getType(cb) === 'function' ){\n * ...\n * }\n */\nexport function getType(value) {\n\tif( !hasValue(value) ) return `${value}`.toLowerCase();\n\n\tconst deepType = Object.prototype.toString.call(value).slice(8,-1).toLowerCase();\n\n\tif( deepType === 'generatorfunction' ) return 'function';\n\tif( deepType === 'document' ) return 'htmldocument';\n\tif( deepType === 'element' ) return 'htmlelement';\n\tif( /^html.*element$/.test(deepType) ) return 'htmlelement';\n\tif( /^.*iterator$/.test(deepType) ) return 'iterator';\n\n\treturn deepType.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)\n\t\t? deepType\n\t\t: ((typeof value === 'object') || (typeof value === 'function')) ? 'object' : typeof value\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isA\n */\n\n/**\n * Short form of \"getType\"-method with a more compact syntax.\n * Can identify all types listed in getType.\n *\n * @param {*} value - variable to check the type of\n * @param {String} type - the name of the type to check for, has to be a standard JS-type, is case insensitive\n * @returns {Boolean} target has type\n *\n * @memberof Basic:isA\n * @alias isA\n * @see getType\n * @example\n * let stringBool = (isA(test, 'boolean') && test) ? 'true' : 'false';\n */\nexport function isA(value, type){\n\tif(\n\t\t[\n\t\t\t'undefined',\n\t\t\t'null',\n\t\t\t'boolean',\n\t\t\t'number',\n\t\t\t'bigint',\n\t\t\t'string',\n\t\t\t'symbol',\n\t\t\t'function',\n\t\t\t'object',\n\t\t\t'array',\n\t\t\t'date',\n\t\t\t'error',\n\t\t\t'generator',\n\t\t\t'iterator',\n\t\t\t'regexp',\n\t\t\t'set',\n\t\t\t'weakset',\n\t\t\t'map',\n\t\t\t'weakmap',\n\t\t\t'htmldocument',\n\t\t\t'htmlelement',\n\t\t\t'nodelist',\n\t\t\t'window'\n\t\t].includes(`${type}`.toLowerCase())\n\t){\n\t\treturn getType(value) === `${type}`.toLowerCase();\n\t} else {\n\t\twarn(`${MODULE_NAME}:isA | \"${type}\" is not a recognized type`);\n\t\treturn false;\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isInt\n */\n\n/**\n * Returns if a value is truly a real integer value and not just an int-parsable value for example.\n * Since JS only knows the data type \"number\" all numbers are usable as floats by default, but not the\n * other way round.\n *\n * @param {*} intVal - the value the check\n * @returns {Boolean} true if intVal is a true integer value\n *\n * @memberof Basic:isInt\n * @alias isInt\n * @example\n * if( !isInt(val) ){\n * val = parseInt(val, 10);\n * }\n */\nexport function isInt(intVal){\n\treturn parseInt(intVal, 10) === intVal;\n}\n\n\n\n/**\n * @namespace Basic:isFloat\n */\n\n/**\n * Returns if a value is a numeric value, usable as a float number in any calculation.\n * Any number that fulfills isInt, is also considered a valid float, which lies in JS's\n * nature of not differentiating ints and floats by putting them both into a \"number\"-type.\n * So ints are always floats, but not necessarily the other way round.\n *\n * @param {*} floatVal - the value to check\n * @returns {Boolean} true if floatVal is usable in a float context\n *\n * @memberof Basic:isFloat\n * @alias isFloat\n * @example\n * if( !isFloat(val) ){\n * alert('val can not be calculated with!');\n * }\n */\nexport function isFloat(floatVal){\n\treturn parseFloat(floatVal) === floatVal;\n}\n\n\n\n/**\n * @namespace Basic:isPlainObject\n */\n\n/**\n * Returns if a value is an object literal, so so-called \"plain object.\n * A plain object is something like \"{hello : 'world'}\".\n *\n * This might especially be helpful when dealing with JSON configs, so quickly check if\n * something might even be parsed JSON (which in most cases is a plain object in js).\n *\n * Be aware that this function cannot differentiate between constructor-based simple objects and\n * plain objects declared inline. So, if someone took on the work to instantiate a base object and assign\n * properties either in a function or a constructor, we accept that as a plain object.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value seems to be a plain object\n *\n * @memberof Basic:isPlainObject\n * @alias isPlainObject\n * @example\n * const isParameterConfigObject = isPlainObject(param);\n */\nexport function isPlainObject(value){\n\treturn isA(value, 'object')\n\t\t&& hasValue(value)\n\t\t&& (value.constructor === Object)\n\t\t&& Object.prototype.toString.call(value) === '[object Object]'\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isNaN\n */\n\n/**\n * Returns if an expression is NaN or not.\n * This method employs two different approaches:\n * By default it really checks if the expression is the _value_ NaN or not, this being a valid JS-value for something.\n * In JS this gets checked by comparing an expression with itself on identity, since NaN is the only value not being\n * identical to itself. If you set checkForIdentity to false, this method will use the standard JS-isNaN, which\n * inspects the expression, tries to cast or parse a number from it and returns the result.\n *\n * @param {*} expression - the expression to check\n * @param {Boolean} [checkForIdentity=true] - set to false if you want to use default JS-functionality\n * @returns {Boolean} true if expression is NaN\n *\n * @memberof Basic:isNaN\n * @alias isNaN\n * @example\n * if( !isNaN(suspiciousCalculatedValue) ){\n * return suspiciousCalculatedValue * 3;\n * }\n */\nexport function isNaN(expression, checkForIdentity=true){\n\tcheckForIdentity = orDefault(checkForIdentity, true, 'bool');\n\n\tif( checkForIdentity ){\n\t\treturn expression !== expression;\n\t} else {\n\t\treturn isNaN(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isEventTarget\n */\n\n/**\n * Returns if a value is an EventTarget, which means that it is able to dispatch and receive events.\n * This is determined via duck-typing and not via class inheritance check, since this method is not\n * about type-safety, but the question if we can use the target for events, which is simply determined\n * by three essential object methods: addEventListener, removeEventListener and dispatchEvent. All\n * objects supporting these are fine with us.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value supports event methods\n *\n * @memberof Basic:isEventTarget\n * @alias isEventTarget\n * @example\n * if( isEventTarget(target) ){\n * target.dispatchEvent(new CustomEvent('foobar'));\n * }\n */\nexport function isEventTarget(value){\n\treturn hasValue(value)\n\t\t&& isA(value.addEventListener, 'function')\n\t\t&& isA(value.removeEventListener, 'function')\n\t\t&& isA(value.dispatchEvent, 'function')\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isSelector\n */\n\n/**\n * Returns if a value is a valid selector, usable in methods such as querySelector\n * and querySelectorAll.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is a valid selector\n *\n * @memberof Basic:isSelector\n * @alias isSelector\n * @example\n * if( isSelector(selector) ){\n * document.querySelector(selector)?.style.setProperty('color', 'red');\n * }\n */\nexport function isSelector(value){\n\t// almost all values like \"null\", \"undefined\" and \"NaN\" are accepted querySelectors, numbers are not\n\tvalue = orDefault(value, 0, 'str');\n\n\tconst fragment = document.createDocumentFragment();\n\n\ttry {\n\t\tfragment.querySelector(value);\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:isPotentialId\n */\n\n/**\n * Determines if a given value is potentially a valid id for something, because it matches a format of given\n * prefix, postfix and id regex. \"Potential\", because we can only assume by the format, we do not actually know\n * if the id really matches anything like a database entry for example.\n *\n * @param {(String|Number)} value - the value to test, will be stringified\n * @param {?String} [prefix=''] - a prefix for the id\n * @param {?String} [idRex='[1-9][0-9]*'] - the regex string to use to identify the id part of the value\n * @param {?String} [postfix=''] - a postfix for the id\n * @param {?Boolean} [maskFixes=true] - usually, prefixes are not treated as regexes and are automatically masked, if you'd like to define complex pre- and postfixes using regexes, set this to false\n * @returns {String|Boolean} if value is potential id according to format, the id is returned as a string (still usable as a truthy value), otherwise the return value is false\n *\n * @memberof Basic:isPotentialId\n * @alias isPotentialId\n * @example\n * if( isPotentialId(id, 'test_(', '[0-9]+', ')') ){\n * createJsonRequest(`/backend/${id}`).then(() => { alert('done'); });\n * }\n */\nexport function isPotentialId(value, prefix='', idRex='[1-9][0-9]*', postfix='', maskFixes=true){\n\tvalue = `${value}`;\n\tprefix = orDefault(prefix, '', 'str');\n\tidRex = orDefault(idRex, '[1-9][0-9]*', 'str');\n\tpostfix = orDefault(postfix, '', 'str');\n\tmaskFixes = orDefault(maskFixes, true, 'bool');\n\n\tconst mask = str => `${str}`.replace(/([\\-\\[\\]\\/{}()*+?.\\\\^$|])/g, \"\\\\$&\");\n\n\tlet rex;\n\tif( maskFixes ){\n\t\trex = new RegExp(`^${mask(prefix)}(${idRex})${mask(postfix)}$`);\n\t} else {\n\t\trex = new RegExp(`^${prefix}(${idRex})${postfix}$`);\n\t}\n\n\tconst matches = rex.exec(value);\n\treturn hasValue(matches) ? matches[1] : false;\n}\n\n\n\n/**\n * @namespace Basic:minMax\n */\n\n/**\n * Checks if a value is within bounds of a minimum and maximum and returns\n * the value or the upper or lower bound respectively.\n *\n * Accepts all values comparable with > and <.\n *\n * @param {*} min - the lower bound\n * @param {*} value - the value to check\n * @param {*} max - the upper bound\n * @throws error if min is not smaller than max\n * @returns {*} value, min or max\n *\n * @memberof Basic:minMax\n * @alias minMax\n * @example\n * let croppedVal = minMax(-100, value, 100);\n */\nexport function minMax(min, value, max){\n\tassert(min <= max, `${MODULE_NAME}:minMax | min can not be larger than max`);\n\n\treturn (value < min)\n\t\t? min\n\t\t: (\n\t\t\t(value > max)\n\t\t\t\t? max\n\t\t\t\t: value\n\t\t)\n\t;\n}\n\n\n\n/**\n * @namespace Basic:Deferred\n */\n\n/**\n * @typedef Deferred\n * @type {Object}\n * @property {Promise} promise - the wrapped promise\n * @property {Function} resolve - resolves the wrapped promise with given value\n * @property {Function} reject - rejects the wrapped promise with given error\n * @property {Function} then - defines a success handler for the wrapped promise and returns its result\n * @property {Function} catch - defines an error handler for the wrapped promise and returns its result\n * @property {Function} finally - defines a \"settled\" handler for the wrapped promise and returns its result\n * @property {String} status - holds the current resolution status, can either be \"pending\", \"fulfilled\" or \"rejected\"\n * @property {Function} isSettled - returns true, if the Deferred is either \"fulfilled\" or \"rejected\"\n * @property {?*} [provision=null] - may contain (a) provisional value(s) to use for a newly instantiated Deferred, before it has resolved to the actual value(s)\n */\n\n/**\n * Class that wraps a Promise, to allow resolving and rejecting outside the\n * Promise's function scope. This allows for decoupled handling of states and\n * handling promises as references in a distributed context, like a class, where\n * a Deferred might then represent an async state.\n *\n * Deferreds also provide accessible status information, normal Promises do not have.\n * Accessing the \"status\" property returns the current status, being either \"pending\",\n * \"fulfilled\" or \"rejected\". You may also check if the Deferred has been settled via\n * \"isSettled()\". If you want to provide a preliminary result, available before the\n * promise has settled, you may set this result as a payload using the \"provision\" property.\n *\n * This follows ideas by jQuery and Q Promises:\n * - https://api.jquery.com/jQuery.Deferred/\n * - https://github.com/kriskowal/q/wiki/Coming-from-jQuery#deferreds-promises-resolvers\n *\n * Keep in mind, that Promises might need a polyfill such as core-js.\n *\n * @memberof Basic:Deferred\n * @name Deferred\n * @example\n * const doStuff = new Deferred();\n * doStuff.provision = 'provisional value';\n * doStuff\n * .then(value => { alert(`yeah, ready with \"${value}\"!`); })\n * .catch(error => { console.error(error); })\n * .finally(() => { console.info('has been settled); })\n * ;\n * if( foobar === 42 ){\n * doStuff.resolve(42);\n * } else {\n * doStuff.reject(new Error('not 42!'));\n * }\n * console.info(doStuff.status);\n */\nexport class Deferred {\n\tconstructor(){\n\t\tconst\n\t\t\tSTATUS_PENDING = 'pending',\n\t\t\tSTATUS_FULFILLED = 'fulfilled',\n\t\t\tSTATUS_REJECTED = 'rejected'\n\t\t;\n\t\tthis.resolve = null;\n\t\tthis.reject = null;\n\t\tthis.provision = null;\n\t\tthis.status = STATUS_PENDING;\n\t\tthis.isSettled = () => [STATUS_FULFILLED, STATUS_REJECTED].includes(this.status);\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolution => {\n\t\t\t\tthis.status = STATUS_FULFILLED;\n\t\t\t\tresolve(resolution);\n\t\t\t};\n\t\t\tthis.reject = rejection => {\n\t\t\t\tthis.status = STATUS_REJECTED;\n\t\t\t\treject(rejection);\n\t\t\t};\n\t\t});\n\t}\n\n\tthen(f){\n\t\treturn this.promise.then(f);\n\t}\n\n\tcatch(f){\n\t\treturn this.promise.catch(f);\n\t}\n\n\tfinally(f){\n\t\treturn this.promise.finally(f);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:Observable\n */\n\n/**\n * @typedef Observable\n * @type {Object}\n * @property {Function} getValue - returns the current value\n * @property {Function} setValue - sets a new value, which will subsequently trigger all subscriptions\n * @property {Function} subscribe - register a given function to be executed on any value change, the subscription receives the new and the old value on each execution, returns the subscription value, which can later be used to unsubscribe again\n * @property {Function} unsubscribe - removes a given subscription again, use subscription value returned by subscribe here\n */\n\n/**\n * A class offering the bare minimum feature set to observe a value and subscribe to future value changes.\n * No automatic magic going on here, this simply follows a basic subscription pattern, where each subscription is\n * a function, being called with a newly set value. This closely resembles the kind of observables knockout is using.\n *\n * @memberof Basic:Observable\n * @name Observable\n * @example\n * const status = new Observable('ok');\n * const subscription = status.subscribe(s => {\n * console.log(`status changed to: ${s}`);\n * });\n * status.setValue('oh noez');\n * status.unsubscribe(subscription);\n */\nexport class Observable {\n\tconstructor(initialValue){\n\t\tthis.__className__ = 'Observable';\n\t\tthis._value = initialValue;\n\t\tthis._subscriptions = [];\n\t}\n\n\tgetValue(){\n\t\treturn this._value;\n\t}\n\n\tsetValue(newValue, force=false){\n\t\tconst\n\t\t\toldValue = this._value,\n\t\t\tisNewValue = oldValue !== newValue\n\t\t;\n\t\tthis._value = newValue;\n\t\tif( isNewValue || force ){\n\t\t\tthis._subscriptions.forEach(s => s(newValue, oldValue));\n\t\t}\n\t}\n\n\tsubscribe(subscription){\n\t\tconst __methodName__ = 'subscribe';\n\t\tassert(isA(subscription, 'function'), `${MODULE_NAME}:${this.__className__}.${__methodName__} | subscription must be function`);\n\t\tif( this._subscriptions.indexOf(subscription) < 0 ){\n\t\t\tthis._subscriptions = [...this._subscriptions, subscription];\n\t\t}\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(subscription){\n\t\tthis._subscriptions = this._subscriptions.filter(s => s !== subscription);\n\t}\n\n\ttoString(){\n\t\treturn `${this._value}`;\n\t}\n}\n"]} \ No newline at end of file +{"version":3,"file":"basic.js","names":["MODULE_NAME","log","warn","assert","condition","message","orDefault","Error","attempt","closure","isA","ex","hasValue","res","Array","from","arguments","forEach","value","size","target","countStringCharacters","values","length","getType","Object","isEmpty","emptyValues","undefined","obj","__additionalEmptyValues__","concat","Set","includes","hasMembers","memberNames","verbose","memberName","info","expression","defaultValue","caster","additionalEmptyValues","toLowerCase","parseInt","parseFloat","deepType","prototype","toString","call","slice","test","match","type","isInt","intVal","isFloat","floatVal","isPlainObject","constructor","isNaN","checkForIdentity","isElement","isEventTarget","addEventListener","removeEventListener","dispatchEvent","isSelector","fragment","document","createDocumentFragment","querySelector","isPotentialId","prefix","idRex","postfix","maskFixes","mask","str","replace","rex","RegExp","matches","exec","minMax","min","max","Deferred","STATUS_FULFILLED","STATUS_REJECTED","this","resolve","reject","provision","status","isSettled","promise","Promise","resolution","rejection","then","f","catch","finally","Observable","initialValue","__className__","_value","_subscriptions","getValue","setValue","newValue","force","oldValue","isNewValue","s","subscribe","subscription","indexOf","unsubscribe","filter"],"sources":["basic.js"],"mappings":";;;AAQA,MAAMA,YAAc,eAMZC,IAAKC,SAAW,sBA0BjB,SAASC,OAAOC,EAAWC,GACjC,IAAKD,EAEJ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B,MACb,CAEAG,SAASC,EAAUC,GAAM,GACxB,MACCC,EAAWvB,KAAKiB,OAChBO,EAAaD,IAAaF,EAE3BrB,KAAKiB,OAASI,GACVG,GAAcF,IACjBtB,KAAKkB,eAAe3F,SAAQkG,GAAKA,EAAEJ,EAAUE,IAE/C,CAEAG,UAAUC,GAMT,OAJAlH,OAAOO,IAAI2G,EAAc,YAAa,SAAkB3B,KAAKgB,2DACzDhB,KAAKkB,eAAeU,QAAQD,GAAgB,IAC/C3B,KAAKkB,eAAiB,IAAIlB,KAAKkB,eAAgBS,IAEzCA,CACR,CAEAE,YAAYF,GACX3B,KAAKkB,eAAiBlB,KAAKkB,eAAeY,QAAOL,GAAKA,IAAME,GAC7D,CAEArE,WACC,MAAO,GAAG0C,KAAKiB,QAChB","sourcesContent":["/*!\n * Module Basic\n */\n\n/**\n * @namespace Basic\n */\n\nconst MODULE_NAME = 'Basic';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {log, warn} from './logging.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Basic:assert\n */\n\n/**\n * Classical assert method. If condition is falsy, throw assert exception.\n *\n * @param {Boolean} condition - defines if an assertion is successful\n * @param {?String} [message='assert exception: assertion failed'] - to display if assertion fails\n * @throws assert exception\n *\n * @memberof Basic:assert\n * @alias assert\n * @example\n * function set(name, value){\n * assert(name.length > 0);\n * assert(isPlainObject(value), 'error: value must be plain object');\n * ...\n * }\n */\nexport function assert(condition, message){\n\tif( !condition ){\n\t\tmessage = orDefault(message, 'assert exception: assertion failed', 'str');\n\t\tthrow new Error(message);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:attempt\n */\n\n/**\n * Attempt to compute contents of closure and catch all occurring exceptions.\n * The boolean result tells you if the operation was successful or not.\n *\n * This is most helpful, when used to test value conversions or other atomic/singluar operations, where it\n * just is important if something isolated works or not.\n *\n * Do not encapsulate complex code in the closure and mind recursively occurring exceptions!\n *\n * @param {Function} closure - the code to test\n * @throws error if closure is not a function\n * @returns {Boolean} true if no exception occurred\n *\n * @memberof Basic:attempt\n * @alias attempt\n * @example\n * if( !attempt(function(){ foobar(); }) ){ console.log('foobar cannot be executed!'); }\n */\nexport function attempt(closure){\n\tassert(isA(closure, 'function'), `${MODULE_NAME}:attempt | closure is no function`);\n\n\ttry {\n\t\tclosure();\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:hasValue\n */\n\n/**\n * Check if variable(s) is set, by being neither undefined nor null.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are set\n *\n * @memberof Basic:hasValue\n * @alias hasValue\n * @example\n * function set(name, value){\n * if( hasValue(name, value) ){\n * ...\n * }\n * }\n */\nexport function hasValue(){\n\tlet res = true;\n\n\tArray.from(arguments).forEach(value => {\n\t\tres &&= ((value !== undefined) && (value !== null));\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:size\n */\n\n/**\n * Determine the (value) size of a collection.\n *\n * A collection is an object with countable values:\n * - Arrays return their length\n * - Sets and Maps return their size\n * - Strings return their (character) length\n * - Iterators return the length of their value list\n * - Objects return the length of their value list\n * - any object implementing .values() returns the length of the returned value list\n *\n * @param {Object|Array|Set|Map|String|Iterable} target - a collection to determine the (value) size of\n * @param {?Boolean} [countStringCharacters=true] - if we want to determine the length of a string, we'd normally like to count actual characters, but length normally returns the technical length counting more than one for unicode chars, set this to \"false\" to use technical length instead of characters\n * @returns {Number|null} the size of the collection or null if no size could be determined\n *\n * @memberof Basic:size\n * @alias size\n * @example\n * size('日本国💩👻');\n * => 5\n * size('日本国💩👻', false);\n * => 7\n * size({a : 1, b : new Date(), c : [1, 2, 3]});\n * => 3\n * size(['test', 'test', 'test']);\n * => 3\n * size(new Set(['test1', 'test2', 'test3']));\n * => 3\n * size(new Set(['test1', 'test2', 'test3']).values());\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]));\n * => 3\n * size(new Map([[1, 1], [new Date(), new Date()], ['foo', 'bar']]).values());\n * => 3\n * size(null);\n * => null\n * size(undefined);\n * => null\n */\nexport function size(target, countStringCharacters=true){\n\tif( isA(target?.values, 'function') ) return Array.from(target.values()).length;\n\n\tlet res;\n\tswitch( getType(target) ){\n\t\tcase 'array':\n\t\t\tres = target.length;\n\t\tbreak;\n\n\t\tcase 'set':\n\t\tcase 'map':\n\t\t\tres = target.size;\n\t\tbreak;\n\n\t\tcase 'iterator':\n\t\t\tres = Array.from(target).length;\n\t\tbreak;\n\n\t\tcase 'string':\n\t\t\t// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description\n\t\t\tres = countStringCharacters ? [...target].length : target.length;\n\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tres = Object.values(target).length;\n\t\tbreak;\n\n\t\tdefault:\n\t\t\tres = null;\n\t\tbreak;\n\t}\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:isEmpty\n */\n\n/**\n * Check if variable(s) contain non-empty value\n * (not undefined, null, '', 0, [], {} or an empty Set/Map).\n *\n * You can supply additional non-empty values by providing an object having the key \"__additionalEmptyValues__\" as\n * any single parameter. Multiple occurrences will be merged.\n *\n * @param {...*} [...] - add any number of variables you wish to check\n * @returns {Boolean} variable(s) is/are empty\n *\n * @memberof Basic:isEmpty\n * @alias isEmpty\n * @example\n * function set(name, value){\n * if( isEmpty(fooBar) || isEmpty({'__additionalEmptyValues__' : [false, '0']}, someArray, someSet, someString, value) ){\n * ...\n * }\n * }\n */\nexport function isEmpty(){\n\tlet\n\t\tres = true,\n\t\temptyValues = [undefined, null, '', 0]\n\t;\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\temptyValues = emptyValues.concat(obj.__additionalEmptyValues__);\n\t\t}\n\t});\n\temptyValues = Array.from(new Set(emptyValues));\n\n\tArray.from(arguments).forEach(obj => {\n\t\tif( res && !isA(obj?.__additionalEmptyValues__, 'array') ){\n\t\t\tres = emptyValues.includes(obj);\n\n\t\t\tif( !res ){\n\t\t\t\tres = (size(obj) === 0);\n\t\t\t}\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:hasMembers\n */\n\n/**\n * \"Validates\" an object in a very basic way by checking if all given members are present and are not nullish.\n *\n * @param {Object} obj - the object to check\n * @param {String[]} memberNames - the names of the members to check\n * @param {Boolean} [verbose=false] - defines if method should output missing members to console\n * @returns {Boolean} all memberNames present and not nullish\n *\n * @memberof Basic:hasMembers\n * @alias hasMembers\n * @example\n * function pat(kitten){\n * if( hasMembers(kitten, ['fluff', 'meow', 'scratch']) ){\n * ...\n * }\n * }\n */\nexport function hasMembers(obj, memberNames, verbose=false){\n\tmemberNames = orDefault(memberNames, [], 'arr');\n\tverbose = orDefault(verbose, false, 'bool');\n\n\tlet res = true;\n\n\tmemberNames.forEach(memberName => {\n\t\tif( !hasValue(obj[`${memberName}`]) ){\n\t\t\tif( verbose ){\n\t\t\t\tlog().info(`${MODULE_NAME}:hasMembers | missing member ${memberName}`);\n\t\t\t}\n\n\t\t\tres = false;\n\t\t}\n\t});\n\n\treturn res;\n}\n\n\n\n/**\n * @namespace Basic:orDefault\n */\n\n/**\n * If an expression returns a non-value (undefined or null), use the default value instead.\n * Define a caster name, to force expression result/value into certain data type.\n *\n * @param {*} expression - the expression to evaluate\n * @param {*} defaultValue - the default value to use if the expression is considered empty\n * @param {?(String|Function)} [caster=null] - either a default caster by name ('str', 'string', 'int', 'integer', 'bool', 'boolean', 'float', 'arr', 'array') or a function getting the value and returning the transformed value\n * @param {?Array} [additionalEmptyValues=null] - if set, provides a list of additional values to be considered empty, apart from undefined and null\n * @returns {*} expression of defaultValue\n *\n * @memberof Basic:orDefault\n * @alias orDefault\n * @example\n * function set(name, value){\n * name = orDefault(name, 'kittens!', 'string', ['', 'none']);\n * value = orDefault(value, 42, 'int');\n * }\n */\nexport function orDefault(expression, defaultValue, caster=null, additionalEmptyValues=null){\n\tif( hasValue(additionalEmptyValues) ){\n\t\tadditionalEmptyValues = [].concat(additionalEmptyValues);\n\t} else {\n\t\tadditionalEmptyValues = [];\n\t}\n\n\tif( hasValue(caster) ){\n\t\tif(\n\t\t\t!isA(caster, 'function')\n\t\t\t&& ([\n\t\t\t\t'str', 'string',\n\t\t\t\t'int', 'integer',\n\t\t\t\t'bool', 'boolean',\n\t\t\t\t'float',\n\t\t\t\t'arr', 'array'\n\t\t\t].includes(`${caster.toLowerCase()}`))\n\t\t){\n\t\t\tcaster = `${caster}`.toLowerCase();\n\n\t\t\tif( ['str', 'string'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return `${value}`; };\n\t\t\t} else if( ['int', 'integer'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return parseInt(value, 10); };\n\t\t\t} else if( ['bool', 'boolean'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return !!value; };\n\t\t\t} else if( caster === 'float' ){\n\t\t\t\tcaster = function(value){ return parseFloat(value); };\n\t\t\t} else if( ['arr', 'array'].includes(caster) ){\n\t\t\t\tcaster = function(value){ return [].concat(value); };\n\t\t\t}\n\t\t} else if( !isA(caster, 'function') ){\n\t\t\tcaster = function(value){ return value; };\n\t\t}\n\t} else {\n\t\tcaster = function(value){ return value; };\n\t}\n\n\tif( !hasValue(expression) || (additionalEmptyValues.includes(expression)) ){\n\t\treturn defaultValue;\n\t} else {\n\t\treturn caster(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:getType\n */\n\n/**\n * Prod-ready type detection for values, expanding on flawed typeof functionality, roughly following\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof, but expanding on\n * useful frontend types like \"htmldocument\", \"htmlelement\" and \"nodelist\"\n *\n * Types:\n * - \"undefined\"\n * - \"null\"\n * - \"boolean\"\n * - \"number\"\n * - \"bigint\"\n * - \"string\"\n * - \"symbol\"\n * - \"function\"\n * - \"object\"\n * - \"array\"\n * - \"date\"\n * - \"error\"\n * - \"generator\"\n * - \"iterator\"\n * - \"regexp\"\n * - \"set\"\n * - \"weakset\"\n * - \"map\"\n * - \"weakmap\"\n * - \"htmldocument\"\n * - \"htmlelement\"\n * - \"nodelist\"\n * - \"window\"\n *\n * @param {*} [value] - variable to check the type of\n * @returns {String} the value type in lower case\n *\n * @memberof Basic:getType\n * @alias getType\n * @example\n * if( getType(cb) === 'function' ){\n * ...\n * }\n */\nexport function getType(value) {\n\tif( !hasValue(value) ) return `${value}`.toLowerCase();\n\n\tconst deepType = Object.prototype.toString.call(value).slice(8,-1).toLowerCase();\n\n\tif( deepType === 'generatorfunction' ) return 'function';\n\tif( deepType === 'document' ) return 'htmldocument';\n\tif( deepType === 'element' ) return 'htmlelement';\n\tif( /^html.*element$/.test(deepType) ) return 'htmlelement';\n\tif( /^.*iterator$/.test(deepType) ) return 'iterator';\n\n\treturn deepType.match(/^(array|bigint|date|error|function|generator|regexp|symbol|set|weakset|map|weakmap|htmldocument|nodelist|window)$/)\n\t\t? deepType\n\t\t: ((typeof value === 'object') || (typeof value === 'function')) ? 'object' : typeof value\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isA\n */\n\n/**\n * Short form of \"getType\"-method with a more compact syntax.\n * Can identify all types listed in getType.\n *\n * @param {*} value - variable to check the type of\n * @param {String} type - the name of the type to check for, has to be a standard JS-type, is case insensitive\n * @returns {Boolean} target has type\n *\n * @memberof Basic:isA\n * @alias isA\n * @see getType\n * @example\n * let stringBool = (isA(test, 'boolean') && test) ? 'true' : 'false';\n */\nexport function isA(value, type){\n\tif(\n\t\t[\n\t\t\t'undefined',\n\t\t\t'null',\n\t\t\t'boolean',\n\t\t\t'number',\n\t\t\t'bigint',\n\t\t\t'string',\n\t\t\t'symbol',\n\t\t\t'function',\n\t\t\t'object',\n\t\t\t'array',\n\t\t\t'date',\n\t\t\t'error',\n\t\t\t'generator',\n\t\t\t'iterator',\n\t\t\t'regexp',\n\t\t\t'set',\n\t\t\t'weakset',\n\t\t\t'map',\n\t\t\t'weakmap',\n\t\t\t'htmldocument',\n\t\t\t'htmlelement',\n\t\t\t'nodelist',\n\t\t\t'window'\n\t\t].includes(`${type}`.toLowerCase())\n\t){\n\t\treturn getType(value) === `${type}`.toLowerCase();\n\t} else {\n\t\twarn(`${MODULE_NAME}:isA | \"${type}\" is not a recognized type`);\n\t\treturn false;\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isInt\n */\n\n/**\n * Returns if a value is truly a real integer value and not just an int-parsable value for example.\n * Since JS only knows the data type \"number\" all numbers are usable as floats by default, but not the\n * other way round.\n *\n * @param {*} intVal - the value the check\n * @returns {Boolean} true if intVal is a true integer value\n *\n * @memberof Basic:isInt\n * @alias isInt\n * @example\n * if( !isInt(val) ){\n * val = parseInt(val, 10);\n * }\n */\nexport function isInt(intVal){\n\treturn parseInt(intVal, 10) === intVal;\n}\n\n\n\n/**\n * @namespace Basic:isFloat\n */\n\n/**\n * Returns if a value is a numeric value, usable as a float number in any calculation.\n * Any number that fulfills isInt, is also considered a valid float, which lies in JS's\n * nature of not differentiating ints and floats by putting them both into a \"number\"-type.\n * So ints are always floats, but not necessarily the other way round.\n *\n * @param {*} floatVal - the value to check\n * @returns {Boolean} true if floatVal is usable in a float context\n *\n * @memberof Basic:isFloat\n * @alias isFloat\n * @example\n * if( !isFloat(val) ){\n * alert('val can not be calculated with!');\n * }\n */\nexport function isFloat(floatVal){\n\treturn parseFloat(floatVal) === floatVal;\n}\n\n\n\n/**\n * @namespace Basic:isPlainObject\n */\n\n/**\n * Returns if a value is an object literal, so so-called \"plain object.\n * A plain object is something like \"{hello : 'world'}\".\n *\n * This might especially be helpful when dealing with JSON configs, so quickly check if\n * something might even be parsed JSON (which in most cases is a plain object in js).\n *\n * Be aware that this function cannot differentiate between constructor-based simple objects and\n * plain objects declared inline. So, if someone took on the work to instantiate a base object and assign\n * properties either in a function or a constructor, we accept that as a plain object.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value seems to be a plain object\n *\n * @memberof Basic:isPlainObject\n * @alias isPlainObject\n * @example\n * const isParameterConfigObject = isPlainObject(param);\n */\nexport function isPlainObject(value){\n\treturn isA(value, 'object')\n\t\t&& hasValue(value)\n\t\t&& (value.constructor === Object)\n\t\t&& Object.prototype.toString.call(value) === '[object Object]'\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isNaN\n */\n\n/**\n * Returns if an expression is NaN or not.\n * This method employs two different approaches:\n * By default it really checks if the expression is the _value_ NaN or not, this being a valid JS-value for something.\n * In JS this gets checked by comparing an expression with itself on identity, since NaN is the only value not being\n * identical to itself. If you set checkForIdentity to false, this method will use the standard JS-isNaN, which\n * inspects the expression, tries to cast or parse a number from it and returns the result.\n *\n * @param {*} expression - the expression to check\n * @param {Boolean} [checkForIdentity=true] - set to false if you want to use default JS-functionality\n * @returns {Boolean} true if expression is NaN\n *\n * @memberof Basic:isNaN\n * @alias isNaN\n * @example\n * if( !isNaN(suspiciousCalculatedValue) ){\n * return suspiciousCalculatedValue * 3;\n * }\n */\nexport function isNaN(expression, checkForIdentity=true){\n\tcheckForIdentity = orDefault(checkForIdentity, true, 'bool');\n\n\tif( checkForIdentity ){\n\t\treturn expression !== expression;\n\t} else {\n\t\treturn isNaN(expression);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:isElement\n */\n\n/**\n * Returns if a value is an HTML element.\n * Be aware, that this explicitly means an element, not necessarily any node.\n * So text nodes, comments and such do not qualify.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is an HTML element\n *\n * @memberof Basic:isElement\n * @alias isElement\n * @example\n * if( isElement(target) ){\n * target.classList.add('foo');\n * }\n */\nexport function isElement(value){\n\treturn isA(value, 'htmlelement');\n}\n\n\n\n/**\n * @namespace Basic:isEventTarget\n */\n\n/**\n * Returns if a value is an EventTarget, which means that it is able to dispatch and receive events.\n * This is determined via duck-typing and not via class inheritance check, since this method is not\n * about type-safety, but the question if we can use the target for events, which is simply determined\n * by three essential object methods: addEventListener, removeEventListener and dispatchEvent. All\n * objects supporting these are fine with us.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value supports event methods\n *\n * @memberof Basic:isEventTarget\n * @alias isEventTarget\n * @example\n * if( isEventTarget(target) ){\n * target.dispatchEvent(new CustomEvent('foobar'));\n * }\n */\nexport function isEventTarget(value){\n\treturn hasValue(value)\n\t\t&& isA(value.addEventListener, 'function')\n\t\t&& isA(value.removeEventListener, 'function')\n\t\t&& isA(value.dispatchEvent, 'function')\n\t;\n}\n\n\n\n/**\n * @namespace Basic:isSelector\n */\n\n/**\n * Returns if a value is a valid selector, usable in methods such as querySelector\n * and querySelectorAll.\n *\n * @param {*} value - the value to check\n * @returns {Boolean} true if value is a valid selector\n *\n * @memberof Basic:isSelector\n * @alias isSelector\n * @example\n * if( isSelector(selector) ){\n * document.querySelector(selector)?.style.setProperty('color', 'red');\n * }\n */\nexport function isSelector(value){\n\t// almost all values like \"null\", \"undefined\" and \"NaN\" are accepted querySelectors, numbers are not\n\tvalue = orDefault(value, 0, 'str');\n\n\tconst fragment = document.createDocumentFragment();\n\n\ttry {\n\t\tfragment.querySelector(value);\n\t} catch(ex){\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n\n/**\n * @namespace Basic:isPotentialId\n */\n\n/**\n * Determines if a given value is potentially a valid id for something, because it matches a format of given\n * prefix, postfix and id regex. \"Potential\", because we can only assume by the format, we do not actually know\n * if the id really matches anything like a database entry for example.\n *\n * @param {(String|Number)} value - the value to test, will be stringified\n * @param {?String} [prefix=''] - a prefix for the id\n * @param {?String} [idRex='[1-9][0-9]*'] - the regex string to use to identify the id part of the value\n * @param {?String} [postfix=''] - a postfix for the id\n * @param {?Boolean} [maskFixes=true] - usually, prefixes are not treated as regexes and are automatically masked, if you'd like to define complex pre- and postfixes using regexes, set this to false\n * @returns {String|Boolean} if value is potential id according to format, the id is returned as a string (still usable as a truthy value), otherwise the return value is false\n *\n * @memberof Basic:isPotentialId\n * @alias isPotentialId\n * @example\n * if( isPotentialId(id, 'test_(', '[0-9]+', ')') ){\n * createJsonRequest(`/backend/${id}`).then(() => { alert('done'); });\n * }\n */\nexport function isPotentialId(value, prefix='', idRex='[1-9][0-9]*', postfix='', maskFixes=true){\n\tvalue = `${value}`;\n\tprefix = orDefault(prefix, '', 'str');\n\tidRex = orDefault(idRex, '[1-9][0-9]*', 'str');\n\tpostfix = orDefault(postfix, '', 'str');\n\tmaskFixes = orDefault(maskFixes, true, 'bool');\n\n\tconst mask = str => `${str}`.replace(/([\\-\\[\\]\\/{}()*+?.\\\\^$|])/g, \"\\\\$&\");\n\n\tlet rex;\n\tif( maskFixes ){\n\t\trex = new RegExp(`^${mask(prefix)}(${idRex})${mask(postfix)}$`);\n\t} else {\n\t\trex = new RegExp(`^${prefix}(${idRex})${postfix}$`);\n\t}\n\n\tconst matches = rex.exec(value);\n\treturn hasValue(matches) ? matches[1] : false;\n}\n\n\n\n/**\n * @namespace Basic:minMax\n */\n\n/**\n * Checks if a value is within bounds of a minimum and maximum and returns\n * the value or the upper or lower bound respectively.\n *\n * Accepts all values comparable with > and <.\n *\n * @param {*} min - the lower bound\n * @param {*} value - the value to check\n * @param {*} max - the upper bound\n * @throws error if min is not smaller than max\n * @returns {*} value, min or max\n *\n * @memberof Basic:minMax\n * @alias minMax\n * @example\n * let croppedVal = minMax(-100, value, 100);\n */\nexport function minMax(min, value, max){\n\tassert(min <= max, `${MODULE_NAME}:minMax | min can not be larger than max`);\n\n\treturn (value < min)\n\t\t? min\n\t\t: (\n\t\t\t(value > max)\n\t\t\t\t? max\n\t\t\t\t: value\n\t\t)\n\t;\n}\n\n\n\n/**\n * @namespace Basic:Deferred\n */\n\n/**\n * @typedef Deferred\n * @type {Object}\n * @property {Promise} promise - the wrapped promise\n * @property {Function} resolve - resolves the wrapped promise with given value\n * @property {Function} reject - rejects the wrapped promise with given error\n * @property {Function} then - defines a success handler for the wrapped promise and returns its result\n * @property {Function} catch - defines an error handler for the wrapped promise and returns its result\n * @property {Function} finally - defines a \"settled\" handler for the wrapped promise and returns its result\n * @property {String} status - holds the current resolution status, can either be \"pending\", \"fulfilled\" or \"rejected\"\n * @property {Function} isSettled - returns true, if the Deferred is either \"fulfilled\" or \"rejected\"\n * @property {?*} [provision=null] - may contain (a) provisional value(s) to use for a newly instantiated Deferred, before it has resolved to the actual value(s)\n */\n\n/**\n * Class that wraps a Promise, to allow resolving and rejecting outside the\n * Promise's function scope. This allows for decoupled handling of states and\n * handling promises as references in a distributed context, like a class, where\n * a Deferred might then represent an async state.\n *\n * Deferreds also provide accessible status information, normal Promises do not have.\n * Accessing the \"status\" property returns the current status, being either \"pending\",\n * \"fulfilled\" or \"rejected\". You may also check if the Deferred has been settled via\n * \"isSettled()\". If you want to provide a preliminary result, available before the\n * promise has settled, you may set this result as a payload using the \"provision\" property.\n *\n * This follows ideas by jQuery and Q Promises:\n * - https://api.jquery.com/jQuery.Deferred/\n * - https://github.com/kriskowal/q/wiki/Coming-from-jQuery#deferreds-promises-resolvers\n *\n * Keep in mind, that Promises might need a polyfill such as core-js.\n *\n * @memberof Basic:Deferred\n * @name Deferred\n * @example\n * const doStuff = new Deferred();\n * doStuff.provision = 'provisional value';\n * doStuff\n * .then(value => { alert(`yeah, ready with \"${value}\"!`); })\n * .catch(error => { console.error(error); })\n * .finally(() => { console.info('has been settled); })\n * ;\n * if( foobar === 42 ){\n * doStuff.resolve(42);\n * } else {\n * doStuff.reject(new Error('not 42!'));\n * }\n * console.info(doStuff.status);\n */\nexport class Deferred {\n\tconstructor(){\n\t\tconst\n\t\t\tSTATUS_PENDING = 'pending',\n\t\t\tSTATUS_FULFILLED = 'fulfilled',\n\t\t\tSTATUS_REJECTED = 'rejected'\n\t\t;\n\t\tthis.resolve = null;\n\t\tthis.reject = null;\n\t\tthis.provision = null;\n\t\tthis.status = STATUS_PENDING;\n\t\tthis.isSettled = () => [STATUS_FULFILLED, STATUS_REJECTED].includes(this.status);\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolution => {\n\t\t\t\tthis.status = STATUS_FULFILLED;\n\t\t\t\tresolve(resolution);\n\t\t\t};\n\t\t\tthis.reject = rejection => {\n\t\t\t\tthis.status = STATUS_REJECTED;\n\t\t\t\treject(rejection);\n\t\t\t};\n\t\t});\n\t}\n\n\tthen(f){\n\t\treturn this.promise.then(f);\n\t}\n\n\tcatch(f){\n\t\treturn this.promise.catch(f);\n\t}\n\n\tfinally(f){\n\t\treturn this.promise.finally(f);\n\t}\n}\n\n\n\n/**\n * @namespace Basic:Observable\n */\n\n/**\n * @typedef Observable\n * @type {Object}\n * @property {Function} getValue - returns the current value\n * @property {Function} setValue - sets a new value, which will subsequently trigger all subscriptions\n * @property {Function} subscribe - register a given function to be executed on any value change, the subscription receives the new and the old value on each execution, returns the subscription value, which can later be used to unsubscribe again\n * @property {Function} unsubscribe - removes a given subscription again, use subscription value returned by subscribe here\n */\n\n/**\n * A class offering the bare minimum feature set to observe a value and subscribe to future value changes.\n * No automatic magic going on here, this simply follows a basic subscription pattern, where each subscription is\n * a function, being called with a newly set value. This closely resembles the kind of observables knockout is using.\n *\n * @memberof Basic:Observable\n * @name Observable\n * @example\n * const status = new Observable('ok');\n * const subscription = status.subscribe(s => {\n * console.log(`status changed to: ${s}`);\n * });\n * status.setValue('oh noez');\n * status.unsubscribe(subscription);\n */\nexport class Observable {\n\tconstructor(initialValue){\n\t\tthis.__className__ = 'Observable';\n\t\tthis._value = initialValue;\n\t\tthis._subscriptions = [];\n\t}\n\n\tgetValue(){\n\t\treturn this._value;\n\t}\n\n\tsetValue(newValue, force=false){\n\t\tconst\n\t\t\toldValue = this._value,\n\t\t\tisNewValue = oldValue !== newValue\n\t\t;\n\t\tthis._value = newValue;\n\t\tif( isNewValue || force ){\n\t\t\tthis._subscriptions.forEach(s => s(newValue, oldValue));\n\t\t}\n\t}\n\n\tsubscribe(subscription){\n\t\tconst __methodName__ = 'subscribe';\n\t\tassert(isA(subscription, 'function'), `${MODULE_NAME}:${this.__className__}.${__methodName__} | subscription must be function`);\n\t\tif( this._subscriptions.indexOf(subscription) < 0 ){\n\t\t\tthis._subscriptions = [...this._subscriptions, subscription];\n\t\t}\n\t\treturn subscription;\n\t}\n\n\tunsubscribe(subscription){\n\t\tthis._subscriptions = this._subscriptions.filter(s => s !== subscription);\n\t}\n\n\ttoString(){\n\t\treturn `${this._value}`;\n\t}\n}\n"]} \ No newline at end of file diff --git a/docs/examples/lib/annex/dist/context.js b/docs/examples/lib/annex/dist/context.js index 1a4f70dc..ce45043b 100644 --- a/docs/examples/lib/annex/dist/context.js +++ b/docs/examples/lib/annex/dist/context.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Context diff --git a/docs/examples/lib/annex/dist/cookies.js b/docs/examples/lib/annex/dist/cookies.js index 3ac1ff65..a1f0bd0e 100644 --- a/docs/examples/lib/annex/dist/cookies.js +++ b/docs/examples/lib/annex/dist/cookies.js @@ -1,5 +1,5 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Cookies diff --git a/docs/examples/lib/annex/dist/css.js b/docs/examples/lib/annex/dist/css.js index 73b3f05a..2fdf60c0 100644 --- a/docs/examples/lib/annex/dist/css.js +++ b/docs/examples/lib/annex/dist/css.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module CSS */ -const MODULE_NAME="CSS";import{assert,isA,orDefault,isPlainObject,hasValue,isNaN}from"./basic.js";import{maskForRegEx}from"./strings.js";export function applyStyles(e,t,r=!1,s=!1){const l="applyStyles";r=orDefault(r,!1,"bool"),s=orDefault(s,!1,"bool"),assert(isA(e,"htmlelement"),`CSS:${l} | element is not an html element`),assert(isPlainObject(t),`CSS:${l} | styles must be a plain object`);const o=["-webkit-","-moz-","-ms-","-o-","-khtml-"];return r&&Object.entries({...t}).forEach((([e,r])=>{o.forEach((s=>{t[s+e]="transition"===e?r.replace("transform",`${s}transform`):r}))})),Object.entries({...t}).forEach((([r,s])=>{isA(s,"number")&&0!==s?(t[r]=`${s}px`,e.style.setProperty(r,t[r])):hasValue(s)?(t[r]=`${s}`,e.style.setProperty(r,t[r])):(o.forEach((s=>{delete t[s+r],e.style.removeProperty(s+r)})),delete t[r],e.style.removeProperty(r))})),s?e.style:t}export function cssValueToNumber(e){return parseFloat(orDefault(e,"","str"))}export function cssUrlValueToUrl(e,t=null,r=null){e=orDefault(e,"","str"),t=orDefault(t,null,"str"),r=orDefault(r,null,"str");const s=new RegExp("(?:^|\\s|,)url\\((?:'|\")?([^'\"\\n\\r\\t]+)(?:'|\")?\\)","gmi"),l=[];let o;for(;null!==(o=s.exec(e));)o=o[1],hasValue(t,r)&&(o=o.replace(new RegExp(`^${maskForRegEx(t)}`),r)),l.push(o);return 1===l.length?l[0]:l.length>1?l:null}export function remByPx(e,t="html"){if(e=cssValueToNumber(e),t=orDefault(t,"html"),isA(t,"htmlelement"))t=cssValueToNumber(t.style.getPropertyValue("font-size"));else{const e=cssValueToNumber(t);if(isNaN(e)){const e=document.querySelector(t);assert(hasValue(e),"CSS:remByPx | selector does not return element"),t=cssValueToNumber(e.style.getPropertyValue("font-size"))}else t=e}const r=e/t;return 0===t||isNaN(r)?null:`${r}rem`} +const MODULE_NAME="CSS";import{assert,isA,orDefault,isPlainObject,isElement,hasValue,isNaN}from"./basic.js";import{maskForRegEx}from"./strings.js";export function applyStyles(e,t,r=!1,s=!1){const l="applyStyles";r=orDefault(r,!1,"bool"),s=orDefault(s,!1,"bool"),assert(isElement(e),`CSS:${l} | element is not an html element`),assert(isPlainObject(t),`CSS:${l} | styles must be a plain object`);const o=["-webkit-","-moz-","-ms-","-o-","-khtml-"];return r&&Object.entries({...t}).forEach((([e,r])=>{o.forEach((s=>{t[s+e]="transition"===e?r.replace("transform",`${s}transform`):r}))})),Object.entries({...t}).forEach((([r,s])=>{isA(s,"number")&&0!==s?(t[r]=`${s}px`,e.style.setProperty(r,t[r])):hasValue(s)?(t[r]=`${s}`,e.style.setProperty(r,t[r])):(o.forEach((s=>{delete t[s+r],e.style.removeProperty(s+r)})),delete t[r],e.style.removeProperty(r))})),s?e.style:t}export function cssValueToNumber(e){return parseFloat(orDefault(e,"","str"))}export function cssUrlValueToUrl(e,t=null,r=null){e=orDefault(e,"","str"),t=orDefault(t,null,"str"),r=orDefault(r,null,"str");const s=new RegExp("(?:^|\\s|,)url\\((?:'|\")?([^'\"\\n\\r\\t]+)(?:'|\")?\\)","gmi"),l=[];let o;for(;null!==(o=s.exec(e));)o=o[1],hasValue(t,r)&&(o=o.replace(new RegExp(`^${maskForRegEx(t)}`),r)),l.push(o);return 1===l.length?l[0]:l.length>1?l:null}export function remByPx(e,t="html"){if(e=cssValueToNumber(e),t=orDefault(t,"html"),isElement(t))t=cssValueToNumber(t.style.getPropertyValue("font-size"));else{const e=cssValueToNumber(t);if(isNaN(e)){const e=document.querySelector(t);assert(hasValue(e),"CSS:remByPx | selector does not return element"),t=cssValueToNumber(e.style.getPropertyValue("font-size"))}else t=e}const r=e/t;return 0===t||isNaN(r)?null:`${r}rem`} //# sourceMappingURL=css.js.map diff --git a/docs/examples/lib/annex/dist/css.js.map b/docs/examples/lib/annex/dist/css.js.map index a3dc1b5c..3e835c9a 100644 --- a/docs/examples/lib/annex/dist/css.js.map +++ b/docs/examples/lib/annex/dist/css.js.map @@ -1 +1 @@ -{"version":3,"file":"css.js","names":["MODULE_NAME","assert","isA","orDefault","isPlainObject","hasValue","isNaN","maskForRegEx","applyStyles","element","styles","crossBrowser","returnCssStyleDeclaration","__methodName__","vendorPrefixes","Object","entries","forEach","cssKey","cssValue","vendorPrefix","replace","style","setProperty","removeProperty","cssValueToNumber","value","parseFloat","cssUrlValueToUrl","urlValue","baseUrl","baseUrlSubstitution","urlValueRex","RegExp","matches","match","exec","push","length","remByPx","px","initial","getPropertyValue","document","querySelector","remVal"],"sources":["css.js"],"mappings":";;;AA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MACCC,EAAc,IAAIC,OAAO,2DAA4D,OACrFC,EAAU,GAGX,IAAIC,EACJ,KAAgD,QAAxCA,EAAQH,EAAYI,KAAKP,KAChCM,EAAQA,EAAM,GACV9B,SAASyB,EAASC,KACrBI,EAAQA,EAAMd,QAAQ,IAAIY,OAAO,IAAI1B,aAAauB,MAAaC,IAEhEG,EAAQG,KAAKF,GAGd,OAAuB,IAAnBD,EAAQI,OACJJ,EAAQ,GACLA,EAAQI,OAAS,EACpBJ,EAEA,IAET,QAiCO,SAASK,QAAQC,EAAIC,EAAQ,QAInC,GAHAD,EAAKf,iBAAiBe,GACtBC,EAAUtC,UAAUsC,EAAS,QAEzBvC,IAAIuC,EAAS,eAChBA,EAAUhB,iBAAiBgB,EAAQnB,MAAMoB,iBAAiB,kBACpD,CACN,MAAMhB,EAAQD,iBAAiBgB,GAC/B,GAAInC,MAAMoB,GAAQ,CACjB,MAAMjB,EAAUkC,SAASC,cAAcH,GACvCxC,OAAOI,SAASI,GAAU,kDAC1BgC,EAAUhB,iBAAiBhB,EAAQa,MAAMoB,iBAAiB,aAC3D,MACCD,EAAUf,CAEZ,CAEA,MAAMmB,EAASL,EAAKC,EAEpB,OAAiB,IAAZA,GAAmBnC,MAAMuC,GAGtB,KAFA,GAAGA,MAIZ","sourcesContent":["/*!\n * Module CSS\n */\n\n/**\n * @namespace CSS\n */\n\nconst MODULE_NAME = 'CSS';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {assert, isA, orDefault, isPlainObject, hasValue, isNaN} from './basic.js';\nimport {maskForRegEx} from './strings.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace CSS:applyStyles\n */\n\n/**\n * Applies CSS definitions to an HTMLElement, by providing a plain object of property-value-pairs.\n * Properties may be written as default CSS kebab-case properties such as \"margin-left\" or as JS\n * camel-cased versions such as \"marginLeft\".\n *\n * Providing a real JS number without a unit will be treated as a pixel value, so defining \"'line-height' : 0\" will\n * actually result in a 1px line-height. To actually set a unit-less value, just set the value as a string:\n * \"'line-height' : '0'\".\n *\n * Generally all CSS values are usually strings (this is also the way JS handles this),\n * treating plain numbers as pixels is just a convenience feature, since pixels are most likely to be\n * calculated values, where it is bothersome and error-prone to add the \"px\" all the time.\n *\n * To remove a property, just set the value to a nullish value. Deleting a property also tries to remove all\n * vendor prefixed variants.\n *\n * This function uses CSSStyleDeclaration.setProperty instead of direct style assignments. This means, that the\n * browser itself decides which value to apply, based on the support of the property. This means, the style object\n * will not be polluted with vendor stuff the browser does not support, but this also means, that all non-standard\n * properties might be refused. If you really need to set something out of spec, use direct style assignment instead.\n *\n * @param {HTMLElement} element - the element to apply the styles to, use null or undefined as value to remove a prop\n * @param {Object} styles - the styles to apply, provided as a plain object, defining property-value-pairs\n * @param {?Boolean} [crossBrowser=false] - set this to true, to automatically generate vendor-prefixed versions of all provided properties\n * @param {?Boolean} [returnCssStyleDeclaration=false] - set this to true, return the CSSStyleDeclaration of the element after the style application, rather than the plain object\n * @throws error if element is not an HTMLElement\n * @throws error if styles is not a plain object\n * @returns {Object|CSSStyleDeclaration} the applied/active styles\n *\n * @memberof CSS:applyStyles\n * @alias applyStyles\n * @example\n * applyStyles(document.body, {backgroundColor : red, transition : 'all 200ms'}, true);\n * applyStyles(document.querySelector('main'), {'font-family' : 'serif'}, false, true);\n */\nexport function applyStyles(element, styles, crossBrowser=false, returnCssStyleDeclaration=false){\n\tconst __methodName__ = 'applyStyles';\n\n\tcrossBrowser = orDefault(crossBrowser, false, 'bool');\n\treturnCssStyleDeclaration = orDefault(returnCssStyleDeclaration, false, 'bool');\n\n\tassert(isA(element, 'htmlelement'), `${MODULE_NAME}:${__methodName__} | element is not an html element`);\n\tassert(isPlainObject(styles), `${MODULE_NAME}:${__methodName__} | styles must be a plain object`);\n\n\tconst vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];\n\n\tif( crossBrowser ){\n\t\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tif(cssKey === 'transition'){\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue.replace('transform', `${vendorPrefix}transform`);\n\t\t\t\t} else {\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\tif( isA(cssValue, 'number') && (cssValue !== 0) ){\n\t\t\tstyles[cssKey] = `${cssValue}px`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t} else if( !hasValue(cssValue) ){\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tdelete styles[vendorPrefix+cssKey];\n\t\t\t\telement.style.removeProperty(vendorPrefix+cssKey);\n\t\t\t});\n\t\t\tdelete styles[cssKey];\n\t\t\telement.style.removeProperty(cssKey);\n\t\t} else {\n\t\t\tstyles[cssKey] = `${cssValue}`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t}\n\t});\n\n\treturn returnCssStyleDeclaration ? element.style : styles;\n}\n\n\n\n/**\n * @namespace CSS:cssValueToNumber\n */\n\n/**\n * Converts a CSS-value to a number without unit. If the base number is an integer the result will also\n * be an integer, float values will also be converted correctly.\n *\n * @param {String} value - the css-value to convert\n * @returns {Number|NaN} true number representation of the given value or NaN if the value is not parsable\n *\n * @memberof CSS:cssValueToNumber\n * @alias cssValueToNumber\n * @example\n * document.querySelector('main').style.setProperty('width', '99vh');\n * cssValueToNumber(document.querySelector('main').style.getPropertyValue('width'));\n * => 99\n */\nexport function cssValueToNumber(value){\n\treturn parseFloat(orDefault(value, '', 'str'));\n}\n\n\n\n/**\n * @namespace CSS:cssUrlValueToUrl\n */\n\n/**\n * Converts a CSS-URL-value (\"url('/foo/bar/baz.jpg')\") to a plain URL usable in requests or src-attributes.\n *\n * @param {String} urlValue - the URL-value from CSS\n * @param {?String} [baseUrl=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace here\n * @param {?String} [baseUrlSubstitution=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace the baseUrl with here\n * @returns {String|Array|null} the extracted URL (or list of URLs if value contained several) with substitutions (if defined) or null if no URL-values were found\n *\n * @memberof CSS:cssUrlValueToUrl\n * @alias cssUrlValueToUrl\n * @example\n * cssUrlValueToUrl('url(\"https://foobar.com/test.jpg\")', 'https://foobar.com', '..');\n * => '../test.jpg'\n * cssUrlValueToUrl(`url(/foo/bar),\n * url('https://google.de') url(\"test.jpg\"),url(omg.svg)\n * url(http://lol.com)`)\n * => ['/foo/bar', 'https://google.com', 'test.jpg', 'omg.svg', 'http://lol.com']\n */\nexport function cssUrlValueToUrl(urlValue, baseUrl=null, baseUrlSubstitution=null){\n\turlValue = orDefault(urlValue, '', 'str');\n\tbaseUrl = orDefault(baseUrl, null, 'str');\n\tbaseUrlSubstitution = orDefault(baseUrlSubstitution, null, 'str');\n\n\tconst\n\t\turlValueRex = new RegExp('(?:^|\\\\s|,)url\\\\((?:\\'|\")?([^\\'\"\\\\n\\\\r\\\\t]+)(?:\\'|\")?\\\\)', 'gmi'),\n\t\tmatches = []\n\t;\n\n\tlet match;\n\twhile( (match = urlValueRex.exec(urlValue)) !== null ){\n\t\tmatch = match[1];\n\t\tif( hasValue(baseUrl, baseUrlSubstitution) ){\n\t\t\tmatch = match.replace(new RegExp(`^${maskForRegEx(baseUrl)}`), baseUrlSubstitution);\n\t\t}\n\t\tmatches.push(match);\n\t}\n\n\tif( matches.length === 1 ){\n\t\treturn matches[0];\n\t} else if( matches.length > 1 ){\n\t\treturn matches;\n\t} else {\n\t\treturn null;\n\t}\n}\n\n\n\n/**\n * @namespace CSS:remByPx\n */\n\n/**\n * Calculates a rem value based on a given px value.\n * As a default this method takes the font-size (supposedly being in px) of the html-container.\n * You can overwrite this behaviour by setting initial to a number to use as a base px value or\n * to a string, which then defines a new selector for an element to get the initial font-size from.\n * You can also provide an HTMLElement directly, but keep in mind that the element's font size definition\n * has to be in pixels, to make this work.\n *\n * In most cases you will have to define the initial value via a constant or a selector to a container\n * with non-changing font-size, since you can never be sure which relative font-size applies atm, even on first\n * call, after dom ready, since responsive definitions might already be active, returning a viewport-specific\n * size.\n *\n * @param {Number} px - the pixel value to convert to rem\n * @param {?(Number|String|HTMLElement)} [initial='html'] - either a pixel value to use as a conversion base, a selector for an element to get the initial font-size from or the element itself; keep in mind, that the element's font-size definition has to be in px\n * @throws error if given selector in initial does not return an element\n * @returns {String|null} the rem value string to use in a css definition or null if the value could not be calculated\n *\n * @memberof CSS:remByPx\n * @alias remByPx\n * @example\n * remByPx(20, 16);\n * => '1.25rem'\n * remByPx('100px', 'p.has-base-fontsize');\n */\nexport function remByPx(px, initial='html'){\n\tpx = cssValueToNumber(px);\n\tinitial = orDefault(initial, 'html');\n\n\tif( isA(initial, 'htmlelement') ){\n\t\tinitial = cssValueToNumber(initial.style.getPropertyValue('font-size'));\n\t} else {\n\t\tconst value = cssValueToNumber(initial);\n\t\tif( isNaN(value) ){\n\t\t\tconst element = document.querySelector(initial);\n\t\t\tassert(hasValue(element), `${MODULE_NAME}:remByPx | selector does not return element`);\n\t\t\tinitial = cssValueToNumber(element.style.getPropertyValue('font-size'));\n\t\t} else {\n\t\t\tinitial = value;\n\t\t}\n\t}\n\n\tconst remVal = px / initial;\n\n\tif( (initial !== 0) && !isNaN(remVal) ){\n\t\treturn `${remVal}rem`;\n\t} else {\n\t\treturn null;\n\t}\n}\n"]} \ No newline at end of file +{"version":3,"file":"css.js","names":["MODULE_NAME","assert","isA","orDefault","isPlainObject","isElement","hasValue","isNaN","maskForRegEx","applyStyles","element","styles","crossBrowser","returnCssStyleDeclaration","__methodName__","vendorPrefixes","Object","entries","forEach","cssKey","cssValue","vendorPrefix","replace","style","setProperty","removeProperty","cssValueToNumber","value","parseFloat","cssUrlValueToUrl","urlValue","baseUrl","baseUrlSubstitution","urlValueRex","RegExp","matches","match","exec","push","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4B,EAAS,KAAM,OACnCC,EAAsB7B,UAAU6B,EAAqB,KAAM,OAE3D,MACCC,EAAc,IAAIC,OAAO,2DAA4D,OACrFC,EAAU,GAGX,IAAIC,EACJ,KAAgD,QAAxCA,EAAQH,EAAYI,KAAKP,KAChCM,EAAQA,EAAM,GACV9B,SAASyB,EAASC,KACrBI,EAAQA,EAAMd,QAAQ,IAAIY,OAAO,IAAI1B,aAAauB,MAAaC,IAEhEG,EAAQG,KAAKF,GAGd,OAAuB,IAAnBD,EAAQI,OACJJ,EAAQ,GACLA,EAAQI,OAAS,EACpBJ,EAEA,IAET,QAiCO,SAASK,QAAQC,EAAIC,EAAQ,QAInC,GAHAD,EAAKf,iBAAiBe,GACtBC,EAAUvC,UAAUuC,EAAS,QAEzBrC,UAAUqC,GACbA,EAAUhB,iBAAiBgB,EAAQnB,MAAMoB,iBAAiB,kBACpD,CACN,MAAMhB,EAAQD,iBAAiBgB,GAC/B,GAAInC,MAAMoB,GAAQ,CACjB,MAAMjB,EAAUkC,SAASC,cAAcH,GACvCzC,OAAOK,SAASI,GAAU,kDAC1BgC,EAAUhB,iBAAiBhB,EAAQa,MAAMoB,iBAAiB,aAC3D,MACCD,EAAUf,CAEZ,CAEA,MAAMmB,EAASL,EAAKC,EAEpB,OAAiB,IAAZA,GAAmBnC,MAAMuC,GAGtB,KAFA,GAAGA,MAIZ","sourcesContent":["/*!\n * Module CSS\n */\n\n/**\n * @namespace CSS\n */\n\nconst MODULE_NAME = 'CSS';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {assert, isA, orDefault, isPlainObject, isElement, hasValue, isNaN} from './basic.js';\nimport {maskForRegEx} from './strings.js';\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace CSS:applyStyles\n */\n\n/**\n * Applies CSS definitions to an HTMLElement, by providing a plain object of property-value-pairs.\n * Properties may be written as default CSS kebab-case properties such as \"margin-left\" or as JS\n * camel-cased versions such as \"marginLeft\".\n *\n * Providing a real JS number without a unit will be treated as a pixel value, so defining \"'line-height' : 0\" will\n * actually result in a 1px line-height. To actually set a unit-less value, just set the value as a string:\n * \"'line-height' : '0'\".\n *\n * Generally all CSS values are usually strings (this is also the way JS handles this),\n * treating plain numbers as pixels is just a convenience feature, since pixels are most likely to be\n * calculated values, where it is bothersome and error-prone to add the \"px\" all the time.\n *\n * To remove a property, just set the value to a nullish value. Deleting a property also tries to remove all\n * vendor prefixed variants.\n *\n * This function uses CSSStyleDeclaration.setProperty instead of direct style assignments. This means, that the\n * browser itself decides which value to apply, based on the support of the property. This means, the style object\n * will not be polluted with vendor stuff the browser does not support, but this also means, that all non-standard\n * properties might be refused. If you really need to set something out of spec, use direct style assignment instead.\n *\n * @param {HTMLElement} element - the element to apply the styles to, use null or undefined as value to remove a prop\n * @param {Object} styles - the styles to apply, provided as a plain object, defining property-value-pairs\n * @param {?Boolean} [crossBrowser=false] - set this to true, to automatically generate vendor-prefixed versions of all provided properties\n * @param {?Boolean} [returnCssStyleDeclaration=false] - set this to true, return the CSSStyleDeclaration of the element after the style application, rather than the plain object\n * @throws error if element is not an HTMLElement\n * @throws error if styles is not a plain object\n * @returns {Object|CSSStyleDeclaration} the applied/active styles\n *\n * @memberof CSS:applyStyles\n * @alias applyStyles\n * @example\n * applyStyles(document.body, {backgroundColor : red, transition : 'all 200ms'}, true);\n * applyStyles(document.querySelector('main'), {'font-family' : 'serif'}, false, true);\n */\nexport function applyStyles(element, styles, crossBrowser=false, returnCssStyleDeclaration=false){\n\tconst __methodName__ = 'applyStyles';\n\n\tcrossBrowser = orDefault(crossBrowser, false, 'bool');\n\treturnCssStyleDeclaration = orDefault(returnCssStyleDeclaration, false, 'bool');\n\n\tassert(isElement(element), `${MODULE_NAME}:${__methodName__} | element is not an html element`);\n\tassert(isPlainObject(styles), `${MODULE_NAME}:${__methodName__} | styles must be a plain object`);\n\n\tconst vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];\n\n\tif( crossBrowser ){\n\t\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tif(cssKey === 'transition'){\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue.replace('transform', `${vendorPrefix}transform`);\n\t\t\t\t} else {\n\t\t\t\t\tstyles[vendorPrefix+cssKey] = cssValue;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tObject.entries({...styles}).forEach(([cssKey, cssValue]) => {\n\t\tif( isA(cssValue, 'number') && (cssValue !== 0) ){\n\t\t\tstyles[cssKey] = `${cssValue}px`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t} else if( !hasValue(cssValue) ){\n\t\t\tvendorPrefixes.forEach(vendorPrefix => {\n\t\t\t\tdelete styles[vendorPrefix+cssKey];\n\t\t\t\telement.style.removeProperty(vendorPrefix+cssKey);\n\t\t\t});\n\t\t\tdelete styles[cssKey];\n\t\t\telement.style.removeProperty(cssKey);\n\t\t} else {\n\t\t\tstyles[cssKey] = `${cssValue}`;\n\t\t\telement.style.setProperty(cssKey, styles[cssKey]);\n\t\t}\n\t});\n\n\treturn returnCssStyleDeclaration ? element.style : styles;\n}\n\n\n\n/**\n * @namespace CSS:cssValueToNumber\n */\n\n/**\n * Converts a CSS-value to a number without unit. If the base number is an integer the result will also\n * be an integer, float values will also be converted correctly.\n *\n * @param {String} value - the css-value to convert\n * @returns {Number|NaN} true number representation of the given value or NaN if the value is not parsable\n *\n * @memberof CSS:cssValueToNumber\n * @alias cssValueToNumber\n * @example\n * document.querySelector('main').style.setProperty('width', '99vh');\n * cssValueToNumber(document.querySelector('main').style.getPropertyValue('width'));\n * => 99\n */\nexport function cssValueToNumber(value){\n\treturn parseFloat(orDefault(value, '', 'str'));\n}\n\n\n\n/**\n * @namespace CSS:cssUrlValueToUrl\n */\n\n/**\n * Converts a CSS-URL-value (\"url('/foo/bar/baz.jpg')\") to a plain URL usable in requests or src-attributes.\n *\n * @param {String} urlValue - the URL-value from CSS\n * @param {?String} [baseUrl=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace here\n * @param {?String} [baseUrlSubstitution=null] - if you want to transform the URL by substituting the start of the path or URL with something fitting for your context, define what to replace the baseUrl with here\n * @returns {String|Array|null} the extracted URL (or list of URLs if value contained several) with substitutions (if defined) or null if no URL-values were found\n *\n * @memberof CSS:cssUrlValueToUrl\n * @alias cssUrlValueToUrl\n * @example\n * cssUrlValueToUrl('url(\"https://foobar.com/test.jpg\")', 'https://foobar.com', '..');\n * => '../test.jpg'\n * cssUrlValueToUrl(`url(/foo/bar),\n * url('https://google.de') url(\"test.jpg\"),url(omg.svg)\n * url(http://lol.com)`)\n * => ['/foo/bar', 'https://google.com', 'test.jpg', 'omg.svg', 'http://lol.com']\n */\nexport function cssUrlValueToUrl(urlValue, baseUrl=null, baseUrlSubstitution=null){\n\turlValue = orDefault(urlValue, '', 'str');\n\tbaseUrl = orDefault(baseUrl, null, 'str');\n\tbaseUrlSubstitution = orDefault(baseUrlSubstitution, null, 'str');\n\n\tconst\n\t\turlValueRex = new RegExp('(?:^|\\\\s|,)url\\\\((?:\\'|\")?([^\\'\"\\\\n\\\\r\\\\t]+)(?:\\'|\")?\\\\)', 'gmi'),\n\t\tmatches = []\n\t;\n\n\tlet match;\n\twhile( (match = urlValueRex.exec(urlValue)) !== null ){\n\t\tmatch = match[1];\n\t\tif( hasValue(baseUrl, baseUrlSubstitution) ){\n\t\t\tmatch = match.replace(new RegExp(`^${maskForRegEx(baseUrl)}`), baseUrlSubstitution);\n\t\t}\n\t\tmatches.push(match);\n\t}\n\n\tif( matches.length === 1 ){\n\t\treturn matches[0];\n\t} else if( matches.length > 1 ){\n\t\treturn matches;\n\t} else {\n\t\treturn null;\n\t}\n}\n\n\n\n/**\n * @namespace CSS:remByPx\n */\n\n/**\n * Calculates a rem value based on a given px value.\n * As a default this method takes the font-size (supposedly being in px) of the html-container.\n * You can overwrite this behaviour by setting initial to a number to use as a base px value or\n * to a string, which then defines a new selector for an element to get the initial font-size from.\n * You can also provide an HTMLElement directly, but keep in mind that the element's font size definition\n * has to be in pixels, to make this work.\n *\n * In most cases you will have to define the initial value via a constant or a selector to a container\n * with non-changing font-size, since you can never be sure which relative font-size applies atm, even on first\n * call, after dom ready, since responsive definitions might already be active, returning a viewport-specific\n * size.\n *\n * @param {Number} px - the pixel value to convert to rem\n * @param {?(Number|String|HTMLElement)} [initial='html'] - either a pixel value to use as a conversion base, a selector for an element to get the initial font-size from or the element itself; keep in mind, that the element's font-size definition has to be in px\n * @throws error if given selector in initial does not return an element\n * @returns {String|null} the rem value string to use in a css definition or null if the value could not be calculated\n *\n * @memberof CSS:remByPx\n * @alias remByPx\n * @example\n * remByPx(20, 16);\n * => '1.25rem'\n * remByPx('100px', 'p.has-base-fontsize');\n */\nexport function remByPx(px, initial='html'){\n\tpx = cssValueToNumber(px);\n\tinitial = orDefault(initial, 'html');\n\n\tif( isElement(initial) ){\n\t\tinitial = cssValueToNumber(initial.style.getPropertyValue('font-size'));\n\t} else {\n\t\tconst value = cssValueToNumber(initial);\n\t\tif( isNaN(value) ){\n\t\t\tconst element = document.querySelector(initial);\n\t\t\tassert(hasValue(element), `${MODULE_NAME}:remByPx | selector does not return element`);\n\t\t\tinitial = cssValueToNumber(element.style.getPropertyValue('font-size'));\n\t\t} else {\n\t\t\tinitial = value;\n\t\t}\n\t}\n\n\tconst remVal = px / initial;\n\n\tif( (initial !== 0) && !isNaN(remVal) ){\n\t\treturn `${remVal}rem`;\n\t} else {\n\t\treturn null;\n\t}\n}\n"]} \ No newline at end of file diff --git a/docs/examples/lib/annex/dist/elements.js b/docs/examples/lib/annex/dist/elements.js index 28f1d8d8..5b05c6fd 100644 --- a/docs/examples/lib/annex/dist/elements.js +++ b/docs/examples/lib/annex/dist/elements.js @@ -1,8 +1,8 @@ /*! - * @oktarintentakel/annex v0.1.3-beta + * @oktarintentakel/annex v0.1.4-beta */ /*! * Module Elements */ -const MODULE_NAME="Elements";import{orDefault,isA,isPlainObject,isSelector,hasValue,assert,size,Deferred}from"./basic.js";import{randomUuid}from"./random.js";import{clone}from"./objects.js";import{onDomReady}from"./events.js";import{applyStyles}from"./css.js";const NOT_AN_HTMLELEMENT_ERROR="given node/target is not an HTMLElement";let BROWSER_HAS_CSS_SCOPE_SUPPORT;try{document.querySelector(":scope *")}catch(e){BROWSER_HAS_CSS_SCOPE_SUPPORT=!1}export function createNode(e,t=null,n=null){e=orDefault(e,"span","str").trim(),t=isPlainObject(t)?t:null,n=orDefault(n,null,"str");const s=document.createElement("div");/^<[^\/][^<>]*>/.test(e)&&/<\/[^<>\/]+>$/.test(e)?s.innerHTML=e:s.appendChild(document.createElement(e));const r=s.firstChild;if(s.removeChild(r),hasValue(t))for(let e in t)r.setAttribute(e,`${t[e]}`);return hasValue(n)&&(r.textContent=n),r}export function insertNode(e,t,n="beforeend"){switch(assert(isA(e,"htmlelement"),`Elements.insertNode | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(t,"htmlelement")||(t=createNode(`${t}`)),n){case"beforebegin":case"before":n="beforebegin";break;case"afterend":case"after":n="afterend";break;case"afterbegin":case"prepend":n="afterbegin";break;default:n="beforeend"}return e.insertAdjacentElement(n,t),t}export function replaceNode(e,t){const n="replaceNode";return assert(isA(e,"htmlelement"),`Elements.${n} | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(t,"htmlelement")||(t=createNode(`${t}`)),assert(isA(e.parentNode,"htmlelement"),`Elements.${n} | given target does not have a parent)`),insertNode(e,t,"after"),e.parentNode.removeChild(e),t}export function defineNode(e,t,n=null){const s="defineNode";assert(isA(e,"htmlelement"),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isPlainObject(t),`Elements:${s} | definitions is not a plain object`);const r="<-";return isA(n,"htmlelement")&&Array.from(n.attributes).forEach((e=>{(t[e.name]===r||!hasValue(t[e.name])&&(t["data*"]===r&&e.name.startsWith("data-")||t["on*"]===r&&e.name.startsWith("on")))&&(t[e.name]=e.value),(t[`+${e.name}`]===r||!hasValue(t[`+${e.name}`])&&(t["+data*"]===r&&e.name.startsWith("data-")||t["+on*"]===r&&e.name.startsWith("on")))&&(hasValue(t[`+${e.name}`])&&t[`+${e.name}`]!==r||(t[`+${e.name}`]=""),t[`+${e.name}`]+=e.value)})),delete t["data*"],delete t["+data*"],delete t["on*"],delete t["+on*"],Object.keys(t).forEach((e=>{t[e]===r&&delete t[e]})),Object.keys(t).sort().reverse().forEach((n=>{const s=t[n],r=n.startsWith("+");r&&(n=n.slice(1)),n.endsWith("*")&&(n=n.slice(0,-1)),"class"===n?(r||e.setAttribute("class",""),[].concat(s).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(`${t.trim()}`)}))}))):"style"===n?(r||e.setAttribute("style",""),[].concat(s).forEach((t=>{if(!isPlainObject(t)){const e=`${t}`.split(";"),n={};e.forEach((e=>{let[t,s]=e.split(":");t=t.trim(),hasValue(s)&&(s=s.trim(),s=s.endsWith(";")?s.slice(0,-1):s,n[t]=s)})),t=n}hasValue(t)&&applyStyles(e,t)}))):r?e.setAttribute(n,`${e.getAttribute(n)??""}${s}`):e.setAttribute(n,`${s}`)})),e}export function getTextContent(e,t=!1){if(t=orDefault(t,!1,"bool"),isA(e,"string")&&(e=createNode(e)),assert(isA(e,"htmlelement"),"Elements:getTextContent | target is neither node nor markup"),t){let t="";return e.childNodes.forEach((e=>{3===e.nodeType&&(t+=e.textContent)})),t}return e.textContent}export function isInDom(e){return assert(isA(e,"htmlelement"),`Elements:isInDom | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(document.contains,"function")?document.contains(e):document.body.contains(e)}export function getData(e,t=null){t=orDefault(t,null,"arr"),assert(isA(e,"htmlelement"),`Elements:getData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n={};return hasValue(t)?t.forEach((t=>{let s=e.getAttribute(`data-${t}`);if(hasValue(s))try{n[t]=JSON.parse(s)}catch(e){n[t]=s}})):Array.from(e.attributes).forEach((e=>{if(e.name.startsWith("data-")){const t=e.name.replace(/^data-/,"");try{n[t]=JSON.parse(e.value)}catch(s){n[t]=e.value}}})),0===size(n)?n=null:1===t?.length&&(n=n[t[0]]??null),n}export function setData(e,t,n=null){const s="setData";assert(isA(e,"htmlelement"),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`);let r=null;hasValue(n)&&(r=`${t}`,t={[r]:n}),assert(isPlainObject(t),`Elements:${s} | dataSet is not a plain object`);const a={};return Object.entries(t).forEach((([t,n])=>{if(isA(n,"function")&&(n=n()),void 0!==n){let s,r;try{s=JSON.stringify(n),r=JSON.parse(s)}catch(e){s=`${n}`,r=s}s=s.replace(/^['"]/,"").replace(/['"]$/,"").trim(),""!==s?(a[t]=r,e.setAttribute(`data-${t}`,s)):e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))}else e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))})),hasValue(r)?r in a?a[r]:null:size(a)>0?a:null}export function removeData(e,t=null){t=orDefault(t,null,"arr"),assert(isA(e,"htmlelement"),`Elements:removeData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n=getData(e,t);return hasValue(n)?setData(e,1===t?.length?{[t[0]]:void 0}:Object.keys(n).reduce(((e,t)=>(e[t]=void 0,e)),{})):n=null,n}export function find(e,t="*",n=!1){const s=/:scope(?![\w-])/gi;if(assert(isA(e,"htmlelement"),`Elements:find | ${NOT_AN_HTMLELEMENT_ERROR}`),t=orDefault(t,"*","str").trim(),s.test(t)||(t=`:scope ${t}`),n=orDefault(n,!1,"bool"),BROWSER_HAS_CSS_SCOPE_SUPPORT)return n?e.querySelector(t):Array.from(e.querySelectorAll(t));{const r=`find-scope-${randomUuid()}`;t=t.replace(s,`[${r}]`),e.setAttribute(r,"");const a=n?e.querySelector(t):Array.from(e.querySelectorAll(t));return e.removeAttribute(r),a}}export function findOne(e,t="*"){return find(e,t,!0)}export function findTextNodes(e,t=null,n=!1){t=isA(t,"function")?t:()=>!0,n=orDefault(n,!1,"bool"),assert(isA(e,"htmlelement"),`Elements:findTextNodes | ${NOT_AN_HTMLELEMENT_ERROR}`);const s=e=>3===e.nodeType&&""!==e.textContent.trim()&&!!t(e),r=e=>s(e)?[].concat(e):Array.from(e.childNodes).reduce(((e,t)=>s(t)?e.concat(t):n?e:e.concat(r(t))),[]);return r(e)}export function prime(e,t,n=null,s="primed"){const r="prime";n=orDefault(n,{}),s=orDefault(s,"primed","str"),assert(isA(e,"htmlelement"),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(t,"function"),`Elements:${r} | init is not a function`);const a=new Deferred;return!0!==getData(e,s)?(setData(e,s,!0),onDomReady((()=>{const n=t(e);hasValue(n)&&isA(n.then,"function")&&isA(n.catch,"function")?n.then((e=>{a.resolve(e)})).catch((e=>{a.reject(e)})):a.resolve(n),setData(e,`${s}-ready`,!0)}))):a.resolve(void 0),a.then((()=>{hasValue(n.remove)&&[].concat(n.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),hasValue(n.add)&&[].concat(n.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),setData(e,`${s}-resolved`,!0)})),a}export function measureHiddenDimensions(e,t="outer",n=null,s=null){const r="measureHidden",a={offset:{width:"offsetWidth",height:"offsetHeight"},outer:{width:"offsetWidth",height:"offsetHeight"},client:{width:"clientWidth",height:"clientHeight"},inner:{width:"clientWidth",height:"clientHeight"},scroll:{width:"scrollWidth",height:"scrollHeight"}};t=a[orDefault(t,"outer","str")]??a.outer,s=orDefault(s,document.body),assert(isA(e,"htmlelement"),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(s,"htmlelement"),`Elements:${r} | context is no an htmlelement`);const o=createNode("div",{id:`sandbox-${randomUuid()}`,class:"sandbox",style:"display:block; opacity:0; visibility:hidden; pointer-events:none; position:absolute; top:-10000px; left:-10000px;"}),i=clone(e);s.appendChild(o),o.appendChild(i);const l=isSelector(n)?i.querySelector(n):i,c=l?.[t.width]??0,d=l?.[t.height]??0,u={width:c,height:d,toString:()=>`${c}x${d}`};return s.removeChild(o),u} +const MODULE_NAME="Elements";import{orDefault,isA,isPlainObject,isSelector,isElement,hasValue,assert,size,Deferred}from"./basic.js";import{randomUuid}from"./random.js";import{clone}from"./objects.js";import{onDomReady}from"./events.js";import{applyStyles}from"./css.js";const NOT_AN_HTMLELEMENT_ERROR="given node/target is not an HTMLElement";let BROWSER_HAS_CSS_SCOPE_SUPPORT;try{document.querySelector(":scope *")}catch(e){BROWSER_HAS_CSS_SCOPE_SUPPORT=!1}export function createNode(e,t=null,n=null){e=orDefault(e,"span","str").trim(),t=isPlainObject(t)?t:null,n=orDefault(n,null,"str");const s=document.createElement("div");/^<[^\/][^<>]*>/.test(e)&&/<\/[^<>\/]+>$/.test(e)?s.innerHTML=e:s.appendChild(document.createElement(e));const r=s.firstChild;if(s.removeChild(r),hasValue(t))for(let e in t)r.setAttribute(e,`${t[e]}`);return hasValue(n)&&(r.textContent=n),r}export function insertNode(e,t,n="beforeend"){switch(assert(isElement(e),`Elements.insertNode | ${NOT_AN_HTMLELEMENT_ERROR}`),isElement(t)||(t=createNode(`${t}`)),n){case"beforebegin":case"before":n="beforebegin";break;case"afterend":case"after":n="afterend";break;case"afterbegin":case"prepend":n="afterbegin";break;default:n="beforeend"}return e.insertAdjacentElement(n,t),t}export function replaceNode(e,t){const n="replaceNode";return assert(isElement(e),`Elements.${n} | ${NOT_AN_HTMLELEMENT_ERROR}`),isElement(t)||(t=createNode(`${t}`)),assert(isElement(e.parentNode),`Elements.${n} | given target does not have a parent)`),insertNode(e,t,"after"),e.parentNode.removeChild(e),t}export function defineNode(e,t,n=null){const s="defineNode";assert(isElement(e),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isPlainObject(t),`Elements:${s} | definitions is not a plain object`);const r="<-";return isElement(n)&&Array.from(n.attributes).forEach((e=>{(t[e.name]===r||!hasValue(t[e.name])&&(t["data*"]===r&&e.name.startsWith("data-")||t["on*"]===r&&e.name.startsWith("on")))&&(t[e.name]=e.value),(t[`+${e.name}`]===r||!hasValue(t[`+${e.name}`])&&(t["+data*"]===r&&e.name.startsWith("data-")||t["+on*"]===r&&e.name.startsWith("on")))&&(hasValue(t[`+${e.name}`])&&t[`+${e.name}`]!==r||(t[`+${e.name}`]=""),t[`+${e.name}`]+=e.value)})),delete t["data*"],delete t["+data*"],delete t["on*"],delete t["+on*"],Object.keys(t).forEach((e=>{t[e]===r&&delete t[e]})),Object.keys(t).sort().reverse().forEach((n=>{const s=t[n],r=n.startsWith("+");r&&(n=n.slice(1)),n.endsWith("*")&&(n=n.slice(0,-1)),"class"===n?(r||e.setAttribute("class",""),[].concat(s).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(`${t.trim()}`)}))}))):"style"===n?(r||e.setAttribute("style",""),[].concat(s).forEach((t=>{if(!isPlainObject(t)){const e=`${t}`.split(";"),n={};e.forEach((e=>{let[t,s]=e.split(":");t=t.trim(),hasValue(s)&&(s=s.trim(),s=s.endsWith(";")?s.slice(0,-1):s,n[t]=s)})),t=n}hasValue(t)&&applyStyles(e,t)}))):r?e.setAttribute(n,`${e.getAttribute(n)??""}${s}`):e.setAttribute(n,`${s}`)})),e}export function getTextContent(e,t=!1){if(t=orDefault(t,!1,"bool"),isA(e,"string")&&(e=createNode(e)),assert(isElement(e),"Elements:getTextContent | target is neither node nor markup"),t){let t="";return e.childNodes.forEach((e=>{3===e.nodeType&&(t+=e.textContent)})),t}return e.textContent}export function isInDom(e){return assert(isElement(e),`Elements:isInDom | ${NOT_AN_HTMLELEMENT_ERROR}`),isA(document.contains,"function")?document.contains(e):document.body.contains(e)}export function getData(e,t=null){t=orDefault(t,null,"arr"),assert(isElement(e),`Elements:getData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n={};return hasValue(t)?t.forEach((t=>{let s=e.getAttribute(`data-${t}`);if(hasValue(s))try{n[t]=JSON.parse(s)}catch(e){n[t]=s}})):Array.from(e.attributes).forEach((e=>{if(e.name.startsWith("data-")){const t=e.name.replace(/^data-/,"");try{n[t]=JSON.parse(e.value)}catch(s){n[t]=e.value}}})),0===size(n)?n=null:1===t?.length&&(n=n[t[0]]??null),n}export function setData(e,t,n=null){const s="setData";assert(isElement(e),`Elements:${s} | ${NOT_AN_HTMLELEMENT_ERROR}`);let r=null;hasValue(n)&&(r=`${t}`,t={[r]:n}),assert(isPlainObject(t),`Elements:${s} | dataSet is not a plain object`);const a={};return Object.entries(t).forEach((([t,n])=>{if(isA(n,"function")&&(n=n()),void 0!==n){let s,r;try{s=JSON.stringify(n),r=JSON.parse(s)}catch(e){s=`${n}`,r=s}s=s.replace(/^['"]/,"").replace(/['"]$/,"").trim(),""!==s?(a[t]=r,e.setAttribute(`data-${t}`,s)):e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))}else e.hasAttribute(`data-${t}`)&&(a[t]=void 0,e.removeAttribute(`data-${t}`))})),hasValue(r)?r in a?a[r]:null:size(a)>0?a:null}export function removeData(e,t=null){t=orDefault(t,null,"arr"),assert(isElement(e),`Elements:removeData | ${NOT_AN_HTMLELEMENT_ERROR}`);let n=getData(e,t);return hasValue(n)?setData(e,1===t?.length?{[t[0]]:void 0}:Object.keys(n).reduce(((e,t)=>(e[t]=void 0,e)),{})):n=null,n}export function find(e,t="*",n=!1){const s=/:scope(?![\w-])/gi;if(assert(isElement(e),`Elements:find | ${NOT_AN_HTMLELEMENT_ERROR}`),t=orDefault(t,"*","str").trim(),s.test(t)||(t=`:scope ${t}`),n=orDefault(n,!1,"bool"),BROWSER_HAS_CSS_SCOPE_SUPPORT)return n?e.querySelector(t):Array.from(e.querySelectorAll(t));{const r=`find-scope-${randomUuid()}`;t=t.replace(s,`[${r}]`),e.setAttribute(r,"");const a=n?e.querySelector(t):Array.from(e.querySelectorAll(t));return e.removeAttribute(r),a}}export function findOne(e,t="*"){return find(e,t,!0)}export function findTextNodes(e,t=null,n=!1){t=isA(t,"function")?t:()=>!0,n=orDefault(n,!1,"bool"),assert(isElement(e),`Elements:findTextNodes | ${NOT_AN_HTMLELEMENT_ERROR}`);const s=e=>3===e.nodeType&&""!==e.textContent.trim()&&!!t(e),r=e=>s(e)?[].concat(e):Array.from(e.childNodes).reduce(((e,t)=>s(t)?e.concat(t):n?e:e.concat(r(t))),[]);return r(e)}export function prime(e,t,n=null,s="primed"){const r="prime";n=orDefault(n,{}),s=orDefault(s,"primed","str"),assert(isElement(e),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isA(t,"function"),`Elements:${r} | init is not a function`);const a=new Deferred;return!0!==getData(e,s)?(setData(e,s,!0),onDomReady((()=>{const n=t(e);hasValue(n)&&isA(n.then,"function")&&isA(n.catch,"function")?n.then((e=>{a.resolve(e)})).catch((e=>{a.reject(e)})):a.resolve(n),setData(e,`${s}-ready`,!0)}))):a.resolve(void 0),a.then((()=>{hasValue(n.remove)&&[].concat(n.remove).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.remove(t.trim())}))})),hasValue(n.add)&&[].concat(n.add).forEach((t=>{`${t}`.split(" ").forEach((t=>{e.classList.add(t.trim())}))})),setData(e,`${s}-resolved`,!0)})),a}export function measureHiddenDimensions(e,t="outer",n=null,s=null){const r="measureHidden",a={offset:{width:"offsetWidth",height:"offsetHeight"},outer:{width:"offsetWidth",height:"offsetHeight"},client:{width:"clientWidth",height:"clientHeight"},inner:{width:"clientWidth",height:"clientHeight"},scroll:{width:"scrollWidth",height:"scrollHeight"}};t=a[orDefault(t,"outer","str")]??a.outer,s=orDefault(s,document.body),assert(isElement(e),`Elements:${r} | ${NOT_AN_HTMLELEMENT_ERROR}`),assert(isElement(s),`Elements:${r} | context is no an htmlelement`);const o=createNode("div",{id:`sandbox-${randomUuid()}`,class:"sandbox",style:"display:block; opacity:0; visibility:hidden; pointer-events:none; position:absolute; top:-10000px; left:-10000px;"}),i=clone(e);s.appendChild(o),o.appendChild(i);const l=isSelector(n)?i.querySelector(n):i,c=l?.[t.width]??0,d=l?.[t.height]??0,u={width:c,height:d,toString:()=>`${c}x${d}`};return s.removeChild(o),u} //# sourceMappingURL=elements.js.map diff --git a/docs/examples/lib/annex/dist/elements.js.map b/docs/examples/lib/annex/dist/elements.js.map index db331aae..fa897e6e 100644 --- a/docs/examples/lib/annex/dist/elements.js.map +++ b/docs/examples/lib/annex/dist/elements.js.map @@ -1 +1 @@ -{"version":3,"file":"elements.js","names":["MODULE_NAME","orDefault","isA","isPlainObject","isSelector","hasValue","assert","size","Deferred","randomUuid","clone","onDomReady","applyStyles","NOT_AN_HTMLELEMENT_ERROR","BROWSER_HAS_CSS_SCOPE_SUPPORT","document","querySelector","ex","createNode","tag","attributes","content","trim","outerNode","createElement","test","innerHTML","appendChild","node","firstChild","removeChild","attribute","setAttribute","textContent","insertNode","target","position","insertAdjacentElement","replaceNode","__methodName__","parentNode","defineNode","definition","boilerplateNode","inheritValue","Array","from","forEach","name","startsWith","value","Object","keys","sort","reverse","addValue","slice","endsWith","concat","split","classList","add","rules","valueObj","rule","key","prop","getAttribute","getTextContent","onlyFirstLevel","childNodes","nodeType","isInDom","contains","body","getData","properties","data","property","attributeValue","JSON","parse","replace","length","setData","dataSet","singleValue","singleKey","appliedValues","entries","undefined","stringifiedValue","getValue","stringify","hasAttribute","removeAttribute","removeData","reduce","removalDataSet","find","selector","onlyOne","scopeRex","querySelectorAll","fallbackScopeAttribute","found","findOne","findTextNodes","filter","isValidTextNode","extractTextNodes","textNodes","childNode","prime","init","classChanges","markerAttributesName","deferred","initResult","then","catch","resolution","resolve","error","reject","remove","removeClass","addClass","measureHiddenDimensions","method","context","methods","offset","width","height","outer","client","inner","scroll","sandbox","id","class","style","measureClone","dimensions","toString"],"sources":["elements.js"],"mappings":";;;AAQA,MAAMA,YAAc,kBAMZC,UAAWC,IAAKC,cAAeC,WAAYC,SAAUC,OAAQC,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ACvEP,OAAOJ,IAAIgI,EAAS,eAAgB,YAAkB3F,oCAEtD,MACCoG,EAAUzH,WAAW,MAAO,CAC3B0H,GAAO,WAAWnI,eAClBoI,MAAU,UACVC,MAAU,sHAEXC,EAAerI,MAAMkB,GAGtBsG,EAAQvG,YAAYgH,GACpBA,EAAQhH,YAAYoH,GAEpB,MACC5G,EAAS/B,WAAWgG,GAAY2C,EAAa/H,cAAcoF,GAAY2C,EACvEV,EAAQlG,IAAS8F,EAAOI,QAAU,EAClCC,EAASnG,IAAS8F,EAAOK,SAAW,EACpCU,EAAa,CACZX,QACAC,SACAW,SAAQ,IAAW,GAAGZ,KAASC,KAMjC,OAFAJ,EAAQpG,YAAY6G,GAEbK,CACR","sourcesContent":["/*!\n * Module Elements\n */\n\n/**\n * @namespace Elements\n */\n\nconst MODULE_NAME = 'Elements';\n\n\n\n//###[ IMPORTS ]########################################################################################################\n\nimport {orDefault, isA, isPlainObject, isSelector, hasValue, assert, size, Deferred} from './basic.js';\nimport {randomUuid} from './random.js';\nimport {clone} from './objects.js';\nimport {onDomReady} from './events.js';\nimport {applyStyles} from './css.js';\n\n\n\n//###[ DATA ]###########################################################################################################\n\nconst NOT_AN_HTMLELEMENT_ERROR = 'given node/target is not an HTMLElement';\nlet BROWSER_HAS_CSS_SCOPE_SUPPORT;\ntry {\n\tdocument.querySelector(':scope *');\n} catch(ex){\n\tBROWSER_HAS_CSS_SCOPE_SUPPORT = false;\n}\n\n\n\n//###[ EXPORTS ]########################################################################################################\n\n/**\n * @namespace Elements:createNode\n */\n\n/**\n * Creates an element on the fly programmatically, based on provided name, attributes and content or markup,\n * without inserting it into the DOM.\n *\n * If you provide markup as \"tag\", make sure that there is one single root element, this method returns exactly one\n * element, not a NodeList. Also be sure to _not_ just pass HTML source from an unsecure source, since this\n * method does not deal with potential security risks.\n *\n * One thing about dynamically creating script tags with this: if you want the script is javascript and you want to\n * actually execute the script upon adding it to the dom, you cannot provide the complete tag as a source string,\n * since scripts created with innerHTML will not execute.\n * (see: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations)\n * Instead, just provide the tag name and define attributes and source via the parameters instead.\n *\n * @param {?String} [tag='span'] - tag of the element to create or markup for root element\n * @param {?Object} [attributes=null] - tag attributes as key/value-pairs, will also be added to provided markup\n * @param {?String} [content=null] - content to insert into the element as textContent, be aware, that this will replace other content in provided markup\n * @returns {HTMLElement} the created DOM-node\n *\n * @memberof Elements:createNode\n * @alias createNode\n * @example\n * document.body.appendChild(\n * createNode('div', {id : 'content', style : 'display:none;'}, 'loading...')\n * );\n * document.body.appendChild(\n * createNode('
loading...
')\n * );\n * document.body.appendChild(\n * createNode('script', {type : 'text/javascript'}, 'alert(\"Hello World\");');\n * );\n */\nexport function createNode(tag, attributes=null, content=null){\n\ttag = orDefault(tag, 'span', 'str').trim();\n\tattributes = isPlainObject(attributes) ? attributes : null;\n\tcontent = orDefault(content, null, 'str');\n\n\t// using anything more generic like template results in non-standard nodes like\n\t//