@adartem/adlib-attributes 0.1.3 → 0.1.4
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/attributes.js +1 -1
- package/package.json +13 -13
package/attributes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as v,Ma as E,ab as _,va as R}from"./dist/chunk-3XBROWKO.js";var S="0.1.3";var D=async t=>{switch(t){case"accordion":return import("./dist/dist-MJIZMTBO.js");case"autovideo":return import("./dist/dist-4KOXX7FX.js");case"codehighlight":return import("./dist/dist-FDVEU4NM.js");case"combobox":return import("./dist/dist-CYWMPADF.js");case"copyclip":return import("./dist/dist-G3CWGTZT.js");case"displayvalues":return import("./dist/dist-WE5HIYWJ.js");case"favcustom":return import("./dist/dist-I62SAT3A.js");case"formsubmit":return import("./dist/dist-N6RICZVA.js");case"inject":return import("./dist/dist-KJYLEW5G.js");case"inputactive":return import("./dist/dist-GCEMMGQC.js");case"inputcounter":return import("./dist/dist-KVCUHKEL.js");case"list":return import("./dist/dist-CYEP7ZYD.js");case"mirrorclick":return import("./dist/dist-XQCFKZZ4.js");case"mirrorinput":return import("./dist/dist-NTTQPHMC.js");case"modal":return import("./dist/dist-GIVVHNIU.js");case"numbercount":return import("./dist/dist-YGHHEKQY.js");case"queryparam":return import("./dist/dist-DCT2OKR6.js");case"rangeslider":return import("./dist/dist-KWNONO67.js");case"readtime":return import("./dist/dist-SPPDEZAG.js");case"removequery":return import("./dist/dist-NDUZI32X.js");case"scrolldisable":return import("./dist/dist-RPND2SFD.js");case"selectcustom":return import("./dist/dist-AZVF6KF7.js");case"sliderdots":return import("./dist/dist-45TZF6O6.js");case"smartlightbox":return import("./dist/dist-6YZ22CPE.js");case"socialshare":return import("./dist/src-EP63RPX3.js");case"starrating":return import("./dist/dist-3KKACNWT.js");case"toc":return import("./dist/dist-NGZXQFOC.js");case"videohls":return import("./dist/src-OO4DGOWA.js");default:throw`Adartem Attribute "${t}" is not supported.`}};function M(t){let r=t.search(/[?#]/);return r===-1?t:t.slice(0,r)}function K(t,r){try{return new URL(t,r)}catch{return null}}function j(t,r){return M(t.pathname).endsWith(M(r.pathname))}function k(t){if(typeof document>"u")return[];let r=Array.from(document.querySelectorAll('script[type="module"][src]')),o=document.baseURI||(typeof location<"u"?location.href:"http://localhost/"),e=K(t,o);if(!e)return[];let s=[];for(let n of r){let u=n.getAttribute("src");if(!u)continue;let m=K(u,o);m&&j(m,e)&&s.push(n)}return s}function L(t,r){let o=t.getAttribute(r);if(o!==null)return o===""||o.toLowerCase()==="true"?!0:o.toLowerCase()!=="false"}function C(t){let r={},o={};for(let e of t){let s=e.getAttribute("data-adlib-registry"),n=e.getAttribute("data-adlib-version"),u=e.getAttribute("data-adlib-base");s&&(r.registry=s),n&&(r.version=n),u&&(r.base=u);let m=L(e,"data-adlib-debug"),i=L(e,"data-adlib-auto"),d=L(e,"data-adlib-observe-attributes");m===!0&&(o.debug=!0),i===!0&&(o.auto=!0),d===!0&&(o.observeAttributes=!0)}return{config:r,flags:o}}var q=/^ad-[a-z0-9-]+$/i,Q=/^data-ad-[a-z0-9-]+$/i;function Y(t){return Q.test(t)?`ad-${t.slice(8)}`:q.test(t)?t:null}function g(t){let r=new Set;for(let o of t)for(let{name:e}of Array.from(o.attributes)){if(e.startsWith("data-adlib-"))continue;let s=Y(e);s&&r.add(s)}return Array.from(r)}function x(t,r){r.config&&(t.config={...t.config,...r.config}),r.debug===!0&&(t.debug=!0),r.auto===!0&&(t.auto=!0),r.observeAttributes===!0&&(t.observeAttributes=!0)}var f=class extends Error{code;key;cause;meta;constructor(r){super(r.message),this.name="AdLibRuntimeError",this.code=r.code,this.key=r.key,this.cause=r.cause,this.meta=r.meta}};function y(t,r){return t instanceof f?t:new f({code:r.code,message:r.message,key:r.key,cause:t,meta:r.meta})}function T(t){let r=[];for(let[o,e]of Object.entries(t.modules)){if(!e)continue;let s=e.error instanceof f?e.error.code:void 0;r.push({key:o,status:e.status,errorCode:s})}return r.sort((o,e)=>o.key.localeCompare(e.key)),r}function G(t){let r=()=>({version:t.version,debug:t.debug,auto:t.auto,observeAttributes:t.observeAttributes,config:t.config,scriptsCount:t.scripts.length,modules:T(t)});return{runtime:t,snapshot:r,modules:()=>T(t),dump:()=>{let o=r();try{console.error("[AdLib] Runtime snapshot",o)}catch{}return o}}}function I(t){if(typeof window>"u")return;let r=window;r.__ADLIB_DEBUG__?.runtime!==t&&(r.__ADLIB_DEBUG__=G(t))}function h(){return typeof window<"u"&&typeof document<"u"}function O(t){if(h()){if(document.readyState==="interactive"||document.readyState==="complete"){t();return}document.addEventListener("DOMContentLoaded",()=>{t()},{once:!0})}}function z(t){return Array.isArray(t)}function H(t){return!!t&&typeof t=="object"&&"push"in t&&typeof t.push=="function"}function N(t){if(typeof window>"u")return;let r=window,o=r.AdLibAttributes;if(H(o)||!z(o)||o.__adlib_drained__===!0)return;let e=o.slice();o.length=0,o.__adlib_drained__=!0,e.length>0&&t.push(...e),r.AdLibAttributes=t}function A(t,r){if(!(typeof window>"u"))try{let o=new CustomEvent(t,{detail:r});window.dispatchEvent(o)}catch{}}function F(t,r){let o=r?.minDelayMs??50,e=!1,s=0,n;function u(){e=!1,n=void 0,s=Date.now(),t()}function m(){if(e)return;e=!0;let d=Date.now()-s,a=d>=o?0:o-d;if(a===0){queueMicrotask(()=>u());return}n=window.setTimeout(()=>u(),a)}function i(){e=!1,n!==void 0&&(clearTimeout(n),n=void 0)}return{schedule:m,cancel:i,isScheduled:()=>e}}var V=/^ad-[a-z0-9-]+$/i,X=/^data-ad-[a-z0-9-]+$/i;function J(t){return t.startsWith("data-adlib-")?null:X.test(t)?`ad-${t.slice(8)}`:V.test(t)?t:null}function U(t,r){for(let{name:o}of Array.from(t.attributes)){let e=J(o);e&&r.add(e)}}function B(t){let r=new Set;for(let o of t){if(o.nodeType!==1)continue;let e=o;U(e,r);for(let s of Array.from(e.querySelectorAll("*")))U(s,r)}return Array.from(r)}var Z=/^ad-[a-z0-9-]+$/i,tt=/^data-ad-[a-z0-9-]+$/i;function et(t){return tt.test(t)?`ad-${t.slice(8)}`:Z.test(t)?t:null}function W(t){let r=null,o=!1,e=null,s=[],n=[],u=F(()=>{let a=B(s);s.length=0;let l=new Set;if(t.observeAttributes)for(let c of n){if(c.startsWith("data-adlib-"))continue;let b=et(c);b&&l.add(b)}n.length=0;let p=Array.from(new Set([...a,...Array.from(l)]));(async()=>{for(let c of p)try{await t.load(c)}catch{}})()},{minDelayMs:50});function m(){return t.observeAttributes?"nodes+attrs":"nodes"}function i(a){for(let l of a){if(l.type==="childList"){for(let p of Array.from(l.addedNodes))s.push(p);continue}if(l.type==="attributes"){if(!t.observeAttributes)continue;let p=l.attributeName;if(!p)continue;n.push(p)}}(s.length>0||n.length>0)&&u.schedule()}function d(a){if(typeof document>"u")return;let l=document.body;if(!l||(r||(r=new MutationObserver(i)),o&&e===a))return;r.disconnect();let p={subtree:!0,childList:!0},c=a==="nodes+attrs"?{...p,attributes:!0,attributeOldValue:!1}:p;r.observe(l,c),o=!0,e=a}return{isActive:()=>o,ensureStarted:()=>{d(m())},stop:()=>{r&&(r.disconnect(),o=!1,e=null,u.cancel(),s.length=0,n.length=0)}}}var rt="ad-attributes",$=new Set(Object.values(R)),ot=t=>Array.isArray(t),it=()=>{let{AdLibAttributes:t}=window,r=t&&!Array.isArray(t)?t:void 0,o=r??{version:S,scripts:[],config:{},debug:!1,auto:!1,observeAttributes:!1,modules:{},process:new Set,utils:{fetchPage:E,attachExternalStylesheets:v},load:w,async reload(i,d){let a=this.modules[i]??await this.load(i);if(a.status==="ready"){let l=a.instance;if(l&&typeof l.restart=="function")try{return await l.restart({rescan:d?.rescan}),a}catch{return a.destroy(),await this.load(i)}}return a.destroy(),await this.load(i)},push(...i){for(let d of i){let[a,l]=ot(d)?d:[d.key,d.cb],p=a,c=this.modules[p];if(c&&(c.status==="ready"||c.status==="error")){l(c);continue}(!c||c.status!=="loading")&&(this.load(p),c=this.modules[p]),c&&(c.promise?c.promise.then(()=>l(c)).catch(()=>l(c)):l(c))}},applyLoaderConfig:()=>{},destroy(i){for(let d in this.modules)this.modules[d]?.destroy?.();e.stop(),i?.keepGlobal},getState(i){return i?this.modules[i]??{key:i,status:"idle",reload:d=>this.reload(i,d),destroy:()=>{this.process.delete(i)}}:this.modules},getErrors(){let i=[];for(let[d,a]of Object.entries(this.modules))a?.status==="error"&&a.error&&i.push({key:d,error:a.error});return i},isLoaded(i){return this.modules[i]?.status==="ready"},initFromScripts(i){let d=i?.scripts??[],a=new Set(this.scripts);for(let b of d)a.has(b)||(a.add(b),this.scripts.push(b));let l=g(this.scripts),p=i?.requestedKeys??[],c=Array.from(new Set([...p,...l]));this.auto&&(async()=>{for(let b of c)try{await this.load(b)}catch{}})()}},e=o.observerCtl??W(o);o.observerCtl=e,o.applyLoaderConfig=i=>{x(o,i),e.ensureStarted()},r||(window.AdLibAttributes=o),N(o),I(o);let s=k(import.meta.url),{config:n,flags:u}=C(s),m=g(s);o.applyLoaderConfig({config:n,debug:u.debug,auto:u.auto,observeAttributes:u.observeAttributes}),o.initFromScripts({scripts:s,requestedKeys:m}),nt()};function st(){h()&&O(()=>{it()})}var nt=()=>{let t=!1;for(let r of window.AdLibAttributes.scripts){t||=r.getAttribute(`${rt}-auto`)==="true";for(let o of $)r.hasAttribute(`ad-${o}`)&&w(o)}t&&_().then(()=>{let r=new Set,o=document.querySelectorAll("*");for(let e of o)for(let s of e.getAttributeNames()){let u=s.match(/^ad-([^-]+)/)?.[1];u&&$.has(u)&&r.add(u)}for(let e of r)w(e)})},w=async t=>{let r=n=>/^ad-[a-z0-9-]+$/i.test(n),o=window.AdLibAttributes,e=o.modules[t]??={key:t,status:"idle",reload:n=>o.reload(t,n),destroy:()=>{o.process.delete(t)}};if(!r(String(t))){let n=new f({code:"UNKNOWN_MODULE_KEY",message:`Unknown module key: ${String(t)}`,key:t});return e.status="error",e.error=n,A("ad:module:error",{key:t,state:e,error:n}),e}if(o.process.has(t))return e;o.process.add(t),e.status="loading",A("ad:module:before",{key:t,state:e});let s=(async()=>{let n;try{n=await D(t)}catch(u){console.error(u);let m=y(u,{code:"MODULE_IMPORT_FAILED",message:`Failed to import module ${t}`,key:t,meta:{}});e.status="error",e.error=m,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:m});return}try{let{init:u}=n,{result:m,destroy:i}=await u()||{};return e.instance=m,e.status="ready",e.error=void 0,A("ad:module:after",{key:t,state:e}),e.destroy=()=>{try{i?.(),o.process.delete(t),e.status="idle",e.instance=void 0,e.error=void 0,e.promise=void 0}catch(d){console.error(d);let a=y(d,{code:"MODULE_DESTROY_FAILED",message:`Failed to destroy module ${t}`,key:t,meta:{}});e.status="error",e.error=a,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:a})}},m}catch(u){console.error(u);let m=y(u,{code:"MODULE_INIT_FAILED",message:`Failed to init module ${t}`,key:t,meta:{}});e.status="error",e.error=m,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:m});return}})();return e.promise=s,await s,e};st();export{st as bootstrapAttributesLoader};
|
|
1
|
+
import{M as v,Ma as E,ab as _,va as R}from"./dist/chunk-3XBROWKO.js";var S="0.1.4";var D=async t=>{switch(t){case"accordion":return import("./dist/dist-MJIZMTBO.js");case"autovideo":return import("./dist/dist-4KOXX7FX.js");case"codehighlight":return import("./dist/dist-FDVEU4NM.js");case"combobox":return import("./dist/dist-CYWMPADF.js");case"copyclip":return import("./dist/dist-G3CWGTZT.js");case"displayvalues":return import("./dist/dist-WE5HIYWJ.js");case"favcustom":return import("./dist/dist-I62SAT3A.js");case"formsubmit":return import("./dist/dist-N6RICZVA.js");case"inject":return import("./dist/dist-KJYLEW5G.js");case"inputactive":return import("./dist/dist-GCEMMGQC.js");case"inputcounter":return import("./dist/dist-KVCUHKEL.js");case"list":return import("./dist/dist-CYEP7ZYD.js");case"mirrorclick":return import("./dist/dist-XQCFKZZ4.js");case"mirrorinput":return import("./dist/dist-NTTQPHMC.js");case"modal":return import("./dist/dist-GIVVHNIU.js");case"numbercount":return import("./dist/dist-YGHHEKQY.js");case"queryparam":return import("./dist/dist-DCT2OKR6.js");case"rangeslider":return import("./dist/dist-KWNONO67.js");case"readtime":return import("./dist/dist-SPPDEZAG.js");case"removequery":return import("./dist/dist-NDUZI32X.js");case"scrolldisable":return import("./dist/dist-RPND2SFD.js");case"selectcustom":return import("./dist/dist-AZVF6KF7.js");case"sliderdots":return import("./dist/dist-45TZF6O6.js");case"smartlightbox":return import("./dist/dist-6YZ22CPE.js");case"socialshare":return import("./dist/src-EP63RPX3.js");case"starrating":return import("./dist/dist-3KKACNWT.js");case"toc":return import("./dist/dist-NGZXQFOC.js");case"videohls":return import("./dist/src-OO4DGOWA.js");default:throw`Adartem Attribute "${t}" is not supported.`}};function M(t){let r=t.search(/[?#]/);return r===-1?t:t.slice(0,r)}function K(t,r){try{return new URL(t,r)}catch{return null}}function j(t,r){return M(t.pathname).endsWith(M(r.pathname))}function k(t){if(typeof document>"u")return[];let r=Array.from(document.querySelectorAll('script[type="module"][src]')),o=document.baseURI||(typeof location<"u"?location.href:"http://localhost/"),e=K(t,o);if(!e)return[];let s=[];for(let n of r){let u=n.getAttribute("src");if(!u)continue;let m=K(u,o);m&&j(m,e)&&s.push(n)}return s}function L(t,r){let o=t.getAttribute(r);if(o!==null)return o===""||o.toLowerCase()==="true"?!0:o.toLowerCase()!=="false"}function C(t){let r={},o={};for(let e of t){let s=e.getAttribute("data-adlib-registry"),n=e.getAttribute("data-adlib-version"),u=e.getAttribute("data-adlib-base");s&&(r.registry=s),n&&(r.version=n),u&&(r.base=u);let m=L(e,"data-adlib-debug"),i=L(e,"data-adlib-auto"),d=L(e,"data-adlib-observe-attributes");m===!0&&(o.debug=!0),i===!0&&(o.auto=!0),d===!0&&(o.observeAttributes=!0)}return{config:r,flags:o}}var q=/^ad-[a-z0-9-]+$/i,Q=/^data-ad-[a-z0-9-]+$/i;function Y(t){return Q.test(t)?t.slice(8):q.test(t)?t.slice(3):null}function g(t){let r=new Set;for(let o of t)for(let{name:e}of Array.from(o.attributes)){if(e.startsWith("data-adlib-"))continue;let s=Y(e);s&&r.add(s)}return Array.from(r)}function x(t,r){r.config&&(t.config={...t.config,...r.config}),r.debug===!0&&(t.debug=!0),r.auto===!0&&(t.auto=!0),r.observeAttributes===!0&&(t.observeAttributes=!0)}var f=class extends Error{code;key;cause;meta;constructor(r){super(r.message),this.name="AdLibRuntimeError",this.code=r.code,this.key=r.key,this.cause=r.cause,this.meta=r.meta}};function y(t,r){return t instanceof f?t:new f({code:r.code,message:r.message,key:r.key,cause:t,meta:r.meta})}function T(t){let r=[];for(let[o,e]of Object.entries(t.modules)){if(!e)continue;let s=e.error instanceof f?e.error.code:void 0;r.push({key:o,status:e.status,errorCode:s})}return r.sort((o,e)=>o.key.localeCompare(e.key)),r}function z(t){let r=()=>({version:t.version,debug:t.debug,auto:t.auto,observeAttributes:t.observeAttributes,config:t.config,scriptsCount:t.scripts.length,modules:T(t)});return{runtime:t,snapshot:r,modules:()=>T(t),dump:()=>{let o=r();try{console.error("[AdLib] Runtime snapshot",o)}catch{}return o}}}function I(t){if(typeof window>"u")return;let r=window;r.__ADLIB_DEBUG__?.runtime!==t&&(r.__ADLIB_DEBUG__=z(t))}function h(){return typeof window<"u"&&typeof document<"u"}function O(t){if(h()){if(document.readyState==="interactive"||document.readyState==="complete"){t();return}document.addEventListener("DOMContentLoaded",()=>{t()},{once:!0})}}function G(t){return Array.isArray(t)}function H(t){return!!t&&typeof t=="object"&&"push"in t&&typeof t.push=="function"}function N(t){if(typeof window>"u")return;let r=window,o=r.AdLibAttributes;if(H(o)||!G(o)||o.__adlib_drained__===!0)return;let e=o.slice();o.length=0,o.__adlib_drained__=!0,e.length>0&&t.push(...e),r.AdLibAttributes=t}function A(t,r){if(!(typeof window>"u"))try{let o=new CustomEvent(t,{detail:r});window.dispatchEvent(o)}catch{}}function F(t,r){let o=r?.minDelayMs??50,e=!1,s=0,n;function u(){e=!1,n=void 0,s=Date.now(),t()}function m(){if(e)return;e=!0;let d=Date.now()-s,a=d>=o?0:o-d;if(a===0){queueMicrotask(()=>u());return}n=window.setTimeout(()=>u(),a)}function i(){e=!1,n!==void 0&&(clearTimeout(n),n=void 0)}return{schedule:m,cancel:i,isScheduled:()=>e}}var V=/^ad-[a-z0-9-]+$/i,X=/^data-ad-[a-z0-9-]+$/i;function J(t){return t.startsWith("data-adlib-")?null:X.test(t)?t.slice(8):V.test(t)?t.slice(3):null}function U(t,r){for(let{name:o}of Array.from(t.attributes)){let e=J(o);e&&r.add(e)}}function B(t){let r=new Set;for(let o of t){if(o.nodeType!==1)continue;let e=o;U(e,r);for(let s of Array.from(e.querySelectorAll("*")))U(s,r)}return Array.from(r)}var Z=/^ad-[a-z0-9-]+$/i,tt=/^data-ad-[a-z0-9-]+$/i;function et(t){return tt.test(t)?t.slice(8):Z.test(t)?t.slice(3):null}function W(t){let r=null,o=!1,e=null,s=[],n=[],u=F(()=>{let a=B(s);s.length=0;let l=new Set;if(t.observeAttributes)for(let c of n){if(c.startsWith("data-adlib-"))continue;let b=et(c);b&&l.add(b)}n.length=0;let p=Array.from(new Set([...a,...Array.from(l)]));(async()=>{for(let c of p)try{await t.load(c)}catch{}})()},{minDelayMs:50});function m(){return t.observeAttributes?"nodes+attrs":"nodes"}function i(a){for(let l of a){if(l.type==="childList"){for(let p of Array.from(l.addedNodes))s.push(p);continue}if(l.type==="attributes"){if(!t.observeAttributes)continue;let p=l.attributeName;if(!p)continue;n.push(p)}}(s.length>0||n.length>0)&&u.schedule()}function d(a){if(typeof document>"u")return;let l=document.body;if(!l||(r||(r=new MutationObserver(i)),o&&e===a))return;r.disconnect();let p={subtree:!0,childList:!0},c=a==="nodes+attrs"?{...p,attributes:!0,attributeOldValue:!1}:p;r.observe(l,c),o=!0,e=a}return{isActive:()=>o,ensureStarted:()=>{d(m())},stop:()=>{r&&(r.disconnect(),o=!1,e=null,u.cancel(),s.length=0,n.length=0)}}}var rt="ad-attributes",P=new Set(Object.values(R)),ot=t=>Array.isArray(t),it=()=>{let{AdLibAttributes:t}=window,r=t&&!Array.isArray(t)?t:void 0,o=r??{version:S,scripts:[],config:{},debug:!1,auto:!1,observeAttributes:!1,modules:{},process:new Set,utils:{fetchPage:E,attachExternalStylesheets:v},load:w,async reload(i,d){let a=this.modules[i]??await this.load(i);if(a.status==="ready"){let l=a.instance;if(l&&typeof l.restart=="function")try{return await l.restart({rescan:d?.rescan}),a}catch{return a.destroy(),await this.load(i)}}return a.destroy(),await this.load(i)},push(...i){for(let d of i){let[a,l]=ot(d)?d:[d.key,d.cb],p=a,c=this.modules[p];if(c&&(c.status==="ready"||c.status==="error")){l(c);continue}(!c||c.status!=="loading")&&(this.load(p),c=this.modules[p]),c&&(c.promise?c.promise.then(()=>l(c)).catch(()=>l(c)):l(c))}},applyLoaderConfig:()=>{},destroy(i){for(let d in this.modules)this.modules[d]?.destroy?.();e.stop(),i?.keepGlobal},getState(i){return i?this.modules[i]??{key:i,status:"idle",reload:d=>this.reload(i,d),destroy:()=>{this.process.delete(i)}}:this.modules},getErrors(){let i=[];for(let[d,a]of Object.entries(this.modules))a?.status==="error"&&a.error&&i.push({key:d,error:a.error});return i},isLoaded(i){return this.modules[i]?.status==="ready"},initFromScripts(i){let d=i?.scripts??[],a=new Set(this.scripts);for(let b of d)a.has(b)||(a.add(b),this.scripts.push(b));let l=g(this.scripts),p=i?.requestedKeys??[],c=Array.from(new Set([...p,...l]));this.auto&&(async()=>{for(let b of c)try{await this.load(b)}catch{}})()}},e=o.observerCtl??W(o);o.observerCtl=e,o.applyLoaderConfig=i=>{x(o,i),e.ensureStarted()},r||(window.AdLibAttributes=o),N(o),I(o);let s=k(import.meta.url),{config:n,flags:u}=C(s),m=g(s);o.applyLoaderConfig({config:n,debug:u.debug,auto:u.auto,observeAttributes:u.observeAttributes}),o.initFromScripts({scripts:s,requestedKeys:m}),nt()};function st(){h()&&O(()=>{it()})}var nt=()=>{let t=!1;for(let r of window.AdLibAttributes.scripts){t||=r.getAttribute(`${rt}-auto`)==="true";for(let o of P)r.hasAttribute(`ad-${o}`)&&w(o)}t&&_().then(()=>{let r=new Set,o=document.querySelectorAll("*");for(let e of o)for(let s of e.getAttributeNames()){let u=s.match(/^ad-([^-]+)/)?.[1];u&&P.has(u)&&r.add(u)}for(let e of r)w(e)})},w=async t=>{let r=n=>/^[a-z][a-z0-9-]*$/i.test(n),o=window.AdLibAttributes,e=o.modules[t]??={key:t,status:"idle",reload:n=>o.reload(t,n),destroy:()=>{o.process.delete(t)}};if(!r(String(t))){let n=new f({code:"UNKNOWN_MODULE_KEY",message:`Unknown module key: ${String(t)}`,key:t});return e.status="error",e.error=n,A("ad:module:error",{key:t,state:e,error:n}),e}if(o.process.has(t))return e;o.process.add(t),e.status="loading",A("ad:module:before",{key:t,state:e});let s=(async()=>{let n;try{n=await D(t)}catch(u){console.error(u);let m=y(u,{code:"MODULE_IMPORT_FAILED",message:`Failed to import module ${t}`,key:t,meta:{}});e.status="error",e.error=m,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:m});return}try{let{init:u}=n,{result:m,destroy:i}=await u()||{};return e.instance=m,e.status="ready",e.error=void 0,A("ad:module:after",{key:t,state:e}),e.destroy=()=>{try{i?.(),o.process.delete(t),e.status="idle",e.instance=void 0,e.error=void 0,e.promise=void 0}catch(d){console.error(d);let a=y(d,{code:"MODULE_DESTROY_FAILED",message:`Failed to destroy module ${t}`,key:t,meta:{}});e.status="error",e.error=a,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:a})}},m}catch(u){console.error(u);let m=y(u,{code:"MODULE_INIT_FAILED",message:`Failed to init module ${t}`,key:t,meta:{}});e.status="error",e.error=m,e.instance=void 0,A("ad:module:error",{key:t,state:e,error:m});return}})();return e.promise=s,await s,e};st();export{st as bootstrapAttributesLoader};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adartem/adlib-attributes",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "ADARTEM AdLib Attributes (ad-*).",
|
|
5
5
|
"homepage": "https://adartem.fr/attributes",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,32 +54,32 @@
|
|
|
54
54
|
"@adartem/ad-accordion": "0.1.0",
|
|
55
55
|
"@adartem/adlib-utils": "0.1.0",
|
|
56
56
|
"@adartem/ad-codehighlight": "0.1.0",
|
|
57
|
-
"@adartem/ad-combobox": "0.1.0",
|
|
58
57
|
"@adartem/ad-autovideo": "0.1.0",
|
|
58
|
+
"@adartem/ad-combobox": "0.1.0",
|
|
59
59
|
"@adartem/ad-copyclip": "0.1.0",
|
|
60
|
-
"@adartem/ad-displayvalues": "0.1.0",
|
|
61
|
-
"@adartem/ad-favcustom": "0.1.0",
|
|
62
60
|
"@adartem/ad-formsubmit": "0.1.0",
|
|
63
|
-
"@adartem/ad-
|
|
64
|
-
"@adartem/ad-inputactive": "0.1.0",
|
|
61
|
+
"@adartem/ad-favcustom": "0.1.0",
|
|
65
62
|
"@adartem/ad-inputcounter": "0.1.0",
|
|
66
|
-
"@adartem/ad-mirrorclick": "0.1.0",
|
|
67
63
|
"@adartem/ad-list": "0.1.1",
|
|
68
|
-
"@adartem/ad-
|
|
64
|
+
"@adartem/ad-mirrorclick": "0.1.0",
|
|
65
|
+
"@adartem/ad-modal": "0.1.0",
|
|
69
66
|
"@adartem/ad-numbercount": "0.1.0",
|
|
70
67
|
"@adartem/ad-queryparam": "0.1.0",
|
|
68
|
+
"@adartem/ad-mirrorinput": "0.1.0",
|
|
71
69
|
"@adartem/ad-rangeslider": "0.1.0",
|
|
70
|
+
"@adartem/ad-inputactive": "0.1.0",
|
|
71
|
+
"@adartem/ad-inject": "0.1.0",
|
|
72
72
|
"@adartem/ad-readtime": "0.1.0",
|
|
73
|
-
"@adartem/ad-
|
|
73
|
+
"@adartem/ad-displayvalues": "0.1.0",
|
|
74
74
|
"@adartem/ad-scrolldisable": "0.1.0",
|
|
75
|
-
"@adartem/ad-selectcustom": "0.1.0",
|
|
76
75
|
"@adartem/ad-sliderdots": "0.1.0",
|
|
76
|
+
"@adartem/ad-removequery": "0.1.0",
|
|
77
|
+
"@adartem/ad-selectcustom": "0.1.0",
|
|
77
78
|
"@adartem/ad-smartlightbox": "0.1.0",
|
|
78
79
|
"@adartem/ad-socialshare": "0.1.0",
|
|
79
|
-
"@adartem/ad-starrating": "0.1.0",
|
|
80
80
|
"@adartem/ad-toc": "0.1.0",
|
|
81
|
-
"@adartem/ad-
|
|
82
|
-
"@adartem/ad-
|
|
81
|
+
"@adartem/ad-starrating": "0.1.0",
|
|
82
|
+
"@adartem/ad-videohls": "0.1.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/node": "^20.14.9",
|