@ulu/frontend 0.4.0 → 0.4.2
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/es/ui/overflow-scroller-pager.d.ts.map +1 -1
- package/dist/es/ui/overflow-scroller-pager.js +13 -13
- package/dist/umd/frontend.css +1 -1
- package/dist/umd/ulu-frontend.umd.js +6 -6
- package/lib/js/ui/overflow-scroller-pager.js +22 -10
- package/lib/scss/_button.scss +2 -1
- package/lib/scss/_color.scss +2 -2
- package/lib/scss/_cssvar.scss +2 -19
- package/lib/scss/_element.scss +2 -2
- package/lib/scss/_index.scss +1 -0
- package/lib/scss/_themes.scss +135 -0
- package/lib/scss/base/_index.scss +6 -0
- package/lib/scss/base/_root.scss +36 -2
- package/lib/scss/base/_themes.scss +143 -0
- package/lib/scss/components/_flipcard.scss +5 -1
- package/lib/scss/components/_progress-bar.scss +7 -7
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("@floating-ui/dom"),require("swipe-listener")):typeof define=="function"&&define.amd?define(["exports","@floating-ui/dom","swipe-listener"],d):(l=typeof globalThis!="undefined"?globalThis:l||self,d(l.ULU={},l.FloatingUIDOM,l.SwipeListener))})(this,(function(l,d,g){"use strict";var
|
|
1
|
+
(function(l,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("@floating-ui/dom"),require("swipe-listener")):typeof define=="function"&&define.amd?define(["exports","@floating-ui/dom","swipe-listener"],d):(l=typeof globalThis!="undefined"?globalThis:l||self,d(l.ULU={},l.FloatingUIDOM,l.SwipeListener))})(this,(function(l,d,g){"use strict";var xi=Object.defineProperty,Di=Object.defineProperties;var Pi=Object.getOwnPropertyDescriptors;var es=Object.getOwnPropertySymbols;var Hi=Object.prototype.hasOwnProperty,Ri=Object.prototype.propertyIsEnumerable;var ss=l=>{throw TypeError(l)};var re=(l,d,g)=>d in l?xi(l,d,{enumerable:!0,configurable:!0,writable:!0,value:g}):l[d]=g,y=(l,d)=>{for(var g in d||(d={}))Hi.call(d,g)&&re(l,g,d[g]);if(es)for(var g of es(d))Ri.call(d,g)&&re(l,g,d[g]);return l},ae=(l,d)=>Di(l,Pi(d));var C=(l,d,g)=>re(l,typeof d!="symbol"?d+"":d,g),le=(l,d,g)=>d.has(l)||ss("Cannot "+g);var v=(l,d,g)=>(le(l,d,"read from private field"),g?g.call(l):d.get(l)),x=(l,d,g)=>d.has(l)?ss("Cannot add the same private member more than once"):d instanceof WeakSet?d.add(l):d.set(l,g),E=(l,d,g,j)=>(le(l,d,"write to private field"),j?j.call(l,g):d.set(l,g),g),P=(l,d,g)=>(le(l,d,"access private method"),g);var ce=(l,d,g)=>new Promise((j,ct)=>{var Rt=D=>{try{V(g.next(D))}catch(st){ct(st)}},Mt=D=>{try{V(g.throw(D))}catch(st){ct(st)}},V=D=>D.done?j(D.value):Promise.resolve(D.value).then(Rt,Mt);V((g=g.apply(l,d)).next())});var G,Q,T,$,_,J,B,Z,tt,A,Ht,ue,de,he;function j(i,t,e,s){let n;const o=function(){const a=this,r=arguments,c=function(){n=null,i.apply(a,r)};clearTimeout(n),n=setTimeout(c,t)};return o.cancel=function(){clearTimeout(n),n=null},o}const ct=/\s+/g,Rt=/^[{\[][\s\S]*[}\]]$/;function Mt(i,t={},e=null){try{return JSON.parse(i)}catch(s){return typeof e=="function"?e(s,i):console.warn("safeParse: Failed to parse JSON string:",i,"Error:",s),t}}function V(){return typeof window!="undefined"&&typeof window.document!="undefined"}function D(i){return new DOMParser().parseFromString(i,"text/html").body.firstElementChild}function st(i,t,e={}){const s=i.dataset[t];return Mt(s,e,n=>{console.error(`Error getting JSON from dataset (${t}) -- "${s}"
|
|
2
2
|
`,i,n)})}function is(i,t){const e=i.dataset[t];return e&&Rt.test(e.trim())?st(i,t):e}function ns(i,t){const e=i.getBoundingClientRect();return t.clientY<e.top||t.clientY>e.top+e.height||t.clientX<e.left||t.clientX>e.left+e.width}function ut(i,t=document){return typeof i=="string"?t.querySelector(i):i instanceof Element?i:(console.warn("getElement: Invalid target type (expected String/Node)",i),null)}function fe(i,t=document){return typeof i=="string"?[...t.querySelectorAll(i)]:i instanceof Element?[i]:Array.isArray(i)||i instanceof NodeList?[...i]:(console.warn("getElement: Invalid target type (expected String/Node/Array/Node List)",i),null)}function os(i){const t={scrollableChild:document.body,container:window,propertyElement:document.documentElement,propertyName:"--ulu-scrollbar-width"},e=y(y({},t),i),{scrollableChild:s,container:n,propertyElement:o,propertyName:a}=e,r=pe(s,n);o.style.setProperty(a,`${r}px`)}function pe(i=document.body,t=window){return t.innerWidth-i.clientWidth}function rs({preventShift:i=!1,container:t=document.body}){const e=t.style.overflow,s=t.style.paddingRight;if(t.style.overflow="hidden",i){const n=pe();if(n>0){const o=parseInt(s||"0px",10);t.style.paddingRight=`${o+n}px`}}return()=>{t.style.overflow=e,t.style.paddingRight=s}}V()&&(ls(),cs());const qt={pageModified(i){i.dispatchEvent(K("pageModified"))},pageResized(i){i.dispatchEvent(K("pageResized"))},beforePrint(i){i.dispatchEvent(K("beforePrint"))},afterPrint(i){i.dispatchEvent(K("afterPrint"))}},as=Object.keys(qt);function it(i,t){qt[i]?qt[i](t):console.warn(`Unable to dispatch non-core event: ${i}`)}function N(i){return"ulu:"+i}function z(i){return as.includes(i)?N(i):(console.warn(`'${i}' is not a valid core event type.`),null)}function K(i,t=null,e={bubbles:!0}){return new CustomEvent(N(i),y({detail:t},e))}function ls(){window.addEventListener("resize",j(()=>it("pageResized",document),250))}function cs(){window.addEventListener("beforeprint",()=>{it("beforePrint",document)}),window.addEventListener("afterprint",()=>{it("afterPrint",document)})}const ge={iconClassClose:"css-icon css-icon--close",iconClassDragX:"css-icon css-icon--drag-x",iconClassDragBoth:"css-icon css-icon--drag-both",iconClassPrevious:"css-icon css-icon--angle-left",iconClassNext:"css-icon css-icon--angle-right",cssvarPrefix:""};let nt=y({},ge);function us(){return y({},ge)}function me(i){Object.assign(nt,i)}function ds(){return y({},nt)}function be(i){if(!nt.hasOwnProperty(i)){console.warn(`Attempted to access non-existent setting: ${i}`);return}return nt[i]}function hs(i,t){nt[i]=t}function H(i,t){return{toString(){const e=be(i);return t?t(e):e}}}function dt(i){return t=>i.every(e=>Object.prototype.hasOwnProperty.call(t,e))}function fs(i){const t=/(px|vw|vh|%|em|rem)/i;return{original:i,value:parseFloat(i.replace(t,"")),unit:i.match(t)[0]}}function ps(i){return i.replace(/[\r\n]+/g,"")}function gs(i){return ps(i).replace(ct," ").trim()}function ht(i){return gs(i)}function ms(i){return i.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}function ve(i){return ms(i.replace(/^data-/,""))}function ye(i,t={columnFirst:"position-column-first",columnLast:"position-column-last",rowFirst:"position-row-first",rowLast:"position-row-last"}){const e=[...i.children],s=[];let n;e.forEach(o=>{const a=o.getBoundingClientRect().y;n!==a&&s.push([]),s[s.length-1].push(o),n=a,o.classList.remove(...Object.values(t))}),s.forEach((o,a)=>{a===0&&o.forEach(r=>r.classList.add(t.rowFirst)),a==s.length-1&&o.forEach(r=>r.classList.add(t.rowLast)),o.forEach((r,c)=>{c===0&&r.classList.add(t.columnFirst),c==o.length-1&&r.classList.add(t.columnLast)})})}function ft(i){return typeof i=="string"?i.split(" ").filter(t=>t!==""):Array.isArray(i)?i:i?(console.warn("resolveClassArray: Invalid class input type.",i),[]):[]}const q=class q{constructor(t){if(!q.hasRequiredOptions(t))throw new Error(`Missing a required options: ${q.requiredOptions.join(", ")}`);this.options=Object.assign({},q.defaults,t),this.logTitle=`ULU: ${this.options.type}:
|
|
3
3
|
`}init(t){var e;this.setupElements(t),(e=t.coreEvents)!=null&&e.length&&t.coreEvents.forEach(s=>{const n=z(s);n&&document.addEventListener(n,()=>this.setupElements(t))})}setupElements(t){const{setup:e,key:s,withData:n,context:o}=t;this.queryAllInitial(s,n,o).forEach(r=>e(r,this))}getAttribute(t){const{baseAttribute:e}=this.options;return t?`${e}-${t}`:`${e}`}attributeSelector(t){return`[${this.getAttribute(t)}]`}attributeSelectorInitial(t){return`${this.attributeSelector(t)}:not([${this.getAttribute("init")}])`}queryAllInitial(t,e,s=document){return[...s.querySelectorAll(this.attributeSelectorInitial(t))].map(o=>({element:o,data:e?this.getData(o,t):null,initialize:()=>this.initializeElement(o)}))}initializeElement(t){t.setAttribute(this.getAttribute("init"),"")}getData(t,e){const s=ve(this.getAttribute(e));return is(t,s)}log(...t){console.log(this.logTitle,...t)}warn(...t){console.warn(this.logTitle,...t)}logError(...t){console.error(this.logTitle,...t)}};C(q,"defaults",{type:null,baseAttribute:null}),C(q,"requiredOptions",["type","baseAttribute"]),C(q,"hasRequiredOptions",dt(q.requiredOptions));let w=q;function Bt(i,t){var e=i.indexOf(t);e>-1&&i.splice(e,1)}function bs(i,t){return`--${i}-${t}`}const ot={debug:!1,warningsAlways:!0,errorsAlways:!0,outputContext:!1},vs="console"in window;function jt(i){var t;return vs&&ot.debug&&((i==null?void 0:i.debug)||((t=i==null?void 0:i.options)==null?void 0:t.debug)||i==null)}function ys(i){var t;return typeof i=="object"&&((t=i==null?void 0:i.constructor)==null?void 0:t.name)}function Nt(i,t,e){const s=ys(t)||"Logger";console[i](s,...e),ot.outputContext&&console.log(`Context:
|
|
4
4
|
`,t)}function Cs(i){Object.assign(ot,i)}function k(i,...t){jt(i)&&Nt("log",i,t)}function Ft(i,...t){(ot.warningsAlways||jt(i))&&Nt("warn",i,t)}function S(i,...t){(ot.errorsAlways||jt(i))&&Nt("error",i,t)}const ws=i=>bs(i,"breakpoint"),O=class O{static _initializeGlobals(){O.globalsInitialized||!V()||(window.addEventListener(z("pageResized"),()=>{O.instances.forEach(t=>t.update())}),O.globalsInitialized=!0)}constructor(t){O._initializeGlobals(),Object.assign(this,O.defaults,t),this.active=null,this.previous=null,this.activeIndex=null,this.resizeDirection=null,this.previousIndex=null,this.breakpoints={},this.onChangeCallbacks=[],this.order.forEach(e=>this.breakpoints[e]=new Es(e,this)),k(this,this),this.update(),O.instances.push(this)}onChange(t){this.onChangeCallbacks.push(t)}removeOnChange(t){Bt(this.onChangeCallbacks,t)}getBreakpointInPseudo(){return window.getComputedStyle(this.element,this.pseudoSelector).content.replace(/^"|"$/g,"")}getBreakpointInProperty(){return getComputedStyle(this.element).getPropertyValue(this.customProperty).trim()}getBreakpoint(){return this.valueFromPseudo?this.getBreakpointInPseudo():this.getBreakpointInProperty()}update(){const t=this.getBreakpoint();if(!t){S(this,"Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!");return}if(t===this.active)return;this.previous=this.active,this.previousIndex=this.activeIndex;const e=this.order.indexOf(t);this.active=t,this.activeIndex=e,this.order.forEach((s,n)=>{const o=this.breakpoints[s],a=this.activeIndex;o._setDirection("min",n<=a),o._setDirection("max",n>a),o._setDirection("only",n===a)}),this.previousIndex!==null&&(this.resizeDirection=this.previousIndex<e?"up":"down"),this.onChangeCallbacks.forEach(s=>s(this))}at(t){const e=this.breakpoints[t];return t||S(this,"Unable to find breakpoint for:",e),e}};C(O,"instances",[]),C(O,"globalsInitialized",!1),C(O,"defaults",{element:document==null?void 0:document.documentElement,valueFromPseudo:!1,customProperty:"--breakpoint",customProperty:H("cssvarPrefix",ws),pseudoSelector:":before",order:["none","small","medium","large"],debug:!1});let Ut=O;class Vt{constructor(t,e){this.direction=t,this.active=!1,this.on=[],this.off=[],this.breakpoint=e}change(t){this.active!==t&&(t?this._call(!0):this.active&&this._call(!1),this.active=t)}_call(t){(t?this.on:this.off).forEach(s=>s()),k(this.breakpoint._manager,`Handlers called (${t?"on":"off"}): ${this.direction}`)}getHandlers(t){return typeof t!="object"?{on:t}:t}add(t){const e=this.getHandlers(t);e.on&&this.on.push(e.on),e.off&&this.off.push(e.off),this.active&&e.on&&(e.on(),k(this.breakpoint._manager,`Handler called immediately: ${this.direction}`,e.on))}remove(t){const e=this.getHandlers(t);e.on&&Bt(this.on,e.on),e.off&&Bt(this.off,e.off)}}class Es{constructor(t,e){this.directions={max:new Vt("max",this),min:new Vt("min",this),only:new Vt("only",this)},this._manager=e,this.name=t}_setDirection(t,e){this.directions[t].change(e)}max(t){this.directions.max.add(t)}min(t){this.directions.min.add(t)}only(t){this.directions.only.add(t)}remove(t,e){(e?[e]:["max","min","only"]).forEach(n=>{this.directions[n]&&this.directions[n].remove(t)})}log(...t){t.unshift(`Breakpoint (${this.name}):`),this._manager.log.apply(this._manager,t)}}let Ss=0;function pt(){return`ulu-uid-${++Ss}`}function R(i){i.id||(i.id=pt())}const zt=class zt{constructor(t,e){const{trigger:s,content:n}=t;if(!s||!n){S(this,"missing required elements (trigger or content)");return}const o=Object.assign({},zt.defaults,e);this.elements=t,this.options=o,this.isOpen=!1,this.handlers={},R(s),R(n),this.debugLog(this,this),o.selfManaged||this.attachHandlers(),this.setup()}attachHandlers(){const{trigger:t,content:e}=this.elements,{focusoutCloses:s}=this.options;this.clickHandler=n=>{this.onClick(n)},this.focusoutHandler=n=>{s&&document.addEventListener("focusin",()=>{e.contains(document.activeElement)||this.close(n)},{once:!0})},t.addEventListener("click",this.clickHandler),e.addEventListener("focusout",this.focusoutHandler)}removeHandlers(){const{trigger:t,content:e}=this.elements;t.removeEventListener("click",this.clickHandler),e.removeEventListener("focusout",this.focusoutHandler)}onClick(t){this.toggle(t)}destroy(){this.removeHandlers(),this.destroyTemporaryHandlers()}debugLog(...t){this.options.debug&&k(this,...t)}setup(){const{trigger:t,content:e}=this.elements,{startOpen:s}=this.options;t.setAttribute("role","button"),t.setAttribute("aria-controls",e.id),e.setAttribute("aria-labelledby",t.id),this.setState(s)}createEvent(t,e){return new CustomEvent(N("collapsible:"+t),{detail:e})}setState(t,e){const s={collapsible:this,isOpen:t,event:e};this.debugLog(this,"Set state",s);const{trigger:n,content:o}=this.elements,{openClass:a}=this.options,r=c=>c.classList[t?"add":"remove"](a);n.setAttribute("aria-expanded",t?"true":"false"),r(n),r(o),this.isOpen=t,this.options.onChange(s),n.dispatchEvent(this.createEvent("change",s)),t?this.setupTemporaryHandlers():this.destroyTemporaryHandlers()}setupTemporaryHandlers(){const{content:t,trigger:e}=this.elements,{clickOutsideCloses:s,escapeCloses:n}=this.options,o=r=>{const{target:c}=r,u=e.contains(c),h=t.contains(c);s&&!u&&!h&&this.close(r)},a=r=>{n&&r.key==="Escape"&&this.close(r)};document.addEventListener("click",o),document.addEventListener("keydown",a),this.handlers.onDocumentClick=o,this.handlers.onDocumentKeydown=a}destroyTemporaryHandlers(){const{onDocumentClick:t,onDocumentKeydown:e}=this.handlers;t&&document.removeEventListener("click",t),t&&document.removeEventListener("keydown",e)}open(t){this.setState(!0,t)}close(t){this.setState(!1,t)}toggle(t){this.setState(!this.isOpen,t)}};C(zt,"defaults",{clickOutsideCloses:!1,focusoutCloses:!1,escapeCloses:!1,selfManaged:!1,startOpen:!1,openClass:"is-active",debug:!0,onChange(t){}});let gt=zt;const mt=new w({type:"details-group",baseAttribute:"data-ulu-details-group"}),Kt=mt.getAttribute("child-init"),As={onlyOneOpen:!0,childSelector:":scope > details"};function $s(){mt.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Ce(i,t),e()}})}function Ce(i,t){const e=Object.assign({},As,t);try{n()}catch(r){console.error(r)}function s(){return i.querySelectorAll(e.childSelector)}function n(){s().forEach(r=>{r.hasAttribute(Kt)||(r.setAttribute(Kt,""),r.addEventListener("toggle",o))})}function o({target:r}){e.onlyOneOpen&&r.open&&s().forEach(c=>{c!==r&&c.open&&(c.open=!1)})}function a(){s().forEach(r=>{r.removeEventListener("toggle",o),r.removeAttribute(Kt)}),i.removeAttribute(mt.getAttribute("init"))}return{destroy:a,element:i,setupChildren:n}}const Ls=[".youtube-embedded-video",'iframe[title*="YouTube video player"]','iframe[src*="youtube.com/embed"]'];function we(i=document){Se(i).forEach(e=>{try{e.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")}catch(s){console.error(s)}})}function Ee(i=document){Se(i).forEach(e=>{const{src:s}=e;s&&(e.src=s.split("?")[0]+"?rel=0&enablejsapi=1")})}function Se(i){return i.querySelectorAll(Ls.join(", "))}function Ae(i,t){const e=new MutationObserver(s=>{s.forEach(n=>{if(n.attributeName==="open"){const o=i.hasAttribute("open");t(o)}})});return e.observe(i,{attributes:!0,attributeFilter:["open"]}),{destroy:()=>e.disconnect()}}const Wt="data-ulu-dialog",W=new w({type:"dialog",baseAttribute:Wt}),$e=W.getAttribute("close"),Xt={nonModal:!1,documentEnd:!1,clickOutsideCloses:!0,pauseVideos:!0,preventScroll:!0,preventScrollShift:!0};let bt=y({},Xt);function ks(i){bt=Object.assign({},bt,i)}function Is(){W.init({coreEvents:["pageModified"],withData:!0,setup({element:i,initialize:t,data:e}){ke(i,e),t()}}),W.init({key:"trigger",coreEvents:["pageModified"],withData:!0,setup({element:i,initialize:t,data:e}){Le(i,e),t()}})}function Le(i,t){i.addEventListener("click",e);function e(s){var r;s.target.closest("a")&&s.preventDefault();const o=document.getElementById(t);if(!o){console.error("Could not locate dialog (id)",t);return}if(((r=o==null?void 0:o.tagName)==null?void 0:r.toLowerCase())!=="dialog"){console.error("Attempted to trigger non <dialog> element. Did you mean to use modal builder?");return}const a=Ie(o);o[a.nonModal?"show":"showModal"]()}}function ke(i,t){const e=Object.assign({},bt,t),s=document.body,{preventScrollShift:n}=e;let o=null,a;if(i.addEventListener(N("resizer:start"),c),i.addEventListener(N("resizer:end"),u),i.addEventListener("click",r),e.documentEnd&&s.appendChild(i),e.pauseVideos&&zs(i),!e.nonModal&&e.preventScroll){let h;o=Ae(i,m=>{m?h=rs({preventShift:n}):h&&(h(),h=null)})}function r(h){const{target:m}=h,f=m===i,b=m.closest(W.attributeSelector("close"));(!a&&e.clickOutsideCloses&&f&&ns(i,h)||b)&&(e.pauseVideos&&Os(i),i.close())}function c(h){a=h.pointerId}function u(h){a===h.pointerId&&setTimeout(()=>{a=null},0)}return{destroy:()=>{o&&o.destroy()}}}function Ie(i){return Object.assign({},bt,W.getData(i))}function zs(i){Ee(i)}function Os(i){we(i),i.querySelectorAll("video").forEach(e=>e.pause())}const vt=new w({type:"flipcard",baseAttribute:"data-ulu-flipcard"});function Ts(){vt.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){const s=Object.assign({},t),n=i.querySelector(vt.attributeSelector("front")),o=i.querySelector(vt.attributeSelector("back"));new yt(i,n,o,s),e()}})}const U=class U{constructor(t,e,s,n){s||S(this,"Missing an element (container, front, back)"),this.options=Object.assign({},U.defaults,n);const{namespace:o}=this.options;U.instances.push(this),this.elements={container:t,front:e,back:s},this.isOpen=!1,this.uid=`${o}-id-${U.instances.length}`,this.stateAttr=`data-${o}-state`.toLowerCase(),this.setup(),this.setVisibility(!1),k(this,this)}toggle(){this.setVisibility(!this.isOpen)}setup(){const{uid:t}=this,{namespace:e,proxyClick:s}=this.options,{container:n,front:o,back:a}=this.elements,r=this.elements.control=document.createElement("button");r.classList.add(this.getClass("control-button")),r.setAttribute("type","button"),r.innerHTML=this.createControlContent(),r.style.gridArea=e,r.style.zIndex="-1",r.addEventListener("focusin",()=>{r.style.zIndex="20"}),r.addEventListener("focusout",()=>{r.style.zIndex="-1"}),r.addEventListener("click",this.toggle.bind(this)),a.parentNode.insertBefore(r,a),n.classList.add(this.options.namespace),n.setAttribute("style",ht(this.containerCss())),s&&n.addEventListener("click",this.onProxyClick.bind(this)),o.style.gridArea=e,a.style.gridArea=e,r.id=`${t}-control`,r.setAttribute("aria-controls",a.id),r.setAttribute("aria-expanded","false"),a.id=`${t}-back`,a.setAttribute("aria-labelledby",r.id),a.setAttribute("aria-hidden","true")}onProxyClick({target:t}){const{exclude:e,allowSelection:s,selectionMin:n}=this.options.proxyClick,o=window.getSelection();e&&!t.matches(e)&&(!s||o.toString().length<n)&&this.toggle()}getClass(t){const{namespace:e}=this.options;return t?`${e}__${t}`:e}createControlContent(){return`
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
`}panelCss(t=1){return`
|
|
16
16
|
grid-area: ${this.options.namespace};
|
|
17
17
|
z-index: ${t}
|
|
18
|
-
`}};C(U,"instances",[]),C(U,"defaults",{namespace:"Flipcard",proxyClick:{allowSelection:!0,selectionMin:10,exclude:"a, input, textarea, button"}});let yt=U;const ze=new w({type:"grid",baseAttribute:"data-grid"});function
|
|
18
|
+
`}};C(U,"instances",[]),C(U,"defaults",{namespace:"Flipcard",proxyClick:{allowSelection:!0,selectionMin:10,exclude:"a, input, textarea, button"}});let yt=U;const ze=new w({type:"grid",baseAttribute:"data-grid"});function xs(i){ze.init({coreEvents:["pageModified","pageResized"],setup({element:t,initialize:e}){ye(t,i),e()}})}const Ot=class Ot{constructor(t,e,s){x(this,A);x(this,G);x(this,Q);x(this,T);x(this,$);x(this,_);x(this,J);x(this,B);x(this,Z);x(this,tt);if(!e||!t){S(this,"Missing required elements: control, container");return}const n=Object.assign({},Ot.defaults,s);this.options=n,this.container=t,this.control=e,this.debug=n.debug;const o=["left","right"],a=["top","bottom"],{fromX:r,fromY:c}=n;if(!o.includes(r)&&r!==null){S(this,`Invalid fromX: ${r} (left|right|null)`);return}if(!a.includes(c)&&c!==null){S(this,`Invalid fromY: ${c} (top|bottom|null)`);return}if(!r&&!c){S(this,"Invalid fromX/fromY, failed to setup resizer (at least one of fromX or fromY must be set)");return}this.resizeHorizontal=n.fromX!==null,this.resizeVertical=n.fromY!==null,n.manageEvents&&(E(this,G,this.onPointerdown.bind(this)),E(this,Q,this.onKeydown.bind(this)),n.enablePointerResizing&&e.addEventListener("pointerdown",v(this,G)),n.enableKeyboardResizing&&e.addEventListener("keydown",v(this,Q))),P(this,A,Ht).call(this),n.manageAriaLabel&&e.setAttribute("aria-label",this.getAriaLabel())}destroy(){const{control:t,options:e}=this;e.manageEvents&&(e.enablePointerResizing&&t.removeEventListener("pointerdown",v(this,G)),e.enableKeyboardResizing&&t.removeEventListener("keydown",v(this,Q))),v(this,T)&&clearTimeout(v(this,T)),P(this,A,Ht).call(this),e.manageAriaLabel&&t.removeAttribute("aria-label"),k(this,"Resizer destroyed.")}onPointerdown(t){if(!this.options.enablePointerResizing){k(this,"Pointer resizing disabled. Ignoring pointerdown event.");return}t.preventDefault();const e=document.documentElement;E(this,Z,t.clientX),E(this,tt,t.clientY),P(this,A,ue).call(this,{inputType:"pointer",startX:t.clientX,startY:t.clientY,pointerId:t.pointerId}),this.control.setPointerCapture(t.pointerId);const s=o=>{const a=o.clientX-v(this,Z),r=o.clientY-v(this,tt);P(this,A,he).call(this,a,r,o)},n=o=>{e.removeEventListener("pointermove",s,!1),e.removeEventListener("pointerup",n,{capture:!0,once:!0}),this.control.hasPointerCapture(o.pointerId)&&this.control.releasePointerCapture(o.pointerId),P(this,A,de).call(this)};e.addEventListener("pointermove",s,!1),e.addEventListener("pointerup",n,{capture:!0,once:!0})}onKeydown(t){if(!this.options.enableKeyboardResizing){k(this,"Keyboard resizing disabled. Ignoring keydown event.");return}const{key:e}=t,{keyboardStep:s,keyboardDebounceTime:n}=this.options;let o=0,a=0,r=!1;this.resizeHorizontal&&(e==="ArrowLeft"?(o=-s,r=!0):e==="ArrowRight"&&(o=s,r=!0)),this.resizeVertical&&(e==="ArrowUp"?(a=-s,r=!0):e==="ArrowDown"&&(a=s,r=!0)),r&&(t.preventDefault(),t.stopPropagation(),(!v(this,B)||v(this,T)===null)&&P(this,A,ue).call(this,{inputType:"keyboard",keyboardKey:e}),E(this,_,v(this,_)+o),E(this,J,v(this,J)+a),P(this,A,he).call(this,v(this,_),v(this,J),t),v(this,T)&&clearTimeout(v(this,T)),E(this,T,setTimeout(()=>{P(this,A,de).call(this),E(this,T,null)},n)))}getAriaLabel(){const{fromY:t,fromX:e}=this.options,s=[t,e].filter(n=>n);return s.length===0?"Resize control":`Resize from ${s.join(" ")} edge`}dispatchEvent(t,e={}){this.container.dispatchEvent(K(t,e))}};G=new WeakMap,Q=new WeakMap,T=new WeakMap,$=new WeakMap,_=new WeakMap,J=new WeakMap,B=new WeakMap,Z=new WeakMap,tt=new WeakMap,A=new WeakSet,Ht=function(){E(this,T,null),E(this,$,{width:0,height:0}),E(this,_,0),E(this,J,0),E(this,B,!1),E(this,Z,0),E(this,tt,0)},ue=function(t){const{container:e,options:s}=this;if(v(this,B)){s.overrideMaxDimensions&&(this.resizeHorizontal&&(e.style.maxWidth="none"),this.resizeVertical&&(e.style.maxHeight="none"));return}const o=document.defaultView.getComputedStyle(e);v(this,$).width=parseInt(o.width,10),v(this,$).height=parseInt(o.height,10),s.overrideMaxDimensions&&(this.resizeHorizontal&&(e.style.maxWidth="none"),this.resizeVertical&&(e.style.maxHeight="none")),E(this,B,!0),this.dispatchEvent("resizer:start",t),k(this,"Resize started.",y({initialWidth:v(this,$).width,initialHeight:v(this,$).height},t))},de=function(){v(this,B)&&(this.dispatchEvent("resizer:end"),P(this,A,Ht).call(this),k(this,"Resize ended."))},he=function(t,e,s){let n=v(this,$).width,o=v(this,$).height;const{fromX:a,fromY:r,multiplier:c}=this.options;this.resizeHorizontal&&(a==="right"?n=v(this,$).width+t*c:a==="left"&&(n=v(this,$).width-t*c),this.container.style.width=`${Math.max(0,n)}px`),this.resizeVertical&&(r==="bottom"?o=v(this,$).height+e*c:r==="top"&&(o=v(this,$).height-e*c),this.container.style.height=`${Math.max(0,o)}px`);const u={newWidth:n,newHeight:o,totalDeltaX:t,totalDeltaY:e,event:s};this.dispatchEvent("resizer:update",u),k(this,"Resizing update.",u)},C(Ot,"defaults",{debug:!1,multiplier:1,overrideMaxDimensions:!1,fromX:null,fromY:null,keyboardStep:10,keyboardDebounceTime:200,manageEvents:!0,manageAriaLabel:!1,enablePointerResizing:!0,enableKeyboardResizing:!0});let Ct=Ot;const Yt=/^\d+$/;function Oe(i){const t=i.querySelectorAll("iframe");if(t.length===1&&i.textContent.trim()===""){const e=t[0],s=e.getAttribute("width"),n=e.getAttribute("height"),o=!!(s&&n&&Yt.test(s)&&Yt.test(n));let a=null;if(!o){const r=e.style.height||n;if(r)if(Yt.test(r))a=`${r}px`;else try{const c=fs(r);c&&c.unit&&c.unit!=="%"&&(a=r)}catch(c){}}return{iframe:e,isStaticSize:o,width:o?s:null,height:o?n:null,aspectRatio:o?`${s} / ${n}`:null,fillHeight:a}}return null}const F=new w({type:"modal-builder",baseAttribute:"data-ulu-modal-builder"}),Te={title:null,titleIcon:null,titleClass:"",labelledby:null,describedby:null,nonModal:!1,documentEnd:!0,allowResize:!1,position:"center",bodyFills:!1,noBackdrop:!1,size:"default",print:!1,noMinHeight:!1,fullscreenMobile:!1,class:"",baseClass:"modal",footerElement:null,footerHtml:null,classClose:"button button--icon",classCloseIcon:H("iconClassClose",i=>`${i} button__icon`),classResizerIcon:H("iconClassDragX"),classResizerIconBoth:H("iconClassDragBoth"),debug:!1,autoIframe:!1,templateCloseIcon(i){const{baseClass:t,classCloseIcon:e}=i;return`<span class="${t}__close-icon ${e}" aria-hidden="true"></span>`},templateResizerIcon(i){const{baseClass:t,classResizerIcon:e,classResizerIconBoth:s}=i,n=i.position==="center"?s:e;return`<span class="${t}__resizer-icon ${n}" aria-hidden="true"></span>`},template(i,t){const{baseClass:e,describedby:s,footerHtml:n}=t,o=[e,`${e}--${t.position}`,`${e}--${t.size}`,`${e}--${t.allowResize?"resize":"no-resize"}`,...t.title?[]:[`${e}--no-header`],...t.bodyFills?[`${e}--body-fills`]:[],...t.noBackdrop?[`${e}--no-backdrop`]:[],...t.noMinHeight?[`${e}--no-min-height`]:[],...t.fullscreenMobile?[`${e}--fullscreen-mobile`]:[],...t.class?[t.class]:[]],a=t.title?`${i}--title`:t.labelledby;return`
|
|
19
19
|
<dialog
|
|
20
20
|
id="${i}"
|
|
21
21
|
class="${o.join(" ")}"
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
${t.templateResizerIcon(t)}
|
|
40
40
|
</button>`:""}
|
|
41
41
|
</dialog>
|
|
42
|
-
`}};let Gt=y({},Te);function
|
|
42
|
+
`}};let Gt=y({},Te);function Ds(i){Gt=Object.assign({},Gt,i)}function Ps(){F.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t}){Qt(i,t)}})}function Qt(i,t){const e=Object.assign({},Gt,t),{position:s}=e;if(e.debug&&F.log(e,i),!i.id)throw new Error("Missing ID on modal");const n=e.template(i.id,e),o=D(n.trim()),a=p=>o.querySelector(F.attributeSelector(p)),r=a("body"),c=a("resizer"),u=Hs(e);if(i.removeAttribute("id"),i.removeAttribute("hidden"),i.removeAttribute(F.getAttribute()),i.parentNode.replaceChild(o,i),r.appendChild(i),o.setAttribute(Wt,JSON.stringify(u)),e.footerElement){const p=ut(e.footerElement);p&&(p.classList.add(`${e.baseClass}__footer`),r.after(p))}if(e.autoIframe){const p=Oe(i);p&&(p.iframe.classList.add(`${e.baseClass}__frame-content`),p.isStaticSize?(o.classList.add(`${e.baseClass}--frame-ratio`),r.style.aspectRatio=p.aspectRatio):(o.classList.add(`${e.baseClass}--frame-fill`),p.fillHeight&&(r.style.minHeight=p.fillHeight)))}let h;const m=["left","right","center"],f=s==="center",b=s==="right";if(e.allowResize)if(m.includes(s)){const p=f?{fromX:"right",fromY:"bottom",multiplier:2}:{fromX:b?"left":"right"};h=new Ct(o,c,p)}else console.warn(`${s} is not supported for resizing`);if(e.print){let p;document.addEventListener(z("beforePrint"),()=>{p=i.cloneNode(!0),o.after(p)}),document.addEventListener(z("afterPrint"),()=>{p.remove()})}return{modal:o,resizer:h}}function Hs(i){return Object.keys(Xt).reduce((t,e)=>(e in i&&(t[e]=i[e]),t),{})}const Tt=class Tt{constructor(t){const e=Object.assign({},Tt.defaults,t);this.options=e,this.triggers=null,this.cachedTrigger=null,this.triggerListener,this.onTriggerClick=s=>{const n=s.target.closest(e.triggerSelector);n&&(this.cachedTrigger=n)},this.onPageModified=()=>{this.setupTriggers()},document.addEventListener(z("pageModified"),this.onPageModified),this.setupTriggers()}setupTriggers(){const{triggerSelector:t,triggerInitAttr:e}=this.options;document.querySelectorAll(`${t}:not([${e}])`).forEach(n=>{n.addEventListener("click",this.onTriggerClick)})}destroy(){const{triggerSelector:t}=this.options;document.querySelectorAll(t).forEach(s=>{s.removeEventListener("click",this.onTriggerClick)})}createAndOpen(t,e){const{noClickTrigger:s,removeOnClose:n,element:o,classes:a}=t,r=ut(o);r.id||(r.id=pt()),a&&r.classList.add(...a);let c;if(s||(c=this.cachedTrigger,this.cachedTrigger=null),!r){console.error("No element found from config.element. ",t);return}const{modal:u}=Qt(r,t.modal),h={trigger:c,modal:u,config:t};e&&e(h);const m=()=>{n&&u.remove(),c&&c.focus()};return u.addEventListener("close",m,{once:!0}),!n&&c&&c.addEventListener("click",f=>{f.preventDefault(),u.showModal()}),it("pageModified",u),u.showModal(),h}};C(Tt,"defaults",{triggerSelector:"[data-ulu-programmatic-modal-trigger]",triggerInitAttr:"data-ulu-programmatic-modal-init"});let _t=Tt;const Rs=["track","controls"],lt=class lt{constructor(t,e){this.options=Object.assign({},lt.defaults,e),dt(Rs)||S(this,"Missing a required Element"),this.elements=y(y({},t),this.createControls(t.controls)),this.nextEnabled=!0,this.previousEnabled=!0,this.scrollHandler=s=>this.onScroll(s),this.elements.track.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.checkOverflow(),this.onScroll()}checkOverflow(){const{track:t}=this.elements;this.hasOverflow=t.scrollWidth>t.clientWidth}createControls(t){const e=document.createElement("ul"),s=document.createElement("li"),n=document.createElement("li"),o=this.createControlButton("previous"),a=this.createControlButton("next"),r=this.getClass("controls-item");return n.classList.add(r),n.classList.add(r+"--next"),s.classList.add(r),s.classList.add(r+"--previous"),e.classList.add(this.getClass("controls")),s.appendChild(o),n.appendChild(a),e.appendChild(s),e.appendChild(n),o.addEventListener("click",this.previous.bind(this)),a.addEventListener("click",this.next.bind(this)),t.appendChild(e),{controls:e,previousItem:s,nextItem:n,previous:o,next:a}}createControlButton(t){const e=document.createElement("button");return e.classList.add(this.getClass("control-button")),e.classList.add(this.getClass(`control-button--${t}`)),e.classList.add(...this.options.buttonClasses),e.setAttribute("type","button"),e.innerHTML=this.getControlContent(t),e}getControlContent(t){const e=this.options[t==="next"?"iconClassNext":"iconClassPrevious"];return`
|
|
43
43
|
<span class="hidden-visually">${t}</span>
|
|
44
44
|
<span class="${e}" aria-hidden="true"></span>
|
|
45
|
-
`}onScroll(t){this.hasOverflow&&this.onScrollHorizontal()}onScrollHorizontal(){const{nextEnabled:t,previousEnabled:e}=this,{track:s}=this.elements,{offsetStart:n,offsetEnd:o}=this.options,{scrollWidth:a,clientWidth:r,scrollLeft:c}=s,u=c<=n,h=a-c-o<=r;u&&e?this.setControlState("previous",!1):!u&&!e&&this.setControlState("previous",!0),h&&t?this.setControlState("next",!1):!h&&!t&&this.setControlState("next",!0)}setControlState(t,e){const s=t==="next",{next:n,nextItem:o,previous:a,previousItem:r}=this.elements,c=s?o:r,u=s?n:a,h=e?"remove":"add";c.classList[h](this.getClass("controls-item--disabled")),u.classList[e?"remove":"add"](this.getClass("control--disabled")),e?u.removeAttribute("disabled"):u.setAttribute("disabled",""),this[s?"nextEnabled":"previousEnabled"]=e}resolveAmount(t){const e=t==="next",{amount:s}=this.options,{scrollLeft:n,offsetWidth:o}=this.elements.track;return s==="auto"?e?n+o:n-o:typeof s=="function"?s(this,t):typeof s=="number"?e?n+s:n-s:(S("Unable to resolve amount for scroll"),500)}next(){this.elements.track.scrollTo({top:0,left:this.resolveAmount("next"),behavior:"smooth"})}previous(){this.elements.track.scrollTo({top:0,left:this.resolveAmount("previous"),behavior:"smooth"})}getClass(t){const{namespace:e}=this.options;return`${e}__${t}`}};C(lt,"instances",[]),C(lt,"defaults",{namespace:"OverflowScroller",events:{},horizontal:!0,offsetStart:100,offsetEnd:100,amount:"auto",buttonClasses:["button","button--icon"],iconClassPrevious:H("iconClassPrevious"),iconClassNext:H("iconClassNext")});let wt=lt;function De(){return function(t,e){const s=e==="next",{track:n}=t.elements;if(!n.children)return 400;const a=window.getComputedStyle(n).getPropertyValue("scroll-padding-left").replace("auto","0px"),r=parseInt(a,10),{scrollLeft:c,offsetWidth:u}=n,h=c+u,m=[...n.children].map(b=>{const{offsetLeft:p,offsetWidth:oe}=b;return{element:b,offsetLeft:p,offsetRight:p+oe}});let f;if(s)f=m.find(b=>b.offsetRight>=h);else{let b=m.findLastIndex(p=>p.offsetLeft<=c);if(b){let p=m[b];f=m.slice(0,b+1).find(Ti=>Ti.offsetLeft+r+u>=p.offsetRight)}}return f?s?f.offsetLeft:f.offsetLeft+r:400}}function Ms(){os()}const Pe={strategy:"absolute",placement:"bottom",inline:!1,offset:{mainAxis:16},shift:!0,flip:!0,arrow:!0};function Jt(i,t){const e=Object.assign({},Pe,t),{placement:s,strategy:n}=e,{trigger:o,content:a,contentArrow:r}=i;return d.autoUpdate(o,a,()=>{d.computePosition(o,a,{placement:s,strategy:n,middleware:[...rt(d.inline,e.inline),...rt(d.offset,e.offset),...rt(d.flip,e.flip),...rt(d.shift,e.shift),...rt(d.arrow,r&&e.arrow,{element:r})]}).then(c=>{const{x:u,y:h,middlewareData:m,placement:f}=c,b=m.arrow;Object.assign(a.style,{left:`${u}px`,top:`${h}px`}),a.setAttribute("data-placement",f),b&&Object.assign(r.style,{left:(b==null?void 0:b.x)!=null?`${b.x}px`:"",top:(b==null?void 0:b.y)!=null?`${b.y}px`:""})})})}function rt(i,t,e={}){return t?typeof t=="object"?[i(y(y({},t),e))]:[i(e)]:[]}const M=new w({type:"popover",baseAttribute:"data-ulu-popover"}),qs=M.attributeSelector("trigger-anchor"),Bs=M.attributeSelector("arrow"),js=M.getAttribute("content"),Ns=M.attributeSelector("content"),Zt=new WeakMap,Fs={clickOutsideCloses:!0,escapeCloses:!0};function Us(){M.init({key:"trigger",withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){if(Zt.has(i))return;const s=xe(i,t);if(!s){M.warn("Unable to resolve popover elements for trigger.",i);return}const{elements:n,options:o,floatingOptions:a}=s;Zt.set(n,new Re(n,o,a)),e()}})}function xe(i,t){const e=Object.assign({},t),s=He(i),n={trigger:i,content:s,anchor:i.querySelector(qs)||i,contentArrow:s.querySelector(Bs)},o=e.floating||{};return delete e.floating,s?{elements:n,options:e,floatingOptions:o}:(M.logError("Unable to make popover for",i),!1)}function He(i){var s;let t;const e=i.getAttribute("aria-controls");if(e)t=document.getElementById(e);else if((s=i==null?void 0:i.nextElementSibling)!=null&&s.hasAttribute(js))t=i.nextElementSibling;else{const n=Array.from(i.parentNode.children),o=n.findIndex(r=>r===i);t=n.slice(o).find(r=>r.matches(Ns))}return t||M.logError("Unable to resolve 'content' element for popover",i),t}class Re extends gt{constructor(t,e,s){const n=Object.assign({},Fs,e);super(t,n),this.floatingOptions=s||{}}setState(t,e){super.setState(t,e),this.destroyFloatingInstance(),t&&this.createFloatingInstance()}destroy(){super.destroy(),this.destroyFloatingInstance()}createFloatingInstance(){const{content:t,anchor:e,contentArrow:s}=this.elements,n={trigger:e,contentArrow:s,content:t};this.floatingCleanup=Jt(n,this.floatingOptions)}destroyFloatingInstance(){this.floatingCleanup&&(this.floatingCleanup(),this.floatingCleanup=null)}}const Et={opened:"data-ulu-print-details-opened"},Vs=i=>`[${Et[i]}]`,Ks={selector:"details:not([open])"};function Ws(i){const t=Object.assign({},Ks,i);document.addEventListener(z("beforePrint"),()=>{document.querySelectorAll(t.selector).forEach(e=>{e.open||(e.setAttribute(Et.opened,!0),e.open=!0)})}),document.addEventListener(z("afterPrint"),()=>{document.querySelectorAll(Vs("opened")).forEach(e=>{e.removeAttribute(Et.opened),e.open=!1})})}function Xs(i){const t=window.open();t.document.write(i),t.print(),t.close()}function Ys(i){var t=i.innerHTML;Xs(t)}const Gs=new w({type:"print",baseAttribute:"data-ulu-print"}),Qs={element:null};function _s(){Gs.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Js(i,t),e()}})}function Js(i,t){const e=Object.assign({},Qs,t);i.addEventListener("click",()=>{if(e.element){const s=ut(e.element);s?Ys(s):console.error("Unable to find element to print",i,e)}else window.print()})}const Me=new w({type:"proxy-click",baseAttribute:"data-ulu-proxy-click"}),qe={selector:"[data-ulu-proxy-click-source]",selectorPreventBase:"input, select, textarea, button, a, [tabindex='-1']",selectorPrevent:"",mousedownDurationPrevent:250};let te=y({},qe);function Zs(i){te=Object.assign({},te,i)}function ti(){Me.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Be(i,t),e()}})}function Be(i,t){const e=Object.assign({},te,t),s=i.querySelector(e.selector);s?je(i,s,e):console.error("Unable to locate proxy click source",e.selector)}function je(i,t,e){const{selectorPreventBase:s,selectorPrevent:n}=e,o=`${s}${n?`, ${n}`:""}`;let a,r;i.addEventListener("mousedown",({target:c,timeStamp:u})=>{r=!1,c.matches(o)||(r=!0,a=u)}),i.addEventListener("mouseup",({timeStamp:c})=>{r&&c-a<e.mousedownDurationPrevent&&t.click()}),i.style.cursor="pointer"}const St=new w({type:"scroll-slider",baseAttribute:"data-ulu-scroll-slider"}),ei=St.attributeSelector("track"),si=St.attributeSelector("control-context"),ii=[],ni={amount:De()};function oi(){St.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){ri(i,t),e()}})}function ri(i,t){const e=Object.assign({},ni,t),s={track:i.querySelector(ei),controls:i.querySelector(si)};ii.push(new wt(s,e))}const At=new w({type:"scrollpoint",baseAttribute:"data-ulu-scrollpoint"});function ai(){At.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){const s=Object.assign({},t);new $t(i,s),e()}})}const Dt=class Dt{constructor(t,e){const s=Object.assign({},Dt.defaults,e);if(!t){S(this,"Missing required element");return}s.rootSelector&&(s.root=document.querySelector(s.rootSelector),delete s.rootSelector),this.options=s,this.observer=null,this.lastPosition=null,this.isActive=!1,this.element=t,this.syncedElements=[t,...s.syncElements.map(n=>ut(n))],this.classes={enter:this.getClassname("enter"),enterForward:this.getClassname("enter--from-forward"),enterReverse:this.getClassname("enter--from-reverse"),exit:this.getClassname("exit"),exitForward:this.getClassname("exit--from-forward"),exitReverse:this.getClassname("exit--from-reverse")},this.setupObserver(),s.debug&&At.log(this)}getClassname(t){return this.options.classPrefix+"-"+t}getObserverOptions(){const{root:t,marginStart:e,marginEnd:s,threshold:n,horizontal:o}=this.options,a=o?`0px ${e} 0px ${s}`:`${e} 0px ${s} 0px`;return{root:t,rootMargin:a,threshold:n}}onObserve(t){const e=this.getScrollY(),{lastPosition:s,isActive:n,options:o}=this,a=s===null?null:s<e;t.forEach(r=>{const{isIntersecting:c}=r;c&&!n?this.setState(!0,a):!c&&n&&o.exit&&(a&&o.exitForward||!a&&o.exitReverse)&&this.setState(!1,a)}),this.lastPosition=e}setupObserver(){const t=s=>{this.onObserve(s)},e=this.getObserverOptions();this.options.debug&&At.log("IntersectionObserver (options)",e),this.observer=new IntersectionObserver(t,e),this.observer.observe(this.element)}getScrollY(){const{root:t}=this.options;return t===null||t===document?window.scrollY:t.scrollTop}setState(t,e){const{element:s}=this,n={isActive:t,isForward:e,element:s,instance:this},{setClasses:o,setAttribute:a,onChange:r}=this.options;o&&this.updateClasses(t,e),a&&this.updateStateAttribute(t,e),r&&r(n),this.isActive=t}getAllClasses(){return Object.values(this.classes)}updateClasses(t,e){const{classes:s}=this,n=this.getAllClasses(),o=[s.enter,e?s.enterForward:s.enterReverse],a=[s.exit,e?s.exitForward:s.exitReverse];this.syncedElements.forEach(r=>{r.classList.remove(...n),t?r.classList.add(...o):r.classList.add(...a)})}updateStateAttribute(t,e){const s=t?"enter":"exit",n=e?"forward":"reverse";this.syncedElements.forEach(o=>{o.setAttribute(this.options.attributeName,`${s}-${n}`)})}destroy(){this.observer.disconnect(),this.observer=null,this.options.setClasses&&this.element.classList.remove(...this.getAllClasses()),this.options.setAttribute&&this.element.removeAttribute(this.options.attributeName)}};C(Dt,"defaults",{root:null,rootSelector:null,debug:!1,horizontal:!1,marginStart:"-25%",marginEnd:"-55%",threshold:[0,1],exit:!0,exitForward:!0,exitReverse:!0,setClasses:!1,classPrefix:"scrollpoint",setAttribute:!0,attributeName:"data-ulu-scrollpoint-state",syncElements:[],onChange(t){}});let $t=Dt;const X=new w({type:"slider",baseAttribute:"data-ulu-slider"}),li=X.attributeSelector("track"),ci=X.attributeSelector("track-container"),ui=X.attributeSelector("control-context"),di=X.attributeSelector("slide"),hi=[],Y={once:!0},Ne=i=>`${i}ms`,fi=["container","trackContainer","track","slides"];function pi(){X.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Fe(i,t),e()}})}function Fe(i,t){const e=Object.assign({},t),s={container:i,track:i.querySelector(li),trackContainer:i.querySelector(ci),controlContext:i.querySelector(ui),slides:i.querySelectorAll(di)};s.slides.length&&hi.push(new Lt(s,e,!1))}const L=class L{static _initializeGlobals(){L.globalsInitialized||(addEventListener("load",()=>{addEventListener("resize",j(()=>{L.instances.forEach(t=>t.handleResize())},250))}),L.reduceMotion=matchMedia("(prefers-reduced-motion: reduce)").matches,L.globalsInitialized=!0)}constructor(t,e){L._initializeGlobals();const s=Object.assign({},L.defaults,e);this.options=s,this.slide=null,this.index=null,this.swipeInstance=null,this.swipeListener=null,this.swipeImageListener=null,this.transitioning=!1,dt(fi)||S(this,"Missing a required Element"),t.slides.length||S(this,"Missing slides"),R(t.track),this.trackId=t.track.id,this.slides=[...t.slides].map((n,o)=>(R(n),{element:n,index:o,id:n.id,number:o+1})),this.elements=y(y(y({},t),this.createControls(t.controlContext||t.container)),this.createNav(t.navContext||t.container)),this.transition=s.transition?s.transitionFade||L.reduceMotion?this.fadeTransition:this.slideTransition:this.noTransition,this.setup(),this.goto(0,null,"init"),k(this,"Slider Instance Created",this),L.instances.push(this)}handleResize(){const{slide:t,transition:e,slideTransition:s}=this;e===s&&t&&this.translateTo(t.element.offsetLeft,0)}previous(t){const{index:e,slides:s}=this,n=s.length-1,o=e-1,a=o<0?n:o;this.emit("previous",[t,a]),this.goto(a,t,"previous")}next(t){const{index:e,slides:s}=this,n=e+1,o=n>s.length-1?0:n;this.emit("next",[t,o]),this.goto(o,t,"next")}ensureTransitionEnds(t,e,s){return new Promise(n=>{const o={},a=()=>{clearTimeout(o.start),o.end=setTimeout(r,e+500)},r=()=>{clearTimeout(o.start),clearTimeout(o.end),t.removeEventListener("transitionrun",a,Y),t.removeEventListener("transitionend",r,Y),t.removeEventListener("transitioncancel",r,Y),n()};t.addEventListener("transitionrun",a,Y),t.addEventListener("transitionend",r,Y),t.addEventListener("transitioncancel",r,Y),o.start=setTimeout(r,e+500),t.style.transitionDuration=Ne(e),s(),e||r()})}translateTo(t,e){const{track:s}=this.elements,n=()=>s.style.transform=`translateX(-${t}px)`;return s.style.willChange="transform",this.ensureTransitionEnds(s,e,n).then(()=>{s.style.willChange="auto"})}setVisibility(t,e){e||(t.element.style.visibility="visible"),this.slides.forEach(s=>{s!==t&&(s.element.style.visibility=e?"visible":"hidden")})}fadeSlide(t,e){const{options:s}=this,{element:n}=t,o=e?s.transitionDuration:s.transitionDurationExit;return this.ensureTransitionEnds(n,o,()=>{n.style.opacity=e?"1":"0"})}slideTransition(a){return ce(this,arguments,function*({slide:t,index:e,old:s,oldIndex:n,triggerType:o}){const r=this.slides.length,c=o==="previous",u=r-1,h=e===0&&n===u,m=e===u&&n===0;let f,b=this.options.transitionDuration;n&&!h&&!m&&(b=b*Math.abs(n-e)),r<3?h&&!c?f=s:m&&(f=c?t:s):h?f=s:m&&(f=t),this.setVisibility(null,!0),f&&(f.element.style.order="-1",yield this.translateTo(h?0:s.element.offsetLeft,0)),yield this.translateTo(t.element.offsetLeft,b),f&&(f.element.style.order="0",yield this.translateTo(t.element.offsetLeft,0)),this.setVisibility(t,!1)})}fadeTransition(s){return ce(this,arguments,function*({slide:t,old:e}){this.setVisibility(null,!0),e&&(yield this.fadeSlide(e,!1),e.element.style.order="0"),t.element.style.order="-1",yield this.fadeSlide(t,!0),this.setVisibility(t,!1)})}noTransition({slide:t,old:e}){return this.setVisibility(t,!1),e&&(e.element.style.order="0"),t.element.style.order="-1",Promise.resolve()}goto(t,e,s){const{slide:n,index:o,slides:a,elements:r}=this,c=s==="init",u=a[t],h=this.getClass("nav-button--active"),m=this.getClass("transition",!0),f={slide:u,index:t,old:n,oldIndex:o,triggerType:s};if(t===o){Ft(this,"Could not goto slide, still performing transition");return}if(this.transitioning){Ft(this,"Cancel goto(), same slide index as current slide");return}this.elements.track.inert=!0,this.transitioning=!0,n&&n.navButton.classList.remove(h),u.navButton.classList.add(h),r.container.classList.add(m),this.transition(f).then(()=>{this.index=t,this.slide=u,this.transitioning=!1,this.elements.track.inert=!1,r.container.classList.remove(m),c||(u.element.focus(),this.emit("goto",[e,t,u]))})}setup(){const{container:t,track:e,trackContainer:s}=this.elements,n=ht(this.trackCss()),o=ht(this.trackContainerStyles()),a=ht(this.slideCss());e.setAttribute("style",n),s.setAttribute("style",o),e.setAttribute("aria-live","polite"),this.slides.forEach(r=>{r.element.setAttribute("style",a),r.element.setAttribute("tabindex","-1"),r.element.setAttribute("role","group"),r.element.setAttribute("aria-roledescription","slide"),r.element.setAttribute("aria-label",`Slide ${r.number} of ${this.slides.length}`)}),t.classList.add(this.getClass()),this.options.swipeEnabled&&this.setupSwipe()}setupSwipe(){const t=this.elements.track.querySelectorAll("img");this.swipeListener=e=>{this.onSwipe(e)},this.swipeImageListener=e=>{e.preventDefault()},this.slides.forEach(e=>{const{element:s}=e;e.swipeInstance=g(s,this.options.swipeOptions),s.addEventListener("swipe",this.swipeListener)}),t.forEach(e=>{e.addEventListener("dragstart",this.swipeImageListener)})}onSwipe(t){const{directions:e}=t.detail,s=e.left?"next":e.right?"previous":null;s&&this[s](t)}trackContainerStyles(){return`
|
|
45
|
+
`}onScroll(t){this.hasOverflow&&this.onScrollHorizontal()}onScrollHorizontal(){const{nextEnabled:t,previousEnabled:e}=this,{track:s}=this.elements,{offsetStart:n,offsetEnd:o}=this.options,{scrollWidth:a,clientWidth:r,scrollLeft:c}=s,u=c<=n,h=a-c-o<=r;u&&e?this.setControlState("previous",!1):!u&&!e&&this.setControlState("previous",!0),h&&t?this.setControlState("next",!1):!h&&!t&&this.setControlState("next",!0)}setControlState(t,e){const s=t==="next",{next:n,nextItem:o,previous:a,previousItem:r}=this.elements,c=s?o:r,u=s?n:a,h=e?"remove":"add";c.classList[h](this.getClass("controls-item--disabled")),u.classList[e?"remove":"add"](this.getClass("control--disabled")),e?u.removeAttribute("disabled"):u.setAttribute("disabled",""),this[s?"nextEnabled":"previousEnabled"]=e}resolveAmount(t){const e=t==="next",{amount:s}=this.options,{scrollLeft:n,offsetWidth:o}=this.elements.track;return s==="auto"?e?n+o:n-o:typeof s=="function"?s(this,t):typeof s=="number"?e?n+s:n-s:(S("Unable to resolve amount for scroll"),500)}next(){this.elements.track.scrollTo({top:0,left:this.resolveAmount("next"),behavior:"smooth"})}previous(){this.elements.track.scrollTo({top:0,left:this.resolveAmount("previous"),behavior:"smooth"})}getClass(t){const{namespace:e}=this.options;return`${e}__${t}`}};C(lt,"instances",[]),C(lt,"defaults",{namespace:"OverflowScroller",events:{},horizontal:!0,offsetStart:100,offsetEnd:100,amount:"auto",buttonClasses:["button","button--icon"],iconClassPrevious:H("iconClassPrevious"),iconClassNext:H("iconClassNext")});let wt=lt;function xe(){return function(t,e){const s=e==="next",{track:n}=t.elements;if(!n.children)return 400;const a=window.getComputedStyle(n).getPropertyValue("scroll-padding-left").replace("auto","0px"),r=parseInt(a,10)||0,{scrollLeft:c,offsetWidth:u}=n,h=c+u,m=[...n.children].map(b=>{const{offsetLeft:p,offsetWidth:oe}=b;return{element:b,offsetLeft:p,offsetRight:p+oe}});let f;if(s)f=m.find(b=>b.offsetRight>h-1);else{let b=m.findLastIndex(p=>p.offsetLeft<c+r-1);if(b>-1){let p=m[b];f=m.slice(0,b+1).find(Ti=>Ti.offsetLeft-r+u>=p.offsetRight-1)||p}}return f?Math.max(0,f.offsetLeft-r):400}}function Ms(){os()}const De={strategy:"absolute",placement:"bottom",inline:!1,offset:{mainAxis:16},shift:!0,flip:!0,arrow:!0};function Jt(i,t){const e=Object.assign({},De,t),{placement:s,strategy:n}=e,{trigger:o,content:a,contentArrow:r}=i;return d.autoUpdate(o,a,()=>{d.computePosition(o,a,{placement:s,strategy:n,middleware:[...rt(d.inline,e.inline),...rt(d.offset,e.offset),...rt(d.flip,e.flip),...rt(d.shift,e.shift),...rt(d.arrow,r&&e.arrow,{element:r})]}).then(c=>{const{x:u,y:h,middlewareData:m,placement:f}=c,b=m.arrow;Object.assign(a.style,{left:`${u}px`,top:`${h}px`}),a.setAttribute("data-placement",f),b&&Object.assign(r.style,{left:(b==null?void 0:b.x)!=null?`${b.x}px`:"",top:(b==null?void 0:b.y)!=null?`${b.y}px`:""})})})}function rt(i,t,e={}){return t?typeof t=="object"?[i(y(y({},t),e))]:[i(e)]:[]}const M=new w({type:"popover",baseAttribute:"data-ulu-popover"}),qs=M.attributeSelector("trigger-anchor"),Bs=M.attributeSelector("arrow"),js=M.getAttribute("content"),Ns=M.attributeSelector("content"),Zt=new WeakMap,Fs={clickOutsideCloses:!0,escapeCloses:!0};function Us(){M.init({key:"trigger",withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){if(Zt.has(i))return;const s=Pe(i,t);if(!s){M.warn("Unable to resolve popover elements for trigger.",i);return}const{elements:n,options:o,floatingOptions:a}=s;Zt.set(n,new Re(n,o,a)),e()}})}function Pe(i,t){const e=Object.assign({},t),s=He(i),n={trigger:i,content:s,anchor:i.querySelector(qs)||i,contentArrow:s.querySelector(Bs)},o=e.floating||{};return delete e.floating,s?{elements:n,options:e,floatingOptions:o}:(M.logError("Unable to make popover for",i),!1)}function He(i){var s;let t;const e=i.getAttribute("aria-controls");if(e)t=document.getElementById(e);else if((s=i==null?void 0:i.nextElementSibling)!=null&&s.hasAttribute(js))t=i.nextElementSibling;else{const n=Array.from(i.parentNode.children),o=n.findIndex(r=>r===i);t=n.slice(o).find(r=>r.matches(Ns))}return t||M.logError("Unable to resolve 'content' element for popover",i),t}class Re extends gt{constructor(t,e,s){const n=Object.assign({},Fs,e);super(t,n),this.floatingOptions=s||{}}setState(t,e){super.setState(t,e),this.destroyFloatingInstance(),t&&this.createFloatingInstance()}destroy(){super.destroy(),this.destroyFloatingInstance()}createFloatingInstance(){const{content:t,anchor:e,contentArrow:s}=this.elements,n={trigger:e,contentArrow:s,content:t};this.floatingCleanup=Jt(n,this.floatingOptions)}destroyFloatingInstance(){this.floatingCleanup&&(this.floatingCleanup(),this.floatingCleanup=null)}}const Et={opened:"data-ulu-print-details-opened"},Vs=i=>`[${Et[i]}]`,Ks={selector:"details:not([open])"};function Ws(i){const t=Object.assign({},Ks,i);document.addEventListener(z("beforePrint"),()=>{document.querySelectorAll(t.selector).forEach(e=>{e.open||(e.setAttribute(Et.opened,!0),e.open=!0)})}),document.addEventListener(z("afterPrint"),()=>{document.querySelectorAll(Vs("opened")).forEach(e=>{e.removeAttribute(Et.opened),e.open=!1})})}function Xs(i){const t=window.open();t.document.write(i),t.print(),t.close()}function Ys(i){var t=i.innerHTML;Xs(t)}const Gs=new w({type:"print",baseAttribute:"data-ulu-print"}),Qs={element:null};function _s(){Gs.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Js(i,t),e()}})}function Js(i,t){const e=Object.assign({},Qs,t);i.addEventListener("click",()=>{if(e.element){const s=ut(e.element);s?Ys(s):console.error("Unable to find element to print",i,e)}else window.print()})}const Me=new w({type:"proxy-click",baseAttribute:"data-ulu-proxy-click"}),qe={selector:"[data-ulu-proxy-click-source]",selectorPreventBase:"input, select, textarea, button, a, [tabindex='-1']",selectorPrevent:"",mousedownDurationPrevent:250};let te=y({},qe);function Zs(i){te=Object.assign({},te,i)}function ti(){Me.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Be(i,t),e()}})}function Be(i,t){const e=Object.assign({},te,t),s=i.querySelector(e.selector);s?je(i,s,e):console.error("Unable to locate proxy click source",e.selector)}function je(i,t,e){const{selectorPreventBase:s,selectorPrevent:n}=e,o=`${s}${n?`, ${n}`:""}`;let a,r;i.addEventListener("mousedown",({target:c,timeStamp:u})=>{r=!1,c.matches(o)||(r=!0,a=u)}),i.addEventListener("mouseup",({timeStamp:c})=>{r&&c-a<e.mousedownDurationPrevent&&t.click()}),i.style.cursor="pointer"}const St=new w({type:"scroll-slider",baseAttribute:"data-ulu-scroll-slider"}),ei=St.attributeSelector("track"),si=St.attributeSelector("control-context"),ii=[],ni={amount:xe()};function oi(){St.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){ri(i,t),e()}})}function ri(i,t){const e=Object.assign({},ni,t),s={track:i.querySelector(ei),controls:i.querySelector(si)};ii.push(new wt(s,e))}const At=new w({type:"scrollpoint",baseAttribute:"data-ulu-scrollpoint"});function ai(){At.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){const s=Object.assign({},t);new $t(i,s),e()}})}const xt=class xt{constructor(t,e){const s=Object.assign({},xt.defaults,e);if(!t){S(this,"Missing required element");return}s.rootSelector&&(s.root=document.querySelector(s.rootSelector),delete s.rootSelector),this.options=s,this.observer=null,this.lastPosition=null,this.isActive=!1,this.element=t,this.syncedElements=[t,...s.syncElements.map(n=>ut(n))],this.classes={enter:this.getClassname("enter"),enterForward:this.getClassname("enter--from-forward"),enterReverse:this.getClassname("enter--from-reverse"),exit:this.getClassname("exit"),exitForward:this.getClassname("exit--from-forward"),exitReverse:this.getClassname("exit--from-reverse")},this.setupObserver(),s.debug&&At.log(this)}getClassname(t){return this.options.classPrefix+"-"+t}getObserverOptions(){const{root:t,marginStart:e,marginEnd:s,threshold:n,horizontal:o}=this.options,a=o?`0px ${e} 0px ${s}`:`${e} 0px ${s} 0px`;return{root:t,rootMargin:a,threshold:n}}onObserve(t){const e=this.getScrollY(),{lastPosition:s,isActive:n,options:o}=this,a=s===null?null:s<e;t.forEach(r=>{const{isIntersecting:c}=r;c&&!n?this.setState(!0,a):!c&&n&&o.exit&&(a&&o.exitForward||!a&&o.exitReverse)&&this.setState(!1,a)}),this.lastPosition=e}setupObserver(){const t=s=>{this.onObserve(s)},e=this.getObserverOptions();this.options.debug&&At.log("IntersectionObserver (options)",e),this.observer=new IntersectionObserver(t,e),this.observer.observe(this.element)}getScrollY(){const{root:t}=this.options;return t===null||t===document?window.scrollY:t.scrollTop}setState(t,e){const{element:s}=this,n={isActive:t,isForward:e,element:s,instance:this},{setClasses:o,setAttribute:a,onChange:r}=this.options;o&&this.updateClasses(t,e),a&&this.updateStateAttribute(t,e),r&&r(n),this.isActive=t}getAllClasses(){return Object.values(this.classes)}updateClasses(t,e){const{classes:s}=this,n=this.getAllClasses(),o=[s.enter,e?s.enterForward:s.enterReverse],a=[s.exit,e?s.exitForward:s.exitReverse];this.syncedElements.forEach(r=>{r.classList.remove(...n),t?r.classList.add(...o):r.classList.add(...a)})}updateStateAttribute(t,e){const s=t?"enter":"exit",n=e?"forward":"reverse";this.syncedElements.forEach(o=>{o.setAttribute(this.options.attributeName,`${s}-${n}`)})}destroy(){this.observer.disconnect(),this.observer=null,this.options.setClasses&&this.element.classList.remove(...this.getAllClasses()),this.options.setAttribute&&this.element.removeAttribute(this.options.attributeName)}};C(xt,"defaults",{root:null,rootSelector:null,debug:!1,horizontal:!1,marginStart:"-25%",marginEnd:"-55%",threshold:[0,1],exit:!0,exitForward:!0,exitReverse:!0,setClasses:!1,classPrefix:"scrollpoint",setAttribute:!0,attributeName:"data-ulu-scrollpoint-state",syncElements:[],onChange(t){}});let $t=xt;const X=new w({type:"slider",baseAttribute:"data-ulu-slider"}),li=X.attributeSelector("track"),ci=X.attributeSelector("track-container"),ui=X.attributeSelector("control-context"),di=X.attributeSelector("slide"),hi=[],Y={once:!0},Ne=i=>`${i}ms`,fi=["container","trackContainer","track","slides"];function pi(){X.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Fe(i,t),e()}})}function Fe(i,t){const e=Object.assign({},t),s={container:i,track:i.querySelector(li),trackContainer:i.querySelector(ci),controlContext:i.querySelector(ui),slides:i.querySelectorAll(di)};s.slides.length&&hi.push(new Lt(s,e,!1))}const L=class L{static _initializeGlobals(){L.globalsInitialized||(addEventListener("load",()=>{addEventListener("resize",j(()=>{L.instances.forEach(t=>t.handleResize())},250))}),L.reduceMotion=matchMedia("(prefers-reduced-motion: reduce)").matches,L.globalsInitialized=!0)}constructor(t,e){L._initializeGlobals();const s=Object.assign({},L.defaults,e);this.options=s,this.slide=null,this.index=null,this.swipeInstance=null,this.swipeListener=null,this.swipeImageListener=null,this.transitioning=!1,dt(fi)||S(this,"Missing a required Element"),t.slides.length||S(this,"Missing slides"),R(t.track),this.trackId=t.track.id,this.slides=[...t.slides].map((n,o)=>(R(n),{element:n,index:o,id:n.id,number:o+1})),this.elements=y(y(y({},t),this.createControls(t.controlContext||t.container)),this.createNav(t.navContext||t.container)),this.transition=s.transition?s.transitionFade||L.reduceMotion?this.fadeTransition:this.slideTransition:this.noTransition,this.setup(),this.goto(0,null,"init"),k(this,"Slider Instance Created",this),L.instances.push(this)}handleResize(){const{slide:t,transition:e,slideTransition:s}=this;e===s&&t&&this.translateTo(t.element.offsetLeft,0)}previous(t){const{index:e,slides:s}=this,n=s.length-1,o=e-1,a=o<0?n:o;this.emit("previous",[t,a]),this.goto(a,t,"previous")}next(t){const{index:e,slides:s}=this,n=e+1,o=n>s.length-1?0:n;this.emit("next",[t,o]),this.goto(o,t,"next")}ensureTransitionEnds(t,e,s){return new Promise(n=>{const o={},a=()=>{clearTimeout(o.start),o.end=setTimeout(r,e+500)},r=()=>{clearTimeout(o.start),clearTimeout(o.end),t.removeEventListener("transitionrun",a,Y),t.removeEventListener("transitionend",r,Y),t.removeEventListener("transitioncancel",r,Y),n()};t.addEventListener("transitionrun",a,Y),t.addEventListener("transitionend",r,Y),t.addEventListener("transitioncancel",r,Y),o.start=setTimeout(r,e+500),t.style.transitionDuration=Ne(e),s(),e||r()})}translateTo(t,e){const{track:s}=this.elements,n=()=>s.style.transform=`translateX(-${t}px)`;return s.style.willChange="transform",this.ensureTransitionEnds(s,e,n).then(()=>{s.style.willChange="auto"})}setVisibility(t,e){e||(t.element.style.visibility="visible"),this.slides.forEach(s=>{s!==t&&(s.element.style.visibility=e?"visible":"hidden")})}fadeSlide(t,e){const{options:s}=this,{element:n}=t,o=e?s.transitionDuration:s.transitionDurationExit;return this.ensureTransitionEnds(n,o,()=>{n.style.opacity=e?"1":"0"})}slideTransition(a){return ce(this,arguments,function*({slide:t,index:e,old:s,oldIndex:n,triggerType:o}){const r=this.slides.length,c=o==="previous",u=r-1,h=e===0&&n===u,m=e===u&&n===0;let f,b=this.options.transitionDuration;n&&!h&&!m&&(b=b*Math.abs(n-e)),r<3?h&&!c?f=s:m&&(f=c?t:s):h?f=s:m&&(f=t),this.setVisibility(null,!0),f&&(f.element.style.order="-1",yield this.translateTo(h?0:s.element.offsetLeft,0)),yield this.translateTo(t.element.offsetLeft,b),f&&(f.element.style.order="0",yield this.translateTo(t.element.offsetLeft,0)),this.setVisibility(t,!1)})}fadeTransition(s){return ce(this,arguments,function*({slide:t,old:e}){this.setVisibility(null,!0),e&&(yield this.fadeSlide(e,!1),e.element.style.order="0"),t.element.style.order="-1",yield this.fadeSlide(t,!0),this.setVisibility(t,!1)})}noTransition({slide:t,old:e}){return this.setVisibility(t,!1),e&&(e.element.style.order="0"),t.element.style.order="-1",Promise.resolve()}goto(t,e,s){const{slide:n,index:o,slides:a,elements:r}=this,c=s==="init",u=a[t],h=this.getClass("nav-button--active"),m=this.getClass("transition",!0),f={slide:u,index:t,old:n,oldIndex:o,triggerType:s};if(t===o){Ft(this,"Could not goto slide, still performing transition");return}if(this.transitioning){Ft(this,"Cancel goto(), same slide index as current slide");return}this.elements.track.inert=!0,this.transitioning=!0,n&&n.navButton.classList.remove(h),u.navButton.classList.add(h),r.container.classList.add(m),this.transition(f).then(()=>{this.index=t,this.slide=u,this.transitioning=!1,this.elements.track.inert=!1,r.container.classList.remove(m),c||(u.element.focus(),this.emit("goto",[e,t,u]))})}setup(){const{container:t,track:e,trackContainer:s}=this.elements,n=ht(this.trackCss()),o=ht(this.trackContainerStyles()),a=ht(this.slideCss());e.setAttribute("style",n),s.setAttribute("style",o),e.setAttribute("aria-live","polite"),this.slides.forEach(r=>{r.element.setAttribute("style",a),r.element.setAttribute("tabindex","-1"),r.element.setAttribute("role","group"),r.element.setAttribute("aria-roledescription","slide"),r.element.setAttribute("aria-label",`Slide ${r.number} of ${this.slides.length}`)}),t.classList.add(this.getClass()),this.options.swipeEnabled&&this.setupSwipe()}setupSwipe(){const t=this.elements.track.querySelectorAll("img");this.swipeListener=e=>{this.onSwipe(e)},this.swipeImageListener=e=>{e.preventDefault()},this.slides.forEach(e=>{const{element:s}=e;e.swipeInstance=g(s,this.options.swipeOptions),s.addEventListener("swipe",this.swipeListener)}),t.forEach(e=>{e.addEventListener("dragstart",this.swipeImageListener)})}onSwipe(t){const{directions:e}=t.detail,s=e.left?"next":e.right?"previous":null;s&&this[s](t)}trackContainerStyles(){return`
|
|
46
46
|
overflow: hidden;
|
|
47
47
|
`}transitionCss(t){const{transitionTimingFunction:e,transitionDuration:s}=this.options;return`
|
|
48
48
|
transition-property: ${t};
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
`}getClass(t,e){const{namespace:s}=this.options;return e?`${s}--${t}`:t?`${s}__${t}`:s}createControlButton(t){const e=document.createElement("button");return e.classList.add(this.getClass("control-button")),e.classList.add(this.getClass(`control-button--${t}`)),e.classList.add(...this.options.buttonClasses),e.setAttribute("data-slider-control",t),e.setAttribute("type","button"),e.setAttribute("aria-controls",this.trackId),e.innerHTML=this.getControlContent(t),e}createControls(t){const e=document.createElement("ul"),s=document.createElement("li"),n=document.createElement("li"),o=this.createControlButton("previous"),a=this.createControlButton("next");return e.classList.add(this.getClass("controls")),s.appendChild(o),n.appendChild(a),e.appendChild(s),e.appendChild(n),o.addEventListener("click",this.previous.bind(this)),a.addEventListener("click",this.next.bind(this)),t.appendChild(e),{controls:e,previousItem:s,nextItem:n,previous:o,next:a}}createNav(t){const e=document.createElement("ul"),s=this.slides.map(this.createNavButton.bind(this)),n=s.map(o=>{const a=document.createElement("li");return a.appendChild(o),e.appendChild(a),a});return e.classList.add(this.getClass("nav")),t.appendChild(e),{nav:e,navButtons:s,navItems:n}}createNavButton(t,e){const s=document.createElement("button");return s.classList.add(this.getClass("nav-button")),s.setAttribute("type","button"),s.setAttribute("aria-controls",t.id),s.innerHTML=this.getNavContent(t),t.navButton=s,s.addEventListener("click",this.goto.bind(this,e)),s}getControlContent(t){const e=this.options[t==="next"?"iconClassNext":"iconClassPrevious"];return`
|
|
62
62
|
<span class="${this.options.classAccessiblyHidden}">${t}</span>
|
|
63
63
|
<span class="${this.getClass("control-icon")} ${e}" aria-hidden="true"></span>
|
|
64
|
-
`}getNavContent(t){return`<span class="${this.options.classAccessiblyHidden}">Item ${t.number}</span>`}emit(t,e){this.options.events[t]&&this.options.events[t].apply(this,e)}};C(L,"instances",[]),C(L,"globalsInitialized",!1),C(L,"reduceMotion",!1),C(L,"defaults",{classAccessiblyHidden:"hidden-visually",namespace:"Slider",events:{},transition:!0,transitionFade:!1,transitionDuration:700,transitionDurationExit:400,transitionTimingFunction:"ease-in-out",buttonClasses:["button","button--icon"],iconClassPrevious:H("iconClassPrevious"),iconClassNext:H("iconClassNext"),swipeEnabled:!0,swipeOptions:{preventScroll:!0}});let Lt=L;const Pt=class Pt{constructor(t,e={}){if(this.tablist=t,this.options=y(y({},Pt.defaults),e),this.tabs=Array.from(this.tablist.children),this.panels=this.tabs.map(n=>{const o=n.getAttribute("aria-controls");return o?document.getElementById(o):null}).filter(Boolean),this.currentIndex=-1,this.handleKeydown=this.handleKeydown.bind(this),this.handleClick=this.handleClick.bind(this),this.updatePanelHeights=this.updatePanelHeights.bind(this),this.tabs.length===0||this.tabs.length!==this.panels.length){console.warn("TabManager: Tab/Panel count mismatch. Check aria-controls.",{tabs:this.tabs,panels:this.panels});return}this.orientation=this.options.orientation||this.tablist.getAttribute("aria-orientation")||"horizontal",this.setupAttributes(),this.attachListeners();let s=this.options.initialIndex;if(this.options.openByUrlHash){const n=window.location.hash.substring(1),o=this.tabs.findIndex(a=>a.id===n);o>-1&&(s=o)}this.activate(s,!1),this.options.equalHeights&&(this.updatePanelHeights(),document.addEventListener(z("pageResized"),this.updatePanelHeights)),this.options.onReady&&this.options.onReady(this)}setupAttributes(){this.tablist.setAttribute("role","tablist"),this.tabs.forEach((t,e)=>{const s=this.panels[e];R(t),R(s),t.setAttribute("role","tab"),t.hasAttribute("aria-controls")||t.setAttribute("aria-controls",s.id),s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",t.id),s.hidden=!0,t.setAttribute("tabindex","-1"),t.setAttribute("aria-selected","false")})}attachListeners(){this.tabs.forEach(t=>{t.addEventListener("click",this.handleClick),t.addEventListener("keydown",this.handleKeydown)})}handleClick(t){const e=this.tabs.indexOf(t.currentTarget);this.activate(e)}handleKeydown(t){const e=this.tabs.indexOf(t.currentTarget);let s=null;const n=this.orientation==="vertical",o=this.options.allArrows,a=(this.tablist.dir==="rtl"||document.dir==="rtl")&&this.tablist.dir!=="ltr",r=a?"ArrowLeft":"ArrowRight",c=a?"ArrowRight":"ArrowLeft";t.key==="ArrowDown"?(n||o)&&(s=(e+1)%this.tabs.length):t.key==="ArrowUp"?(n||o)&&(s=(e-1+this.tabs.length)%this.tabs.length):t.key===r?(!n||o)&&(s=(e+1)%this.tabs.length):t.key===c?(!n||o)&&(s=(e-1+this.tabs.length)%this.tabs.length):t.key==="Home"?s=0:t.key==="End"&&(s=this.tabs.length-1),s!==null&&(t.preventDefault(),this.activate(s),this.tabs[s].focus())}activate(t,e=!0){let s=-1;if(typeof t=="string"?s=this.tabs.findIndex(u=>u.id===t):s=t,s<0||s>=this.tabs.length||this.currentIndex===s)return;const n=this.currentIndex,o=n>-1?this.tabs[n]:null,a=n>-1?this.panels[n]:null;o&&(o.setAttribute("aria-selected","false"),o.setAttribute("tabindex","-1"),a.hidden=!0);const r=this.tabs[s],c=this.panels[s];r.setAttribute("aria-selected","true"),r.setAttribute("tabindex","0"),c.hidden=!1,this.currentIndex=s,e&&this.options.setUrlHash&&window.history&&window.history.replaceState(null,"",`#${r.id}`),e&&this.options.onChange&&this.options.onChange({index:s,tab:r,panel:c},{index:n,tab:o,panel:a})}activateById(t){this.activate(t,!0)}updatePanelHeights(){if(!this.panels||this.panels.length===0)return;const t=this.panels[0].parentElement;if(!t)return;const e=[...t.querySelectorAll("img")],s=o=>new Promise(a=>{if(o.complete)return a(o);o.onload=()=>a(o),o.onerror=()=>a(o)}),n=e.map(s);Promise.all(n).then(()=>{this.panels.forEach(r=>{r.style.minHeight=""});const o=this.panels.map(r=>{const c=r.hidden;r.hidden=!1;const u=r.offsetHeight;return r.hidden=c,u}),a=Math.max(...o);a>0&&this.panels.forEach(r=>{r.style.minHeight=`${a}px`})})}destroy(){this.tabs.forEach(t=>{t.removeEventListener("click",this.handleClick),t.removeEventListener("keydown",this.handleKeydown)}),this.options.equalHeights&&document.removeEventListener(z("pageResized"),this.updatePanelHeights),this.tablist.removeAttribute("role"),this.tabs.forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex")}),this.panels.forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.hidden=!1,t.style.minHeight=""}),this.tablist=null,this.tabs=[],this.panels=[],this.options={},this.currentIndex=-1}};C(Pt,"defaults",{orientation:null,initialIndex:0,allArrows:!1,openByUrlHash:!1,setUrlHash:!1,equalHeights:!1,onReady:null,onChange:null});let kt=Pt;const Ue=[],Ve=new w({type:"tabs",baseAttribute:"data-ulu-tablist"});function gi(){const i=()=>{Ve.init({coreEvents:["pageModified"],withData:!0,setup({element:t,data:e,initialize:s}){Ke(t,e),s()}})};document.readyState==="complete"?i():window.addEventListener("load",i)}function Ke(i,t={}){const e=y({},t);e.vertical&&(e.allArrows=!0),e.openByUrlHash&&(e.setUrlHash=!0),[...i.children].forEach(o=>{if(!o.hasAttribute("aria-controls")){const a=document.querySelector(`[aria-labelledby="${o.id}"]`);a&&(R(a),o.setAttribute("aria-controls",a.id))}});const n={element:i,options:t};return n.tabManager=new kt(i,e),Ue.push(n),n}const I=new w({type:"theme-toggle",baseAttribute:"data-ulu-theme-toggle"}),mi=I.attributeSelector("label"),bi=I.attributeSelector("icon"),We=I.getAttribute("remote"),ee=I.getAttribute("init"),Xe=I.getAttribute("state"),vi=i=>document.querySelectorAll(`[${We}="${i}"]`),Ye=i=>document.querySelectorAll(`[${We}="${i}"]:not([${ee}])`),Ge=["target"],yi=dt(Ge),Qe=(i,t)=>i?t():null,se={themes:{light:{label:"Light",value:"light",iconClass:"fas fa-moon",targetClass:"theme-light",mediaQuery:"(prefers-color-scheme: light)"},dark:{label:"Dark",iconClass:"fas fa-sun",targetClass:"theme-dark",mediaQuery:"(prefers-color-scheme: dark)"}},target:"body",group:null,onChange(i){},initialState:"light",checkMediaQuery:!1,savePreference:!1,storagePrefix:"ulu-theme-",debug:!1};let _e=y({},se);function Ci(i){_e=Object.assign({},_e,i)}function wi(){I.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){Je(i,t),e()}})}function Je(i,t){const e=Object.assign({},se,t);if(!yi(e)){console.error(`Missing a required option: ${Ge.join(", ")}`);return}const s=e.group,n={toggle:i,options:e},o=Ei(e);if(!o){console.error("Unable to resolve initial key");return}ie(o,n),i.addEventListener("click",r),c(),document.addEventListener(z("pageModified"),c);function a(m){const b=fe(e.target)[0].dataset.uluThemeToggleState,p=Ai(b,e);if(!p){console.error("Issue getting next theme key");return}ie(p,ae(y({},n),{event:m}))}function r(m){a(m)}function c(){if(!s)return;Ye(s).forEach(f=>{f.addEventListener("click",r),I.initializeElement(f)})}function u(){if(!s)return;Ye(s).forEach(f=>{f.removeEventListener("click",r),f.removeAttribute(ee,"")})}function h(){i.removeEventListener("click",r),i.removeAttribute(ee,""),u(),document.removeEventListener(z("pageModified"),c)}return{destroy:h,toggle:i,options:e,toggleState:a,setState(m){ie(m,n)}}}function ie(i,t){if(!i){console.error("Missing key");return}const{toggle:e,options:s}=t,{themes:n,group:o}=s,a={targets:fe(s.target),toggles:[e,...o?vi(o):[]]};if(!a.targets.length||!a.toggles.length){console.error("Issue setting state, couldn't find needed elements",a);return}const r=n[i],c=$i(i,n),u=ae(y({},t),{key:i,elements:a,theme:r,otherThemes:c});s.debug&&I.log("Set state context",u);const h=Ze(c,"targetClass"),m=Ze(c,"iconClass");a.targets.forEach(f=>{f.setAttribute(Xe,i),f.classList.remove(...h),f.classList.add(...ft(r.targetClass))}),a.toggles.forEach(f=>{const b=f.querySelector(mi),p=f.querySelector(bi);b&&(b.textContent=r.label),p&&(p.classList.remove(...m),p.classList.add(...ft(r.iconClass))),f.setAttribute(Xe,i)}),s.onChange&&s.onChange(u),s.savePreference&&localStorage.setItem(ts(s),i)}function Ei(i){const{savePreference:t,checkMediaQuery:e,themes:s,initialState:n}=i,o=ts(i),a=Qe(t,()=>localStorage.getItem(o)),r=Qe(e,()=>Si(s)),c=a||r||n;return i.debug&&(I.log("Preference Saved",a),I.log("Media Query Preference",r),I.log("Initial State:",n)),c||I.logError("Failed to resolve initial theme (pass 'initialState' to options)"),c}function Si(i){const t=Object.entries(i).find(([e,s])=>{if(s.mediaQuery)return window.matchMedia(s.mediaQuery).matches});return t?t[0]:null}function Ai(i,t){const{themes:e}=t,s=Object.keys(e),n=s.findIndex(a=>a===i),o=n===-1?0:(n+1)%s.length;return s[o]}function $i(i,t){return Object.entries(t).filter(([s])=>s!==i).map(([s,n])=>n)}function Ze(i,t){return i.reduce((e,s)=>e.concat(ft(s[t])),[])}function ts(i){const{storagePrefix:t,group:e}=i;return e?`${t}${e}`:t}const at=new w({type:"tooltip",baseAttribute:"data-ulu-tooltip"}),Li=at.getAttribute("body"),ki=at.attributeSelector("body"),Ii=at.attributeSelector("arrow");function zi(){at.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){const s=typeof t=="object"?t:{};typeof t=="string"&&(s.content=t),e(),new It({trigger:i},s)}})}const et=class et{constructor(t,e,s){const{trigger:n}=t;if(!n){S(this,"missing required trigger");return}this.options=Object.assign({},et.defaults,e),this.floatingOptions=Object.assign({},et.defaultFloatingOptions,s),this.elements=y({},t),this.handlers={},this.isOpen=!1,R(n),this.setup()}setup(){this.createContentElement(),this.attachHandlers(),this.setupAccessibility()}setupAccessibility(){const{trigger:t,content:e}=this.elements,{accessible:s}=this.options;s&&t.setAttribute("aria-describedby",e.id)}destroy(){this.destroyHandlers(),this.destroyDisplay()}getInnerContent(){const{fromElement:t,content:e,isHtml:s,fromAnchor:n}=this.options;if(e)return e;if(t||n){const o=n?this.getAnchorElement():document.querySelector(t);return o?s?o.innerHTML:o.innerText:""}else S(this,"Could not resolve inner content")}getAnchorElement(){const{trigger:t}=this.elements,{href:e}=t,s=e?e.split("#")[1]:null,n=s?document.getElementById(s):null;return n||console.error("Unable to get 'fromAnchor' element",t),n}createContentElement(){const{options:t}=this,e=P(t.template(t)),s=e.querySelector(ki),n=this.getInnerContent();t.isHtml?s.innerHTML=n:s.textContent=n,e.id=pt(),t.contentClass&&e.classList.add(t.contentClass),this.elements.content=e,this.elements.contentArrow=e.querySelector(Ii),document.body.appendChild(e)}attachHandlers(){const{trigger:t}=this.elements,{showEvents:e,hideEvents:s,delay:n}=this.options;let o=null;const a=u=>{o||(o=setTimeout(()=>{this.show(u),clearTimeout(o)},n))},r=u=>{o&&(clearTimeout(o),o=null),this.hide(u)},c=u=>{u.key==="Escape"&&this.hide(u)};e.forEach(u=>{t.addEventListener(u,a)}),s.forEach(u=>{t.addEventListener(u,r)}),document.addEventListener("keydown",c),this.handlers={onShow:a,onHide:r,onDocumentKeydown:c}}destroyHandlers(){const{trigger:t}=this,{onShow:e,onHide:s,onDocumentKeydown:n}=this.handlers,{showEvents:o,hideEvents:a}=this.options;e&&o.forEach(r=>{t.removeEventListener(r,e)}),s&&a.forEach(r=>{t.removeEventListener(r,s)}),n&&document.removeEventListener("keydown",n)}setState(t,e){const s={instance:this,isOpen:t,event:e},{trigger:n,content:o}=this.elements,{openClass:a}=this.options,r=c=>c.classList[t?"add":"remove"](a);r(n),r(o),this.isOpen=t,this.options.onChange(s),n.dispatchEvent(this.createEvent("change",s)),this.destroyFloatingInstance(),t&&this.createFloatingInstance()}createEvent(t,e){return new CustomEvent(N("tooltip:"+t),{detail:e})}createFloatingInstance(){this.floatingCleanup=Jt(this.elements,this.floatingOptions)}destroyFloatingInstance(){this.floatingCleanup&&(this.floatingCleanup(),this.floatingCleanup=null)}show(t){this.setState(!0,t)}hide(t){this.setState(!1,t)}};C(et,"defaults",{accessible:!0,content:null,openClass:"is-active",contentClass:"",isHtml:!1,fromElement:null,fromAnchor:!1,endOfDocument:!0,showEvents:["pointerenter","focus"],hideEvents:["pointerleave","blur"],delay:500,template(t){return`
|
|
64
|
+
`}getNavContent(t){return`<span class="${this.options.classAccessiblyHidden}">Item ${t.number}</span>`}emit(t,e){this.options.events[t]&&this.options.events[t].apply(this,e)}};C(L,"instances",[]),C(L,"globalsInitialized",!1),C(L,"reduceMotion",!1),C(L,"defaults",{classAccessiblyHidden:"hidden-visually",namespace:"Slider",events:{},transition:!0,transitionFade:!1,transitionDuration:700,transitionDurationExit:400,transitionTimingFunction:"ease-in-out",buttonClasses:["button","button--icon"],iconClassPrevious:H("iconClassPrevious"),iconClassNext:H("iconClassNext"),swipeEnabled:!0,swipeOptions:{preventScroll:!0}});let Lt=L;const Dt=class Dt{constructor(t,e={}){if(this.tablist=t,this.options=y(y({},Dt.defaults),e),this.tabs=Array.from(this.tablist.children),this.panels=this.tabs.map(n=>{const o=n.getAttribute("aria-controls");return o?document.getElementById(o):null}).filter(Boolean),this.currentIndex=-1,this.handleKeydown=this.handleKeydown.bind(this),this.handleClick=this.handleClick.bind(this),this.updatePanelHeights=this.updatePanelHeights.bind(this),this.tabs.length===0||this.tabs.length!==this.panels.length){console.warn("TabManager: Tab/Panel count mismatch. Check aria-controls.",{tabs:this.tabs,panels:this.panels});return}this.orientation=this.options.orientation||this.tablist.getAttribute("aria-orientation")||"horizontal",this.setupAttributes(),this.attachListeners();let s=this.options.initialIndex;if(this.options.openByUrlHash){const n=window.location.hash.substring(1),o=this.tabs.findIndex(a=>a.id===n);o>-1&&(s=o)}this.activate(s,!1),this.options.equalHeights&&(this.updatePanelHeights(),document.addEventListener(z("pageResized"),this.updatePanelHeights)),this.options.onReady&&this.options.onReady(this)}setupAttributes(){this.tablist.setAttribute("role","tablist"),this.tabs.forEach((t,e)=>{const s=this.panels[e];R(t),R(s),t.setAttribute("role","tab"),t.hasAttribute("aria-controls")||t.setAttribute("aria-controls",s.id),s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",t.id),s.hidden=!0,t.setAttribute("tabindex","-1"),t.setAttribute("aria-selected","false")})}attachListeners(){this.tabs.forEach(t=>{t.addEventListener("click",this.handleClick),t.addEventListener("keydown",this.handleKeydown)})}handleClick(t){const e=this.tabs.indexOf(t.currentTarget);this.activate(e)}handleKeydown(t){const e=this.tabs.indexOf(t.currentTarget);let s=null;const n=this.orientation==="vertical",o=this.options.allArrows,a=(this.tablist.dir==="rtl"||document.dir==="rtl")&&this.tablist.dir!=="ltr",r=a?"ArrowLeft":"ArrowRight",c=a?"ArrowRight":"ArrowLeft";t.key==="ArrowDown"?(n||o)&&(s=(e+1)%this.tabs.length):t.key==="ArrowUp"?(n||o)&&(s=(e-1+this.tabs.length)%this.tabs.length):t.key===r?(!n||o)&&(s=(e+1)%this.tabs.length):t.key===c?(!n||o)&&(s=(e-1+this.tabs.length)%this.tabs.length):t.key==="Home"?s=0:t.key==="End"&&(s=this.tabs.length-1),s!==null&&(t.preventDefault(),this.activate(s),this.tabs[s].focus())}activate(t,e=!0){let s=-1;if(typeof t=="string"?s=this.tabs.findIndex(u=>u.id===t):s=t,s<0||s>=this.tabs.length||this.currentIndex===s)return;const n=this.currentIndex,o=n>-1?this.tabs[n]:null,a=n>-1?this.panels[n]:null;o&&(o.setAttribute("aria-selected","false"),o.setAttribute("tabindex","-1"),a.hidden=!0);const r=this.tabs[s],c=this.panels[s];r.setAttribute("aria-selected","true"),r.setAttribute("tabindex","0"),c.hidden=!1,this.currentIndex=s,e&&this.options.setUrlHash&&window.history&&window.history.replaceState(null,"",`#${r.id}`),e&&this.options.onChange&&this.options.onChange({index:s,tab:r,panel:c},{index:n,tab:o,panel:a})}activateById(t){this.activate(t,!0)}updatePanelHeights(){if(!this.panels||this.panels.length===0)return;const t=this.panels[0].parentElement;if(!t)return;const e=[...t.querySelectorAll("img")],s=o=>new Promise(a=>{if(o.complete)return a(o);o.onload=()=>a(o),o.onerror=()=>a(o)}),n=e.map(s);Promise.all(n).then(()=>{this.panels.forEach(r=>{r.style.minHeight=""});const o=this.panels.map(r=>{const c=r.hidden;r.hidden=!1;const u=r.offsetHeight;return r.hidden=c,u}),a=Math.max(...o);a>0&&this.panels.forEach(r=>{r.style.minHeight=`${a}px`})})}destroy(){this.tabs.forEach(t=>{t.removeEventListener("click",this.handleClick),t.removeEventListener("keydown",this.handleKeydown)}),this.options.equalHeights&&document.removeEventListener(z("pageResized"),this.updatePanelHeights),this.tablist.removeAttribute("role"),this.tabs.forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex")}),this.panels.forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.hidden=!1,t.style.minHeight=""}),this.tablist=null,this.tabs=[],this.panels=[],this.options={},this.currentIndex=-1}};C(Dt,"defaults",{orientation:null,initialIndex:0,allArrows:!1,openByUrlHash:!1,setUrlHash:!1,equalHeights:!1,onReady:null,onChange:null});let kt=Dt;const Ue=[],Ve=new w({type:"tabs",baseAttribute:"data-ulu-tablist"});function gi(){const i=()=>{Ve.init({coreEvents:["pageModified"],withData:!0,setup({element:t,data:e,initialize:s}){Ke(t,e),s()}})};document.readyState==="complete"?i():window.addEventListener("load",i)}function Ke(i,t={}){const e=y({},t);e.vertical&&(e.allArrows=!0),e.openByUrlHash&&(e.setUrlHash=!0),[...i.children].forEach(o=>{if(!o.hasAttribute("aria-controls")){const a=document.querySelector(`[aria-labelledby="${o.id}"]`);a&&(R(a),o.setAttribute("aria-controls",a.id))}});const n={element:i,options:t};return n.tabManager=new kt(i,e),Ue.push(n),n}const I=new w({type:"theme-toggle",baseAttribute:"data-ulu-theme-toggle"}),mi=I.attributeSelector("label"),bi=I.attributeSelector("icon"),We=I.getAttribute("remote"),ee=I.getAttribute("init"),Xe=I.getAttribute("state"),vi=i=>document.querySelectorAll(`[${We}="${i}"]`),Ye=i=>document.querySelectorAll(`[${We}="${i}"]:not([${ee}])`),Ge=["target"],yi=dt(Ge),Qe=(i,t)=>i?t():null,se={themes:{light:{label:"Light",value:"light",iconClass:"fas fa-moon",targetClass:"theme-light",mediaQuery:"(prefers-color-scheme: light)"},dark:{label:"Dark",iconClass:"fas fa-sun",targetClass:"theme-dark",mediaQuery:"(prefers-color-scheme: dark)"}},target:"body",group:null,onChange(i){},initialState:"light",checkMediaQuery:!1,savePreference:!1,storagePrefix:"ulu-theme-",debug:!1};let _e=y({},se);function Ci(i){_e=Object.assign({},_e,i)}function wi(){I.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){Je(i,t),e()}})}function Je(i,t){const e=Object.assign({},se,t);if(!yi(e)){console.error(`Missing a required option: ${Ge.join(", ")}`);return}const s=e.group,n={toggle:i,options:e},o=Ei(e);if(!o){console.error("Unable to resolve initial key");return}ie(o,n),i.addEventListener("click",r),c(),document.addEventListener(z("pageModified"),c);function a(m){const b=fe(e.target)[0].dataset.uluThemeToggleState,p=Ai(b,e);if(!p){console.error("Issue getting next theme key");return}ie(p,ae(y({},n),{event:m}))}function r(m){a(m)}function c(){if(!s)return;Ye(s).forEach(f=>{f.addEventListener("click",r),I.initializeElement(f)})}function u(){if(!s)return;Ye(s).forEach(f=>{f.removeEventListener("click",r),f.removeAttribute(ee,"")})}function h(){i.removeEventListener("click",r),i.removeAttribute(ee,""),u(),document.removeEventListener(z("pageModified"),c)}return{destroy:h,toggle:i,options:e,toggleState:a,setState(m){ie(m,n)}}}function ie(i,t){if(!i){console.error("Missing key");return}const{toggle:e,options:s}=t,{themes:n,group:o}=s,a={targets:fe(s.target),toggles:[e,...o?vi(o):[]]};if(!a.targets.length||!a.toggles.length){console.error("Issue setting state, couldn't find needed elements",a);return}const r=n[i],c=$i(i,n),u=ae(y({},t),{key:i,elements:a,theme:r,otherThemes:c});s.debug&&I.log("Set state context",u);const h=Ze(c,"targetClass"),m=Ze(c,"iconClass");a.targets.forEach(f=>{f.setAttribute(Xe,i),f.classList.remove(...h),f.classList.add(...ft(r.targetClass))}),a.toggles.forEach(f=>{const b=f.querySelector(mi),p=f.querySelector(bi);b&&(b.textContent=r.label),p&&(p.classList.remove(...m),p.classList.add(...ft(r.iconClass))),f.setAttribute(Xe,i)}),s.onChange&&s.onChange(u),s.savePreference&&localStorage.setItem(ts(s),i)}function Ei(i){const{savePreference:t,checkMediaQuery:e,themes:s,initialState:n}=i,o=ts(i),a=Qe(t,()=>localStorage.getItem(o)),r=Qe(e,()=>Si(s)),c=a||r||n;return i.debug&&(I.log("Preference Saved",a),I.log("Media Query Preference",r),I.log("Initial State:",n)),c||I.logError("Failed to resolve initial theme (pass 'initialState' to options)"),c}function Si(i){const t=Object.entries(i).find(([e,s])=>{if(s.mediaQuery)return window.matchMedia(s.mediaQuery).matches});return t?t[0]:null}function Ai(i,t){const{themes:e}=t,s=Object.keys(e),n=s.findIndex(a=>a===i),o=n===-1?0:(n+1)%s.length;return s[o]}function $i(i,t){return Object.entries(t).filter(([s])=>s!==i).map(([s,n])=>n)}function Ze(i,t){return i.reduce((e,s)=>e.concat(ft(s[t])),[])}function ts(i){const{storagePrefix:t,group:e}=i;return e?`${t}${e}`:t}const at=new w({type:"tooltip",baseAttribute:"data-ulu-tooltip"}),Li=at.getAttribute("body"),ki=at.attributeSelector("body"),Ii=at.attributeSelector("arrow");function zi(){at.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){const s=typeof t=="object"?t:{};typeof t=="string"&&(s.content=t),e(),new It({trigger:i},s)}})}const et=class et{constructor(t,e,s){const{trigger:n}=t;if(!n){S(this,"missing required trigger");return}this.options=Object.assign({},et.defaults,e),this.floatingOptions=Object.assign({},et.defaultFloatingOptions,s),this.elements=y({},t),this.handlers={},this.isOpen=!1,R(n),this.setup()}setup(){this.createContentElement(),this.attachHandlers(),this.setupAccessibility()}setupAccessibility(){const{trigger:t,content:e}=this.elements,{accessible:s}=this.options;s&&t.setAttribute("aria-describedby",e.id)}destroy(){this.destroyHandlers(),this.destroyDisplay()}getInnerContent(){const{fromElement:t,content:e,isHtml:s,fromAnchor:n}=this.options;if(e)return e;if(t||n){const o=n?this.getAnchorElement():document.querySelector(t);return o?s?o.innerHTML:o.innerText:""}else S(this,"Could not resolve inner content")}getAnchorElement(){const{trigger:t}=this.elements,{href:e}=t,s=e?e.split("#")[1]:null,n=s?document.getElementById(s):null;return n||console.error("Unable to get 'fromAnchor' element",t),n}createContentElement(){const{options:t}=this,e=D(t.template(t)),s=e.querySelector(ki),n=this.getInnerContent();t.isHtml?s.innerHTML=n:s.textContent=n,e.id=pt(),t.contentClass&&e.classList.add(t.contentClass),this.elements.content=e,this.elements.contentArrow=e.querySelector(Ii),document.body.appendChild(e)}attachHandlers(){const{trigger:t}=this.elements,{showEvents:e,hideEvents:s,delay:n}=this.options;let o=null;const a=u=>{o||(o=setTimeout(()=>{this.show(u),clearTimeout(o)},n))},r=u=>{o&&(clearTimeout(o),o=null),this.hide(u)},c=u=>{u.key==="Escape"&&this.hide(u)};e.forEach(u=>{t.addEventListener(u,a)}),s.forEach(u=>{t.addEventListener(u,r)}),document.addEventListener("keydown",c),this.handlers={onShow:a,onHide:r,onDocumentKeydown:c}}destroyHandlers(){const{trigger:t}=this,{onShow:e,onHide:s,onDocumentKeydown:n}=this.handlers,{showEvents:o,hideEvents:a}=this.options;e&&o.forEach(r=>{t.removeEventListener(r,e)}),s&&a.forEach(r=>{t.removeEventListener(r,s)}),n&&document.removeEventListener("keydown",n)}setState(t,e){const s={instance:this,isOpen:t,event:e},{trigger:n,content:o}=this.elements,{openClass:a}=this.options,r=c=>c.classList[t?"add":"remove"](a);r(n),r(o),this.isOpen=t,this.options.onChange(s),n.dispatchEvent(this.createEvent("change",s)),this.destroyFloatingInstance(),t&&this.createFloatingInstance()}createEvent(t,e){return new CustomEvent(N("tooltip:"+t),{detail:e})}createFloatingInstance(){this.floatingCleanup=Jt(this.elements,this.floatingOptions)}destroyFloatingInstance(){this.floatingCleanup&&(this.floatingCleanup(),this.floatingCleanup=null)}show(t){this.setState(!0,t)}hide(t){this.setState(!1,t)}};C(et,"defaults",{accessible:!0,content:null,openClass:"is-active",contentClass:"",isHtml:!1,fromElement:null,fromAnchor:!1,endOfDocument:!0,showEvents:["pointerenter","focus"],hideEvents:["pointerleave","blur"],delay:500,template(t){return`
|
|
65
65
|
<div class="popover popover--tooltip">
|
|
66
66
|
<div class="popover__inner" ${Li}>
|
|
67
67
|
</div>
|
|
68
68
|
<span class="popover__arrow" data-ulu-tooltip-arrow></span>
|
|
69
69
|
</div>
|
|
70
|
-
`},onChange(t){}}),C(et,"defaultFloatingOptions",{});let It=et;const
|
|
70
|
+
`},onChange(t){}}),C(et,"defaultFloatingOptions",{});let It=et;const Pt=class Pt{constructor(t,e){this.options=Object.assign({},Pt.defaults,e),this.data=t,this.blob=new Blob([t],{type:this.options.type}),this.url=URL.createObjectURL(this.blob)}destroy(){return URL.revokeObjectURL(this.url)}getUrl(){return this.url}createLink(t){const e=document.createElement("a"),s=document.createTextNode(t);return e.setAttribute("download",this.options.filename),e.setAttribute("href",this.url),e.appendChild(s),e}static isBrowserSupported(){return"FileReader"in window}};C(Pt,"defaults",{filename:"filesave-file.txt",type:"text/plain;charset=utf-8"});let ne=Pt;function Oi(){me({iconClassClose:"fas fa-xmark",iconClassDragX:"fas fa-solid fa-grip-lines-vertical",iconClassPrevious:"fas fa-solid fa-chevron-left",iconClassNext:"fas fa-solid fa-chevron-right"})}l.BreakpointManager=Ut,l.Collapsible=gt,l.ComponentInitializer=w,l.FileSave=ne,l.Flipcard=yt,l.OverflowScroller=wt,l.Popover=Re,l.ProgrammaticModalManager=_t,l.Resizer=Ct,l.Scrollpoint=$t,l.Slider=Lt,l.TabManager=kt,l.Tooltip=It,l.classLoggerLog=k,l.classLoggerLogError=S,l.classLoggerLogWarning=Ft,l.classLoggerSet=Cs,l.createFloatingUi=Jt,l.createUluEvent=K,l.dataAttributeToDatasetKey=ve,l.detailsGroupInit=$s,l.detailsGroupInitializer=mt,l.detailsGroupSetupGroup=Ce,l.dialogBaseAttribute=Wt,l.dialogCloseAttribute=$e,l.dialogDefaults=Xt,l.dialogGetDialogOptions=Ie,l.dialogInit=Is,l.dialogInitializer=W,l.dialogSetDefaults=ks,l.dialogSetupDialog=ke,l.dialogSetupTrigger=Le,l.dispatchCoreEvent=it,l.ensureId=R,l.flipcardInit=Ts,l.flipcardInitializer=vt,l.floatingUiDefaults=De,l.fontAwesomeConfigureIcons=Oi,l.getCoreEventName=z,l.getDefaultSettings=us,l.getSetting=be,l.getSettings=ds,l.getSoleIframeLayout=Oe,l.getUluEventName=N,l.gridInit=xs,l.gridInitializer=ze,l.modalBuilderBuildModal=Qt,l.modalBuilderDefaults=Te,l.modalBuilderInit=Ps,l.modalBuilderInitializer=F,l.modalBuilderSetDefaults=Ds,l.newId=pt,l.observeDialogToggle=Ae,l.overflowScrollerCreatePager=xe,l.pageInit=Ms,l.popoverGetContentByTrigger=He,l.popoverInit=Us,l.popoverInitializer=M,l.popoverInstances=Zt,l.popoverResolve=Pe,l.printDetailsAttrs=Et,l.printDetailsInit=Ws,l.printInit=_s,l.proxyClickAttachHandlers=je,l.proxyClickDefaults=qe,l.proxyClickInit=ti,l.proxyClickInitializer=Me,l.proxyClickSetDefaults=Zs,l.proxyClickSetupProxy=Be,l.resolveClasses=ft,l.scrollSliderInit=oi,l.scrollSliderInitializer=St,l.scrollpointInit=ai,l.scrollpointInitializer=At,l.setPositionClasses=ye,l.sliderInit=pi,l.sliderInitializer=X,l.sliderSetupSlider=Fe,l.tabsInit=gi,l.tabsInitializer=Ve,l.tabsInstances=Ue,l.tabsSetup=Ke,l.themeToggleDefaults=se,l.themeToggleInit=wi,l.themeToggleInitializer=I,l.themeToggleSetDefaults=Ci,l.themeToggleSetupToggle=Je,l.tooltipInit=zi,l.tooltipInitializer=at,l.updateSetting=hs,l.updateSettings=me,l.wrapSettingString=H,l.youtubePauseVideos=we,l.youtubePrepVideos=Ee,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -22,7 +22,7 @@ export function createPager() {
|
|
|
22
22
|
const trackStyle = window.getComputedStyle(track);
|
|
23
23
|
// Note we are banking on the scroll padding string to be in "px", not doing any conversions here
|
|
24
24
|
const scrollPaddingRaw = trackStyle.getPropertyValue( 'scroll-padding-left' ).replace( 'auto', '0px' );
|
|
25
|
-
const scrollPadding = parseInt(scrollPaddingRaw, 10);
|
|
25
|
+
const scrollPadding = parseInt(scrollPaddingRaw, 10) || 0;
|
|
26
26
|
|
|
27
27
|
const { scrollLeft, offsetWidth } = track;
|
|
28
28
|
const right = scrollLeft + offsetWidth;
|
|
@@ -38,24 +38,36 @@ export function createPager() {
|
|
|
38
38
|
// Test edges to see what can fit, slide found will be the slide to scroll to
|
|
39
39
|
let slideFound;
|
|
40
40
|
if (isNext) {
|
|
41
|
-
// Find the first item
|
|
42
|
-
|
|
41
|
+
// Find the first item whose right edge is cut off by the right side of the viewport.
|
|
42
|
+
// -1 handles sub-pixel rounding issues.
|
|
43
|
+
slideFound = slides.find(slide => slide.offsetRight > right - 1);
|
|
43
44
|
} else {
|
|
44
|
-
|
|
45
|
+
// Find the index of the slide immediately before the currently visible (padded) area.
|
|
46
|
+
// -1 ensures we grab the slide that is fully outside the view.
|
|
47
|
+
let slideBeforeIndex = slides.findLastIndex(slide => slide.offsetLeft < scrollLeft + scrollPadding - 1);
|
|
48
|
+
|
|
45
49
|
// Find the slides before this slide that can fit, including the slide before
|
|
46
|
-
if (slideBeforeIndex) {
|
|
50
|
+
if (slideBeforeIndex > -1) {
|
|
47
51
|
let slideBefore = slides[slideBeforeIndex];
|
|
48
52
|
let slidesBefore = slides.slice(0, slideBeforeIndex + 1);
|
|
53
|
+
|
|
54
|
+
// Iterate backwards from the start to see how far back we can jump while still
|
|
55
|
+
// keeping our anchor `slideBefore` fully visible in the new viewport.
|
|
49
56
|
slideFound = slidesBefore.find(slide => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
// Calculate where the right edge of the viewport will be if we snap to this slide.
|
|
58
|
+
// Snapping aligns slide.offsetLeft to the padding.
|
|
59
|
+
const rightEdge = slide.offsetLeft - scrollPadding + offsetWidth;
|
|
60
|
+
// Return true if our anchor slide is still within this new right edge.
|
|
61
|
+
return rightEdge >= slideBefore.offsetRight - 1;
|
|
62
|
+
}) || slideBefore; // Fallback to `slideBefore` if no older slides fit in the same view.
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
if (slideFound) {
|
|
56
|
-
|
|
66
|
+
// Return the target scroll position that aligns the target slide's left edge
|
|
67
|
+
// exactly with the CSS scroll-padding. Ensure we don't return a negative scroll amount.
|
|
68
|
+
return Math.max(0, slideFound.offsetLeft - scrollPadding);
|
|
57
69
|
} else {
|
|
58
|
-
return 400;
|
|
70
|
+
return 400; // Fallback amount
|
|
59
71
|
}
|
|
60
72
|
}
|
|
61
73
|
}
|
package/lib/scss/_button.scss
CHANGED
|
@@ -149,7 +149,8 @@ $styles: (
|
|
|
149
149
|
/// Get a config option
|
|
150
150
|
/// @param {Map} $name Name of property
|
|
151
151
|
/// @example scss - General example
|
|
152
|
-
///
|
|
152
|
+
/// $shadow: ulu.button-get("box-shadow");
|
|
153
|
+
/// @return {*} Resolved value
|
|
153
154
|
|
|
154
155
|
@function get($name) {
|
|
155
156
|
$value: utils.require-map-get($config, $name, "button [config]");
|
package/lib/scss/_color.scss
CHANGED
|
@@ -39,8 +39,8 @@ $palette: (
|
|
|
39
39
|
"placeholder-background-alt": #d1d5db,
|
|
40
40
|
"selected": #0ea5e9,
|
|
41
41
|
"selected-background": #e0f2fe,
|
|
42
|
-
"box-shadow": rgba(0, 0, 0, 0.
|
|
43
|
-
"box-shadow-hover": rgba(0, 0, 0, 0.
|
|
42
|
+
"box-shadow": rgba(0, 0, 0, 0.2),
|
|
43
|
+
"box-shadow-hover": rgba(0, 0, 0, 0.4),
|
|
44
44
|
"rule": #e5e7eb,
|
|
45
45
|
"rule-light": #f3f4f6,
|
|
46
46
|
"link": #2563eb,
|
package/lib/scss/_cssvar.scss
CHANGED
|
@@ -145,29 +145,12 @@ $config: (
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/// Outputs css vars for a specific type from a theme map
|
|
148
|
+
/// @deprecated Moved to themes core module (`themes.declare-values()`). This will be removed in a future version.
|
|
148
149
|
/// @param {Map} $theme The map containing the values. Example (
|
|
149
150
|
/// @param {String} $key The key used to retrieve values from the map.
|
|
150
151
|
/// @param {String} $prefix The optional prefix for CSS variables.
|
|
151
|
-
/// @example scss - Example of theme map and usage
|
|
152
|
-
/// // Defining a map to hold my color theme values
|
|
153
|
-
/// $color-themes: (
|
|
154
|
-
/// "color-button" : (
|
|
155
|
-
/// "light" : blue,
|
|
156
|
-
/// "dark" : red
|
|
157
|
-
/// ), ...
|
|
158
|
-
/// );
|
|
159
|
-
///
|
|
160
|
-
/// // Declaring default theme
|
|
161
|
-
/// :root {
|
|
162
|
-
/// @include ulu.cssvar-declare-theme-values($color-themes, "light");
|
|
163
|
-
/// }
|
|
164
|
-
///
|
|
165
|
-
/// // Creating class to use on body/other elements to switch to dark theme
|
|
166
|
-
/// .theme-dark {
|
|
167
|
-
/// @include ulu.cssvar-declare-theme-values($color-themes, "dark");
|
|
168
|
-
/// }
|
|
169
|
-
|
|
170
152
|
@mixin declare-theme-values($theme, $key, $prefix: get("prefix")) {
|
|
153
|
+
@warn "ulu.cssvar-declare-theme-values() is deprecated. Please use ulu.themes-declare-values() instead.";
|
|
171
154
|
@each $name, $definition in $theme {
|
|
172
155
|
$value: map.get($definition, $key);
|
|
173
156
|
@if ($value) {
|
package/lib/scss/_element.scss
CHANGED
|
@@ -294,9 +294,9 @@ $rule-margins: (
|
|
|
294
294
|
/// Hide text for assistive devices
|
|
295
295
|
/// @param {Boolean} $hidden Defaults to true, pass false to override the hidden css (ie. on focus)
|
|
296
296
|
/// @example scss
|
|
297
|
-
/// @include ulu.layout-hidden-visually()
|
|
297
|
+
/// @include ulu.layout-hidden-visually();
|
|
298
298
|
/// // Reset styling
|
|
299
|
-
/// @include ulu.layout-hidden-visually(false)
|
|
299
|
+
/// @include ulu.layout-hidden-visually(false);
|
|
300
300
|
|
|
301
301
|
@mixin hidden-visually($hidden: true) {
|
|
302
302
|
@if $hidden {
|
package/lib/scss/_index.scss
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group themes
|
|
3
|
+
/// Core configuration module for the themes system.
|
|
4
|
+
/// Used to orchestrate custom property variations (e.g., light/dark modes).
|
|
5
|
+
/// - Note: This system is intended for switching context values like colors, box-shadows, and borders.
|
|
6
|
+
/// It is not recommended to use this for structural layout values like margins or padding.
|
|
7
|
+
/// For responsive or structural changes, rely on the layout/breakpoint modules or component modifiers.
|
|
8
|
+
////
|
|
9
|
+
|
|
10
|
+
@use "sass:map";
|
|
11
|
+
@use "sass:list";
|
|
12
|
+
@use "sass:meta";
|
|
13
|
+
@use "utils";
|
|
14
|
+
@use "cssvar";
|
|
15
|
+
|
|
16
|
+
/// Module Settings
|
|
17
|
+
/// @type Map
|
|
18
|
+
/// @prop {String} default ["light"] The theme key output to :root
|
|
19
|
+
/// @prop {Map} color-schemes [()] Maps theme names to their corresponding valid CSS color-scheme value (e.g. ("high-contrast": "dark")). Note: If a theme name is literally "light" or "dark", it does not need to be mapped here.
|
|
20
|
+
/// @prop {Map} inverses [()] Maps theme names to their opposite theme name (e.g. ("light": "dark", "dark": "light")). Used to output the .theme-inverse utility.
|
|
21
|
+
$config: (
|
|
22
|
+
"default" : "light",
|
|
23
|
+
"color-schemes" : (),
|
|
24
|
+
"inverses" : ()
|
|
25
|
+
) !default;
|
|
26
|
+
|
|
27
|
+
/// The themes map
|
|
28
|
+
/// - Format: `("property-name": ("light": value, "dark": value))`
|
|
29
|
+
/// @type Map
|
|
30
|
+
|
|
31
|
+
$tokens: () !default;
|
|
32
|
+
|
|
33
|
+
/// Change modules $config
|
|
34
|
+
/// @param {Map} $changes Map of changes
|
|
35
|
+
/// @example scss
|
|
36
|
+
/// @include ulu.themes-set(( "default" : "dark" ));
|
|
37
|
+
|
|
38
|
+
@mixin set($changes) {
|
|
39
|
+
$config: map.merge($config, $changes) !global;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// Set the theme variations
|
|
43
|
+
/// @param {Map} $changes Map of theme variations to merge
|
|
44
|
+
/// @param {String} $merge-mode Merge mode see utils.map-merge() [null|"deep"|"overwrite"]
|
|
45
|
+
/// @example scss
|
|
46
|
+
/// @include ulu.themes-set-tokens((
|
|
47
|
+
/// "color-background": (
|
|
48
|
+
/// "light": white,
|
|
49
|
+
/// "dark": black
|
|
50
|
+
/// )
|
|
51
|
+
/// ));
|
|
52
|
+
|
|
53
|
+
@mixin set-tokens($changes, $merge-mode: "deep") {
|
|
54
|
+
$tokens: utils.map-merge($tokens, $changes, $merge-mode) !global;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// Get a config option
|
|
58
|
+
/// @param {String} $name Name of property
|
|
59
|
+
/// @example scss {compile} Example usage
|
|
60
|
+
/// .test {
|
|
61
|
+
/// content: ulu.themes-get("default");
|
|
62
|
+
/// }
|
|
63
|
+
/// @return {*} Resolved value
|
|
64
|
+
|
|
65
|
+
@function get($name) {
|
|
66
|
+
@return utils.require-map-get($config, $name, "themes [config]");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// Helper function to safely get the color scheme
|
|
70
|
+
/// @param {String} $theme-name The name of the theme to lookup
|
|
71
|
+
/// @example scss {compile} Example usage
|
|
72
|
+
/// .test {
|
|
73
|
+
/// content: ulu.themes-get-color-scheme("dark");
|
|
74
|
+
/// }
|
|
75
|
+
/// @return {String|Null} The CSS color-scheme value or null
|
|
76
|
+
|
|
77
|
+
@function get-color-scheme($theme-name) {
|
|
78
|
+
$schemes: get("color-schemes");
|
|
79
|
+
$mapped: map.get($schemes, $theme-name);
|
|
80
|
+
|
|
81
|
+
@if ($mapped) {
|
|
82
|
+
@return $mapped;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@if ($theme-name == "light" or $theme-name == "dark") {
|
|
86
|
+
@return $theme-name;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@warn "ULU Themes: No valid color-scheme mapped for theme '#{$theme-name}'. Please add it using `themes.set(( \"color-schemes\" : ( \"#{$theme-name}\": \"light|dark\" ) ))`. The `color-scheme` property will not be output for this theme.";
|
|
90
|
+
@return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// Helper function to get all unique theme keys (e.g., 'light', 'dark') from the $themes map
|
|
94
|
+
/// @return {List} A list of all unique theme string keys
|
|
95
|
+
|
|
96
|
+
@function get-keys() {
|
|
97
|
+
$keys: ();
|
|
98
|
+
@each $prop, $theme-map in $tokens {
|
|
99
|
+
@if meta.type-of($theme-map) == 'map' {
|
|
100
|
+
@each $key, $val in $theme-map {
|
|
101
|
+
@if not list.index($keys, $key) {
|
|
102
|
+
$keys: list.append($keys, $key);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
@return $keys;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Outputs css vars for a specific type from a theme map
|
|
111
|
+
/// @param {String} $key The key used to retrieve values from the map.
|
|
112
|
+
/// @param {Map} $tokens [$tokens] The map containing the values. Defaults to the internal $tokens map.
|
|
113
|
+
/// @param {String} $prefix The optional prefix for CSS variables.
|
|
114
|
+
/// @example scss {compile} Example usage
|
|
115
|
+
/// @include ulu.themes-set-tokens((
|
|
116
|
+
/// "color-background": (
|
|
117
|
+
/// "light": white,
|
|
118
|
+
/// "dark": black
|
|
119
|
+
/// )
|
|
120
|
+
/// ));
|
|
121
|
+
/// :root {
|
|
122
|
+
/// @include ulu.themes-declare("light");
|
|
123
|
+
/// }
|
|
124
|
+
|
|
125
|
+
@mixin declare($key, $tokens: $tokens, $prefix: cssvar.get("prefix")) {
|
|
126
|
+
@each $name, $definition in $tokens {
|
|
127
|
+
$value: map.get($definition, $key);
|
|
128
|
+
@if ($value) {
|
|
129
|
+
@include cssvar.declare($name, $value, $prefix);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@forward "root" as root-*;
|
|
7
7
|
@forward "normalize" as normalize-*;
|
|
8
|
+
@forward "themes" as themes-*;
|
|
8
9
|
@forward "print" as print-*;
|
|
9
10
|
@forward "color" as color-*;
|
|
10
11
|
@forward "elements" as elements-*;
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
@use "../utils";
|
|
18
19
|
@use "normalize";
|
|
19
20
|
@use "root";
|
|
21
|
+
@use "themes";
|
|
20
22
|
@use "elements";
|
|
21
23
|
@use "print";
|
|
22
24
|
@use "typography";
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
$all-includes: (
|
|
31
33
|
"normalize",
|
|
32
34
|
"root",
|
|
35
|
+
"themes",
|
|
33
36
|
"elements,"
|
|
34
37
|
"print",
|
|
35
38
|
"elements",
|
|
@@ -77,6 +80,9 @@ $current-includes: $all-includes;
|
|
|
77
80
|
@if (list.index($includes, "root")) {
|
|
78
81
|
@include root.styles;
|
|
79
82
|
}
|
|
83
|
+
@if (list.index($includes, "themes")) {
|
|
84
|
+
@include themes.styles;
|
|
85
|
+
}
|
|
80
86
|
@if (list.index($includes, "elements")) {
|
|
81
87
|
@include elements.styles;
|
|
82
88
|
}
|