jqx-es 1.1.9 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -17,9 +17,9 @@ import {
17
17
  addJQxStaticMethods,
18
18
  createElementFromHtmlString,
19
19
  insertPositions,
20
- systemLog,
21
20
  IS,
22
21
  } from "./src/JQxExtensionHelpers.js";
22
+ import { systemLog, } from "./src/Utilities.js";
23
23
 
24
24
  export default addJQxStaticMethods(JQxFactory());
25
25
 
@@ -34,7 +34,7 @@ function JQxFactory() {
34
34
  const isRawHtml = isHtmlString(input);
35
35
  const isRawHtmlArray = !isRawHtml && isArrayOfHtmlStrings(input);
36
36
  const shouldCreateElements = isRawHtmlArray || isRawHtml;
37
-
37
+
38
38
  let instance = {
39
39
  collection: input2Collection(input) ?? [],
40
40
  isVirtual,
@@ -42,7 +42,7 @@ function JQxFactory() {
42
42
  };
43
43
 
44
44
  const isRawElemCollection = isArrayOfHtmlElements(instance.collection);
45
-
45
+
46
46
  const logStr = `input => ${
47
47
  isRawHtmlArray
48
48
  ? `"${truncateHtmlStr(input.join(`, `), logLineLength)}"`
@@ -53,7 +53,7 @@ function JQxFactory() {
53
53
  : `"${truncateHtmlStr(input, logLineLength)}"`}`;
54
54
 
55
55
  if (instance.collection.length && isRawElemCollection) {
56
- systemLog(logStr);
56
+ systemLog.log(logStr);
57
57
 
58
58
  if (!isVirtual) {
59
59
  instance.collection.forEach(el => {
@@ -74,13 +74,13 @@ function JQxFactory() {
74
74
  const errors = instance.collection.filter( el => el?.dataset?.jqxcreationerror );
75
75
  instance.collection = instance.collection.filter(el => !el?.dataset?.jqxcreationerror);
76
76
 
77
- systemLog(`${logStr}`);
78
- systemLog(`*Created ${instance.isVirtual ? `VIRTUAL ` : ``}[${
77
+ systemLog.log(`${logStr}`);
78
+ systemLog.log(`*Created ${instance.isVirtual ? `VIRTUAL ` : ``}[${
79
79
  truncateHtmlStr(ElemArray2HtmlString(instance.collection) ||
80
80
  "sanitized: no elements remaining", logLineLength)}]`);
81
81
 
82
82
  if (errors.length) {
83
- console.error(`JQx: illegal html, not rendered: "${
83
+ systemLog.error(`JQx: illegal html, not rendered: "${
84
84
  errors.reduce( (acc, el) => acc.concat(`${el.textContent}\n`), ``).trim()}"` );
85
85
  }
86
86
 
@@ -93,7 +93,7 @@ function JQxFactory() {
93
93
  }
94
94
 
95
95
  const forLog = setCollectionFromCssSelector(input, root, instance);
96
- systemLog(`input => ${forLog}`);
96
+ systemLog.log(`input => ${forLog}`);
97
97
  return proxify(instance);
98
98
  }
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqx-es",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The good parts of JQuery",
package/src/DOMCleanup.js CHANGED
@@ -1,22 +1,21 @@
1
- import { truncate2SingleStr, IS } from "./JQxExtensionHelpers.js";
1
+ import { truncate2SingleStr, IS/*, debugLog*/ } from "./JQxExtensionHelpers.js";
2
2
  import cleanupTagInfo from "./HTMLTags.js";
3
3
  import {ATTRS} from "./EmbedResources.js";
4
- import {debugLog} from "./JQxLog.js";
5
- import {escHtml} from "./Utilities.js";
4
+ import {escHtml, systemLog} from "./Utilities.js";
6
5
 
7
6
  let logElementCreationErrors2Console = true;
8
7
  const attrRegExpStore = {
9
8
  data: /data-[\-\w.\p{L}]/ui, // data-* minimal 1 character after dash
10
9
  validURL: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
11
10
  whiteSpace: /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,
12
- notAllowedValues: /javascript|injected|noreferrer|alert|DataURL/gi
11
+ notAllowedValues: /^javascript|injected|noreferrer|alert|DataURL/gi
13
12
  };
14
13
  const logContingentErrors = elCreationInfo => {
15
14
  if (logElementCreationErrors2Console && Object.keys(elCreationInfo.removed).length) {
16
15
  const msgs = Object.entries(elCreationInfo.removed)
17
16
  .reduce( (acc, [k, v]) => [...acc, `${escHtml(k)} => ${v}`], [])
18
17
  .join(`\\000A`);
19
- debugLog.log(`JQx HTML creation errors: ${debugLog.isConsole ? msgs : escHtml(msgs)}`);
18
+ systemLog.error(`JQx HTML creation errors: ${msgs}`);
20
19
  }
21
20
  };
22
21
  const elementCheck = function(child) {
@@ -31,7 +30,7 @@ const cleanupHtml = el2Clean => {
31
30
  rawHTML: el2Clean?.parentElement?.getHTML() ?? `no html`,
32
31
  removed: { },
33
32
  }
34
-
33
+
35
34
  if (IS(el2Clean, HTMLElement)) {
36
35
  [...el2Clean.childNodes].forEach(child => {
37
36
  if (child?.children?.length) {
@@ -52,17 +51,17 @@ const cleanupHtml = el2Clean => {
52
51
  if (evilValue || evilAttrib) {
53
52
  let val = truncate2SingleStr(attr.value || `none`, 60);
54
53
  val += val.length === 60 ? `...` : ``;
55
- elCreationInfo.removed[`${attr.name}`] = `attribute/property (-value) not allowed, removed. Value: ${
54
+ elCreationInfo.removed[`${attr.name}`] = `attribute/property/value not allowed, removed. Value: ${
56
55
  val}`;
57
56
  child.removeAttribute(attr.name);
58
57
  }
59
58
  });
60
59
  }
61
-
60
+
62
61
  const allowed = elementCheck(child) ||
63
62
  child.constructor === CharacterData ||
64
63
  child.constructor === Comment;
65
-
64
+
66
65
  if (!allowed) {
67
66
  const tag = (child?.outerHTML || child?.textContent).trim();
68
67
  let tagValue = truncate2SingleStr(tag, 60) ?? `EMPTY`;
@@ -1,9 +1,8 @@
1
1
  const svgImg = `url('data:image/svg+xml\\3butf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Layer_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20128%20128%22%20style%3D%22enable-background%3Anew%200%200%20128%20128%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Crect%20x%3D%22-368%22%20y%3D%226%22%20style%3D%22display%3Anone%3Bfill%3A%23E0E0E0%3B%22%20width%3D%22866%22%20height%3D%221018%22%2F%3E%3Ccircle%20style%3D%22fill%3A%23FFFFFF%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2248%22%2F%3E%3Ccircle%20style%3D%22fill%3A%238CCFB9%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2239%22%2F%3E%3Ccircle%20style%3D%22fill%3Anone%3Bstroke%3A%23444B54%3Bstroke-width%3A6%3Bstroke-miterlimit%3A10%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2248%22%2F%3E%3Cpolyline%20style%3D%22fill%3Anone%3Bstroke%3A%23FFFFFF%3Bstroke-width%3A6%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%20points%3D%2242%2C69%2055.55%2C81%20%20%2086%2C46%20%22%2F%3E%3C%2Fsvg%3E')`;
2
- let logStyling = getLogStyling();
3
2
  let popupStyling = getPopupStyling();
4
3
  const ATTRS = getAttrs();
5
4
  const allTags = getPermissions();
6
- export {logStyling, popupStyling, ATTRS, allTags};
5
+ export {popupStyling, ATTRS, allTags};
7
6
 
8
7
  function getAttrs() {
9
8
  return {
@@ -18,20 +17,6 @@ function getPermissions() {
18
17
  return {a:true,area:true,audio:false,br:true,base:true,body:true,button:true,canvas:true,comment:true,dl:true,data:true,datalist:true,div:true,em:true, embed:false,fieldset:true,font:true,footer:true,form:false,hr:true,head:true,header:true,output:true,iframe:false,frameset:false,img:true,input:true,li:true,label:true,legend:true,link:true,map:true,mark:true,menu:true,media:true,meta:true,nav:true,meter:true,ol:true,object:false,optgroup:true,option:true,p:true,param:true,picture:true,pre:true,progress:false,quote:true,script:false,select:true,source:true,span:true,style:true,caption:true,td:true,col:true,table:true,tr:true,template:false,textarea:true,time:true,title:true,track:true,details:true,ul:true,video:true,del:true,ins:true,slot:true,blockquote:true,svg:true,dialog:true,summary:true,main:true,address:true,colgroup:true,tbody:true,tfoot:true,thead:true,th:true,dd:true,dt:true,figcaption:true,figure:true,i:true,b:true,code:true,h1:true,h2:true,h3:true,h4:true,abbr:true,bdo:true,dfn:true,kbd:true,q:true,rb:true,rp:true,rt:true,ruby:true,s:true,strike:true,samp:true,small:true,strong:true,sup:true,sub:true,u:true,var:true,wbr:true,nobr:true,tt:true,noscript:true};
19
18
  }
20
19
 
21
- function getLogStyling() {
22
- return [
23
- "#logBox{min-width:0px;max-width:0px;min-height:0px;max-height:0px;width:0;height:0;z-index:-1;border:none;padding:0px;overflow:hidden;transition:all 0.3s ease;margin-top:-100px;}",
24
- "#logBox.visible{background-color:rgb(255, 255, 224);z-index:1;position:static;border:1px dotted rgb(153, 153, 153);max-width:50vw;min-width:30vw;min-height:10vh;max-height:90vh;overflow:auto;width:50vw;height:20vh;margin:1rem 0px;padding:0px 8px 19px;resize:both;}",
25
- "#logBox.visible .legend{position:absolute;}",
26
- "#logBox .legend{text-align:center;margin-top:-1em;width:inherit;max-width:inherit;}",
27
- "#logBox .legend div{text-align:center;display:inline-block;max-width:inherit;height:1.2rem;background-color:rgb(119, 119, 119);padding:2px 10px;color:rgb(255, 255, 255);box-shadow:rgb(119 119 119) 2px 1px 10px;border-radius:4px;}",
28
- "#logBox .legend div:before{content:'JQx Logging (chronological)';}",
29
- "#logBox .legend.reversed div:before{content:'JQx Logging (reversed)';}",
30
- "#logBox #jqx_logger{marginTop:0.7rem;lineHeight:1.4em;font-family:consolas,monospace;whiteSpace:pre-wrap;maxWidth:inherit;padding-left:100px;}",
31
- "#logBox #jqx_logger div.entry{text-indent:-100px;whiteSpace:normal;}",
32
- ]
33
- }
34
-
35
20
  function getPopupStyling() {
36
21
  return [
37
22
  "::backdrop{background-color:grey;opacity:0.2;}",
@@ -17,16 +17,16 @@ function HandleFactory(jqx) {
17
17
  name = name || (!/handlers$/.test(callback.name) && callback.name) || undefined;
18
18
  capture = jqx.IS(capture, Boolean) ? capture : false;
19
19
  once = jqx.IS(once, Boolean) ? once : false;
20
- canRemove = isNonEmptyString(name, 4) && jqx.IS(canRemove, Boolean) ? canRemove : false;
21
- const { handler, signal, remove } = wrapHandlerFunction({selector, callback, canRemove, name, eventType});
20
+ canRemove = isNonEmptyString(name, 4) && jqx.IS(canRemove, Boolean) ? canRemove : once;
21
+ const { handler, signal, remove } = wrapHandlerFunction({selector, callback, canRemove, once, name, eventType});
22
22
  return addAndStoreListener({eventType, handler, capture, once, signal, remove, name});
23
23
  }
24
24
  };
25
25
 
26
26
  function wrapHandlerFunction(spec) {
27
- const {selector, callback, canRemove, name, eventType} = spec;
28
- const abortcontroller = canRemove && new AbortController();
29
- const remove = removeHandlerFactory({abortcontroller, name, eventType});
27
+ const {selector, callback, canRemove, name, eventType, once} = spec;
28
+ const abortcontroller = (canRemove || once) && new AbortController();
29
+ const remove = removeHandlerFactory({once, abortcontroller, name, eventType});
30
30
  const listener = !selector
31
31
  ? { handler: evt => callback(evt, evt.target, remove), remove}
32
32
  : { handler: evt => {
@@ -34,17 +34,29 @@ function HandleFactory(jqx) {
34
34
  return target && callback(evt, jqx(target), remove);
35
35
  }, remove
36
36
  };
37
- if (abortcontroller) { listener.signal = abortcontroller.signal; }
37
+
38
+ if (abortcontroller) {
39
+ listener.signal = abortcontroller.signal;
40
+ if (once) {
41
+ return {
42
+ handler: (evt, me) => {
43
+ listener.handler(evt, me);
44
+ remove();
45
+ }
46
+ }
47
+ }
48
+ }
49
+
38
50
  return listener;
39
51
  }
40
52
 
41
53
  function removeHandlerFactory(spec) {
42
- const {abortcontroller, name, eventType} = spec;
54
+ const {once, abortcontroller, name, eventType} = spec;
43
55
  return !name
44
- ? function() { console.error(`An anonymous listener can not be removed`); }
56
+ ? function() { jqx.logger.error(`An anonymous listener can not be removed`); }
45
57
  : !abortcontroller
46
58
  ? function(evt) {
47
- console.error(`Listener for event type [${eventType}] with name [${
59
+ jqx.logger.error(`Listener for event type [${eventType}] with name [${
48
60
  name}] is not marked as removable`);
49
61
  }
50
62
  : function removeHandler() {
@@ -52,14 +64,13 @@ function HandleFactory(jqx) {
52
64
  const toRemove = [...handlerStore[eventType].entries()].find(([k, v]) => v.name === name);
53
65
  handlerStore[eventType].delete(toRemove[0]);
54
66
  setTimeout( () =>
55
- console.warn(`Listener for event type [${eventType}] with name [${
56
- name}] was removed`), 100 );
67
+ jqx.logger.log(`Listener for event type [${eventType}] with name [${
68
+ name}] was removed${once ? ` (once active, so handled once).` : ``}`), 100 );
57
69
  }
58
70
  }
59
71
 
60
72
  function addAndStoreListener(spec) {
61
73
  const {eventType, handler, capture, once, signal, remove, name} = spec;
62
- if (once) { return addEventListener(eventType, handler, {once}); }
63
74
  if (!handlerStore[eventType]) { handlerStore[eventType] = new Map(); }
64
75
  const delegateExists = handlerStore[eventType].has(handler) ||
65
76
  [...handlerStore[eventType].values()].find(h => (h.name || ``) === name);
@@ -1,68 +1,33 @@
1
1
  import { createElementFromHtmlString, insertPositions, inject2DOMTree, cleanupHtml } from "./DOM.js";
2
- import { debugLog, Log, systemLog } from "./JQxLog.js";
3
2
  import allMethodsFactory from "./JQxMethods.js";
4
3
  import PopupFactory from "./Popup.js";
5
4
  import { listeners, default as HandleFactory } from "./HandlerFactory.js";
6
5
  import tagLib from "./HTMLTags.js";
7
6
  import {
8
7
  randomString, toDashedNotation, IS, truncateHtmlStr, tagFNFactory as $T,
9
- truncate2SingleStr, logTime, hex2RGBA, styleFactory, toCamelcase,
10
- isNonEmptyString, resolveEventTypeParameter,
8
+ truncate2SingleStr, styleFactory, toCamelcase, systemLog, escHtml,
9
+ isNonEmptyString, resolveEventTypeParameter, extensionHelpers,
11
10
  } from "./Utilities.js";
12
- let static4Docs = {};
13
- let instanceGetters, instanceMethods, $;
14
11
 
12
+ let instanceGetters, instanceMethods;
15
13
  const {
16
- isCommentOrTextNode, isNode,
17
- isHtmlString, isArrayOfHtmlElements, isArrayOfHtmlStrings, ElemArray2HtmlString,
18
- input2Collection, setCollectionFromCssSelector, addHandlerId, cssRuleEdit,
19
- addFn, elems4Docs } = smallHelpersFactory();
14
+ isCommentOrTextNode, isNode, isComment, isText, isHtmlString, isArrayOfHtmlElements,
15
+ isArrayOfHtmlStrings, ElemArray2HtmlString, input2Collection, setCollectionFromCssSelector,
16
+ addHandlerId, cssRuleEdit, addFn
17
+ } = localHelpersFactory();
18
+
19
+ // todo: clean this up
20
+ export {
21
+ addHandlerId, isHtmlString, isNode, isArrayOfHtmlStrings, isArrayOfHtmlElements, isCommentOrTextNode,
22
+ inject2DOMTree, ElemArray2HtmlString, input2Collection, setCollectionFromCssSelector,
23
+ truncateHtmlStr, truncate2SingleStr, proxify, addJQxStaticMethods, createElementFromHtmlString,
24
+ insertPositions, IS, };
20
25
 
21
26
  /* region functions */
22
- function smallHelpersFactory() {
23
- const cssRuleEdit = styleFactory( { createWithId: `JQxStylesheet` } );
27
+ function localHelpersFactory() {
28
+ const cssRuleEdit = styleFactory({createWithId: `JQxStylesheet`});
24
29
  const addFn = (name, fn) => instanceMethods[name] = (self, ...params) => fn(self, ...params);
25
- const isCommentOrTextNode = elem => IS(elem, Comment, Text);
26
- const isNode = input => IS(input, Text, HTMLElement, Comment);
27
- const isComment = input => IS(input, Comment);
28
- const isText = input => IS(input, Text);
29
- const isHtmlString = input => IS(input, String) && /^<|>$/.test(`${input}`.trim());
30
- const isArrayOfHtmlStrings = input => IS(input, Array) && !input?.find(s => !isHtmlString(s));
31
- const isArrayOfHtmlElements = input => IS(input, Array) && !input?.find(el => !isNode(el));
32
- const ElemArray2HtmlString = elems => elems?.filter(el => el).reduce((acc, el) =>
33
- acc.concat(isComment(el) ? `<!--${el.data}-->`
34
- : isCommentOrTextNode(el) ? el.textContent
35
- : el.outerHTML), ``);
36
- const input2Collection = input =>
37
- !input ? []
38
- : IS(input, Proxy) ? [input.EL]
39
- : IS(input, NodeList) ? [...input]
40
- : isNode(input) ? [input]
41
- : isArrayOfHtmlElements(input) ? input
42
- : input.isJQx ? input.collection : undefined;
43
- const setCollectionFromCssSelector = (input, root, self) => {
44
- const selectorRoot = root !== document.body && (IS(input, String) && input.toLowerCase() !== "body") ? root : document;
45
- let errorStr = undefined;
46
-
47
- try { self.collection = [...selectorRoot.querySelectorAll(input)]; }
48
- catch (err) { errorStr = `Invalid CSS querySelector. [${!IS(input, String) ? `Nothing valid given!` : input}]`; }
49
-
50
- return errorStr ?? `CSS querySelector "${input}", output ${self.collection.length} element(s)`;
51
- };
52
- const addHandlerId = instance => {
53
- const handleId = instance.data.get(`hid`) || `HID${randomString()}`;
54
- instance.data.add({hid: handleId});
55
- return `[data-hid="${handleId}"]`;
56
- };
57
- const elems4Docs = Object.entries(tagLib.tagsRaw)
58
- .filter( ([,cando]) => cando)
59
- .map( ([key,]) => key)
60
- .sort( (a, b) => a.localeCompare(b));
61
-
62
- return {
63
- isCommentOrTextNode, isNode, isComment, isText, isHtmlString, isArrayOfHtmlElements,
64
- isArrayOfHtmlStrings, ElemArray2HtmlString, input2Collection, setCollectionFromCssSelector,
65
- addHandlerId, cssRuleEdit, addFn, elems4Docs };
30
+ return {...extensionHelpers(), ...{cssRuleEdit, addFn, }};
66
31
  }
67
32
 
68
33
  function proxify(instance) {
@@ -81,17 +46,19 @@ function proxyKeyFactory(self, key, instance) {
81
46
  switch(true) {
82
47
  case IS(key, Symbol): return self;
83
48
  case IS(+key, Number): return self.collection?.[key] || undefined;
84
- case !!(key in instanceGetters): return wrapGetter(instanceGetters[key], instance)();
85
- case !!(key in instanceMethods): return wrapExtension(instanceMethods[key], instance);
49
+ case (key in instanceGetters): return wrapGetter(instanceGetters[key], instance)();
50
+ case (key in instanceMethods): return wrapExtension(instanceMethods[key], instance);
86
51
  default: return self[key];
87
52
  }
88
53
  }
89
54
 
90
55
  function addJQxStaticMethods(jqx) {
91
56
  const staticMethods = defaultStaticMethodsFactory(jqx);
57
+
92
58
  for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(staticMethods))) {
93
59
  Object.defineProperty(jqx, key, descriptor);
94
- Object.defineProperty(static4Docs, key, descriptor); }
60
+ }
61
+
95
62
  return jqx;
96
63
  }
97
64
 
@@ -147,14 +114,12 @@ function virtualFactory(jqx) {
147
114
 
148
115
  function combineObjectSources(...sources) {
149
116
  const result = {};
150
-
151
117
  for (const source of sources) {
152
118
  const descriptors = Object.getOwnPropertyDescriptors(source);
153
119
  for (const [key, descriptor] of Object.entries(descriptors)) {
154
120
  !(key in result) && Object.defineProperty(result, key, descriptor);
155
121
  }
156
122
  }
157
-
158
123
  return result;
159
124
  }
160
125
 
@@ -165,7 +130,6 @@ function tagNotAllowed(tagName) {
165
130
 
166
131
  function tagGetterFactory(tagName, cando, jqx, webComponentTagName) {
167
132
  tagName = toDashedNotation(webComponentTagName || tagName.toLowerCase());
168
-
169
133
  return {
170
134
  get() {
171
135
  return (...args) => {
@@ -181,7 +145,6 @@ function tagGetterFactory(tagName, cando, jqx, webComponentTagName) {
181
145
  function addGetters(tag, cando, jqx, webComponentTagName) {
182
146
  tag = tag.toLowerCase();
183
147
  const jqxGetterForThisTag = tagGetterFactory(tag, cando, jqx, webComponentTagName);
184
-
185
148
  return webComponentTagName
186
149
  ? { [webComponentTagName]: jqxGetterForThisTag, [toCamelcase(webComponentTagName)]: jqxGetterForThisTag, }
187
150
  : { [tag]: jqxGetterForThisTag, [tag.toUpperCase()]: jqxGetterForThisTag, };
@@ -201,14 +164,14 @@ function staticTagsLambda(jqx) {
201
164
  }
202
165
 
203
166
  function delegateFactory(listen) {
204
- return function(type, origin, ...eventHandlers) {
167
+ return function(type, selector, ...listeners) {
205
168
 
206
- if (IS(origin, Function)) {
207
- eventHandlers.push(origin);
208
- origin = undefined;
169
+ if (IS(selector, Function)) {
170
+ listeners.push(selector);
171
+ selector = undefined;
209
172
  }
210
173
 
211
- listen({type, selector: origin, handlers: eventHandlers});
174
+ listen({type, selector: selector, handlers: listeners});
212
175
  }
213
176
  }
214
177
 
@@ -222,10 +185,6 @@ function delegateCaptureFactory(listen) {
222
185
  canRemove = IS(canRemove, Boolean) ? canRemove : false;
223
186
  const params = { eventType: typesResolved, selector: selector || origin, capture,
224
187
  name: specifiedName, once, canRemove};
225
- const doHandle = handler => {
226
- params.name = specifiedName;
227
- IS(handler, Function) && listen({...params, callback: handler});
228
- }
229
188
  switch(true) {
230
189
  case IS(typesResolved, Array) && typesResolved.length > 0:
231
190
  for (const type of typesResolved) {
@@ -233,8 +192,12 @@ function delegateCaptureFactory(listen) {
233
192
  for (const handler of handlers) { doHandle(handler); }
234
193
  }
235
194
  return;
236
- default:
237
- for (const handler of handlers) { doHandle(handler); }
195
+ default: for (const handler of handlers) { doHandle(handler); }
196
+ }
197
+
198
+ function doHandle(handler) {
199
+ params.name = specifiedName;
200
+ IS(handler, Function) && listen({...params, callback: handler});
238
201
  }
239
202
  }
240
203
  }
@@ -247,79 +210,62 @@ function getNamedListener(type, name) {
247
210
  }
248
211
  }
249
212
 
250
- function staticMethodsFactory(jqx) {
251
- $ = jqx;
252
- const { factoryExtensions, instanceExtensions } = allMethodsFactory(jqx);
253
- instanceGetters = factoryExtensions;
254
- instanceMethods = instanceExtensions;
213
+ function popupGetter(jqx) {
214
+ if (!jqx.activePopup) {
215
+ Object.defineProperty(
216
+ jqx, `activePopup`, {
217
+ value: PopupFactory(jqx),
218
+ enumerable: false
219
+ } );
220
+ }
221
+ return jqx.activePopup;
222
+ }
223
+
224
+ function getSelectedStaticMethods(jqx) {
255
225
  const editCssRule = (ruleOrSelector, ruleObject) => cssRuleEdit(ruleOrSelector, ruleObject);
226
+ const createStyle = id => styleFactory({createWithId: id || `jqx${randomString()}`});
227
+ const editCssRules = (...rules) => { for (const rule of rules) { cssRuleEdit(rule); } };
256
228
  const allowProhibit = allowances(jqx);
257
229
  const handle = HandleFactory(jqx);
258
230
  const capturedHandling = delegateCaptureFactory(handle);
231
+ const log = (...line) => systemLog.on.log(...line).off;
232
+ return {editCssRule, createStyle, editCssRules, allowProhibit, handle, capturedHandling,log};
233
+ }
234
+
235
+ function staticMethodsFactory(jqx) {
236
+ const { factoryExtensions, instanceExtensions } = allMethodsFactory(jqx);
237
+ instanceGetters = factoryExtensions;
238
+ instanceMethods = instanceExtensions;
239
+ const { editCssRule, createStyle, editCssRules, allowProhibit, handle, capturedHandling, log } =
240
+ getSelectedStaticMethods(jqx);
241
+
259
242
  return {
260
- debugLog,
261
- log: (...args) => Log(`fromStatic`, ...args),
262
- insertPositions,
263
- get at() { return insertPositions; },
264
- editCssRules: (...rules) => { for (const rule of rules) { cssRuleEdit(rule); } },
243
+ log,
244
+ editCssRules,
245
+ createStyle,
246
+ editStylesheet: createStyle,
265
247
  editCssRule,
248
+ escHtml,
249
+ logger: systemLog,
250
+ text: (str, isComment = false) => isComment ? jqx.comment(str) : document.createTextNode(str),
251
+ node: (selector, root = document) => root.querySelector(selector, root),
252
+ nodes: (selector, root = document) => [...root.querySelectorAll(selector, root)],
253
+ //get logger() { return loggerFactory() },
254
+ get getNamedListener() { return getNamedListener; },
255
+ get virtual() { return virtualFactory(jqx); },
256
+ get allowTag() { return allowProhibit.allow; },
257
+ get prohibitTag() { return allowProhibit.prohibit; },
258
+ get removeCssRule() { return cssRemove; },
259
+ get removeCssRules() { return cssRemove; },
260
+ get delegate() { return delegateFactory(capturedHandling); },
261
+ get delegateCaptured() { return capturedHandling; } ,
262
+ get handle() { return capturedHandling; },
263
+ get at() { return insertPositions; },
266
264
  get setStyle() { /*deprecated*/return editCssRule; },
267
- getNamedListener,
268
- delegate: delegateFactory(capturedHandling),
269
- delegateCaptured: capturedHandling,
270
- handle: capturedHandling,
271
- virtual: virtualFactory(jqx),
272
265
  get fn() { return addFn; },
273
- allowTag: allowProhibit.allow,
274
- prohibitTag: allowProhibit.prohibit,
275
266
  get lenient() { return tagLib.allowUnknownHtmlTags; },
276
267
  get IS() { return IS; },
277
- get Popup() {
278
- if (!jqx.activePopup) {
279
- Object.defineProperty(
280
- jqx, `activePopup`, {
281
- value: PopupFactory(jqx),
282
- enumerable: false
283
- } );
284
- }
285
- return jqx.activePopup;
286
- },
287
- popup: () => jqx.Popup,
288
- createStyle: id => styleFactory({createWithId: id || `jqx${randomString()}`}),
289
- editStylesheet: id => styleFactory({createWithId: id || `jqx${randomString()}`}),
290
- removeCssRule: cssRemove,
291
- removeCssRules: cssRemove,
292
- text: (str, isComment = false) => isComment ? jqx.comment(str) : document.createTextNode(str),
293
- node: (selector, root = document) => root.querySelector(selector, root),
294
- nodes: (selector, root = document) => [...root.querySelectorAll(selector, root)],
268
+ get Popup() { return popupGetter(jqx); },
295
269
  };
296
270
  }
297
271
  /* endregion functions */
298
-
299
- export {
300
- hex2RGBA,
301
- addHandlerId,
302
- isHtmlString,
303
- isNode,
304
- logTime,
305
- toDashedNotation,
306
- randomString,
307
- isArrayOfHtmlStrings,
308
- isArrayOfHtmlElements,
309
- isCommentOrTextNode,
310
- inject2DOMTree,
311
- ElemArray2HtmlString,
312
- input2Collection,
313
- setCollectionFromCssSelector,
314
- truncateHtmlStr,
315
- truncate2SingleStr,
316
- proxify,
317
- addJQxStaticMethods,
318
- createElementFromHtmlString,
319
- insertPositions,
320
- systemLog,
321
- IS,
322
- static4Docs,
323
- elems4Docs,
324
- $ as jqx,
325
- };