@ulu/frontend
Advanced tools
Comparing version 0.0.21 to 0.0.22
# Change Log | ||
## Version 0.1.0 | @in-progress | ||
## Version 0.0.22 | ||
@@ -9,2 +9,4 @@ - Add in other common component modules | ||
- badge | ||
- fill-context | ||
- Add .crop-margins to helpers/utilities | ||
@@ -11,0 +13,0 @@ ## Version 0.0.21 |
@@ -1,1 +0,1 @@ | ||
var w=Object.defineProperty;var E=(i,e,t)=>e in i?w(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var f=(i,e,t)=>(E(i,typeof e!="symbol"?e+"":e,t),t);function m(i,e){var t=i.indexOf(e);t>-1&&i.splice(t,1)}function x(i,e,t,o){var s;return function(){var h=o||this,a=arguments,d=function(){s=null,t||i.apply(h,a)},l=t&&!s;clearTimeout(s),s=setTimeout(d,e),l&&i.apply(h,a)}}const b={pageModified(i){i.dispatchEvent(new Event(g("pageModified"),{bubbles:!0}))},pageResized(i){i.dispatchEvent(new Event(g("pageResized"),{bubbles:!0}))}};window.addEventListener("resize",x(()=>C("pageResized",document),250));function C(i,e){b[i]?b[i](e):console.warn(`Unable to dispatch site event: ${i} in context:`,e)}function g(i){return"ulu:"+i}const I={debug:!1,warningsAlways:!0,errorsAlways:!0,outputContext:!1},_="console"in window;function D(i){return _&&I.debug&&((i==null?void 0:i.debug)||i==null)}function B(i){var e;return typeof i=="object"&&((e=i==null?void 0:i.constructor)==null?void 0:e.name)}function y(i,e,t){const o=B(e)||"Logger";console[i](o,...t)}function c(i,...e){D(i)&&y("log",i,e)}function k(i,...e){y("error",i,e)}window.addEventListener(g("pageResized"),()=>{v.instances.forEach(i=>i.update())});const r=class r{constructor(e){Object.assign(this,r.defaults,e),this.active=null,this.previous=null,this.activeIndex=null,this.resizeDirection=null,this.previousIndex=null,this.breakpoints={},this.onChangeCallbacks=[],this.order.forEach(t=>this.breakpoints[t]=new P(t,this)),c(this,this),this.update(),r.instances.push(this)}onChange(e){this.onChangeCallbacks.push(e)}removeOnChange(e){m(this.onChangeCallbacks,e)}getBreakpointInPsuedo(){return window.getComputedStyle(this.element,this.psuedoSelector).content.replace(/^"|"$/g,"")}getBreakpointInProperty(){return getComputedStyle(this.element).getPropertyValue(this.customProperty)}getBreakpoint(){return this.valueFromPsuedo?this.getBreakpointInPsuedo():this.getBreakpointInProperty()}update(){const e=this.getBreakpoint();if(!e){k(this,"Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!");return}if(e===this.active)return;this.previous=this.active,this.previousIndex=this.activeIndex;const t=this.order.indexOf(e);this.active=e,this.activeIndex=t;const o=this.at(this.active),s=n=>this.at(n),u=this.order.slice(t).map(s),h=this.order.slice(0,t).map(s),a=this.order.slice(0,t+1).map(s),d=this.order.slice(t+1).map(s),l=this.order.slice().map(s);l.splice(t,1),c(this,"max:",u.map(n=>n.name).join()),c(this,"min:",a.map(n=>n.name).join()),u.forEach(n=>n._setDirection("max",!0)),a.forEach(n=>n._setDirection("min",!0)),o._setDirection("only",!0),h.forEach(n=>n._setDirection("max",!1)),d.forEach(n=>n._setDirection("min",!1)),l.forEach(n=>n._setDirection("only",!1)),this.previousIndex!==null&&(this.resizeDirection=this.previousIndex<t?"up":"down"),this.onChangeCallbacks.forEach(n=>n(this))}at(e){const t=this.breakpoints[e];return e||k(this,"Unable to find breakpoint for:",t),t}};f(r,"instances",[]),f(r,"defaults",{element:document.documentElement,valueFromPsuedo:!1,customProperty:"--breakpoint",psuedoSelector:":before",order:["none","small","medium","large"],debug:!1});let v=r;class p{constructor(e,t){this.direction=e,this.active=!1,this.on=[],this.off=[],this.breakpoint=t}change(e){this.active!==e&&(e?this._call(!0):this.active&&this._call(!1),this.active=e)}_call(e){(e?this.on:this.off).forEach(o=>o()),c(this.breakpoint._manager,`Handlers called (${e?"on":"off"}): ${this.direction}`)}getHandlers(e){return typeof e!="object"?{on:e}:e}add(e){const t=this.getHandlers(e);t.on&&this.on.push(t.on),t.off&&this.off.push(t.off),this.active&&t.on&&(t.on(),c(this.breakpoint._manager,`Handler called immediately: ${this.direction}`,t.on))}remove(e){const t=this.getHandlers(e);t.on&&m(this.on,t.on),t.off&&m(this.off,t.off)}}class P{constructor(e,t){this.directions={max:new p("max",this),min:new p("min",this),only:new p("only",this)},this._manager=t,this.name=e}_setDirection(e,t){this.directions[e].change(t)}max(e){this.directions.max.add(e)}min(e){this.directions.min.add(e)}only(e){this.directions.only.add(e)}remove(e,t){(t?[t]:["max","min","only"]).forEach(s=>s.remove(e))}log(...e){e.unshift(`Breakpoint (${this.name}):`),this._manager.log.apply(this._manager,e)}} | ||
var U=Object.defineProperty;var J=(a,i,n)=>i in a?U(a,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[i]=n;var C=(a,i,n)=>(J(a,typeof i!="symbol"?i+"":i,n),n);function A(a,i){var n=a.indexOf(i);n>-1&&a.splice(n,1)}function V(a,i,n,p){var l;return function(){var h=p||this,u=arguments,y=function(){l=null,n||a.apply(h,u)},v=n&&!l;clearTimeout(l),l=setTimeout(y,i),v&&a.apply(h,u)}}const L={pageModified(a){a.dispatchEvent(new Event(_("pageModified"),{bubbles:!0}))},pageResized(a){a.dispatchEvent(new Event(_("pageResized"),{bubbles:!0}))}};window.addEventListener("resize",V(()=>G("pageResized",document),250));function G(a,i){L[a]?L[a](i):console.warn(`Unable to dispatch site event: ${a} in context:`,i)}function _(a){return"ulu:"+a}const Q={debug:!1,warningsAlways:!0,errorsAlways:!0,outputContext:!1},X="console"in window;function Y(a){return X&&Q.debug&&((a==null?void 0:a.debug)||a==null)}function Z(a){var i;return typeof a=="object"&&((i=a==null?void 0:a.constructor)==null?void 0:i.name)}function B(a,i,n){const p=Z(i)||"Logger";console[a](p,...n)}function x(a,...i){Y(a)&&B("log",a,i)}function j(a,...i){B("error",a,i)}window.addEventListener(_("pageResized"),()=>{I.instances.forEach(a=>a.update())});const E=class E{constructor(i){Object.assign(this,E.defaults,i),this.active=null,this.previous=null,this.activeIndex=null,this.resizeDirection=null,this.previousIndex=null,this.breakpoints={},this.onChangeCallbacks=[],this.order.forEach(n=>this.breakpoints[n]=new tt(n,this)),x(this,this),this.update(),E.instances.push(this)}onChange(i){this.onChangeCallbacks.push(i)}removeOnChange(i){A(this.onChangeCallbacks,i)}getBreakpointInPsuedo(){return window.getComputedStyle(this.element,this.psuedoSelector).content.replace(/^"|"$/g,"")}getBreakpointInProperty(){return getComputedStyle(this.element).getPropertyValue(this.customProperty)}getBreakpoint(){return this.valueFromPsuedo?this.getBreakpointInPsuedo():this.getBreakpointInProperty()}update(){const i=this.getBreakpoint();if(!i){j(this,"Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!");return}if(i===this.active)return;this.previous=this.active,this.previousIndex=this.activeIndex;const n=this.order.indexOf(i);this.active=i,this.activeIndex=n;const p=this.at(this.active),l=b=>this.at(b),c=this.order.slice(n).map(l),h=this.order.slice(0,n).map(l),u=this.order.slice(0,n+1).map(l),y=this.order.slice(n+1).map(l),v=this.order.slice().map(l);v.splice(n,1),x(this,"max:",c.map(b=>b.name).join()),x(this,"min:",u.map(b=>b.name).join()),c.forEach(b=>b._setDirection("max",!0)),u.forEach(b=>b._setDirection("min",!0)),p._setDirection("only",!0),h.forEach(b=>b._setDirection("max",!1)),y.forEach(b=>b._setDirection("min",!1)),v.forEach(b=>b._setDirection("only",!1)),this.previousIndex!==null&&(this.resizeDirection=this.previousIndex<n?"up":"down"),this.onChangeCallbacks.forEach(b=>b(this))}at(i){const n=this.breakpoints[i];return i||j(this,"Unable to find breakpoint for:",n),n}};C(E,"instances",[]),C(E,"defaults",{element:document.documentElement,valueFromPsuedo:!1,customProperty:"--breakpoint",psuedoSelector:":before",order:["none","small","medium","large"],debug:!1});let I=E;class O{constructor(i,n){this.direction=i,this.active=!1,this.on=[],this.off=[],this.breakpoint=n}change(i){this.active!==i&&(i?this._call(!0):this.active&&this._call(!1),this.active=i)}_call(i){(i?this.on:this.off).forEach(p=>p()),x(this.breakpoint._manager,`Handlers called (${i?"on":"off"}): ${this.direction}`)}getHandlers(i){return typeof i!="object"?{on:i}:i}add(i){const n=this.getHandlers(i);n.on&&this.on.push(n.on),n.off&&this.off.push(n.off),this.active&&n.on&&(n.on(),x(this.breakpoint._manager,`Handler called immediately: ${this.direction}`,n.on))}remove(i){const n=this.getHandlers(i);n.on&&A(this.on,n.on),n.off&&A(this.off,n.off)}}class tt{constructor(i,n){this.directions={max:new O("max",this),min:new O("min",this),only:new O("only",this)},this._manager=n,this.name=i}_setDirection(i,n){this.directions[i].change(n)}max(i){this.directions.max.add(i)}min(i){this.directions.min.add(i)}only(i){this.directions.only.add(i)}remove(i,n){(n?[n]:["max","min","only"]).forEach(l=>l.remove(i))}log(...i){i.unshift(`Breakpoint (${this.name}):`),this._manager.log.apply(this._manager,i)}}function et(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var F={exports:{}};(function(a,i){(function(n,p){a.exports=p()})(window,function(){return function(n){var p={};function l(c){if(p[c])return p[c].exports;var h=p[c]={i:c,l:!1,exports:{}};return n[c].call(h.exports,h,h.exports,l),h.l=!0,h.exports}return l.m=n,l.c=p,l.d=function(c,h,u){l.o(c,h)||Object.defineProperty(c,h,{enumerable:!0,get:u})},l.r=function(c){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(c,"__esModule",{value:!0})},l.t=function(c,h){if(1&h&&(c=l(c)),8&h||4&h&&typeof c=="object"&&c&&c.__esModule)return c;var u=Object.create(null);if(l.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:c}),2&h&&typeof c!="string")for(var y in c)l.d(u,y,(function(v){return c[v]}).bind(null,y));return u},l.n=function(c){var h=c&&c.__esModule?function(){return c.default}:function(){return c};return l.d(h,"a",h),h},l.o=function(c,h){return Object.prototype.hasOwnProperty.call(c,h)},l.p="",l(l.s=0)}([function(n,p,l){l.r(p),l.d(p,"AriaTablist",function(){return D});var c=35,h=36,u=37,y=38,v=39,b=40,$=46,S=13,M=32,q={37:-1,38:-1,39:1,40:1},z=function(){function s(t){this.tabs=t.tabs,this.panels=t.panels,this.options=t.options,this.open=this.open.bind(t),this.close=this.close.bind(t),this.delete=this.delete.bind(t),this.destroy=this.destroy.bind(t),t.tablist.ariaTablist=this}return s.prototype.open=function(t,e){this.checkMultiple(),this.activateTabWithTimer.apply(this,[t,e,!0])},s.prototype.close=function(t,e){this.checkMultiple(),this.deactivateTab.apply(this,[t,e,!0]),this.makeFocusable()},s.prototype.delete=function(t){this.determineDeletable.call(this,t)},s.prototype.destroy=function(){this.destroy.call(this)},s}(),N=function(s){for(var t in s===void 0&&(s={}),this.delay=0,this.deletable=!1,this.focusableTabs=!1,this.focusablePanels=!0,this.arrowActivation=!1,this.allArrows=!1,this.tabSelector='[role="tab"]',this.tabindex=0,s)s.hasOwnProperty(t)&&s[t]!==void 0&&(this[t]=s[t])};function k(s){s&&typeof s.preventDefault=="function"&&s.preventDefault()}function m(s,t){return s.getAttribute&&s.getAttribute(t)||""}function f(s,t,e){s&&m(s,t)!==e&&s.setAttribute&&s.setAttribute(t,e)}function T(s,t){s&&t&&s.removeAttribute&&t.split(" ").forEach(function(e){return e&&s.removeAttribute(e)})}var P=0,W=function(){function s(t,e){if(this.tabs=[],this.panels=[],t&&t.nodeType===1){var o=t.ariaTablist;o&&typeof o.destroy=="function"&&o.destroy(),P+=1,this.tablist=t,this.options=new N(e),this.api=new z(this),this.init()}}return s.prototype.checkMultiple=function(){this.multiple=m(this.tablist,"aria-multiselectable")==="true"},s.prototype.triggerOptionCallback=function(t,e){if(e===void 0&&(e=[]),this.options&&typeof this.options[t]=="function")return this.options[t].apply(this.api,e)},s.prototype.makeFocusable=function(){for(var t=""+(this.options.tabindex||0),e=0,o=this.tabs.length;e<o;e+=1)if(m(this.tabs[e],"tabindex")===t)return;f(this.tabs[0],"tabindex",t)},s.prototype.setCoreAttributes=function(t,e,o){var r=this.options.tabindex||"0";this.options.focusableTabs&&f(t,"tabindex",r),this.options.focusablePanels&&f(e,"tabindex",r),t.id||f(t,"id","aria-tablist-"+P+"-tab-"+o),e.id||f(e,"id","aria-tablist-"+P+"-panel-"+o),f(t,"role","tab"),f(e,"role","tabpanel"),f(t,"aria-controls",e.id),f(e,"aria-labelledby",t.id)},s.prototype.getTabPanel=function(t){var e=typeof t=="number"?this.tabs[t]:t;if(!e||e.nodeType!==1)return null;var o=typeof t=="number"?this.panels[t]:null;if(o)return o;var r=m(e,"aria-controls");return r||(r=m(e,"data-controls")),r&&(o=document.getElementById(r)),o||(r&&T(e,"aria-controls"),e.id&&(o=document.querySelector('[aria-labelledby="'+e.id+'"]')),o||(o=document.querySelector('[data-labelledby="'+e.id+'"]'))),o},s.prototype.generateArrays=function(t){this.tabs.splice(0),this.panels.splice(0);var e=this.tablist.querySelectorAll(this.options.tabSelector);t&&!e.length&&(e=this.tablist.childNodes);for(var o=0,r=e.length;o<r;o+=1){var d=e[o];if(d&&d.nodeType===1&&!(this.panels.indexOf(d)>-1)){var g=this.getTabPanel(d);g?(this.tabs.push(d),this.panels.push(g),this.setCoreAttributes(d,g,o),d._ariaTablistTabIndex=this.tabs.length-1):m(d,"role")==="tab"&&T(d,"role")}}},s.prototype.elementIsTab=function(t){return!!(t&&this.tabs.indexOf(t)>-1)},s.prototype.addListenersToTab=function(t){var e=this.tabs[t];e.addEventListener("keydown",this.tabKeydownEvent),e.addEventListener("keyup",this.tabKeyupEvent),e.addEventListener("click",this.tabClickEvent)},s.prototype.tabClickEvent=function(t){var e=t.target;do{if(this.elementIsTab(e))return this.checkMultiple(),k(t),this.activateTabWithTimer(e,!1);e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1)},s.prototype.tabKeydownEvent=function(t){if(this.elementIsTab(t.target))switch(t.keyCode){case c:k(t),this.focusLastTab();break;case h:k(t),this.focusFirstTab();break;case y:case b:case u:case v:this.processArrowPress(t);break;case M:case S:k(t)}},s.prototype.tabKeyupEvent=function(t){var e=t.target;if(this.elementIsTab(e))switch(t.keyCode){case $:this.determineDeletable(e);break;case S:case M:this.checkMultiple(),k(t),this.activateTabWithTimer(e)}},s.prototype.processArrowPress=function(t){var e=t.keyCode;(this.options.allArrows||(m(this.tablist,"aria-orientation")==="vertical"?e===y||e===b:e===u||e===v))&&this.switchTabOnArrowPress(t)},s.prototype.switchTabOnArrowPress=function(t){var e=t.keyCode,o=q[e],r=t.target._ariaTablistTabIndex;if(o&&typeof r=="number"){k(t);var d=(e===u||e===v)&&(document.dir==="rtl"||this.tablist.dir==="rtl");d&&this.tablist.dir!=="ltr"&&(o*=-1);var g=r+o;this.tabs[g]?this.focusTab(g):e===u||e===y?d?this.focusFirstTab():this.focusLastTab():e!==v&&e!=b||(d?this.focusLastTab():this.focusFirstTab())}},s.prototype.getTab=function(t){return typeof t=="number"&&this.elementIsTab(this.tabs[t])?this.tabs[t]:this.elementIsTab(t)?t:null},s.prototype.activateTabWithTimer=function(t,e,o){var r=this;this.tabTimer&&clearTimeout(this.tabTimer);var d=typeof this.options.delay=="number"?this.options.delay:0;this.tabTimer=setTimeout(function(){r.activateTab(t,e,o)},d)},s.prototype.activateTab=function(t,e,o){e===void 0&&(e=!0),o===void 0&&(o=!1);var r=this.getTab(t);if(r&&e&&r.focus(),r&&(o||m(r,"aria-disabled")!=="true")){var d=m(r,"aria-selected")==="true";if(this.multiple&&d&&!o)return this.deactivateTab(r),void this.makeFocusable();this.multiple||this.deactivateTabs([r]);var g=this.options.tabindex||"0";f(r,"tabindex",g),f(r,"aria-selected","true");var w=this.getTabPanel(t);if(w){var R=m(w,"hidden")==="hidden";T(w,"hidden aria-hidden"),this.multiple&&(f(w,"aria-expanded","true"),f(r,"aria-expanded","true")),this.options.focusablePanels&&f(w,"tabindex",g),R&&this.triggerOptionCallback("onOpen",[w,r])}}},s.prototype.deactivateTab=function(t,e,o){e===void 0&&(e=!1),o===void 0&&(o=!1);var r=this.getTab(t);if(r&&(e&&r.focus(),f(r,"tabindex",this.options.focusableTabs?this.options.tabindex||"0":"-1"),o||m(r,"aria-disabled")!=="true")){f(r,"aria-selected","false");var d=this.getTabPanel(t);if(d){var g=m(d,"hidden")==="hidden";T(d,"tabindex"),f(d,"hidden","hidden"),f(d,"aria-hidden","true"),this.multiple?(f(r,"aria-expanded","false"),f(d,"aria-expanded","false")):(T(d,"aria-expanded"),T(r,"aria-expanded")),g||this.triggerOptionCallback("onClose",[d,r])}}},s.prototype.deactivateTabs=function(t){var e=this;t===void 0&&(t=[]);var o=Array.isArray(t);this.tabs.forEach(function(r){o&&t.indexOf(r)!==-1||e.deactivateTab(r,!1,!0)})},s.prototype.focusTab=function(t){var e=this.getTab(t),o=this.options.arrowActivation;if(e){if(o&&m(e,"aria-selected")!=="true")return void this.activateTabWithTimer(e);e.focus()}},s.prototype.focusFirstTab=function(){this.focusTab(0)},s.prototype.focusLastTab=function(){this.focusTab(this.tabs.length-1)},s.prototype.determineDeletable=function(t){if(this.options.deletable){var e=this.getTab(t);if(e&&m(e,"data-deletable")!=="false"){this.checkMultiple(),this.deleteTab(e),this.generateArrays();var o=e._ariaTablistTabIndex,r=o-1>-1?o-1:0;this.multiple||m(e,"aria-selected")!=="true"?this.tabs[r]&&this.tabs[r].focus():this.activateTab(r),this.makeFocusable(),this.triggerOptionCallback("onDelete",[e])}}},s.prototype.deleteTab=function(t){var e=this.getTabPanel(t);t.parentElement.removeChild(t),e&&e.parentElement.removeChild(e)},s.prototype.destroy=function(){var t=this,e="aria-expanded aria-hidden hidden role tabindex";this.tabs.forEach(function(o,r){o.removeEventListener("keydown",t.tabKeydownEvent),o.removeEventListener("keyup",t.tabKeyupEvent),o.removeEventListener("click",t.tabClickEvent),T(t.panels[r],e),T(o,e),delete o._ariaTablistTabIndex}),this.tablist&&(delete this.tablist.ariaTablist,T(this.tablist,"role")),this.panels.splice(0),this.tabs.splice(0),this.tablist=null},s.prototype.init=function(){var t=this;this.checkMultiple(),this.generateArrays(!0),this.tabKeydownEvent=this.tabKeydownEvent.bind(this),this.tabClickEvent=this.tabClickEvent.bind(this),this.tabKeyupEvent=this.tabKeyupEvent.bind(this);var e=[];this.tabs.forEach(function(o,r){t.addListenersToTab(r),!(m(o,"aria-selected")==="true"||m(o,"data-selected")==="true")||!t.multiple&&e.length||e.push(o)}),f(this.tablist,"role","tablist"),this.tabs.length&&(this.multiple||e.length||e.push(this.tabs[0]),this.deactivateTabs(e),e.forEach(function(o){return t.activateTab(o,!1,!0)}),this.makeFocusable()),this.triggerOptionCallback("onReady",[this.tablist])},s}();function D(s,t){return new W(s,t).api}p.default=D}])})})(F);var it=F.exports;const at=et(it),nt="Site Tablist [data-site-tablist] error:",H=[];window.addEventListener("load",()=>{K(document),H.forEach(st)});document.addEventListener("pageModified",a=>K(a.target));function K(a){if(!a)return;a.querySelectorAll("[data-site-tablist]").forEach(ot)}function st({options:a,ariaTablist:i}){if(a.openByUrlHash){const{hash:n}=window.location;if(n&&n.length>1){const p=n.substring(1);i.tabs.forEach(l=>{p===l.id&&i.open(l)})}}}function ot(a){let i={};const n={};if(a.dataset.siteTablist)try{i=JSON.parse(a.dataset.siteTablist)}catch{console.error(nt,"(JSON Parse for options)",a)}i.vertical&&(n.allArrows=!0),p(),i.equalHeights&<(a);function p(){const l={element:a,options:i};l.ariaTablist=at(a,{onOpen(...c){c.unshift(l),rt.apply(null,c)},...n}),H.push(l)}}function rt({options:a},i,n){a.openByUrlHash&&window.history&&window.history.replaceState(null,"",`#${n.id}`)}function lt(a){const n=[...a.children].map(u=>document.querySelector(`[aria-labelledby="${u.id}"]`)),c=[...n[0].parentElement.querySelectorAll("img")].map(u=>h(u));function h(u){return new Promise((y,v)=>{u.onload=()=>y(u),u.onerror=v})}Promise.all(c).then(()=>{const u=n.map(v=>v.offsetHeight),y=Math.max(...u);n.forEach(v=>v.style.minHeight=`${y}px`)})} |
@@ -13,2 +13,3 @@ // ============================================================================= | ||
export * as events from "./events/index.js"; | ||
export * as grid from "./ui/grid.js"; | ||
export * as grid from "./ui/grid.js"; | ||
export * as tabs from "./ui/tabs.js"; |
/** | ||
* @module ui/tabs | ||
*/ | ||
// ============================================================================= | ||
// Tabs | ||
// ============================================================================= | ||
// | ||
// Version: 1.0.1 | ||
// | ||
// Selected by: [data-site-tablist] | ||
// | ||
// Possible options (passed in attribute JSON) | ||
// - openByUrlHash | Optionally add "openByUrlHash" to | ||
// have the scriptopen a tab and focus it on page load | ||
// (and set it in history as they navigate) | ||
import AriaTablist from 'aria-tablist'; | ||
// * - Attribute to enable behavior 'data-site-tablist' | ||
// * - Options can be passed via JSON in data attribute | ||
// * - openByUrlHash | Optionally add "openByUrlHash" to have the | ||
// * script open a tab and focus it on page load (and set it in history | ||
// * as they navigate) | ||
import AriaTablist from "aria-tablist"; | ||
const errorHeader = "Site Tablist [data-site-tablist] error:"; | ||
/** | ||
* Array of current tab instances (exported if you need to interact with them) | ||
* @type {Array} | ||
*/ | ||
const instances = []; | ||
// Init all instances currently in page | ||
@@ -29,7 +30,7 @@ window.addEventListener("load", () => { | ||
// Initialize when page updates/changes | ||
document.addEventListener('pageModified', e => initWithin(e.target)); | ||
document.addEventListener("pageModified", e => initWithin(e.target)); | ||
function initWithin(context) { | ||
if (!context) return; | ||
const tablists = context.querySelectorAll('[data-site-tablist]'); | ||
const tablists = context.querySelectorAll("[data-site-tablist]"); | ||
tablists.forEach(init); | ||
@@ -46,3 +47,3 @@ } | ||
} | ||
}) | ||
}); | ||
} | ||
@@ -95,3 +96,3 @@ } | ||
const parent = panels[0].parentElement; | ||
const images = [ ...parent.querySelectorAll('img') ]; | ||
const images = [ ...parent.querySelectorAll("img") ]; | ||
const imagePromises = images.map(image => imagePromise(image)); | ||
@@ -98,0 +99,0 @@ function imagePromise(image) { |
{ | ||
"name": "@ulu/frontend", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "Modular Sass Theming Library", | ||
@@ -24,3 +24,3 @@ "browser": "js/index.js", | ||
"scripts": { | ||
"build" : "vite build", | ||
"build": "vite build", | ||
"docs:dev": "vitepress dev docs-src", | ||
@@ -31,3 +31,3 @@ "docs:build": "vitepress build docs-src", | ||
"docs:update:scss:debug": "node --inspect-brk ./docs-src/.vitepress/sassdoc.js", | ||
"docs:build:js": "node ./docs-src/.vitepress/jsdoc.js", | ||
"docs:update:js": "node ./docs-src/.vitepress/jsdoc.js", | ||
"types": "npx tsc" | ||
@@ -60,4 +60,3 @@ }, | ||
"@ulu/vitepress-auto-menus": "^0.0.3", | ||
"@ulu/vitepress-sassdoc": "^0.0.8", | ||
"clean-jsdoc-theme": "^4.2.17", | ||
"@ulu/vitepress-sassdoc": "^0.0.9", | ||
"fs-extra": "^11.2.0", | ||
@@ -72,2 +71,3 @@ "jsdoc": "^4.0.2", | ||
"@ulu/utils": "^0.0.6", | ||
"aria-tablist": "^1.2.2", | ||
"autoprefixer": "^10.4.16", | ||
@@ -74,0 +74,0 @@ "vite": "^5.0.10" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325110
8
120
3957
4
+ Addedaria-tablist@^1.2.2
+ Addedaria-tablist@1.2.2(transitive)