Socket
Socket
Sign inDemoInstall

@finsweet/attributes-a11y

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finsweet/attributes-a11y - npm Package Compare versions

Comparing version 0.2.1 to 1.0.0

2

a11y.js

@@ -1,1 +0,1 @@

"use strict";(()=>{var q=Object.create;var v=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!z.call(e,r)&&r!==o&&v(e,r,{get:()=>t[r],enumerable:!(s=X(t,r))||s.enumerable});return e};var Z=(e,t,o)=>(o=e!=null?q(W(e)):{},J(t||!e||!e.__esModule?v(o,"default",{value:e,enumerable:!0}):o,e));var k=Q((Ft,D)=>{D.exports=it;function it(e,t,o,s){var r,i,n;return function(){if(n=this,i=Array.prototype.slice.call(arguments),r&&(o||s))return;if(!o)return u(),r=setTimeout(a,t),r;r=setTimeout(u,t),e.apply(n,i);function a(){u(),e.apply(n,i)}function u(){clearTimeout(r),r=null}}}});var m="fs-attributes";var p="a11y";var w="cmsattribute";var g="inputcounter";var U="modal";var y="support";var B=async(...e)=>{var o;let t=[];for(let s of e){let r=await((o=window.fsAttributes[s])==null?void 0:o.loading);t.push(r)}return t};var T=()=>{};function I(e,t,o,s){return e?(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)):T}var R=(e,t)=>(Array.isArray(t)||(t=[t]),t.map(s=>e.dispatchEvent(new Event(s,{bubbles:!0}))).every(s=>s));var b=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length);function C(e,t,o){var r;let s=window.fsAttributes[e];return s.destroy=o||T,(r=s.resolve)==null||r.call(s,t),t}var K=(e,t="1",o="iife")=>{let r=`${e}${o==="esm"?".esm":""}.js`;return`https://cdn.jsdelivr.net/npm/@finsweet/attributes-${e}@${t}/${r}`};var tt=`${m}-${y}`,N=async()=>{var r;let{fsAttributes:e,location:t}=window,{host:o,searchParams:s}=new URL(t.href);return!o.includes("webflow.io")||!s.has(tt)?!1:(r=e.import)==null?void 0:r.call(e,y,"1")};var d=e=>{let t=(r,i,n)=>{let c=e[r],{key:a,values:u}=c,l;if(!i)return`[${a}]`;let x=u==null?void 0:u[i];typeof x=="string"?l=x:l=x(n&&"instanceIndex"in n?n.instanceIndex:void 0);let E=n&&"caseInsensitive"in n&&n.caseInsensitive?"i":"";if(!(n!=null&&n.operator))return`[${a}="${l}"${E}]`;switch(n.operator){case"prefixed":return`[${a}^="${l}"${E}]`;case"suffixed":return`[${a}$="${l}"${E}]`;case"contains":return`[${a}*="${l}"${E}]`}};function o(r,i){let n=t("element",r,i),c=(i==null?void 0:i.scope)||document;return i!=null&&i.all?[...c.querySelectorAll(n)]:c.querySelector(n)}return[t,o,(r,i)=>{let n=e[i];return n?r.getAttribute(n.key):null}]};var A={preventLoad:{key:`${m}-preventload`},debugMode:{key:`${m}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${m}-dev`}},[_,ht]=d(A);var h=e=>{let{currentScript:t}=document,o={};if(!t)return{attributes:o,preventsLoad:!1};let r={preventsLoad:typeof t.getAttribute(A.preventLoad.key)=="string",attributes:o};for(let i in e){let n=t.getAttribute(e[i]);r.attributes[i]=n}return r};var P=({scriptAttributes:e,attributeKey:t,version:o,init:s})=>{var c;et(),(c=window.fsAttributes)[t]||(c[t]={});let{preventsLoad:r,attributes:i}=h(e),n=window.fsAttributes[t];n.version=o,n.init=s,r||(window.Webflow||(window.Webflow=[]),window.Webflow.push(()=>s(i)))},et=()=>{let e=ot();if(window.fsAttributes&&!Array.isArray(window.fsAttributes)){S(window.fsAttributes,e);return}let t=rt(e);S(t,e),st(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,N()},rt=e=>{let t={cms:{},push(...o){var s,r;for(let[i,n]of o)(r=(s=this[i])==null?void 0:s.loading)==null||r.then(n)},async import(o,s){let r=t[o];return r||new Promise(i=>{let n=document.createElement("script");n.src=K(o,s),n.async=!0,n.onload=()=>{let[c]=S(t,[o]);i(c)},document.head.append(n)})},destroy(){var o,s;for(let r of e)(s=(o=window.fsAttributes[r])==null?void 0:o.destroy)==null||s.call(o)}};return t},ot=()=>{let e=_("src","finsweet",{operator:"contains"}),t=_("dev");return[...document.querySelectorAll(`script${e}, script${t}`)].reduce((r,i)=>{var c;let n=i.getAttribute(A.dev.key)||((c=i.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return n&&!r.includes(n)&&r.push(n),r},[])},S=(e,t)=>t.map(s=>{let r=e[s];return r||(e[s]={},r=e[s],r.loading=new Promise(i=>{r.resolve=n=>{i(n),delete r.resolve}}),r)}),st=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var L="0.2.1";var O="tabindex";var M="aria-expanded";var f="aria-controls";var Y=Z(k(),1);var ct=`fs-${p}`,at="autofocus",ut={element:{key:`${ct}-element`,values:{autoFocus:at}}},[qt,$]=d(ut);var F=()=>{let t=[...document.querySelectorAll(`[${f}]`)].map(lt);return()=>{for(let o of t)o==null||o.disconnect()}},lt=e=>{let t=e.getAttribute(f);if(!t)return;let o=document.getElementById(t);if(!o){e.removeAttribute(f);return}let s=$("autoFocus",{operator:"prefixed",scope:o}),r=b(o);V(e,r);let n=(0,Y.default)(()=>{let a=b(o);V(e,a),s&&!r&&a&&s.focus(),r=a},100),c=new MutationObserver(n);return c.observe(o,{attributes:!0,attributeFilter:["style","class"]}),c},V=(e,t)=>{e.setAttribute(M,String(t))};var mt=[HTMLAnchorElement,HTMLButtonElement,HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement,HTMLVideoElement,HTMLAudioElement],H=()=>{let t=I(window,"keydown",o=>{var i;let{target:s,key:r}=o;r!=="Enter"&&r!==" "||!s||!((i=s.getAttribute)!=null&&i.call(s,O))||mt.some(n=>s instanceof n)||(o.preventDefault(),R(s,"click"))});return()=>{t()}};var j=async()=>{await B(w,U,g);let e=H(),t=F();return C(p,void 0,()=>{e(),t()})};P({init:j,version:L,attributeKey:p});})();
"use strict";(()=>{var X=Object.create;var v=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Z=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of W(t))!Q.call(e,r)&&r!==o&&v(e,r,{get:()=>t[r],enumerable:!(s=G(t,r))||s.enumerable});return e};var tt=(e,t,o)=>(o=e!=null?X(z(e)):{},Z(t||!e||!e.__esModule?v(o,"default",{value:e,enumerable:!0}):o,e));var M=J((Ft,D)=>{D.exports=ct;function ct(e,t,o,s){var r,i,n;return function(){if(n=this,i=Array.prototype.slice.call(arguments),r&&(o||s))return;if(!o)return u(),r=setTimeout(a,t),r;r=setTimeout(u,t),e.apply(n,i);function a(){u(),e.apply(n,i)}function u(){clearTimeout(r),r=null}}}});var m="fs-attributes";var p="a11y",g="accordion";var U="cmsattribute";var w="inputcounter";var B="modal";var I="support";var C=async(...e)=>{var o;let t=[];for(let s of e){let r=await((o=window.fsAttributes[s])==null?void 0:o.loading);t.push(r)}return t};var T=()=>{};function R(e,t,o,s){return e?(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)):T}var y=(e,t)=>(Array.isArray(t)||(t=[t]),t.map(s=>e.dispatchEvent(new Event(s,{bubbles:!0}))).every(s=>s));var b=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length);function N(e,t,o){var r;let s=window.fsAttributes[e];return s.destroy=o||T,(r=s.resolve)==null||r.call(s,t),t}var K=(e,t="1",o="iife")=>{let r=`${e}${o==="esm"?".esm":""}.js`;return`https://cdn.jsdelivr.net/npm/@finsweet/attributes-${e}@${t}/${r}`};var et=`${m}-${I}`,h=async()=>{var r;let{fsAttributes:e,location:t}=window,{host:o,searchParams:s}=new URL(t.href);return!o.includes("webflow.io")||!s.has(et)?!1:(r=e.import)==null?void 0:r.call(e,I,"1")};var d=e=>{let t=(r,i,n)=>{let c=e[r],{key:a,values:u}=c,l;if(!i)return`[${a}]`;let x=u==null?void 0:u[i];typeof x=="string"?l=x:l=x(n&&"instanceIndex"in n?n.instanceIndex:void 0);let E=n&&"caseInsensitive"in n&&n.caseInsensitive?"i":"";if(!(n!=null&&n.operator))return`[${a}="${l}"${E}]`;switch(n.operator){case"prefixed":return`[${a}^="${l}"${E}]`;case"suffixed":return`[${a}$="${l}"${E}]`;case"contains":return`[${a}*="${l}"${E}]`}};function o(r,i){let n=t("element",r,i),c=(i==null?void 0:i.scope)||document;return i!=null&&i.all?[...c.querySelectorAll(n)]:c.querySelector(n)}return[t,o,(r,i)=>{let n=e[i];return n?r.getAttribute(n.key):null}]};var A={preventLoad:{key:`${m}-preventload`},debugMode:{key:`${m}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${m}-dev`}},[_,Ot]=d(A);var O=e=>{let{currentScript:t}=document,o={};if(!t)return{attributes:o,preventsLoad:!1};let r={preventsLoad:typeof t.getAttribute(A.preventLoad.key)=="string",attributes:o};for(let i in e){let n=t.getAttribute(e[i]);r.attributes[i]=n}return r};var P=({scriptAttributes:e,attributeKey:t,version:o,init:s})=>{var c;rt(),(c=window.fsAttributes)[t]||(c[t]={});let{preventsLoad:r,attributes:i}=O(e),n=window.fsAttributes[t];n.version=o,n.init=s,r||(window.Webflow||(window.Webflow=[]),window.Webflow.push(()=>s(i)))},rt=()=>{let e=st();if(window.fsAttributes&&!Array.isArray(window.fsAttributes)){S(window.fsAttributes,e);return}let t=ot(e);S(t,e),nt(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,h()},ot=e=>{let t={cms:{},push(...o){var s,r;for(let[i,n]of o)(r=(s=this[i])==null?void 0:s.loading)==null||r.then(n)},async import(o,s){let r=t[o];return r||new Promise(i=>{let n=document.createElement("script");n.src=K(o,s),n.async=!0,n.onload=()=>{let[c]=S(t,[o]);i(c)},document.head.append(n)})},destroy(){var o,s;for(let r of e)(s=(o=window.fsAttributes[r])==null?void 0:o.destroy)==null||s.call(o)}};return t},st=()=>{let e=_("src","finsweet",{operator:"contains"}),t=_("dev");return[...document.querySelectorAll(`script${e}, script${t}`)].reduce((r,i)=>{var c;let n=i.getAttribute(A.dev.key)||((c=i.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return n&&!r.includes(n)&&r.push(n),r},[])},S=(e,t)=>t.map(s=>{let r=e[s];return r||(e[s]={},r=e[s],r.loading=new Promise(i=>{r.resolve=n=>{i(n),delete r.resolve}}),r)}),nt=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var L="1.0.0";var F=tt(M(),1);var k="tabindex";var $="aria-expanded";var f="aria-controls";var at=`fs-${p}`,ut="autofocus",lt={element:{key:`${at}-element`,values:{autoFocus:ut}}},[Xt,V]=d(lt);var H=()=>{let t=[...document.querySelectorAll(`[${f}]`)].map(mt);return()=>{for(let o of t)o==null||o.disconnect()}},mt=e=>{let t=e.getAttribute(f);if(!t)return;let o=document.getElementById(t);if(!o){e.removeAttribute(f);return}let s=V("autoFocus",{operator:"prefixed",scope:o}),r=b(o);Y(e,r);let n=(0,F.default)(()=>{let a=b(o);Y(e,a),s&&!r&&a&&s.focus(),r=a},100),c=new MutationObserver(n);return c.observe(o,{attributes:!0,attributeFilter:["style","class"]}),c},Y=(e,t)=>{e.setAttribute($,String(t))};var pt=[HTMLAnchorElement,HTMLButtonElement,HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement,HTMLVideoElement,HTMLAudioElement],j=()=>{let t=R(window,"keydown",o=>{var i;let{target:s,key:r}=o;r!=="Enter"&&r!==" "||!s||!((i=s.getAttribute)!=null&&i.call(s,k))||pt.some(n=>s instanceof n)||(o.preventDefault(),y(s,"click"))});return()=>{t()}};var q=async()=>{await C(U,B,w,g);let e=j(),t=H();return N(p,void 0,()=>{e(),t()})};P({init:q,version:L,attributeKey:p});})();

@@ -1,1 +0,1 @@

[{"version":"0.2.1","markdown":"- 460f73c6: Ensure compatibility with modal and inputcounter"},{"version":"0.2.0","markdown":"- e4b3b680: Created new `window.fsAttributes.destroy()` method to support SPA environments.\n This new method allows users to destroy all Attributes instances, cleaning up event listeners, observers, states, global variables, etc.\n\n Websites that use a client-side router that simulates an SPA environment like [barba.js](https://barba.js.org/) or [Swup](https://swup.js.org/) can now properly init and destroy Attributes.\n After destroying, Attributes can be manually re-initted by calling `window.fsAttribute[ATTRIBUTE_KEY].init()`.\n\n Updated changesets system, now all updates will be correctly reflected in [the official updates page](https://www.finsweet.com/attributes/updates)."},{"version":"0.1.3","markdown":"- Updated dependencies [4792998a]\n - @global/constants@1.2.0\n - @global/factory@1.1.5"},{"version":"0.1.2","markdown":"- Updated dependencies [07f32375]\n - @global/constants@1.1.0\n - @global/factory@1.1.4"},{"version":"0.1.1","markdown":"- 62a2d7f3: Ensured aria-expanded is always set for aria-controls controllers"},{"version":"0.1.0","markdown":"- a14e67a5: Added aria-controls and keyboard-clicks functionalities."}]
[{"version":"1.0.0","markdown":"- 1eb9c91e: Added support for `fs-accordion` + released official v1.0.0"},{"version":"0.2.1","markdown":"- 460f73c6: Ensure compatibility with modal and inputcounter"},{"version":"0.2.0","markdown":"- e4b3b680: Created new `window.fsAttributes.destroy()` method to support SPA environments.\n This new method allows users to destroy all Attributes instances, cleaning up event listeners, observers, states, global variables, etc.\n\n Websites that use a client-side router that simulates an SPA environment like [barba.js](https://barba.js.org/) or [Swup](https://swup.js.org/) can now properly init and destroy Attributes.\n After destroying, Attributes can be manually re-initted by calling `window.fsAttribute[ATTRIBUTE_KEY].init()`.\n\n Updated changesets system, now all updates will be correctly reflected in [the official updates page](https://www.finsweet.com/attributes/updates)."},{"version":"0.1.3","markdown":"- Updated dependencies [4792998a]\n - @global/constants@1.2.0\n - @global/factory@1.1.5"},{"version":"0.1.2","markdown":"- Updated dependencies [07f32375]\n - @global/constants@1.1.0\n - @global/factory@1.1.4"},{"version":"0.1.1","markdown":"- 62a2d7f3: Ensured aria-expanded is always set for aria-controls controllers"},{"version":"0.1.0","markdown":"- a14e67a5: Added aria-controls and keyboard-clicks functionalities."}]
{
"name": "@finsweet/attributes-a11y",
"version": "0.2.1",
"version": "1.0.0",
"description": "Accessibility JS solutions for Webflow.",

@@ -5,0 +5,0 @@ "homepage": "https://www.finsweet.com/attributes",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc