shadow-dom-selector 6.0.0 → 6.1.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.
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- function t(t,n,e,o){return new(e||(e=Promise))(function(r,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function l(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(s,l)}u((o=o.apply(t,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n="$",e=":host",o="invalid selector",r=10,i=10;var s=function(t,n,e){var o;void 0===e&&(e={});var r=e.retries,i=void 0===r?10:r,s=e.delay,l=void 0===s?10:s,u=e.shouldReject,c=void 0===u||u,a=null!==(o=e.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise(function(e,o){var r=0,s=function(){var u=t();n(u)?e(u):++r<i?setTimeout(s,l):c?o(new Error(a.replace(/\{\{\s*retries\s*\}\}/g,"".concat(i)))):e(u)};s()})};const l=t=>{const[n,e]=t;return!!(o=n)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof e;var o};function u(t,e){return function(t){return t.split(",").map(t=>t.trim())}(t).map(t=>{const o=function(t){return t.split(n).map(t=>t.trim())}(t);return e(o)})}function c(t,e){return`${t} cannot be used with a selector ending in a shadowRoot (${n}).${e?` If you want to select a shadowRoot, use ${e} instead.`:""}`}function a(t){return t instanceof Promise?t:Promise.resolve(t)}function d(){return`You can not select a shadowRoot (${n}) of the document.`}function f(){return`You can not select a shadowRoot (${n}) of a shadowRoot.`}function h(t,n){var o,r;let i=null;const s=t.length;for(let l=0;l<s;l++){if(0===l)if(t[l].length)i=n.querySelector(t[l]);else{if(n instanceof Document)throw new SyntaxError(d());if(n instanceof ShadowRoot)throw new SyntaxError(f());i=(null===(o=n.shadowRoot)||void 0===o?void 0:o.querySelector(t[++l]))||null}else i=(null===(r=i.shadowRoot)||void 0===r?void 0:r.querySelector(`${e} ${t[l]}`))||null;if(null===i)return null}return i}function y(t,n){var o;const r=[...t],i=r.pop();if(!r.length)return n.querySelectorAll(i);const s=h(r,n);return(null===(o=null==s?void 0:s.shadowRoot)||void 0===o?void 0:o.querySelectorAll(`${e} ${i}`))||null}function v(t,n){if(1===t.length&&!t[0].length){if(n instanceof Document)throw new SyntaxError(d());if(n instanceof ShadowRoot)throw new SyntaxError(f());return n.shadowRoot}const e=h(t,n);return(null==e?void 0:e.shadowRoot)||null}function m(t,n,e="querySelector",o="shadowRootQuerySelector"){const r=u(t,t=>{if(!t[t.length-1].length)throw new SyntaxError(c(e,o));return t}),i=r.length;for(let t=0;t<i;t++){const e=h(r[t],n);if(e)return e}return null}function w(t,n,e="querySelectorAll"){const r=u(t,t=>{if(!t[t.length-1].length)throw new SyntaxError(c(e));return t}),i=r.length;for(let t=0;t<i;t++){const e=y(r[t],n);if(null==e?void 0:e.length)return e}return document.querySelectorAll(o)}function g(t,e,o="shadowRootQuerySelector",r="querySelector"){const i=u(t,t=>{if(t.pop().length)throw new SyntaxError(function(t,e){return`${t} must be used with a selector ending in a shadowRoot (${n}). If you don't want to select a shadowRoot, use ${e} instead.`}(o,r));return t}),s=i.length;for(let t=0;t<s;t++){const n=v(i[t],e);if(n)return n}return null}function S(n,e,o,r){return t(this,void 0,void 0,function*(){return s(()=>m(n,e,"asyncQuerySelector","asyncShadowRootQuerySelector"),t=>!!t,{retries:o,delay:r,shouldReject:!1})})}function R(n,e,o,r){return t(this,void 0,void 0,function*(){return s(()=>w(n,e,"asyncQuerySelectorAll"),t=>!!t.length,{retries:o,delay:r,shouldReject:!1})})}function p(n,e,o,r){return t(this,void 0,void 0,function*(){return s(()=>g(n,e,"asyncShadowRootQuerySelector","asyncQuerySelector"),t=>!!t,{retries:o,delay:r,shouldReject:!1})})}const _=(t,n)=>{const e=t.querySelectorAll(n);if(e.length)return e;if(t instanceof Element&&t.shadowRoot){const e=_(t.shadowRoot,n);if(e.length)return e}const r=Array.from(t.querySelectorAll("*"));for(const t of r){const e=_(t,n);if(e.length)return e}return document.querySelectorAll(o)},P=(t,n,e,o)=>s(()=>_(t,n),t=>!!t.length,{retries:e,delay:o,shouldReject:!1});function q(...t){const[n,e]=t;return"string"==typeof n?m(n,document):m(e,n)}function $(...t){const[n,e]=t;return"string"==typeof n?_(document,n)[0]||null:_(n,e)[0]||null}function E(...t){const[n,e]=t;return"string"==typeof n?w(n,document):w(e,n)}function A(...t){const[n,e]=t;return"string"==typeof n?_(document,n):_(n,e)}function x(...t){const[n,e]=t;return"string"==typeof n?g(n,document):g(e,n)}function N(...n){return t(this,void 0,void 0,function*(){if(l(n)){const[t,e,o]=n;return yield S(e,t,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||i)}const[t,e]=n;return yield S(t,document,(null==e?void 0:e.retries)||r,(null==e?void 0:e.delay)||i)})}function L(...n){return t(this,void 0,void 0,function*(){if(l(n)){const[t,e,o]=n;return(yield P(t,e,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||i))[0]||null}const[t,e]=n;return(yield P(document,t,(null==e?void 0:e.retries)||r,(null==e?void 0:e.delay)||i))[0]||null})}function j(...n){return t(this,void 0,void 0,function*(){if(l(n)){const[t,e,o]=n;return yield R(e,t,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||i)}const[t,e]=n;return R(t,document,(null==e?void 0:e.retries)||r,(null==e?void 0:e.delay)||i)})}function Q(...t){if(l(t)){const[n,e,o]=t;return P(n,e,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||i)}const[n,e]=t;return P(document,n,(null==e?void 0:e.retries)||r,(null==e?void 0:e.delay)||i)}function b(...n){return t(this,void 0,void 0,function*(){if(l(n)){const[t,e,o]=n;return yield p(e,t,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||i)}const[t,e]=n;return p(t,document,(null==e?void 0:e.retries)||r,(null==e?void 0:e.delay)||i)})}class D{constructor(t,n){t instanceof Node||t instanceof Promise?(this._element=t,this._asyncParams=Object.assign({retries:r,delay:i},n||{})):(this._element=document,this._asyncParams=Object.assign({retries:r,delay:i},t||{}))}get element(){return a(this._element).then(t=>t instanceof NodeList?t[0]||null:t)}get $(){const t=a(this._element).then(t=>t instanceof Document||t instanceof ShadowRoot||null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?b(t[0],n,this._asyncParams):b(t,n,this._asyncParams));return new D(t,this._asyncParams)}get all(){return a(this._element).then(t=>t instanceof NodeList?t:document.querySelectorAll(o))}get asyncParams(){return this._asyncParams}eq(n){return t(this,void 0,void 0,function*(){return a(this._element).then(t=>t instanceof NodeList&&t[n]||null)})}query(t){const n=a(this._element).then(n=>null===n||n instanceof NodeList&&0===n.length?null:n instanceof NodeList?j(n[0],t,this._asyncParams):j(n,t,this._asyncParams));return new D(n,this._asyncParams)}deepQuery(t){const n=a(this._element).then(n=>null===n||n instanceof NodeList&&0===n.length?null:n instanceof NodeList?Promise.race(Array.from(n).map(n=>P(n,t,this._asyncParams.retries,this._asyncParams.delay))):P(n,t,this._asyncParams.retries,this._asyncParams.delay));return new D(n,this._asyncParams)}}export{D as AsyncSelector,L as asyncDeepQuerySelector,Q as asyncDeepQuerySelectorAll,N as asyncQuerySelector,j as asyncQuerySelectorAll,b as asyncShadowRootQuerySelector,$ as deepQuerySelector,A as deepQuerySelectorAll,q as querySelector,E as querySelectorAll,x as shadowRootQuerySelector};
1
+ import{getPromisableResult as n}from"get-promisable-result";function t(n,t,e,o){return new(e||(e=Promise))(function(r,i){function l(n){try{u(o.next(n))}catch(n){i(n)}}function s(n){try{u(o.throw(n))}catch(n){i(n)}}function u(n){var t;n.done?r(n.value):(t=n.value,t instanceof e?t:new e(function(n){n(t)})).then(l,s)}u((o=o.apply(n,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const e="$",o=":host",r="invalid selector",i=10,l=10,s=n=>{const[t,e]=n;return!!(o=t)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof e;var o};function u(n,t){return function(n){return n.split(",").map(n=>n.trim())}(n).map(n=>{const o=function(n){return n.split(e).map(n=>n.trim())}(n);return t(o)})}function c(n,t){return`${n} cannot be used with a selector ending in a shadowRoot (${e}).${t?` If you want to select a shadowRoot, use ${t} instead.`:""}`}function a(n){return n instanceof Promise?n:Promise.resolve(n)}function d(){return`You can not select a shadowRoot (${e}) of the document.`}function f(){return`You can not select a shadowRoot (${e}) of a shadowRoot.`}function h(n,t){var e,r;let i=null;const l=n.length;for(let s=0;s<l;s++){if(0===s)if(n[s].length)i=t.querySelector(n[s]);else{if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());i=(null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(n[++s]))||null}else i=(null===(r=i.shadowRoot)||void 0===r?void 0:r.querySelector(`${o} ${n[s]}`))||null;if(null===i)return null}return i}function y(n,t){var e;const r=[...n],i=r.pop();if(!r.length)return t.querySelectorAll(i);const l=h(r,t);return(null===(e=null==l?void 0:l.shadowRoot)||void 0===e?void 0:e.querySelectorAll(`${o} ${i}`))||null}function m(n,t){if(1===n.length&&!n[0].length){if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());return t.shadowRoot}const e=h(n,t);return(null==e?void 0:e.shadowRoot)||null}function v(n,t,e="querySelector",o="shadowRootQuerySelector"){const r=u(n,n=>{if(!n[n.length-1].length)throw new SyntaxError(c(e,o));return n}),i=r.length;for(let n=0;n<i;n++){const e=h(r[n],t);if(e)return e}return null}function w(n,t,e="querySelectorAll"){const o=u(n,n=>{if(!n[n.length-1].length)throw new SyntaxError(c(e));return n}),i=o.length;for(let n=0;n<i;n++){const e=y(o[n],t);if(null==e?void 0:e.length)return e}return document.querySelectorAll(r)}function g(n,t,o="shadowRootQuerySelector",r="querySelector"){const i=u(n,n=>{if(n.pop().length)throw new SyntaxError(function(n,t){return`${n} must be used with a selector ending in a shadowRoot (${e}). If you don't want to select a shadowRoot, use ${t} instead.`}(o,r));return n}),l=i.length;for(let n=0;n<l;n++){const e=m(i[n],t);if(e)return e}return null}function S(e,o,r,i){return t(this,void 0,void 0,function*(){return n(()=>v(e,o,"asyncQuerySelector","asyncShadowRootQuerySelector"),n=>!!n,{retries:r,delay:i,shouldReject:!1})})}function p(e,o,r,i){return t(this,void 0,void 0,function*(){return n(()=>w(e,o,"asyncQuerySelectorAll"),n=>!!n.length,{retries:r,delay:i,shouldReject:!1})})}function R(e,o,r,i){return t(this,void 0,void 0,function*(){return n(()=>g(e,o,"asyncShadowRootQuerySelector","asyncQuerySelector"),n=>!!n,{retries:r,delay:i,shouldReject:!1})})}const _=(n,t)=>{const e=n.querySelectorAll(t);if(e.length)return e;if(n instanceof Element&&n.shadowRoot){const e=_(n.shadowRoot,t);if(e.length)return e}const o=Array.from(n.querySelectorAll("*"));for(const n of o){const e=_(n,t);if(e.length)return e}return document.querySelectorAll(r)},P=(t,e,o,r)=>n(()=>_(t,e),n=>!!n.length,{retries:o,delay:r,shouldReject:!1});function q(...n){const[t,e]=n;return"string"==typeof t?v(t,document):v(e,t)}function $(...n){const[t,e]=n;return"string"==typeof t?_(document,t)[0]||null:_(t,e)[0]||null}function A(...n){const[t,e]=n;return"string"==typeof t?w(t,document):w(e,t)}function E(...n){const[t,e]=n;return"string"==typeof t?_(document,t):_(t,e)}function x(...n){const[t,e]=n;return"string"==typeof t?g(t,document):g(e,t)}function N(...n){return t(this,void 0,void 0,function*(){if(s(n)){const[t,e,o]=n;return yield S(e,t,(null==o?void 0:o.retries)||i,(null==o?void 0:o.delay)||l)}const[t,e]=n;return yield S(t,document,(null==e?void 0:e.retries)||i,(null==e?void 0:e.delay)||l)})}function L(...n){return t(this,void 0,void 0,function*(){if(s(n)){const[t,e,o]=n;return(yield P(t,e,(null==o?void 0:o.retries)||i,(null==o?void 0:o.delay)||l))[0]||null}const[t,e]=n;return(yield P(document,t,(null==e?void 0:e.retries)||i,(null==e?void 0:e.delay)||l))[0]||null})}function Q(...n){return t(this,void 0,void 0,function*(){if(s(n)){const[t,e,o]=n;return yield p(e,t,(null==o?void 0:o.retries)||i,(null==o?void 0:o.delay)||l)}const[t,e]=n;return p(t,document,(null==e?void 0:e.retries)||i,(null==e?void 0:e.delay)||l)})}function j(...n){if(s(n)){const[t,e,o]=n;return P(t,e,(null==o?void 0:o.retries)||i,(null==o?void 0:o.delay)||l)}const[t,e]=n;return P(document,t,(null==e?void 0:e.retries)||i,(null==e?void 0:e.delay)||l)}function b(...n){return t(this,void 0,void 0,function*(){if(s(n)){const[t,e,o]=n;return yield R(e,t,(null==o?void 0:o.retries)||i,(null==o?void 0:o.delay)||l)}const[t,e]=n;return R(t,document,(null==e?void 0:e.retries)||i,(null==e?void 0:e.delay)||l)})}class D{constructor(n,t){n instanceof Node||n instanceof Promise?(this._element=n,this._asyncParams=Object.assign({retries:i,delay:l},t||{})):(this._element=document,this._asyncParams=Object.assign({retries:i,delay:l},n||{}))}get element(){return a(this._element).then(n=>n instanceof NodeList?n[0]||null:n)}get $(){const n=a(this._element).then(n=>n instanceof Document||n instanceof ShadowRoot||null===n||n instanceof NodeList&&0===n.length?null:n instanceof NodeList?b(n[0],e,this._asyncParams):b(n,e,this._asyncParams));return new D(n,this._asyncParams)}get all(){return a(this._element).then(n=>n instanceof NodeList?n:document.querySelectorAll(r))}get asyncParams(){return this._asyncParams}eq(n){return t(this,void 0,void 0,function*(){return a(this._element).then(t=>t instanceof NodeList&&t[n]||null)})}query(n){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Q(t[0],n,this._asyncParams):Q(t,n,this._asyncParams));return new D(t,this._asyncParams)}deepQuery(n){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map(t=>P(t,n,this._asyncParams.retries,this._asyncParams.delay))):P(t,n,this._asyncParams.retries,this._asyncParams.delay));return new D(t,this._asyncParams)}}export{D as AsyncSelector,L as asyncDeepQuerySelector,j as asyncDeepQuerySelectorAll,N as asyncQuerySelector,Q as asyncQuerySelectorAll,b as asyncShadowRootQuerySelector,$ as deepQuerySelector,E as deepQuerySelectorAll,q as querySelector,A as querySelectorAll,x as shadowRootQuerySelector};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";function e(e,t,n,o){return new(n||(n=Promise))(function(r,s){function l(e){try{u(o.next(e))}catch(e){s(e)}}function i(e){try{u(o.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,i)}u((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t="$",n=":host",o="invalid selector",r=10,s=10;var l=function(e,t,n){var o;void 0===n&&(n={});var r=n.retries,s=void 0===r?10:r,l=n.delay,i=void 0===l?10:l,u=n.shouldReject,c=void 0===u||u,a=null!==(o=n.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise(function(n,o){var r=0,l=function(){var u=e();t(u)?n(u):++r<s?setTimeout(l,i):c?o(new Error(a.replace(/\{\{\s*retries\s*\}\}/g,"".concat(s)))):n(u)};l()})};const i=e=>{const[t,n]=e;return!!(o=t)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof n;var o};function u(e,n){return function(e){return e.split(",").map(e=>e.trim())}(e).map(e=>{const o=function(e){return e.split(t).map(e=>e.trim())}(e);return n(o)})}function c(e,n){return`${e} cannot be used with a selector ending in a shadowRoot (${t}).${n?` If you want to select a shadowRoot, use ${n} instead.`:""}`}function a(e){return e instanceof Promise?e:Promise.resolve(e)}function d(){return`You can not select a shadowRoot (${t}) of the document.`}function f(){return`You can not select a shadowRoot (${t}) of a shadowRoot.`}function y(e,t){var o,r;let s=null;const l=e.length;for(let i=0;i<l;i++){if(0===i)if(e[i].length)s=t.querySelector(e[i]);else{if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());s=(null===(o=t.shadowRoot)||void 0===o?void 0:o.querySelector(e[++i]))||null}else s=(null===(r=s.shadowRoot)||void 0===r?void 0:r.querySelector(`${n} ${e[i]}`))||null;if(null===s)return null}return s}function h(e,t){var o;const r=[...e],s=r.pop();if(!r.length)return t.querySelectorAll(s);const l=y(r,t);return(null===(o=null==l?void 0:l.shadowRoot)||void 0===o?void 0:o.querySelectorAll(`${n} ${s}`))||null}function v(e,t){if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());return t.shadowRoot}const n=y(e,t);return(null==n?void 0:n.shadowRoot)||null}function m(e,t,n="querySelector",o="shadowRootQuerySelector"){const r=u(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(c(n,o));return e}),s=r.length;for(let e=0;e<s;e++){const n=y(r[e],t);if(n)return n}return null}function w(e,t,n="querySelectorAll"){const r=u(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(c(n));return e}),s=r.length;for(let e=0;e<s;e++){const n=h(r[e],t);if(null==n?void 0:n.length)return n}return document.querySelectorAll(o)}function S(e,n,o="shadowRootQuerySelector",r="querySelector"){const s=u(e,e=>{if(e.pop().length)throw new SyntaxError(function(e,n){return`${e} must be used with a selector ending in a shadowRoot (${t}). If you don't want to select a shadowRoot, use ${n} instead.`}(o,r));return e}),l=s.length;for(let e=0;e<l;e++){const t=v(s[e],n);if(t)return t}return null}function p(t,n,o,r){return e(this,void 0,void 0,function*(){return l(()=>m(t,n,"asyncQuerySelector","asyncShadowRootQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}function g(t,n,o,r){return e(this,void 0,void 0,function*(){return l(()=>w(t,n,"asyncQuerySelectorAll"),e=>!!e.length,{retries:o,delay:r,shouldReject:!1})})}function R(t,n,o,r){return e(this,void 0,void 0,function*(){return l(()=>S(t,n,"asyncShadowRootQuerySelector","asyncQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}const _=(e,t)=>{const n=e.querySelectorAll(t);if(n.length)return n;if(e instanceof Element&&e.shadowRoot){const n=_(e.shadowRoot,t);if(n.length)return n}const r=Array.from(e.querySelectorAll("*"));for(const e of r){const n=_(e,t);if(n.length)return n}return document.querySelectorAll(o)},P=(e,t,n,o)=>l(()=>_(e,t),e=>!!e.length,{retries:n,delay:o,shouldReject:!1});function x(...t){return e(this,void 0,void 0,function*(){if(i(t)){const[e,n,o]=t;return yield g(n,e,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||s)}const[e,n]=t;return g(e,document,(null==n?void 0:n.retries)||r,(null==n?void 0:n.delay)||s)})}function q(...t){return e(this,void 0,void 0,function*(){if(i(t)){const[e,n,o]=t;return yield R(n,e,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||s)}const[e,n]=t;return R(e,document,(null==n?void 0:n.retries)||r,(null==n?void 0:n.delay)||s)})}class A{constructor(e,t){e instanceof Node||e instanceof Promise?(this._element=e,this._asyncParams=Object.assign({retries:r,delay:s},t||{})):(this._element=document,this._asyncParams=Object.assign({retries:r,delay:s},e||{}))}get element(){return a(this._element).then(e=>e instanceof NodeList?e[0]||null:e)}get $(){const e=a(this._element).then(e=>e instanceof Document||e instanceof ShadowRoot||null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?q(e[0],t,this._asyncParams):q(e,t,this._asyncParams));return new A(e,this._asyncParams)}get all(){return a(this._element).then(e=>e instanceof NodeList?e:document.querySelectorAll(o))}get asyncParams(){return this._asyncParams}eq(t){return e(this,void 0,void 0,function*(){return a(this._element).then(e=>e instanceof NodeList&&e[t]||null)})}query(e){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?x(t[0],e,this._asyncParams):x(t,e,this._asyncParams));return new A(t,this._asyncParams)}deepQuery(e){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map(t=>P(t,e,this._asyncParams.retries,this._asyncParams.delay))):P(t,e,this._asyncParams.retries,this._asyncParams.delay));return new A(t,this._asyncParams)}}exports.AsyncSelector=A,exports.asyncDeepQuerySelector=function(...t){return e(this,void 0,void 0,function*(){if(i(t)){const[e,n,o]=t;return(yield P(e,n,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||s))[0]||null}const[e,n]=t;return(yield P(document,e,(null==n?void 0:n.retries)||r,(null==n?void 0:n.delay)||s))[0]||null})},exports.asyncDeepQuerySelectorAll=function(...e){if(i(e)){const[t,n,o]=e;return P(t,n,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||s)}const[t,n]=e;return P(document,t,(null==n?void 0:n.retries)||r,(null==n?void 0:n.delay)||s)},exports.asyncQuerySelector=function(...t){return e(this,void 0,void 0,function*(){if(i(t)){const[e,n,o]=t;return yield p(n,e,(null==o?void 0:o.retries)||r,(null==o?void 0:o.delay)||s)}const[e,n]=t;return yield p(e,document,(null==n?void 0:n.retries)||r,(null==n?void 0:n.delay)||s)})},exports.asyncQuerySelectorAll=x,exports.asyncShadowRootQuerySelector=q,exports.deepQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?_(document,t)[0]||null:_(t,n)[0]||null},exports.deepQuerySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?_(document,t):_(t,n)},exports.querySelector=function(...e){const[t,n]=e;return"string"==typeof t?m(t,document):m(n,t)},exports.querySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?w(t,document):w(n,t)},exports.shadowRootQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?S(t,document):S(n,t)};
1
+ "use strict";var e=require("get-promisable-result");function t(e,t,n,o){return new(n||(n=Promise))(function(r,l){function s(e){try{u(o.next(e))}catch(e){l(e)}}function i(e){try{u(o.throw(e))}catch(e){l(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,i)}u((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n="$",o=":host",r="invalid selector",l=10,s=10,i=e=>{const[t,n]=e;return!!(o=t)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof n;var o};function u(e,t){return function(e){return e.split(",").map(e=>e.trim())}(e).map(e=>{const o=function(e){return e.split(n).map(e=>e.trim())}(e);return t(o)})}function c(e,t){return`${e} cannot be used with a selector ending in a shadowRoot (${n}).${t?` If you want to select a shadowRoot, use ${t} instead.`:""}`}function a(e){return e instanceof Promise?e:Promise.resolve(e)}function d(){return`You can not select a shadowRoot (${n}) of the document.`}function f(){return`You can not select a shadowRoot (${n}) of a shadowRoot.`}function y(e,t){var n,r;let l=null;const s=e.length;for(let i=0;i<s;i++){if(0===i)if(e[i].length)l=t.querySelector(e[i]);else{if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());l=(null===(n=t.shadowRoot)||void 0===n?void 0:n.querySelector(e[++i]))||null}else l=(null===(r=l.shadowRoot)||void 0===r?void 0:r.querySelector(`${o} ${e[i]}`))||null;if(null===l)return null}return l}function h(e,t){var n;const r=[...e],l=r.pop();if(!r.length)return t.querySelectorAll(l);const s=y(r,t);return(null===(n=null==s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelectorAll(`${o} ${l}`))||null}function m(e,t){if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(d());if(t instanceof ShadowRoot)throw new SyntaxError(f());return t.shadowRoot}const n=y(e,t);return(null==n?void 0:n.shadowRoot)||null}function v(e,t,n="querySelector",o="shadowRootQuerySelector"){const r=u(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(c(n,o));return e}),l=r.length;for(let e=0;e<l;e++){const n=y(r[e],t);if(n)return n}return null}function w(e,t,n="querySelectorAll"){const o=u(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(c(n));return e}),l=o.length;for(let e=0;e<l;e++){const n=h(o[e],t);if(null==n?void 0:n.length)return n}return document.querySelectorAll(r)}function S(e,t,o="shadowRootQuerySelector",r="querySelector"){const l=u(e,e=>{if(e.pop().length)throw new SyntaxError(function(e,t){return`${e} must be used with a selector ending in a shadowRoot (${n}). If you don't want to select a shadowRoot, use ${t} instead.`}(o,r));return e}),s=l.length;for(let e=0;e<s;e++){const n=m(l[e],t);if(n)return n}return null}function g(n,o,r,l){return t(this,void 0,void 0,function*(){return e.getPromisableResult(()=>v(n,o,"asyncQuerySelector","asyncShadowRootQuerySelector"),e=>!!e,{retries:r,delay:l,shouldReject:!1})})}function p(n,o,r,l){return t(this,void 0,void 0,function*(){return e.getPromisableResult(()=>w(n,o,"asyncQuerySelectorAll"),e=>!!e.length,{retries:r,delay:l,shouldReject:!1})})}function R(n,o,r,l){return t(this,void 0,void 0,function*(){return e.getPromisableResult(()=>S(n,o,"asyncShadowRootQuerySelector","asyncQuerySelector"),e=>!!e,{retries:r,delay:l,shouldReject:!1})})}const P=(e,t)=>{const n=e.querySelectorAll(t);if(n.length)return n;if(e instanceof Element&&e.shadowRoot){const n=P(e.shadowRoot,t);if(n.length)return n}const o=Array.from(e.querySelectorAll("*"));for(const e of o){const n=P(e,t);if(n.length)return n}return document.querySelectorAll(r)},_=(t,n,o,r)=>e.getPromisableResult(()=>P(t,n),e=>!!e.length,{retries:o,delay:r,shouldReject:!1});function x(...e){return t(this,void 0,void 0,function*(){if(i(e)){const[t,n,o]=e;return yield p(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return p(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})}function q(...e){return t(this,void 0,void 0,function*(){if(i(e)){const[t,n,o]=e;return yield R(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return R(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})}class A{constructor(e,t){e instanceof Node||e instanceof Promise?(this._element=e,this._asyncParams=Object.assign({retries:l,delay:s},t||{})):(this._element=document,this._asyncParams=Object.assign({retries:l,delay:s},e||{}))}get element(){return a(this._element).then(e=>e instanceof NodeList?e[0]||null:e)}get $(){const e=a(this._element).then(e=>e instanceof Document||e instanceof ShadowRoot||null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?q(e[0],n,this._asyncParams):q(e,n,this._asyncParams));return new A(e,this._asyncParams)}get all(){return a(this._element).then(e=>e instanceof NodeList?e:document.querySelectorAll(r))}get asyncParams(){return this._asyncParams}eq(e){return t(this,void 0,void 0,function*(){return a(this._element).then(t=>t instanceof NodeList&&t[e]||null)})}query(e){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?x(t[0],e,this._asyncParams):x(t,e,this._asyncParams));return new A(t,this._asyncParams)}deepQuery(e){const t=a(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map(t=>_(t,e,this._asyncParams.retries,this._asyncParams.delay))):_(t,e,this._asyncParams.retries,this._asyncParams.delay));return new A(t,this._asyncParams)}}exports.AsyncSelector=A,exports.asyncDeepQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(i(e)){const[t,n,o]=e;return(yield _(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s))[0]||null}const[t,n]=e;return(yield _(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s))[0]||null})},exports.asyncDeepQuerySelectorAll=function(...e){if(i(e)){const[t,n,o]=e;return _(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return _(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)},exports.asyncQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(i(e)){const[t,n,o]=e;return yield g(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return yield g(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})},exports.asyncQuerySelectorAll=x,exports.asyncShadowRootQuerySelector=q,exports.deepQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?P(document,t)[0]||null:P(t,n)[0]||null},exports.deepQuerySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?P(document,t):P(t,n)},exports.querySelector=function(...e){const[t,n]=e;return"string"==typeof t?v(t,document):v(n,t)},exports.querySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?w(t,document):w(n,t)},exports.shadowRootQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?S(t,document):S(n,t)};
@@ -1 +1 @@
1
- var ShadowDomSelector=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))(function(r,l){function i(e){try{u(o.next(e))}catch(e){l(e)}}function s(e){try{u(o.throw(e))}catch(e){l(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,s)}u((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n="$",o=":host",r="invalid selector",l=10,i=10;var s=function(e,t,n){var o;void 0===n&&(n={});var r=n.retries,l=void 0===r?10:r,i=n.delay,s=void 0===i?10:i,u=n.shouldReject,c=void 0===u||u,a=null!==(o=n.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise(function(n,o){var r=0,i=function(){var u=e();t(u)?n(u):++r<l?setTimeout(i,s):c?o(new Error(a.replace(/\{\{\s*retries\s*\}\}/g,"".concat(l)))):n(u)};i()})};const u=e=>{const[t,n]=e;return!!(o=t)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof n;var o};function c(e,t){return function(e){return e.split(",").map(e=>e.trim())}(e).map(e=>{const o=function(e){return e.split(n).map(e=>e.trim())}(e);return t(o)})}function a(e,t){return`${e} cannot be used with a selector ending in a shadowRoot (${n}).${t?` If you want to select a shadowRoot, use ${t} instead.`:""}`}function d(e){return e instanceof Promise?e:Promise.resolve(e)}function f(){return`You can not select a shadowRoot (${n}) of the document.`}function h(){return`You can not select a shadowRoot (${n}) of a shadowRoot.`}function y(e,t){var n,r;let l=null;const i=e.length;for(let s=0;s<i;s++){if(0===s)if(e[s].length)l=t.querySelector(e[s]);else{if(t instanceof Document)throw new SyntaxError(f());if(t instanceof ShadowRoot)throw new SyntaxError(h());l=(null===(n=t.shadowRoot)||void 0===n?void 0:n.querySelector(e[++s]))||null}else l=(null===(r=l.shadowRoot)||void 0===r?void 0:r.querySelector(`${o} ${e[s]}`))||null;if(null===l)return null}return l}function v(e,t){var n;const r=[...e],l=r.pop();if(!r.length)return t.querySelectorAll(l);const i=y(r,t);return(null===(n=null==i?void 0:i.shadowRoot)||void 0===n?void 0:n.querySelectorAll(`${o} ${l}`))||null}function m(e,t){if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(f());if(t instanceof ShadowRoot)throw new SyntaxError(h());return t.shadowRoot}const n=y(e,t);return(null==n?void 0:n.shadowRoot)||null}function w(e,t,n="querySelector",o="shadowRootQuerySelector"){const r=c(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(a(n,o));return e}),l=r.length;for(let e=0;e<l;e++){const n=y(r[e],t);if(n)return n}return null}function S(e,t,n="querySelectorAll"){const o=c(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(a(n));return e}),l=o.length;for(let e=0;e<l;e++){const n=v(o[e],t);if(null==n?void 0:n.length)return n}return document.querySelectorAll(r)}function g(e,t,o="shadowRootQuerySelector",r="querySelector"){const l=c(e,e=>{if(e.pop().length)throw new SyntaxError(function(e,t){return`${e} must be used with a selector ending in a shadowRoot (${n}). If you don't want to select a shadowRoot, use ${t} instead.`}(o,r));return e}),i=l.length;for(let e=0;e<i;e++){const n=m(l[e],t);if(n)return n}return null}function p(e,n,o,r){return t(this,void 0,void 0,function*(){return s(()=>w(e,n,"asyncQuerySelector","asyncShadowRootQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}function R(e,n,o,r){return t(this,void 0,void 0,function*(){return s(()=>S(e,n,"asyncQuerySelectorAll"),e=>!!e.length,{retries:o,delay:r,shouldReject:!1})})}function _(e,n,o,r){return t(this,void 0,void 0,function*(){return s(()=>g(e,n,"asyncShadowRootQuerySelector","asyncQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}const P=(e,t)=>{const n=e.querySelectorAll(t);if(n.length)return n;if(e instanceof Element&&e.shadowRoot){const n=P(e.shadowRoot,t);if(n.length)return n}const o=Array.from(e.querySelectorAll("*"));for(const e of o){const n=P(e,t);if(n.length)return n}return document.querySelectorAll(r)},q=(e,t,n,o)=>s(()=>P(e,t),e=>!!e.length,{retries:n,delay:o,shouldReject:!1});function A(...e){return t(this,void 0,void 0,function*(){if(u(e)){const[t,n,o]=e;return yield R(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||i)}const[t,n]=e;return R(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||i)})}function Q(...e){return t(this,void 0,void 0,function*(){if(u(e)){const[t,n,o]=e;return yield _(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||i)}const[t,n]=e;return _(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||i)})}class ${constructor(e,t){e instanceof Node||e instanceof Promise?(this._element=e,this._asyncParams=Object.assign({retries:l,delay:i},t||{})):(this._element=document,this._asyncParams=Object.assign({retries:l,delay:i},e||{}))}get element(){return d(this._element).then(e=>e instanceof NodeList?e[0]||null:e)}get $(){const e=d(this._element).then(e=>e instanceof Document||e instanceof ShadowRoot||null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?Q(e[0],n,this._asyncParams):Q(e,n,this._asyncParams));return new $(e,this._asyncParams)}get all(){return d(this._element).then(e=>e instanceof NodeList?e:document.querySelectorAll(r))}get asyncParams(){return this._asyncParams}eq(e){return t(this,void 0,void 0,function*(){return d(this._element).then(t=>t instanceof NodeList&&t[e]||null)})}query(e){const t=d(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?A(t[0],e,this._asyncParams):A(t,e,this._asyncParams));return new $(t,this._asyncParams)}deepQuery(e){const t=d(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map(t=>q(t,e,this._asyncParams.retries,this._asyncParams.delay))):q(t,e,this._asyncParams.retries,this._asyncParams.delay));return new $(t,this._asyncParams)}}return e.AsyncSelector=$,e.asyncDeepQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(u(e)){const[t,n,o]=e;return(yield q(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||i))[0]||null}const[t,n]=e;return(yield q(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||i))[0]||null})},e.asyncDeepQuerySelectorAll=function(...e){if(u(e)){const[t,n,o]=e;return q(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||i)}const[t,n]=e;return q(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||i)},e.asyncQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(u(e)){const[t,n,o]=e;return yield p(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||i)}const[t,n]=e;return yield p(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||i)})},e.asyncQuerySelectorAll=A,e.asyncShadowRootQuerySelector=Q,e.deepQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?P(document,t)[0]||null:P(t,n)[0]||null},e.deepQuerySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?P(document,t):P(t,n)},e.querySelector=function(...e){const[t,n]=e;return"string"==typeof t?w(t,document):w(n,t)},e.querySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?S(t,document):S(n,t)},e.shadowRootQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?g(t,document):g(n,t)},e}({});
1
+ var ShadowDomSelector=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))(function(r,l){function s(e){try{u(o.next(e))}catch(e){l(e)}}function i(e){try{u(o.throw(e))}catch(e){l(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,i)}u((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n="$",o=":host",r="invalid selector",l=10,s=10,i=10,u=10,c=(e,t,n={})=>{var o;const{retries:r=i,delay:l=u,shouldReject:s=!0}=n,c=null!==(o=n.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise((n,o)=>{let i=0;const u=()=>{const a=e();t(a)?n(a):(i++,i<r?setTimeout(u,l):s?o(new Error(c.replace(/\{\{\s*retries\s*\}\}/g,`${r}`))):n(a))};u()})},a=e=>{const[t,n]=e;return!!(o=t)&&(o instanceof Document||o instanceof Element||o instanceof ShadowRoot)&&"string"==typeof n;var o};function d(e,t){return function(e){return e.split(",").map(e=>e.trim())}(e).map(e=>{const o=function(e){return e.split(n).map(e=>e.trim())}(e);return t(o)})}function f(e,t){return`${e} cannot be used with a selector ending in a shadowRoot (${n}).${t?` If you want to select a shadowRoot, use ${t} instead.`:""}`}function h(e){return e instanceof Promise?e:Promise.resolve(e)}function y(){return`You can not select a shadowRoot (${n}) of the document.`}function m(){return`You can not select a shadowRoot (${n}) of a shadowRoot.`}function v(e,t){var n,r;let l=null;const s=e.length;for(let i=0;i<s;i++){if(0===i)if(e[i].length)l=t.querySelector(e[i]);else{if(t instanceof Document)throw new SyntaxError(y());if(t instanceof ShadowRoot)throw new SyntaxError(m());l=(null===(n=t.shadowRoot)||void 0===n?void 0:n.querySelector(e[++i]))||null}else l=(null===(r=l.shadowRoot)||void 0===r?void 0:r.querySelector(`${o} ${e[i]}`))||null;if(null===l)return null}return l}function w(e,t){var n;const r=[...e],l=r.pop();if(!r.length)return t.querySelectorAll(l);const s=v(r,t);return(null===(n=null==s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelectorAll(`${o} ${l}`))||null}function S(e,t){if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(y());if(t instanceof ShadowRoot)throw new SyntaxError(m());return t.shadowRoot}const n=v(e,t);return(null==n?void 0:n.shadowRoot)||null}function g(e,t,n="querySelector",o="shadowRootQuerySelector"){const r=d(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(f(n,o));return e}),l=r.length;for(let e=0;e<l;e++){const n=v(r[e],t);if(n)return n}return null}function p(e,t,n="querySelectorAll"){const o=d(e,e=>{if(!e[e.length-1].length)throw new SyntaxError(f(n));return e}),l=o.length;for(let e=0;e<l;e++){const n=w(o[e],t);if(null==n?void 0:n.length)return n}return document.querySelectorAll(r)}function R(e,t,o="shadowRootQuerySelector",r="querySelector"){const l=d(e,e=>{if(e.pop().length)throw new SyntaxError(function(e,t){return`${e} must be used with a selector ending in a shadowRoot (${n}). If you don't want to select a shadowRoot, use ${t} instead.`}(o,r));return e}),s=l.length;for(let e=0;e<s;e++){const n=S(l[e],t);if(n)return n}return null}function _(e,n,o,r){return t(this,void 0,void 0,function*(){return c(()=>g(e,n,"asyncQuerySelector","asyncShadowRootQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}function P(e,n,o,r){return t(this,void 0,void 0,function*(){return c(()=>p(e,n,"asyncQuerySelectorAll"),e=>!!e.length,{retries:o,delay:r,shouldReject:!1})})}function q(e,n,o,r){return t(this,void 0,void 0,function*(){return c(()=>R(e,n,"asyncShadowRootQuerySelector","asyncQuerySelector"),e=>!!e,{retries:o,delay:r,shouldReject:!1})})}const A=(e,t)=>{const n=e.querySelectorAll(t);if(n.length)return n;if(e instanceof Element&&e.shadowRoot){const n=A(e.shadowRoot,t);if(n.length)return n}const o=Array.from(e.querySelectorAll("*"));for(const e of o){const n=A(e,t);if(n.length)return n}return document.querySelectorAll(r)},Q=(e,t,n,o)=>c(()=>A(e,t),e=>!!e.length,{retries:n,delay:o,shouldReject:!1});function $(...e){return t(this,void 0,void 0,function*(){if(a(e)){const[t,n,o]=e;return yield P(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return P(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})}function E(...e){return t(this,void 0,void 0,function*(){if(a(e)){const[t,n,o]=e;return yield q(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return q(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})}class N{constructor(e,t){e instanceof Node||e instanceof Promise?(this._element=e,this._asyncParams=Object.assign({retries:l,delay:s},t||{})):(this._element=document,this._asyncParams=Object.assign({retries:l,delay:s},e||{}))}get element(){return h(this._element).then(e=>e instanceof NodeList?e[0]||null:e)}get $(){const e=h(this._element).then(e=>e instanceof Document||e instanceof ShadowRoot||null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?E(e[0],n,this._asyncParams):E(e,n,this._asyncParams));return new N(e,this._asyncParams)}get all(){return h(this._element).then(e=>e instanceof NodeList?e:document.querySelectorAll(r))}get asyncParams(){return this._asyncParams}eq(e){return t(this,void 0,void 0,function*(){return h(this._element).then(t=>t instanceof NodeList&&t[e]||null)})}query(e){const t=h(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?$(t[0],e,this._asyncParams):$(t,e,this._asyncParams));return new N(t,this._asyncParams)}deepQuery(e){const t=h(this._element).then(t=>null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map(t=>Q(t,e,this._asyncParams.retries,this._asyncParams.delay))):Q(t,e,this._asyncParams.retries,this._asyncParams.delay));return new N(t,this._asyncParams)}}return e.AsyncSelector=N,e.asyncDeepQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(a(e)){const[t,n,o]=e;return(yield Q(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s))[0]||null}const[t,n]=e;return(yield Q(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s))[0]||null})},e.asyncDeepQuerySelectorAll=function(...e){if(a(e)){const[t,n,o]=e;return Q(t,n,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return Q(document,t,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)},e.asyncQuerySelector=function(...e){return t(this,void 0,void 0,function*(){if(a(e)){const[t,n,o]=e;return yield _(n,t,(null==o?void 0:o.retries)||l,(null==o?void 0:o.delay)||s)}const[t,n]=e;return yield _(t,document,(null==n?void 0:n.retries)||l,(null==n?void 0:n.delay)||s)})},e.asyncQuerySelectorAll=$,e.asyncShadowRootQuerySelector=E,e.deepQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?A(document,t)[0]||null:A(t,n)[0]||null},e.deepQuerySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?A(document,t):A(t,n)},e.querySelector=function(...e){const[t,n]=e;return"string"==typeof t?g(t,document):g(n,t)},e.querySelectorAll=function(...e){const[t,n]=e;return"string"==typeof t?p(t,document):p(n,t)},e.shadowRootQuerySelector=function(...e){const[t,n]=e;return"string"==typeof t?R(t,document):R(n,t)},e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadow-dom-selector",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "A very small JavaScript utility to query DOM elements through the Shadow Dom subtrees in a sync or an async way",
5
5
  "keywords": [
6
6
  "query-selector",
@@ -77,7 +77,10 @@
77
77
  "typescript-eslint": "^8.57.2"
78
78
  },
79
79
  "dependencies": {
80
- "get-promisable-result": "^1.0.2"
80
+ "get-promisable-result": "^2.0.0"
81
+ },
82
+ "peerDependencies": {
83
+ "get-promisable-result": "^2.0.0"
81
84
  },
82
85
  "pnpm": {
83
86
  "overrides": {