@ulu/frontend 0.3.0 → 0.3.1
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/index.js +18 -16
- package/dist/es/utils/index.d.ts +1 -0
- package/dist/umd/ulu-frontend.umd.js +10 -10
- package/lib/js/exports.md +1 -0
- package/lib/js/utils/index.js +4 -1
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { createUluEvent as i, dispatchCoreEvent as r, getCoreEventName as a, get
|
|
|
2
2
|
import { getDefaultSettings as l, getSetting as n, getSettings as p, updateSetting as g, updateSettings as u, wrapSettingString as f } from "./core/settings.js";
|
|
3
3
|
import { ComponentInitializer as m } from "./core/component.js";
|
|
4
4
|
import { BreakpointManager as I } from "./ui/breakpoints.js";
|
|
5
|
-
import { Collapsible as
|
|
5
|
+
import { Collapsible as S } from "./ui/collapsible.js";
|
|
6
6
|
import { init as D, initializer as C, setupGroup as v } from "./ui/details-group.js";
|
|
7
|
-
import { baseAttribute as
|
|
7
|
+
import { baseAttribute as y, closeAttribute as T, defaults as B, getDialogOptions as P, init as h, initializer as A, setDefaults as L, setupDialog as k, setupTrigger as G } from "./ui/dialog.js";
|
|
8
8
|
import { Flipcard as M, init as w, initializer as U } from "./ui/flipcard.js";
|
|
9
9
|
import { init as F, initializer as O } from "./ui/grid.js";
|
|
10
10
|
import { buildModal as N, defaults as R, init as W, initializer as K, setDefaults as j } from "./ui/modal-builder.js";
|
|
@@ -15,11 +15,11 @@ import { init as $ } from "./ui/page.js";
|
|
|
15
15
|
import { Popover as te, getContentByTrigger as ie, init as re, initializer as ae, instances as oe, resolve as se } from "./ui/popover.js";
|
|
16
16
|
import { attrs as ne, init as pe } from "./ui/print-details.js";
|
|
17
17
|
import { init as ue } from "./ui/print.js";
|
|
18
|
-
import { attachHandlers as de, defaults as me, init as xe, initializer as Ie, setDefaults as ce, setupProxy as
|
|
18
|
+
import { attachHandlers as de, defaults as me, init as xe, initializer as Ie, setDefaults as ce, setupProxy as Se } from "./ui/proxy-click.js";
|
|
19
19
|
import { Resizer as De } from "./ui/resizer.js";
|
|
20
20
|
import { init as ve, initializer as be } from "./ui/scroll-slider.js";
|
|
21
|
-
import { Scrollpoint as
|
|
22
|
-
import { Slider as Ae, init as
|
|
21
|
+
import { Scrollpoint as Te, init as Be, initializer as Pe } from "./ui/scrollpoint.js";
|
|
22
|
+
import { Slider as Ae, init as Le, initializer as ke, setupSlider as Ge } from "./ui/slider.js";
|
|
23
23
|
import { TabManager as Me } from "./ui/tab-manager.js";
|
|
24
24
|
import { init as Ue, initializer as Ve, instances as Fe, setup as Oe } from "./ui/tabs.js";
|
|
25
25
|
import { defaults as Ne, init as Re, initializer as We, setDefaults as Ke, setupToggle as je } from "./ui/theme-toggle.js";
|
|
@@ -31,9 +31,10 @@ import { createFloatingUi as nt, defaults as pt } from "./utils/floating-ui.js";
|
|
|
31
31
|
import { configureIcons as ut } from "./utils/font-awesome.js";
|
|
32
32
|
import { ensureId as dt, newId as mt } from "./utils/id.js";
|
|
33
33
|
import { pauseVideos as It, prepVideos as ct } from "./utils/pause-youtube-video.js";
|
|
34
|
+
import { getSoleIframeLayout as zt } from "./utils/iframe.js";
|
|
34
35
|
export {
|
|
35
36
|
I as BreakpointManager,
|
|
36
|
-
|
|
37
|
+
S as Collapsible,
|
|
37
38
|
m as ComponentInitializer,
|
|
38
39
|
st as FileSave,
|
|
39
40
|
M as Flipcard,
|
|
@@ -41,7 +42,7 @@ export {
|
|
|
41
42
|
te as Popover,
|
|
42
43
|
J as ProgrammaticModalManager,
|
|
43
44
|
De as Resizer,
|
|
44
|
-
|
|
45
|
+
Te as Scrollpoint,
|
|
45
46
|
Ae as Slider,
|
|
46
47
|
Me as TabManager,
|
|
47
48
|
Je as Tooltip,
|
|
@@ -55,15 +56,15 @@ export {
|
|
|
55
56
|
D as detailsGroupInit,
|
|
56
57
|
C as detailsGroupInitializer,
|
|
57
58
|
v as detailsGroupSetupGroup,
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
y as dialogBaseAttribute,
|
|
60
|
+
T as dialogCloseAttribute,
|
|
60
61
|
B as dialogDefaults,
|
|
61
62
|
P as dialogGetDialogOptions,
|
|
62
63
|
h as dialogInit,
|
|
63
64
|
A as dialogInitializer,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
L as dialogSetDefaults,
|
|
66
|
+
k as dialogSetupDialog,
|
|
67
|
+
G as dialogSetupTrigger,
|
|
67
68
|
r as dispatchCoreEvent,
|
|
68
69
|
dt as ensureId,
|
|
69
70
|
w as flipcardInit,
|
|
@@ -74,6 +75,7 @@ export {
|
|
|
74
75
|
l as getDefaultSettings,
|
|
75
76
|
n as getSetting,
|
|
76
77
|
p as getSettings,
|
|
78
|
+
zt as getSoleIframeLayout,
|
|
77
79
|
o as getUluEventName,
|
|
78
80
|
F as gridInit,
|
|
79
81
|
O as gridInitializer,
|
|
@@ -98,16 +100,16 @@ export {
|
|
|
98
100
|
xe as proxyClickInit,
|
|
99
101
|
Ie as proxyClickInitializer,
|
|
100
102
|
ce as proxyClickSetDefaults,
|
|
101
|
-
|
|
103
|
+
Se as proxyClickSetupProxy,
|
|
102
104
|
rt as resolveClasses,
|
|
103
105
|
ve as scrollSliderInit,
|
|
104
106
|
be as scrollSliderInitializer,
|
|
105
107
|
Be as scrollpointInit,
|
|
106
108
|
Pe as scrollpointInitializer,
|
|
107
109
|
at as setPositionClasses,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
Le as sliderInit,
|
|
111
|
+
ke as sliderInitializer,
|
|
112
|
+
Ge as sliderSetupSlider,
|
|
111
113
|
Ue as tabsInit,
|
|
112
114
|
Ve as tabsInitializer,
|
|
113
115
|
Fe as tabsInstances,
|
package/dist/es/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FileSave } from './file-save.js';
|
|
2
2
|
export { configureIcons as fontAwesomeConfigureIcons } from './font-awesome.js';
|
|
3
|
+
export { getSoleIframeLayout } from './iframe.js';
|
|
3
4
|
export { set as classLoggerSet, log as classLoggerLog, logWarning as classLoggerLogWarning, logError as classLoggerLogError } from './class-logger.js';
|
|
4
5
|
export { dataAttributeToDatasetKey, setPositionClasses, resolveClasses } from './dom.js';
|
|
5
6
|
export { defaults as floatingUiDefaults, createFloatingUi } from './floating-ui.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
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,Pi=Object.defineProperties;var Di=Object.getOwnPropertyDescriptors;var
|
|
2
|
-
`,i,n)})}function
|
|
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
|
|
4
|
-
`,t)}function vs(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 ys=i=>gs(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 Cs(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",ys),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 Cs{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 ws=0;function pt(){return`ulu-uid-${++ws}`}function N(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={},N(s),N(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(j("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"),Es={onlyOneOpen:!0,childSelector:":scope > details"};function Ss(){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({},Es,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 As=[".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(As.join(", "))}function $s(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}),Ae=W.getAttribute("close"),Xt={nonModal:!1,documentEnd:!1,clickOutsideCloses:!0,pauseVideos:!0,preventScroll:!0,preventScrollShift:!0};let bt=y({},Xt);function Ls(i){bt=Object.assign({},bt,i)}function ks(){W.init({coreEvents:["pageModified"],withData:!0,setup({element:i,initialize:t,data:e}){Le(i,e),t()}}),W.init({key:"trigger",coreEvents:["pageModified"],withData:!0,setup({element:i,initialize:t,data:e}){$e(i,e),t()}})}function $e(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=ke(o);o[a.nonModal?"show":"showModal"]()}}function Le(i,t){const e=Object.assign({},bt,t),s=document.body,{preventScrollShift:n}=e;let o=null,a;if(i.addEventListener(j("resizer:start"),c),i.addEventListener(j("resizer:end"),u),i.addEventListener("click",r),e.documentEnd&&s.appendChild(i),e.pauseVideos&&Is(i),!e.nonModal&&e.preventScroll){let h;o=$s(i,m=>{m?h=ns({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&&ss(i,h)||b)&&(e.pauseVideos&&zs(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 ke(i){return Object.assign({},bt,W.getData(i))}function Is(i){Ee(i)}function zs(i){we(i),i.querySelectorAll("video").forEach(e=>e.pause())}const vt=new w({type:"flipcard",baseAttribute:"data-ulu-flipcard"});function Os(){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`
|
|
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,Pi=Object.defineProperties;var Di=Object.getOwnPropertyDescriptors;var ts=Object.getOwnPropertySymbols;var Hi=Object.prototype.hasOwnProperty,Ri=Object.prototype.propertyIsEnumerable;var es=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(ts)for(var g of ts(d))Ri.call(d,g)&&re(l,g,d[g]);return l},ae=(l,d)=>Pi(l,Di(d));var C=(l,d,g)=>re(l,typeof d!="symbol"?d+"":d,g),le=(l,d,g)=>d.has(l)||es("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)?es("Cannot add the same private member more than once"):d instanceof WeakSet?d.add(l):d.set(l,g),E=(l,d,g,B)=>(le(l,d,"write to private field"),B?B.call(l,g):d.set(l,g),g),D=(l,d,g)=>(le(l,d,"access private method"),g);var ce=(l,d,g)=>new Promise((B,ct)=>{var Rt=P=>{try{V(g.next(P))}catch(st){ct(st)}},Mt=P=>{try{V(g.throw(P))}catch(st){ct(st)}},V=P=>P.done?B(P.value):Promise.resolve(P.value).then(Rt,Mt);V((g=g.apply(l,d)).next())});var G,Q,T,$,_,J,q,Z,tt,A,Ht,ue,de,he;function B(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 P(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
|
+
`,i,n)})}function ss(i,t){const e=i.dataset[t];return e&&Rt.test(e.trim())?st(i,t):e}function is(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 ns(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 os({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()&&(as(),ls());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"))}},rs=Object.keys(qt);function it(i,t){qt[i]?qt[i](t):console.warn(`Unable to dispatch non-core event: ${i}`)}function j(i){return"ulu:"+i}function z(i){return rs.includes(i)?j(i):(console.warn(`'${i}' is not a valid core event type.`),null)}function K(i,t=null,e={bubbles:!0}){return new CustomEvent(j(i),y({detail:t},e))}function as(){window.addEventListener("resize",B(()=>it("pageResized",document),250))}function ls(){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 cs(){return y({},ge)}function me(i){Object.assign(nt,i)}function us(){return y({},nt)}function be(i){if(!nt.hasOwnProperty(i)){console.warn(`Attempted to access non-existent setting: ${i}`);return}return nt[i]}function ds(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 hs(i){const t=/(px|vw|vh|%|em|rem)/i;return{original:i,value:parseFloat(i.replace(t,"")),unit:i.match(t)[0]}}function fs(i){return i.replace(/[\r\n]+/g,"")}function ps(i){return fs(i).replace(ct," ").trim()}function ht(i){return ps(i)}function gs(i){return i.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}function ve(i){return gs(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 M=class M{constructor(t){if(!M.hasRequiredOptions(t))throw new Error(`Missing a required options: ${M.requiredOptions.join(", ")}`);this.options=Object.assign({},M.defaults,t),this.logTitle=`ULU: ${this.options.type}:
|
|
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 ss(t,s)}log(...t){console.log(this.logTitle,...t)}warn(...t){console.warn(this.logTitle,...t)}logError(...t){console.error(this.logTitle,...t)}};C(M,"defaults",{type:null,baseAttribute:null}),C(M,"requiredOptions",["type","baseAttribute"]),C(M,"hasRequiredOptions",dt(M.requiredOptions));let w=M;function Bt(i,t){var e=i.indexOf(t);e>-1&&i.splice(e,1)}function ms(i,t){return`--${i}-${t}`}const ot={debug:!1,warningsAlways:!0,errorsAlways:!0,outputContext:!1},bs="console"in window;function jt(i){var t;return bs&&ot.debug&&((i==null?void 0:i.debug)||((t=i==null?void 0:i.options)==null?void 0:t.debug)||i==null)}function vs(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=vs(t)||"Logger";console[i](s,...e),ot.outputContext&&console.log(`Context:
|
|
4
|
+
`,t)}function ys(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 Cs=i=>ms(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 ws(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",Cs),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 ws{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 Es=0;function pt(){return`ulu-uid-${++Es}`}function N(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={},N(s),N(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(j("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"),Ss={onlyOneOpen:!0,childSelector:":scope > details"};function As(){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({},Ss,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 $s=[".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($s.join(", "))}function Ls(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}),Ae=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}){Le(i,e),t()}}),W.init({key:"trigger",coreEvents:["pageModified"],withData:!0,setup({element:i,initialize:t,data:e}){$e(i,e),t()}})}function $e(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=ke(o);o[a.nonModal?"show":"showModal"]()}}function Le(i,t){const e=Object.assign({},bt,t),s=document.body,{preventScrollShift:n}=e;let o=null,a;if(i.addEventListener(j("resizer:start"),c),i.addEventListener(j("resizer:end"),u),i.addEventListener("click",r),e.documentEnd&&s.appendChild(i),e.pauseVideos&&zs(i),!e.nonModal&&e.preventScroll){let h;o=Ls(i,m=>{m?h=os({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&&is(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 ke(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`
|
|
5
5
|
<span class="hidden-visually">Show More Information</span>
|
|
6
6
|
`}setVisibility(t){const{back:e,container:s,control:n}=this.elements,o=t?"open":"closed";e.style.zIndex=t?"10":"1",e.style.visibility=t?"visible":"hidden",s.setAttribute(this.stateAttr,o),e.setAttribute("aria-hidden",t?"false":"true"),n.setAttribute("aria-expanded",t?"true":"false"),this.isOpen=t}containerCss(){return`
|
|
7
7
|
display: -ms-grid;
|
|
@@ -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 Ie=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 Ie=new w({type:"grid",baseAttribute:"data-grid"});function xs(i){Ie.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,q);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))),D(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)),D(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),D(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);D(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),D(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,q)||v(this,T)===null)&&D(this,A,ue).call(this,{inputType:"keyboard",keyboardKey:e}),E(this,_,v(this,_)+o),E(this,J,v(this,J)+a),D(this,A,he).call(this,v(this,_),v(this,J),t),v(this,T)&&clearTimeout(v(this,T)),E(this,T,setTimeout(()=>{D(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,q=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,q,!1),E(this,Z,0),E(this,tt,0)},ue=function(t){const{container:e,options:s}=this;if(v(this,q)){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,q,!0),this.dispatchEvent("resizer:start",t),k(this,"Resize started.",y({initialWidth:v(this,$).width,initialHeight:v(this,$).height},t))},de=function(){v(this,q)&&(this.dispatchEvent("resizer:end"),D(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 ze(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=hs(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"}),Oe={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,14 +39,14 @@
|
|
|
39
39
|
${t.templateResizerIcon(t)}
|
|
40
40
|
</button>`:""}
|
|
41
41
|
</dialog>
|
|
42
|
-
`}};let Gt=y({},
|
|
42
|
+
`}};let Gt=y({},Oe);function Ps(i){Gt=Object.assign({},Gt,i)}function Ds(){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=P(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=ze(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 Oe(){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(){is()}const Te={strategy:"absolute",placement:"bottom",inline:!1,offset:{mainAxis:16},shift:!0,flip:!0,arrow:!0};function Jt(i,t){const e=Object.assign({},Te,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 R=new w({type:"popover",baseAttribute:"data-ulu-popover"}),qs=R.attributeSelector("trigger-anchor"),Bs=R.attributeSelector("arrow"),js=R.getAttribute("content"),Ns=R.attributeSelector("content"),Zt=new WeakMap,Fs={clickOutsideCloses:!0,escapeCloses:!0};function Us(){R.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){R.warn("Unable to resolve popover elements for trigger.",i);return}const{elements:n,options:o,floatingOptions:a}=s;Zt.set(n,new De(n,o,a)),e()}})}function xe(i,t){const e=Object.assign({},t),s=Pe(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}:(R.logError("Unable to make popover for",i),!1)}function Pe(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||R.logError("Unable to resolve 'content' element for popover",i),t}class De 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 He=new w({type:"proxy-click",baseAttribute:"data-ulu-proxy-click"}),Re={selector:"[data-ulu-proxy-click-source]",selectorPreventBase:"input, select, textarea, button, a, [tabindex='-1']",selectorPrevent:"",mousedownDurationPrevent:250};let te=y({},Re);function Zs(i){te=Object.assign({},te,i)}function ti(){He.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Me(i,t),e()}})}function Me(i,t){const e=Object.assign({},te,t),s=i.querySelector(e.selector);s?qe(i,s,e):console.error("Unable to locate proxy click source",e.selector)}function qe(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:Oe()};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},Be=i=>`${i}ms`,fi=["container","trackContainer","track","slides"];function pi(){X.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){je(i,t),e()}})}function je(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",B(()=>{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"),this.slides=[...t.slides].map((n,o)=>({element:n,index:o,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=Be(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),this.slides.forEach(r=>{r.element.setAttribute("style",a),r.element.setAttribute("tabindex","-1")}),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 Te(){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(){ns()}const xe={strategy:"absolute",placement:"bottom",inline:!1,offset:{mainAxis:16},shift:!0,flip:!0,arrow:!0};function Jt(i,t){const e=Object.assign({},xe,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 R=new w({type:"popover",baseAttribute:"data-ulu-popover"}),qs=R.attributeSelector("trigger-anchor"),Bs=R.attributeSelector("arrow"),js=R.getAttribute("content"),Ns=R.attributeSelector("content"),Zt=new WeakMap,Fs={clickOutsideCloses:!0,escapeCloses:!0};function Us(){R.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){R.warn("Unable to resolve popover elements for trigger.",i);return}const{elements:n,options:o,floatingOptions:a}=s;Zt.set(n,new He(n,o,a)),e()}})}function Pe(i,t){const e=Object.assign({},t),s=De(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}:(R.logError("Unable to make popover for",i),!1)}function De(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||R.logError("Unable to resolve 'content' element for popover",i),t}class He 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 Re=new w({type:"proxy-click",baseAttribute:"data-ulu-proxy-click"}),Me={selector:"[data-ulu-proxy-click-source]",selectorPreventBase:"input, select, textarea, button, a, [tabindex='-1']",selectorPrevent:"",mousedownDurationPrevent:250};let te=y({},Me);function Zs(i){te=Object.assign({},te,i)}function ti(){Re.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){qe(i,t),e()}})}function qe(i,t){const e=Object.assign({},te,t),s=i.querySelector(e.selector);s?Be(i,s,e):console.error("Unable to locate proxy click source",e.selector)}function Be(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:Te()};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},je=i=>`${i}ms`,fi=["container","trackContainer","track","slides"];function pi(){X.init({withData:!0,coreEvents:["pageModified"],setup({element:i,data:t,initialize:e}){Ne(i,t),e()}})}function Ne(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",B(()=>{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"),this.slides=[...t.slides].map((n,o)=>({element:n,index:o,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=je(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),this.slides.forEach(r=>{r.element.setAttribute("style",a),r.element.setAttribute("tabindex","-1")}),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};
|
|
49
|
-
transition-duration: ${
|
|
49
|
+
transition-duration: ${je(s)};
|
|
50
50
|
transition-timing-function: ${e};
|
|
51
51
|
`}trackCss(){return`
|
|
52
52
|
display: flex;
|
|
@@ -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.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.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];N(t),N(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 Ne=[],Fe=new w({type:"tabs",baseAttribute:"data-ulu-tablist"});function gi(){const i=()=>{Fe.init({coreEvents:["pageModified"],withData:!0,setup({element:t,data:e,initialize:s}){Ue(t,e),s()}})};document.readyState==="complete"?i():window.addEventListener("load",i)}function Ue(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&&(N(a),o.setAttribute("aria-controls",a.id))}});const n={element:i,options:t};return n.tabManager=new kt(i,e),Ne.push(n),n}const I=new w({type:"theme-toggle",baseAttribute:"data-ulu-theme-toggle"}),mi=I.attributeSelector("label"),bi=I.attributeSelector("icon"),Ve=I.getAttribute("remote"),ee=I.getAttribute("init"),Ke=I.getAttribute("state"),vi=i=>document.querySelectorAll(`[${Ve}="${i}"]`),We=i=>document.querySelectorAll(`[${Ve}="${i}"]:not([${ee}])`),Xe=["target"],yi=dt(Xe),Ye=(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 Ge=y({},se);function Ci(i){Ge=Object.assign({},Ge,i)}function wi(){I.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){Qe(i,t),e()}})}function Qe(i,t){const e=Object.assign({},se,t);if(!yi(e)){console.error(`Missing a required option: ${Xe.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;We(s).forEach(f=>{f.addEventListener("click",r),I.initializeElement(f)})}function u(){if(!s)return;We(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=_e(c,"targetClass"),m=_e(c,"iconClass");a.targets.forEach(f=>{f.setAttribute(Ke,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(Ke,i)}),s.onChange&&s.onChange(u),s.savePreference&&localStorage.setItem(Je(s),i)}function Ei(i){const{savePreference:t,checkMediaQuery:e,themes:s,initialState:n}=i,o=Je(i),a=Ye(t,()=>localStorage.getItem(o)),r=Ye(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 _e(i,t){return i.reduce((e,s)=>e.concat(ft(s[t])),[])}function Je(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,N(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(j("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 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];N(t),N(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 Fe=[],Ue=new w({type:"tabs",baseAttribute:"data-ulu-tablist"});function gi(){const i=()=>{Ue.init({coreEvents:["pageModified"],withData:!0,setup({element:t,data:e,initialize:s}){Ve(t,e),s()}})};document.readyState==="complete"?i():window.addEventListener("load",i)}function Ve(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&&(N(a),o.setAttribute("aria-controls",a.id))}});const n={element:i,options:t};return n.tabManager=new kt(i,e),Fe.push(n),n}const I=new w({type:"theme-toggle",baseAttribute:"data-ulu-theme-toggle"}),mi=I.attributeSelector("label"),bi=I.attributeSelector("icon"),Ke=I.getAttribute("remote"),ee=I.getAttribute("init"),We=I.getAttribute("state"),vi=i=>document.querySelectorAll(`[${Ke}="${i}"]`),Xe=i=>document.querySelectorAll(`[${Ke}="${i}"]:not([${ee}])`),Ye=["target"],yi=dt(Ye),Ge=(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 Qe=y({},se);function Ci(i){Qe=Object.assign({},Qe,i)}function wi(){I.init({coreEvents:["pageModified"],withData:!0,setup({element:i,data:t,initialize:e}){_e(i,t),e()}})}function _e(i,t){const e=Object.assign({},se,t);if(!yi(e)){console.error(`Missing a required option: ${Ye.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;Xe(s).forEach(f=>{f.addEventListener("click",r),I.initializeElement(f)})}function u(){if(!s)return;Xe(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=Je(c,"targetClass"),m=Je(c,"iconClass");a.targets.forEach(f=>{f.setAttribute(We,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(We,i)}),s.onChange&&s.onChange(u),s.savePreference&&localStorage.setItem(Ze(s),i)}function Ei(i){const{savePreference:t,checkMediaQuery:e,themes:s,initialState:n}=i,o=Ze(i),a=Ge(t,()=>localStorage.getItem(o)),r=Ge(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 Je(i,t){return i.reduce((e,s)=>e.concat(ft(s[t])),[])}function Ze(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,N(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(j("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 Dt=class Dt{constructor(t,e){this.options=Object.assign({},Dt.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(Dt,"defaults",{filename:"filesave-file.txt",type:"text/plain;charset=utf-8"});let ne=Dt;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=
|
|
70
|
+
`},onChange(t){}}),C(et,"defaultFloatingOptions",{});let It=et;const Dt=class Dt{constructor(t,e){this.options=Object.assign({},Dt.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(Dt,"defaults",{filename:"filesave-file.txt",type:"text/plain;charset=utf-8"});let ne=Dt;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=He,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=ys,l.createFloatingUi=Jt,l.createUluEvent=K,l.dataAttributeToDatasetKey=ve,l.detailsGroupInit=As,l.detailsGroupInitializer=mt,l.detailsGroupSetupGroup=Ce,l.dialogBaseAttribute=Wt,l.dialogCloseAttribute=Ae,l.dialogDefaults=Xt,l.dialogGetDialogOptions=ke,l.dialogInit=Is,l.dialogInitializer=W,l.dialogSetDefaults=ks,l.dialogSetupDialog=Le,l.dialogSetupTrigger=$e,l.dispatchCoreEvent=it,l.ensureId=N,l.flipcardInit=Ts,l.flipcardInitializer=vt,l.floatingUiDefaults=xe,l.fontAwesomeConfigureIcons=Oi,l.getCoreEventName=z,l.getDefaultSettings=cs,l.getSetting=be,l.getSettings=us,l.getSoleIframeLayout=ze,l.getUluEventName=j,l.gridInit=xs,l.gridInitializer=Ie,l.modalBuilderBuildModal=Qt,l.modalBuilderDefaults=Oe,l.modalBuilderInit=Ds,l.modalBuilderInitializer=F,l.modalBuilderSetDefaults=Ps,l.newId=pt,l.overflowScrollerCreatePager=Te,l.pageInit=Ms,l.popoverGetContentByTrigger=De,l.popoverInit=Us,l.popoverInitializer=R,l.popoverInstances=Zt,l.popoverResolve=Pe,l.printDetailsAttrs=Et,l.printDetailsInit=Ws,l.printInit=_s,l.proxyClickAttachHandlers=Be,l.proxyClickDefaults=Me,l.proxyClickInit=ti,l.proxyClickInitializer=Re,l.proxyClickSetDefaults=Zs,l.proxyClickSetupProxy=qe,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=Ne,l.tabsInit=gi,l.tabsInitializer=Ue,l.tabsInstances=Fe,l.tabsSetup=Ve,l.themeToggleDefaults=se,l.themeToggleInit=wi,l.themeToggleInitializer=I,l.themeToggleSetDefaults=Ci,l.themeToggleSetupToggle=_e,l.tooltipInit=zi,l.tooltipInitializer=at,l.updateSetting=ds,l.updateSettings=me,l.wrapSettingString=H,l.youtubePauseVideos=we,l.youtubePrepVideos=Ee,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/lib/js/exports.md
CHANGED
package/lib/js/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ulu/frontend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A framework-agnostic frontend toolkit providing a modular, tree-shakable library of accessible components and utilities. Designed for seamless integration, it features a highly configurable SCSS system for any environment and vanilla JavaScript modules optimized for traditional websites and content management systems.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|