jqx-es 1.3.8 → 1.4.0

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.
@@ -49,10 +49,11 @@ function factoryExtensionsFactory(jqx) {
49
49
  },
50
50
  dimensions(instance) {
51
51
  if (instance.is.empty) {
52
+ systemLog.error(`[JQx instance].dimensions called on empty instance`);
52
53
  return { error: `[JQx instance].dimensions: NO ELEMENTS` };
53
54
  }
54
- let node = instance[0];
55
- const boundingRect = instance.first()?.getBoundingClientRect().toJSON();
55
+ let {node} = instance;
56
+ const boundingRect = node.getBoundingClientRect().toJSON();
56
57
  boundingRect.scrollTopDistance = findParentScrollDistance(node, 0);
57
58
  boundingRect.scrollLeftDistance = findParentScrollDistance(node, 0, false);
58
59
  return boundingRect;
@@ -107,12 +108,18 @@ function factoryExtensionsFactory(jqx) {
107
108
  Style(instance) {
108
109
  return {
109
110
  get computed() { return !instance.is.empty ? getComputedStyle(instance[0]) : {}; },
110
- inline: styleObj => instance.style(styleObj),
111
- inSheet: styleObj => instance.css(styleObj),
111
+ inline(styleObj) {
112
+ return instance.style(styleObj);
113
+ },
114
+ inSheet(styleObj) {
115
+ return instance.css(styleObj)
116
+ },
112
117
  valueOf(key) {
113
118
  return !instance.is.empty ? getComputedStyle(instance[0])[toDashedNotation(key)] : undefined;
114
119
  },
115
- nwRule: rule => instance.Style.byRule({rules: rule}),
120
+ nwRule(rule) {
121
+ return instance.Style.byRule({rules: rule})
122
+ },
116
123
  byRule({classes2Apply = [], rules = []} = {}) {
117
124
  const isSingleRule = IS(rules, String);
118
125
  const addClassNameOrID = isSingleRule && !classes2Apply.length ? rules.split(`{`)[0].trim() : ``;
@@ -235,13 +242,18 @@ function instanceExtensionsFactory(jqx) {
235
242
  },
236
243
  before,
237
244
  beforeMe: before,
238
- clear: instance => loop(instance, emptyElement),
245
+ clear(instance) { return loop(instance, emptyElement); },
239
246
  closest(instance, selector) {
240
247
  const theClosest = isNonEmptyString(selector) ? instance.node?.closest(selector) : undefined;
241
248
  return theClosest ? jqx(theClosest) : instance;
242
249
  },
243
- computedStyle: (instance, property) => instance.first() && getComputedStyle(instance.first())[property],
244
- css: (instance, keyOrKvPairs, value) => loop(instance, el => css(el, keyOrKvPairs, value, jqx)),
250
+ computedStyle(instance, property) {
251
+ const {node} = instance;
252
+ return node && getComputedStyle(node)[property];
253
+ },
254
+ css(instance, keyOrKvPairs, value) {
255
+ return loop(instance, el => css(el, keyOrKvPairs, value, jqx));
256
+ },
245
257
  duplicate(instance, toDOM = false, root = document.body) {
246
258
  switch(true) {
247
259
  case instance.is.empty:
@@ -253,10 +265,11 @@ function instanceExtensionsFactory(jqx) {
253
265
  return toDOM ? jqx(clone).toDOM(root) : jqx.virtual(clone);
254
266
  }
255
267
  },
256
- each: (instance, cb) => loop(instance, cb),
257
- empty: instance => loop(instance, emptyElement),
258
- find: (instance, selector) =>
259
- instance.collection.length > 0 ? [...instance.first()?.querySelectorAll(selector)] : [],
268
+ each(instance, cb) { return loop(instance, cb); },
269
+ empty(instance) { return loop(instance, emptyElement); },
270
+ find(instance, selector) {
271
+ return instance.collection.length > 0 ? [...instance.first()?.querySelectorAll(selector)] : [];
272
+ },
260
273
  find$(instance, selector) {
261
274
  return instance.collection.length > 0 ? jqx(selector, instance) : instance;
262
275
  },
@@ -276,7 +289,7 @@ function instanceExtensionsFactory(jqx) {
276
289
  ? false
277
290
  : classNames.find(cn => instance.node.classList.contains(cn)) && true || false;
278
291
  },
279
- hide: instance => loop(instance, el => applyStyle(el, {display: `none !important`})),
292
+ hide(instance) { return loop(instance, el => applyStyle(el, {display: `none !important`})); },
280
293
  html(instance, htmlValue, append) {
281
294
  switch(true) {
282
295
  case instance.is.empty && !isNonEmptyString(htmlValue): return "";
@@ -303,8 +316,8 @@ function instanceExtensionsFactory(jqx) {
303
316
 
304
317
  return instance;
305
318
  },
306
- isEmpty: instance => instance.collection.length < 1,
307
- nth$: (instance, indexOrSelector) => instance.single(indexOrSelector),
319
+ isEmpty(instance) { return !!!instance.node; },
320
+ nth$(instance, indexOrSelector) { return instance.single(indexOrSelector); },
308
321
  on(instance, type, ...callback) {
309
322
  switch(true) {
310
323
  case instance.is.empty || !IS(type, String, Array) || !isNonEmptyString(type) || callback.length < 1:
@@ -408,8 +421,9 @@ function instanceExtensionsFactory(jqx) {
408
421
  for (const attr of attrNames) { instance.node.removeAttribute(attr); }
409
422
  return instance;
410
423
  },
411
- removeClass: (instance, ...classNames) =>
412
- loop(instance, el => { if (el) { for (const cn of classNames) { el.classList.remove(cn); } } }),
424
+ removeClass(instance, ...classNames) {
425
+ return loop(instance, el => { if (el) { for (const cn of classNames) { el.classList.remove(cn); } } });
426
+ },
413
427
  renderTo(instance, root, position) {
414
428
  root = IS(root, HTMLElement) || root.isJQx ? root : document.body;
415
429
  position = IS(position, String) && jqx.at[position] ? position : jqx.at.end;
@@ -417,18 +431,14 @@ function instanceExtensionsFactory(jqx) {
417
431
  return instance;
418
432
  },
419
433
  replace(instance, oldChild, newChild) {
420
- const firstElem = instance[0];
434
+ const firstElem = instance.node;
421
435
 
422
- if (!oldChild || (!newChild || !IS(newChild, HTMLElement) && !newChild.isJQx)) {
423
- console.error(`JQx replace: invalid replacement value`);
436
+ if (!oldChild || (!IS(newChild, HTMLElement) && !newChild?.isJQx)) {
437
+ jqx.logger.error(`JQx replace: invalid replacement value`);
424
438
  return instance;
425
439
  }
426
440
 
427
- if (newChild.isJQx) {
428
- newChild = newChild[0];
429
- }
430
-
431
- if (IS(newChild, NodeList)) {
441
+ if (newChild.isJQx || IS(newChild, NodeList)) {
432
442
  newChild = newChild[0];
433
443
  }
434
444
 
@@ -447,12 +457,16 @@ function instanceExtensionsFactory(jqx) {
447
457
 
448
458
  return instance;
449
459
  },
450
- replaceClass: (instance, className, ...nwClassNames) => loop( instance, el => {
451
- el.classList.remove(className);
452
- for (const name of nwClassNames) { el.classList.add(name); }
453
- } ),
454
- replaceMe: (instance, newChild) => /*NODOC*/ instance.replaceWith(newChild),
455
- replaceWith: (instance, newChild) => {
460
+ replaceClass(instance, className, ...nwClassNames) {
461
+ return loop( instance, el => {
462
+ el.classList.remove(className);
463
+ for (const name of nwClassNames) { el.classList.add(name); }
464
+ } )
465
+ },
466
+ replaceMe(instance, newChild) {
467
+ /*NODOC*/ return instance.replaceWith(newChild);
468
+ },
469
+ replaceWith(instance, newChild) {
456
470
  newChild = IS(newChild, Element) ? newChild : newChild.isJQx ? newChild[0] : undefined;
457
471
 
458
472
  if (newChild) {
@@ -462,8 +476,12 @@ function instanceExtensionsFactory(jqx) {
462
476
 
463
477
  return instance;
464
478
  },
465
- setData: (instance, keyValuePairs) => loop(instance, el => setData(el, keyValuePairs)),
466
- show: instance => loop(instance, el => applyStyle(el, {display: `revert-layer !important`})),
479
+ setData(instance, keyValuePairs) {
480
+ return loop(instance, el => setData(el, keyValuePairs));
481
+ },
482
+ show(instance) {
483
+ return loop(instance, el => applyStyle(el, {display: `revert-layer !important`}));
484
+ },
467
485
  single(instance, indexOrSelector) {
468
486
  const hasNodes = instance.collection.length > 0;
469
487
  indexOrSelector = indexOrSelector ?? 0;
@@ -498,8 +516,12 @@ function instanceExtensionsFactory(jqx) {
498
516
  inject2DOMTree(instance.collection, root, position);
499
517
  return instance;
500
518
  },
501
- toggleClass: (instance, className) => loop(instance, el => el.classList.toggle(className)),
502
- toNodeList: instance => [...instance.collection].map(el => document.importNode(el, true)),
519
+ toggleClass(instance, className) {
520
+ return loop(instance, el => el.classList.toggle(className));
521
+ },
522
+ toNodeList(instance) {
523
+ return [...instance.collection].map(el => document.importNode(el, true));
524
+ },
503
525
  trigger(instance, evtType, SpecifiedEvent, options) {
504
526
  SpecifiedEvent = /Event\]$/.test(IS(SpecifiedEvent)) ? SpecifiedEvent : Event;
505
527
  options = IS(options, Object) ? { ...options, bubbles: options.bubbles??true} : {bubbles: true};
@@ -515,7 +537,7 @@ function instanceExtensionsFactory(jqx) {
515
537
  switch(true) {
516
538
  case instance.is.empty || !IS(instance.node, HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement):
517
539
  return instance;
518
- case !!newValue && isNonEmptyString(instance.node.value):
540
+ case !IS(newValue, String):
519
541
  return instance.node.value;
520
542
  default:
521
543
  instance.node.value = !IS(newValue, String) ? "" : newValue;
@@ -1,11 +0,0 @@
1
- function d(t,...e){let n=typeof t=="symbol"?Symbol("any"):t;return e.length>1?L(n,...e):P(n,...e)}function P(t,...e){let{compareWith:n,inputIsNothing:o,shouldBeIsNothing:r,inputCTOR:a,is_NAN:c}=j(t,...e);return c&&n?(n=S({trial:l=>String(n),whenError:l=>""}),n===String(t)||e===Number):o||r?r?String(t)===String(n):n?!1:`${t}`:a===Boolean?n?a===n:"Boolean":M(t,n,I(t,a))}function I(t,e){return t===0?Number:t===""?String:t?e:{name:String(t)}}function j(t,...e){let n=e.length>0,o=n&&e.shift(),r=_(t),a=n&&_(o),c=!r&&Object.getPrototypeOf(t)?.constructor,l=S({trial:i=>String(t),whenError:i=>""})==="NaN";return{compareWith:o,inputIsNothing:r,shouldBeIsNothing:a,inputCTOR:c,is_NAN:l}}function M(t,e,n){return S({trial:o=>String(e),whenError:o=>"-"})==="NaN"?String(t)==="NaN":e?S({trial:o=>t instanceof e,whenError:o=>!1})||e===n||e===Object.getPrototypeOf(n)||`${e?.name}`===n?.name:n?.name}function L(t,...e){for(let n of e)if(d(t,n))return!0;return!1}function _(t){return S({trial:e=>/^(undefined|null)$/.test(String(t)),whenError:e=>!1})}function S({trial:t,whenError:e=n=>console.log(n)}={}){if(!t||!(t instanceof Function))return console.info("TypeofAnything {maybe}: trial parameter not a Function or Lambda"),!1;try{return t()}catch(n){return e(n)}}function H({IS:t,tryJSON:e,contractsPrefix:n}={}){return n=n&&`${n}
2
- `||"",{EN:{unknownOrNa:"unknown or n/a",unknown:"unknown",nameOkExpected:"The contract to add needs a name (String)",isMethodExpected:"The contract to add needs a method (Function)",expectedOkExpected:"The contract to add needs an expected value method (String|Function)",addContracts_Contract_Expected:"the parameter for [addContracts] should be at least { [contractName]: { method: Function, expected: String|Function } }",addContract_Contract_Expected:`addContract parameters should at least be {name, method, expected}
3
- (when method is a named function, the name was derived from that)`,report_sorry:(o,r)=>`\u2718 ${n}Contract violation for contract [${o}], input ${r}`,report_forValue:o=>`${o}`,report_Expected:o=>`
4
- ${o}`,report_defaultValue:(o,r)=>o?"":`
5
- Using the contract default value (${t(r,Function)?r.toString():t(r,String)?`"${r}"`:e(r)}) instead`},NL:{unknownOrNa:"onbekend of nvt",unknown:"onbekend",nameOkExpected:"Het contract moet een naam hebben (eigenschap name: String)",isMethodExpected:"Het contract moet kunnen worden uitgevoerd (eigenschap method: Function)",expectedOkExpected:"Het contract moet aangeven wat er wordt verwacht (eigenschap expected: String|Function)",addContracts_Contract_Expected:"De parameter for [addContracts] moet tenminste { [contractName]: { method: Function, expected: String|Function } } zijn",addContract_Contract_Expected:`De invoer vooor [addContract] moet tenminste {name, method, expected} zijn
6
- (wanneer de eigenschap [method] een functie met naam was wordt [name] daarvan afgeleid)`,report_sorry:(o,r)=>`\u2718 ${n} Contractbreuk voor contract [${o}], input ${r}`,report_forValue:o=>`${o}`,report_Expected:o=>`
7
- ${o}`,report_defaultValue:(o,r)=>o?"":`
8
- In plaats daarvan wordt de voor dit contract toegekende standaardwaarde (${t(r,Function)?r.toString():t(r,String)?`"${r}"`:e(r)}) gebruikt`}}}var s,F=z,v=q(),A=J();function z(t){l(t);let{reporter:e,logViolations:n,alwaysThrow:o,language:r,contractsPrefix:a}=t;s=H({IS:d,tryJSON:N,contractsPrefix:a})[r];let c={addContract:b,addContracts:i};return U(c),Object.freeze({contracts:c,IS:d,tryJSON:N});function l(u){u.reporter=u.reporter||E,u.logViolations=u.logViolations||!1,u.alwaysThrow=u.alwaysThrow||!1,u.language=u.language||"EN"}function i(u){if(!c.addContracts_Contract(u))return;let m=Object.entries(u);for(let[p,h]of m)b({...h,paramsChecked:!0,name:p})}function b(u=v.addContract){let{name:m,method:p,expected:h,defaultValue:y,customReport:g,reportFn:O,shouldThrow:V,reportViolationsByDefault:w,paramsChecked:x}=u;m=m||p?.name;let B=c.addContract_Contract||A.checkSingleContractParameters;if(!x&&!B({name:m,method:p,expected:h}))return;let D=W({name:m,method:p,expected:h,defaultValue:y,reporter:e,reportFn:O,customReport:g,reportViolationsByDefault:w,logViolations:n,shouldThrow:V,alwaysThrow:o});return Object.defineProperty(c,m,{value:D,enumerable:!0})}}function W(t=v.createContract){let{name:e,method:n,expected:o,defaultValue:r,customReport:a,reportFn:c,reporter:l,logViolations:i,shouldThrow:b,reportViolationsByDefault:u,alwaysThrow:m}=t;return function(p,...h){let y=n(p,...h),g=d(h[0],Object)&&{...h[0],value:p}||{value:p};if(c=c??l??E,d(a,Function)&&a(g),$(y)){let O=d(o,Function)?o(g):o;y=!$(g.defaultValue)||r?g.defaultValue||r:y;let[V,w]=[g.reportViolation??u,g.shouldThrow??b];if(V||w||i){let x=K({inputValue:p,defaultValue:y,shouldBe:O,fnName:e||n.name});if(w||m)throw new TypeError(x);l(x)}}return y}}function q(){let[t,e,n,o,r,a,c]=[...Array(7)];return{get reportViolations(){return{inputValue:c,defaultValue:o,shouldBe:s.unknowOrNa,fnName:s.unknown}},get createContract(){return{name:t,method:e,expected:n,defaultValue:o,customReport:r,reportFn:a,reporter:E,logViolations:!1,shouldThrow:!1,alwaysThrow:!1,reportViolationsByDefault:!1}},get addContract(){return{name:t,method:e,expected:n,defaultValue:o,customReport:r,reportFn:a,reporter:E,shouldThrow:!1,reportViolationsByDefault:!1,paramsChecked:!1}}}}function J(){let t=o=>d(o,String)&&o.trim().length,e=o=>d(o,String)&&o.length||d(o,Function),n=o=>d(o,Function);return{nameOk:t,expectedOk:e,isMethod:n,checkSingleContractParameters:({name:o,method:r,expected:a}={})=>o&&t(o)&&r&&n(r)&&a&&e(a)}}function U(t){let{nameOk:e,expectedOk:n,isMethod:o,checkSingleContractParameters:r}=A;t.addContract({method:e,expected:s.nameOkExpected,reportViolationsByDefault:!0}),t.addContract({method:o,expected:s.isMethodExpected,reportViolationsByDefault:!0}),t.addContract({method:n,expected:s.expectedOkExpected,reportViolationsByDefault:!0}),t.addContract({name:"addContracts_Contract",method:a=>d(a,Object)&&[...Object.entries(a)].filter(([,c])=>c.method&&o(c.method)&&c.expected&&n(c.expected)).length>0?a:void 0,expected:s.addContracts_Contract_Expected,reportViolationsByDefault:!0}),t.addContract({name:"addContract_Contract",method:r,expected:s.addContract_Contract_Expected,reportViolationsByDefault:!0})}function K(t=v.reportViolations){let{inputValue:e,defaultValue:n,shouldBe:o,fnName:r}=t,a=s.report_sorry(r,G(e)),c=s.report_forValue(a),l=s.report_Expected(o),i=s.report_defaultValue($(n),n);return Q(`${c}${l}${i}`)}function Q(t,e=3){return t.replace(/\n/g,`
9
- ${" ".repeat(e)}`)}function $(t){return d(t,void 0,null,NaN)}function N(t){return X(()=>{let e=JSON.stringify(t);return/Infinity|NaN/.test(e)?e.replace(/"/g,""):e},t)}function G(t){let e=n=>d(n,String)?`"${n}"`:d(n,Object)?N(n):String(n);return d(t,String)?`"${t}"`:d(t,Object)?N(t):/Array\(/.test(t?.constructor.toString())?`[${[...t].map(e)}]`:String(t)}function E(t){console.info(t)}function X(t,e){try{return t()}catch(n){return console.error({isOk:n.name===expected,message:n.message,type:n.name}),e}}var{contracts:k,IS:f,tryJSON:Y}=F({contractsPrefix:"[Web Component creator module]"});Z();function Z(){k.addContracts({componentName:{method:tt,reportViolationsByDefault:!0,expected({customElementName:e}={}){return[`createComponent componentName: '${e??"*no name given*"}' is not a valid custom element name!`,"See https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name"].join(`
10
- `)}},attrChange:{method:t,defaultValue:{attributes:[],method:function(){}},expected:"onAttrChange expected {attributes: Array, method: Function}"}});function t(e){let n=f(e,Object)&&r(e?.attributes)&&f(e?.method,Function);return e&&!n&&o(),n?e:void 0;function o(){let a=f(e?.method,Function)?"Function ok":"nothing or not a Function";console.log(["\u2718 [Web Component creator module]","createComponent onAttrChange: contract for parameters violated",`Input: { attributes: ${Y(e?.attributes)}, method: ${a} }`,"Input expected: nothing or { attributes: Array[string], method: Function({input}) {...} }","Will use default: { attributes: [], method: () => {} }"].join(`
11
- `))}function r(a){return f(a,Array)&&a.filter(c=>f(c,String)&&!/\s/g.test(c)).length===a.length&&a||void 0}}}function tt(t){let e=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return f(t,String)&&/\-{1,}/.test(t)&&t.toLowerCase()===t&&!e.find(n=>n===t)&&t||void 0}var T={};["a","area","audio","br","base","body","button","canvas","dl","data","datalist","div","em","fieldset","font","footer","form","hr","head","header","output","iframe","frameset","img","input","li","label","legend","link","map","mark","menu","media","meta","nav","meter","ol","object","optgroup","option","p","param","picture","pre","progress","quote","script","select","source","span","style","caption","td","col","table","tr","template","textarea","time","title","track","details","ul","video","del","ins","slot","blockquote","svg","dialog","summary","main","address","colgroup","tbody","tfoot","thead","th","dd","dt","figcaption","figure","i","b","code","h1","h2","h3","h4","abbr","bdo","dfn","kbd","q","rb","rp","rt","ruby","s","strike","samp","small","strong","sup","sub","u","var","wbr","nobr","tt","noscript"].forEach(t=>{Object.defineProperty(T,t,{get(){if(!t)return;let e=document.createElement(t)?.constructor;return e!==HTMLUnknownElement?e:void 0}})});var R=Object.freeze(T);var C=ut();function ht(t){t=rt(t);let{componentName:e}=t;if(k.componentName(e)&&!customElements.get(e)){let n=t.extends?.toLowerCase()?.trim(),o=R[n]??HTMLElement,r=et({forElem:o});ot(r,t),!C.clientOnly&&C.report(`[factory] Registered component "${e}"`),customElements.define(e,r,{extends:n})}}function et({forElem:t}={}){let e=t;return function n(){return n.prototype=e.prototype,nt(n),Reflect.construct(e,[],n)}}function nt(t){if(!t.prototype.setComponentState){let e={},n=o=>o.hasAttribute("is")||/-/.test(o.tagName);Object.defineProperties(t.prototype,{myName:{get:function(){return it(this)}},state:{get:function(){return n(this)&&e[this.myName]||{}}},nth:{value:function(o){return f(o,Number,void 0)&&at(this,o)||void 0}},instanceNr:{get(){return n(this)&&getInstancePositionInDom(this)}},setComponentState:{value:function(o){if(n(this)){let r=this.myName;Object.entries(o).forEach(([a,c])=>{e[r]=e[r]??{component:this.myName},e[r][a]=c})}}}})}}function ot(t,e){let{onConnect:n,onDisconnect:o,onAdopted:r,onAttrChange:a}=e,[c,l]=[a.attributes,a.method];t.observedAttributes=c,t.prototype={connectedCallback:function(){let i=this;return!C.clientOnly&&C.report(`[factory] (Re)connected an instance of &lt;${i.myName}>`),i.shadowRoot?.isConnected?!0:n(i)},disconnectedCallback(){let i=this;!C.clientOnly&&C.report(`[factory] Removed an instance of &lt;${i.myName}>`),o(i)},adoptedCallback(){return r(this)},attributeChangedCallback(i,b,u){if(c.length)return c.find(m=>m===i)&&l(this,i,b,u),!0}}}function rt(t){t.onAttrChange=k.attrChange(t.onAttrChange);let e=function(){};return t.onConnect=t.onConnect??e,t.onDisconnect=t.onDisconnect??e,t.onAdopted=t.onAdopted??e,t}function at(t,e=1){return[...t.getRootNode().querySelectorAll(t.myName)].find((n,o)=>e===o+1)}function ct(){let t=new Date;return[t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()].reduce((e,n,o)=>`${e}${o<3?":":"."}${`${n}`.padStart(o<3?2:3,"0")}`,"").slice(1)}function it(t){let e=t.getAttribute("is");return`${t.tagName.toLowerCase()}${e?`[is='${e}']`:""}`}function gt(t,e={mode:"open"}){let n=t.shadowRoot;return n||t.attachShadow(e)}function yt(t,e){if(t.state.styling)return t.state.styling;e=e.startsWith("#")?document.querySelector(e).content.querySelector("style").textContent:e,C.report(`[client] Storing embedded style for &lt;${t.myName}>`);let n=new CSSStyleSheet;return n.replaceSync(e),t.setComponentState({styling:n}),t.state.styling}function ut(){let t={"&lt;":"<","&gt;":">"},e=!1,n=function(c){console.info(`\u2714 ${c.replaceAll(/&lt;|&gt;/g,l=>t[l])}`)},o=n,r=function(){},a=!1;return{on(){e=!0},off(){e=!1},get now(){return ct},set clientOnly(c){a=f(c,Boolean)&&c||!1},get clientOnly(){return a},set report(c){o=c||n},get report(){return e&&o||r}}}export{gt as createOrRetrieveShadowRoot,ht as default,C as reporter,yt as setComponentStyleFor};
@@ -1,85 +0,0 @@
1
- import { isNonEmptyString } from "./Utilities.js";
2
- const handlerStore = {};
3
- const shouldCaptureEventTypes = [
4
- `load`, `unload`, `scroll`, `focus`, `blur`, `DOMNodeRemovedFromDocument`,
5
- `DOMNodeInsertedIntoDocument`, `loadstart`, `progress`, `error`, `abort`,
6
- `load`, `loadend`, `pointerenter`, `pointerleave`, `readystatechange`];
7
- const getCapture = eventType => !!(shouldCaptureEventTypes.find(t => t === eventType));
8
- export { handlerStore as listeners, HandleFactory as default };
9
-
10
- function HandleFactory(jqx) {
11
- return function(spec) {
12
- let {eventType, selector, callback, name, capture, once, canRemove} = spec;
13
-
14
- switch(true) {
15
- case !isNonEmptyString(eventType) || !jqx.IS(callback, Function):
16
- default:
17
- name = name || (!/handlers$/.test(callback.name) && callback.name) || undefined;
18
- capture = jqx.IS(capture, Boolean) ? capture : false;
19
- once = jqx.IS(once, Boolean) ? once : false;
20
- canRemove = isNonEmptyString(name, 4) && jqx.IS(canRemove, Boolean) ? canRemove : once;
21
- const { handler, signal, remove } = wrapHandlerFunction({selector, callback, canRemove, once, name, eventType});
22
- return addAndStoreListener({eventType, handler, capture, once, signal, remove, name});
23
- }
24
- };
25
-
26
- function wrapHandlerFunction(spec) {
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
- const listener = !selector
31
- ? { handler: evt => callback(evt, evt.target, remove), remove}
32
- : { handler: evt => {
33
- const target = evt.target?.closest?.(selector);
34
- return target && callback(evt, jqx(target), remove);
35
- },
36
- remove
37
- };
38
-
39
- if (abortcontroller) {
40
- listener.signal = abortcontroller.signal;
41
- if (once) {
42
- return {
43
- handler: (evt, me) => {
44
- listener.handler(evt, me);
45
- remove();
46
- }
47
- }
48
- }
49
- }
50
-
51
- return listener;
52
- }
53
-
54
- function removeHandlerFactory(spec) {
55
- const {once, abortcontroller, name, eventType} = spec;
56
- return !name
57
- ? function() { jqx.logger.error(`JQx: an anonymous listener can not be removed`); }
58
- : !abortcontroller
59
- ? function(evt) {
60
- jqx.logger.error(`JQx: listener for event type [${eventType}] with name [${
61
- name}] is not marked as removable`);
62
- }
63
- : function removeHandler() {
64
- abortcontroller.abort();
65
- const toRemove = [...handlerStore[eventType].entries()].find(([k, v]) => v.name === name);
66
- handlerStore[eventType].delete(toRemove[0]);
67
- jqx.logger.log(`JQx: Listener for event type [${eventType}] with name [${
68
- name}] was removed${once ? ` (once active, so handled once).` : ``}`);
69
- }
70
- }
71
-
72
- function addAndStoreListener(spec) {
73
- const {eventType, handler, capture, once, signal, remove, name} = spec;
74
- if (!handlerStore[eventType]) { handlerStore[eventType] = new Map(); }
75
- const delegateExists = handlerStore[eventType].has(handler) ||
76
- [...handlerStore[eventType].values()].find(h => (h.name || ``) === name);
77
- if (!delegateExists) {
78
- const opts = {capture: capture || getCapture(eventType), once: once || false};
79
- if (signal) { opts.signal = signal; }
80
- document.addEventListener(eventType, handler, opts);
81
- const stored = { name, remove, capture: capture || getCapture(eventType), }
82
- handlerStore[eventType].set(handler, stored);
83
- }
84
- }
85
- }
@@ -1,40 +0,0 @@
1
- :host {
2
- color: #555;
3
- display: inline-block;
4
- position: fixed;
5
- background-color: #fff;
6
- top: 0;
7
- left: 50%;
8
- transform: translateX(-50%);
9
- z-index: 2;
10
- border-radius: 4px;
11
- padding: 2px 0;
12
- width: 100vw;
13
- text-align: center;
14
- box-shadow: 0 2px 14px #999;
15
- }
16
-
17
- ::slotted(span.yr) {
18
- font-weight: bold;
19
- color: green;
20
- }
21
-
22
- ::slotted(a[target]) {
23
- text-decoration: none;
24
- font-weight: bold;
25
- }
26
-
27
- ::slotted(a[target]):before {
28
- color: rgba(0, 0, 238, 0.7);
29
- font-size: 1.1rem;
30
- padding-right: 2px;
31
- vertical-align: baseline;
32
- }
33
-
34
- ::slotted(a[target]):after {
35
- content: ' | ';
36
- color: #000;
37
- font-weight: normal;
38
- }
39
-
40
- ::slotted(a[target]:last-child):after { content: ''; margin-right: 2rem; }
@@ -1,31 +0,0 @@
1
- /*! `css` grammar compiled for Highlight.js 11.11.1 */
2
- (()=>{var e=(()=>{"use strict"
3
- ;const e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],i=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),t=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),o=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),r=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse()
4
- ;return n=>{const a=n.regex,l=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},
5
- BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",
6
- begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{
7
- className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{
8
- scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",
9
- contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{
10
- scope:"number",
11
- begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
12
- relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}
13
- }))(n),s=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",
14
- case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},
15
- classNameAliases:{keyframePosition:"selector-tag"},contains:[l.BLOCK_COMMENT,{
16
- begin:/-(webkit|moz|ms|o)-(?=[a-z])/},l.CSS_NUMBER_MODE,{
17
- className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{
18
- className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0
19
- },l.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{
20
- begin:":("+t.join("|")+")"},{begin:":(:)?("+o.join("|")+")"}]},l.CSS_VARIABLE,{
21
- className:"attribute",begin:"\\b("+r.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,
22
- contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...s,{
23
- begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"
24
- },contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,
25
- excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]",
26
- relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/
27
- },{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{
28
- $pattern:/[a-z-]+/,keyword:"and or not only",attribute:i.join(" ")},contains:[{
29
- begin:/[a-z-]+(?=:)/,className:"attribute"},...s,l.CSS_NUMBER_MODE]}]},{
30
- className:"selector-tag",begin:"\\b("+e.join("|")+")\\b"}]}}})()
31
- ;hljs.registerLanguage("css",e)})();