@hsfx/attr 2.0.21 → 2.0.22

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/README.md CHANGED
@@ -156,10 +156,10 @@ window.hsfx.modal.onClose(() => {
156
156
 
157
157
  ## jsDelivr Cache Purge
158
158
 
159
- After publishing to npm, purge the entire package cache:
159
+ After publishing to npm, go to https://www.jsdelivr.com/tools/purge and paste:
160
160
 
161
161
  ```
162
- https://purge.jsdelivr.net/npm/@hsfx/attr@2
162
+ /npm/@hsfx/attr@2
163
163
  ```
164
164
 
165
165
  ---
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./hsfxcounterCHBYPnnN.js","./hsfxutilsBiyhgSbR.js","./hsfxmarqueeBZW0uarL.js"])))=>i.map(i=>d[i]);
2
+ import{_ as e}from"../main.js";import{m as t}from"./hsfxutilsBiyhgSbR.js";const r=[{name:"counter",selector:'[data-hs-anim="counter"]',import:()=>e(()=>import("./hsfxcounterCHBYPnnN.js"),__vite__mapDeps([0,1]),import.meta.url)},{name:"marquee",selector:'[data-hs-marquee="wrapper"]',import:()=>e(()=>import("./hsfxmarqueeBZW0uarL.js"),__vite__mapDeps([2,1]),import.meta.url)}],a=(()=>{const e=r.filter(e=>document.querySelector(e.selector)).map(e=>e.import().catch(t=>(console.error(`[animations] Failed to preload ${e.name}:`,t),null)));return Promise.allSettled(e)})();async function o(){await a;const e=t(r),{loaded:o}=await e.scan();return{result:`animations initialized (${o.length} active)`,rescan:e.scan,destroy:e.destroy}}export{o as init};
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hsfxnormalizeRBQuLzMp.js","assets/hsfxutilsBiyhgSbR.js","assets/hsfxdefaultB8v7rms6.js","assets/hsfxanimationspsjD9e2k.js"])))=>i.map(i=>d[i]);
2
- import{c as e}from"./assets/hsfxutilsBiyhgSbR.js";const t={},s=function(e,s,o){let r=Promise.resolve();if(s&&s.length>0){let e=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");r=e(s.map(e=>{if((e=function(e){return"https://cdn.jsdelivr.net/npm/@hsfx/attr@2/dist/"+e}(e))in t)return;t[e]=!0;const s=e.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${o}`))return;const r=document.createElement("link");return r.rel=s?"stylesheet":"modulepreload",s||(r.as="script"),r.crossOrigin="",r.href=e,a&&r.setAttribute("nonce",a),document.head.appendChild(r),s?new Promise((t,s)=>{r.addEventListener("load",t),r.addEventListener("error",()=>s(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function a(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(const e of t||[])"rejected"===e.status&&a(e.reason);return e().catch(a)})},o=e._global.apiName;(async()=>{if(window[o]&&!Array.isArray(window[o])&&window[o].loaded)return;const t=Array.isArray(window[o])?window[o]:[],r={normalize:()=>s(()=>import("./assets/hsfxnormalizeRBQuLzMp.js"),__vite__mapDeps([0,1])),default:()=>s(()=>import("./assets/hsfxdefaultB8v7rms6.js"),__vite__mapDeps([2,1])),animations:()=>s(()=>import("./assets/hsfxanimationspsjD9e2k.js"),__vite__mapDeps([3,1]))};let a=[...document.querySelectorAll(`script[type="module"][src="${import.meta.url}"]`)];0===a.length&&(a=[...document.querySelectorAll('script[type="module"][src*="@hsfx/attr"]')].filter(e=>{const t=e.src,s=import.meta.url,o=t.match(/@hsfx\/attr(@[\d.]+)?/)?.[0],r=s.match(/@hsfx\/attr(@[\d.]+)?/)?.[0];return o&&r&&o.split("@")[0]===r.split("@")[0]}));const n={isSPA:a.some(e=>"true"===e.getAttribute("data-hs-spa"))},l={normalize:{modules:["normalize"],parallel:!1},default:{modules:["default"],parallel:!0}},i=async e=>{const t=window[o];if(t.process.has(e))return t.modules[e]?.loading;t.process.add(e);const s=t.modules[e]||{};let a;t.modules[e]=s,s.loading=new Promise((e,t)=>{s.resolve=e,s.reject=t});try{const{init:o}=await r[e](),n=await o()||{};a=n.destroy;const l=n.result;return s.destroy=()=>{a?.(),t.process.delete(e)},s.restart=()=>{s.destroy?.(),t.load(e)},s.resolve?.(l),delete s.resolve,delete s.reject,l}catch(n){throw a?.(),s.reject?.(n),t.process.delete(e),n}},d=async e=>{const t=l[e];if(t.parallel){const e=t.modules.map(e=>i(e));await Promise.allSettled(e)}else for(const s of t.modules)await i(s)},c=async()=>{await Promise.allSettled([r.normalize(),r.default(),r.animations()]),await d("normalize");const e=d("default"),t=i("animations");await e,(()=>{const e=new CustomEvent(`${o}:dom-ready`);window.dispatchEvent(e)})();const{initScrollAnimations:a}=await s(async()=>{const{initScrollAnimations:e}=await import("./assets/hsfxutilsBiyhgSbR.js").then(e=>e.u);return{initScrollAnimations:e}},[]);Promise.all([t,a()]).catch(e=>{console.error(`[${o}] Phase 3 (animations + scroll trigger) failed:`,e)})},u=[];window[o]={scripts:a,settings:n,modules:{},process:new Set,load:i,loaded:!1,push(...e){for(const[t,s]of e)"function"==typeof s?this.modules[t]?.loading?.then(s):this.load(t)},destroy(){for(const e in this.modules)this.modules[e]?.destroy?.()},async reinitialize(){this.loaded=!1,this.destroy(),this.modules={},this.process=new Set,await this.scanForEmbedModules(),await c(),this.loaded=!0},async scanForEmbedModules(){document.querySelectorAll(".w-embed").forEach(e=>{e.querySelectorAll("script[data-hs-module]").forEach(e=>{const t=e.getAttribute("data-hs-module-type"),s=e.getAttribute("data-hs-module");if(t&&s){const e=`data-hs-${t}-${s}`;r[e]&&this.load(e)}})})},ready(e){"function"==typeof e&&(this.loaded?e():u.push(e))},status(e){return e?{loaded:!!this.modules[e],loading:this.process.has(e)}:{loaded:Object.keys(this.modules),loading:[...this.process],phases:l}}};(async()=>{window[o].push(...t),document.querySelectorAll("iframe").forEach(e=>{const t=e.src;t&&(e.src="",e.src=t)}),await c(),window[o].loaded=!0,document.documentElement.classList.add(e._global.classes.ready),u.forEach(e=>{try{e()}catch{}}),u.length=0})().catch(()=>{})})();export{s as _};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/hsfxnormalizeRBQuLzMp.js","./assets/hsfxutilsBiyhgSbR.js","./assets/hsfxdefaultB8v7rms6.js","./assets/hsfxanimations4-YamNu6.js"])))=>i.map(i=>d[i]);
2
+ import{c as e}from"./assets/hsfxutilsBiyhgSbR.js";const t={},s=function(e,s,o){let r=Promise.resolve();if(s&&s.length>0){let e=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const a=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),l=n?.nonce||n?.getAttribute("nonce");r=e(s.map(e=>{if(e=function(e,t){return new URL(e,t).href}(e,o),e in t)return;t[e]=!0;const s=e.endsWith(".css"),r=s?'[rel="stylesheet"]':"";if(o)for(let t=a.length-1;t>=0;t--){const o=a[t];if(o.href===e&&(!s||"stylesheet"===o.rel))return}else if(document.querySelector(`link[href="${e}"]${r}`))return;const n=document.createElement("link");return n.rel=s?"stylesheet":"modulepreload",s||(n.as="script"),n.crossOrigin="",n.href=e,l&&n.setAttribute("nonce",l),document.head.appendChild(n),s?new Promise((t,s)=>{n.addEventListener("load",t),n.addEventListener("error",()=>s(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function a(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(const e of t||[])"rejected"===e.status&&a(e.reason);return e().catch(a)})},o=e._global.apiName;(async()=>{if(window[o]&&!Array.isArray(window[o])&&window[o].loaded)return;const t=Array.isArray(window[o])?window[o]:[],r={normalize:()=>s(()=>import("./assets/hsfxnormalizeRBQuLzMp.js"),__vite__mapDeps([0,1]),import.meta.url),default:()=>s(()=>import("./assets/hsfxdefaultB8v7rms6.js"),__vite__mapDeps([2,1]),import.meta.url),animations:()=>s(()=>import("./assets/hsfxanimations4-YamNu6.js"),__vite__mapDeps([3,1]),import.meta.url)};let a=[...document.querySelectorAll(`script[type="module"][src="${import.meta.url}"]`)];0===a.length&&(a=[...document.querySelectorAll('script[type="module"][src*="@hsfx/attr"]')].filter(e=>{const t=e.src,s=import.meta.url,o=t.match(/@hsfx\/attr(@[\d.]+)?/)?.[0],r=s.match(/@hsfx\/attr(@[\d.]+)?/)?.[0];return o&&r&&o.split("@")[0]===r.split("@")[0]}));const n={isSPA:a.some(e=>"true"===e.getAttribute("data-hs-spa"))},l={normalize:{modules:["normalize"],parallel:!1},default:{modules:["default"],parallel:!0}},i=async e=>{const t=window[o];if(t.process.has(e))return t.modules[e]?.loading;t.process.add(e);const s=t.modules[e]||{};let a;t.modules[e]=s,s.loading=new Promise((e,t)=>{s.resolve=e,s.reject=t});try{const{init:o}=await r[e](),n=await o()||{};a=n.destroy;const l=n.result;return s.destroy=()=>{a?.(),t.process.delete(e)},s.restart=()=>{s.destroy?.(),t.load(e)},s.resolve?.(l),delete s.resolve,delete s.reject,l}catch(n){throw a?.(),s.reject?.(n),t.process.delete(e),n}},d=async e=>{const t=l[e];if(t.parallel){const e=t.modules.map(e=>i(e));await Promise.allSettled(e)}else for(const s of t.modules)await i(s)},c=async()=>{await Promise.allSettled([r.normalize(),r.default(),r.animations()]),await d("normalize");const e=d("default"),t=i("animations");await e,(()=>{const e=new CustomEvent(`${o}:dom-ready`);window.dispatchEvent(e)})();const{initScrollAnimations:a}=await s(async()=>{const{initScrollAnimations:e}=await import("./assets/hsfxutilsBiyhgSbR.js").then(e=>e.u);return{initScrollAnimations:e}},[],import.meta.url);Promise.all([t,a()]).catch(e=>{console.error(`[${o}] Phase 3 (animations + scroll trigger) failed:`,e)})},u=[];window[o]={scripts:a,settings:n,modules:{},process:new Set,load:i,loaded:!1,push(...e){for(const[t,s]of e)"function"==typeof s?this.modules[t]?.loading?.then(s):this.load(t)},destroy(){for(const e in this.modules)this.modules[e]?.destroy?.()},async reinitialize(){this.loaded=!1,this.destroy(),this.modules={},this.process=new Set,await this.scanForEmbedModules(),await c(),this.loaded=!0},async scanForEmbedModules(){document.querySelectorAll(".w-embed").forEach(e=>{e.querySelectorAll("script[data-hs-module]").forEach(e=>{const t=e.getAttribute("data-hs-module-type"),s=e.getAttribute("data-hs-module");if(t&&s){const e=`data-hs-${t}-${s}`;r[e]&&this.load(e)}})})},ready(e){"function"==typeof e&&(this.loaded?e():u.push(e))},status(e){return e?{loaded:!!this.modules[e],loading:this.process.has(e)}:{loaded:Object.keys(this.modules),loading:[...this.process],phases:l}}};(async()=>{window[o].push(...t),document.querySelectorAll("iframe").forEach(e=>{const t=e.src;t&&(e.src="",e.src=t)}),await c(),window[o].loaded=!0,document.documentElement.classList.add(e._global.classes.ready),u.forEach(e=>{try{e()}catch{}}),u.length=0})().catch(()=>{})})();export{s as _};
package/dist/main.js.br CHANGED
Binary file
package/dist/main.js.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hsfx/attr",
3
- "version": "2.0.21",
3
+ "version": "2.0.22",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "license": "UNLICENSED",
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hsfxcounterCHBYPnnN.js","assets/hsfxutilsBiyhgSbR.js","assets/hsfxmarqueeBZW0uarL.js"])))=>i.map(i=>d[i]);
2
- import{_ as e}from"../main.js";import{m as t}from"./hsfxutilsBiyhgSbR.js";const r=[{name:"counter",selector:'[data-hs-anim="counter"]',import:()=>e(()=>import("./hsfxcounterCHBYPnnN.js"),__vite__mapDeps([0,1]))},{name:"marquee",selector:'[data-hs-marquee="wrapper"]',import:()=>e(()=>import("./hsfxmarqueeBZW0uarL.js"),__vite__mapDeps([2,1]))}],a=(()=>{const e=r.filter(e=>document.querySelector(e.selector)).map(e=>e.import().catch(t=>(console.error(`[animations] Failed to preload ${e.name}:`,t),null)));return Promise.allSettled(e)})();async function o(){await a;const e=t(r),{loaded:o}=await e.scan();return{result:`animations initialized (${o.length} active)`,rescan:e.scan,destroy:e.destroy}}export{o as init};