@webority/ui-elements 0.53.0 → 0.54.0
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/WuiCarousel-C33Z8FBt.js +1 -0
- package/dist/WuiCodeBlock-BcLJhLBJ.js +1 -0
- package/dist/WuiCommandPalette-B5OB6lsf.js +2 -0
- package/dist/WuiCommentThread-Bww7P_cu.js +1 -0
- package/dist/WuiConsentBanner-DWdHLSx9.js +1 -0
- package/dist/WuiDataTable-tR8Lp4XZ.js +1 -0
- package/dist/WuiDateRange-B5sO9usZ.js +25 -0
- package/dist/WuiDrawer-BuvDLR6M.js +1 -0
- package/dist/WuiHoverCard-CNEawHmO.js +1 -0
- package/dist/WuiInlineEdit-CI-3C7yP.js +1 -0
- package/dist/WuiLightbox-hluak_-q.js +1 -0
- package/dist/WuiMentionInput-DW7N1Zne.js +1 -0
- package/dist/WuiMenubar-D2tb_3eU.js +1 -0
- package/dist/WuiNavigationMenu-BsLnvz2Y.js +1 -0
- package/dist/WuiNotificationCenter-DKdvaSbm.js +1 -0
- package/dist/WuiOnboardingChecklist-s2DG6PZ0.js +1 -0
- package/dist/WuiOverflow-CB3j6q6n.js +1 -0
- package/dist/WuiRating-BzeW6iDC.js +1 -0
- package/dist/WuiRecordPager-yXv4g2ZR.js +1 -0
- package/dist/WuiRelativeTime-Cfc8TMd8.js +1 -0
- package/dist/WuiResizable-m2Ypa-zD.js +1 -0
- package/dist/WuiRollingNumber-DBgi_3l7.js +1 -0
- package/dist/WuiShortcuts-CMibF1XM.js +1 -0
- package/dist/WuiShowMore-Bu7IQcXS.js +1 -0
- package/dist/{WuiTour-D0zFmfkz.js → WuiTour-CUWrh5MD.js} +5 -5
- package/dist/WuiTruncate-BLl2u3b-.js +1 -0
- package/dist/WuiWhatsNew-BO78119Z.js +1 -0
- package/dist/copyText-DM5HhXjf.js +1 -0
- package/dist/elements/carousel.js +1 -0
- package/dist/elements/code-block.js +1 -0
- package/dist/elements/command-palette.js +1 -1
- package/dist/elements/comment-thread.js +1 -0
- package/dist/elements/consent-banner.js +1 -1
- package/dist/elements/data-table.js +1 -0
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/drawer.js +1 -0
- package/dist/elements/hover-card.js +1 -0
- package/dist/elements/inline-edit.js +1 -0
- package/dist/elements/lightbox.js +1 -0
- package/dist/elements/mention-input.js +1 -0
- package/dist/elements/menubar.js +1 -0
- package/dist/elements/navigation-menu.js +1 -0
- package/dist/elements/notification-center.js +1 -0
- package/dist/elements/onboarding-checklist.js +1 -0
- package/dist/elements/overflow.js +1 -0
- package/dist/elements/rating.js +1 -0
- package/dist/elements/record-pager.js +1 -0
- package/dist/elements/relative-time.js +1 -0
- package/dist/elements/resizable.js +1 -0
- package/dist/elements/rolling-number.js +1 -0
- package/dist/elements/shortcuts.js +1 -0
- package/dist/elements/show-more.js +1 -0
- package/dist/elements/tour.js +1 -1
- package/dist/elements/truncate.js +1 -0
- package/dist/elements/whats-new.js +1 -0
- package/dist/helpers.js +1 -1
- package/dist/notificationDays-pYmoU0g6.js +1 -0
- package/dist/shortcutKeys-BQiDpsTJ.js +1 -0
- package/dist/themeTransition-C61cbmZ4.js +1 -0
- package/dist/ui-consent-banner.global.js +1 -1
- package/dist/ui-elements.global.js +123 -123
- package/dist/ui-elements.js +1 -1
- package/dist/ui-tour.global.js +1 -1
- package/package.json +24 -1
- package/dist/WuiCommandPalette-CfbMtT6z.js +0 -2
- package/dist/WuiConsentBanner-BgLJlAnE.js +0 -1
- package/dist/WuiDateRange-BFpOjqWn.js +0 -25
- package/dist/themeTransition-lkmQm8FR.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),n=120,r=class extends e{static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),n)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:!!e.relatedTarget&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){if(this._track=this.querySelector(`.wui-carousel-track`),!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument,this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,clearTimeout(this._timer),clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){return Array.from(this._track.children).filter(e=>e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=e.target.closest?.(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`);!t||!this.contains(t)||this._track.contains(t)||(t.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):t.getAttribute(`aria-disabled`)===`true`?e.preventDefault():t.classList.contains(`wui-carousel-prev`)?this.prev():t.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(t.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=typeof window<`u`?window.getComputedStyle(this._track).getPropertyValue(`--wui-carousel-view`):``,t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((n,r)=>{let i=t.slide(r+1,e.length);n.getAttribute(`aria-label`)!==i&&n.setAttribute(`aria-label`,i)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let n=Math.max(1,Math.ceil(e/this._perView)),r=this.querySelector(`.wui-carousel-dots`);if(r&&r.children.length!==n){let e=this.getAttribute(`dot-label`)||t.dot;r.replaceChildren(...Array.from({length:n},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=n,this._page=Math.min(this._page,n-1),this.toggleAttribute(`data-single`,n<=1),this._render(!1),this._sync()}_settle(){let e=this._track,t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._slides()[this._start(this._page)];if(t){let e=this._motion?.matches?`auto`:`smooth`;typeof this._track.scrollTo==`function`?this._track.scrollTo({left:t.offsetLeft,behavior:e}):this._track.scrollLeft=t.offsetLeft}this._render(!0),this._sync()}_render(e){let n=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`);this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!n&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!n&&this._page===this._pages-1));let r=this._slides().length,i=this._start(this._page)+1,a=Math.min(r,i+this._perView-1),o=t.status(i,a,r);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){clearTimeout(this._timer),this._timer=null;let e=this._interval(),n=this.querySelector(`.wui-carousel-pause`);if(n){n.hidden=e===0||this._pages<=1||!!this._motion?.matches;let r=this._paused?this.getAttribute(`play-label`)||t.play:this.getAttribute(`pause-label`)||t.pause,i=n.querySelector(`.wui-carousel-pause-text`);i&&i.textContent!==r&&(i.textContent=r),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{t}from"./iconGlyphs.g-CUm_mfze.js";import{n,t as r}from"./copyText-DM5HhXjf.js";var i=Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`]),a=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,css:`CSS`}),o=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),s=`(?![\\s\\S])`,c=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${s})`).source,l=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,o([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],u=[[`comment`,RegExp(`//[^\\n]*|${c}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,o(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,o([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],d=[[`comment`,RegExp(`//[^\\n]*|${c}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,o(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,o([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],f=[[`comment`,RegExp(`--[^\\n]*|${c}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,o(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,o([`true`,`false`])],[`type`,o([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],p=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,o([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,o(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],m=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],h=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${s})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],g={json:l,js:u,cs:d,sql:f,bash:p,http:m,css:[[`comment`,new RegExp(c)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:h,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},_=new Map;function v(e){let t=_.get(e);if(!t){let n=g[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},_.set(e,t)}return t}function y(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function b(e,t,n=[]){let{re:r,types:i}=v(e),a=0;for(let o of t.matchAll(r)){if(!o[0])continue;y(n,`plain`,t.slice(a,o.index));let r=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[r]===`tag`?b(`htmlTag`,o[0],n):y(n,i[r],o[0]),a=o.index+o[0].length}return y(n,`plain`,t.slice(a)),n}function x(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return b(`http`,e);let n=b(`http`,e.slice(0,t.index+t[0].length)),r=e.slice(t.index+t[0].length),i=r.trimStart()[0];return i===`{`||i===`[`?b(`json`,r,n):i===`<`?b(`html`,r,n):(y(n,`plain`,r),n)}function S(e,t){let n=String(e??``);return!n||n.length>1e5?n?[[`plain`,n]]:[]:t===`http`?x(n):!Object.hasOwn(g,t)||t===`htmlTag`?[[`plain`,n]]:b(t,n)}function C(e,t){let n=[[]];for(let[r,i]of S(e,t))i.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&n.push([]),e&&n[n.length-1].push([r,e])});return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var w=class extends e{static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}constructor(){super(),this._chrome=null,this._observer=null,this._timer=0}connectedCallback(){this._render(),!(typeof MutationObserver>`u`)&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,clearTimeout(this._timer)}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_render(){let e=this._source();if(!e)return;clearTimeout(this._timer);let t=this.ownerDocument,n=(e.textContent??``).replace(/\r?\n$/,``),r=this.getAttribute(`language`),o=i.includes(r)?r:`text`,s=this.getAttribute(`label`)||``,c=C(n,o),l=t.createElement(`div`);l.className=`wui-code-chrome`,l.append(this._bar(t,s||a[o],n));let u=t.createElement(`div`);u.className=`wui-code-view`,u.setAttribute(`role`,`region`),u.setAttribute(`aria-label`,s||`Code`),u.tabIndex=0,u.style.setProperty(`--wui-code-digits`,String(String(c.length).length));let d=t.createElement(`pre`);d.className=`wui-code-pre`;let f=t.createElement(`code`);for(let e of c){let n=t.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of e){if(r===`plain`){n.append(i);continue}let e=t.createElement(`span`);e.className=`wui-code-t-${r}`,e.textContent=i,n.append(e)}f.append(n)}d.append(f),u.append(d),l.append(u),this._chrome?.remove(),this._chrome=l,this.append(l),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_bar(e,i,a){let o=e.createElement(`div`);o.className=`wui-code-bar`;let s=e.createElement(`span`);s.className=`wui-code-title`,s.textContent=i;let c=this.getAttribute(`copy-label`)||`Copy`,l=this.getAttribute(`copied-label`)||`Copied`,u=e.createElement(`button`);u.type=`button`,u.className=`btn btn-ghost btn-sm wui-code-copy`,u.setAttribute(`aria-live`,`polite`);let d=e.createElement(`span`);d.className=`wui-code-copy-icon`;let f=e.createElement(`span`),p=e=>{d.innerHTML=t(e?`check`:`files`,{size:14}),f.textContent=e?l:c};return p(!1),u.append(d,f),u.addEventListener(`click`,async()=>{await n(a)&&(p(!0),clearTimeout(this._timer),this._timer=setTimeout(()=>p(!1),r))}),o.append(s,u),o}};export{w as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t}from"./optionLabel-DOZb8ERB.js";import{t as n}from"./textMatch-wdY7XLIc.js";var r=`[role="option"]`,i=`No results`,a=`All`,o=`Recent`,s=5,c=20,l=`.wui-cmd-back, [data-depth]`,u=0,d=class extends e{static get observedAttributes(){return[`filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++u}`,this._onModalHidden=()=>this._reset(),this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=e.target?.closest?.(l);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=this._optionFrom(e.target);n&&this._select(n)},this._onMouseDown=e=>{let t=e.target?.closest?.(l);(t&&this.contains(t)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{!this.hasAttribute(`filter`)||e.target!==this._input()||(this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`.modal`),this._modal?.addEventListener(`hidden.bs.modal`,this._onModalHidden),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??i}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
|
|
2
|
+
`),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1),this._setActive(o??r[0]??null,n)}_input(){return this.querySelector(`[role="combobox"]`)}_optionFrom(e,t=!1){let n=e?.closest?.(r);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden||!!e.closest(`[role="group"]`)?.hidden}_selectableOptions(){return[...this.querySelectorAll(r)].filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of this.querySelectorAll(r))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setActive(t[r],!0)}_handleKeyDown(e){if(e.target===this._input()){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!e.target.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=[...this.querySelectorAll(`.wui-cmd-page`)].find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_restart(){let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=this.querySelector(`.wui-cmd-crumbs`);if(!e)return;let t=this.getAttribute(`root-label`)??a,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=e.querySelector(`.wui-cmd-trail`);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);return a.className=`wui-cmd-crumb`,a.textContent=e,r?a.setAttribute(`aria-current`,`page`):(a.type=`button`,a.dataset.depth=String(t)),n.append(a),n}))}_recentsHost(){return this.querySelector(`.wui-cmd-recents`)}_realOptions(){let e=this._recentsHost();return[...this.querySelectorAll(r)].filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,c):s}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>!(e.g===n&&e.k===r))];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch{}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries():[],r=this._realOptions(),i=[];for(let e of n){let t=r.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&i.push(t),i.length>=this._recentsLimit())break}if(!i.length){e.firstChild&&e.replaceChildren();return}let a=`${this._recentsId}-label`,s=document.createElement(`div`);s.className=`wui-cmd-group`,s.setAttribute(`role`,`group`),s.setAttribute(`aria-labelledby`,a);let c=document.createElement(`div`);c.className=`wui-cmd-group-label`,c.setAttribute(`role`,`presentation`),c.id=a,c.textContent=this.getAttribute(`recents-label`)??o,s.append(c);for(let e of i){let t=e.cloneNode(!0);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),s.append(t)}e.replaceChildren(s)}_inScope(e,t){return!t||(e.closest(`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),i=(e?e.value:``).trim(),a=i.toLowerCase(),o=this.highlight,s=[...this.querySelectorAll(`.wui-cmd-page`)],c=s.length>0,l=this._path.at(-1)?.key??null;for(let e of s)e.hidden=e.dataset.page!==l;let u=0;for(let e of this._realOptions()){let r=e.querySelector(`.wui-cmd-item-label`),s=e.dataset.label??r?.textContent??``,l=this._inScope(e,c)&&(!a||s.toLowerCase().includes(a));e.hidden=!l,l&&u++,r&&(r.innerHTML=n(s,o?i:``).map(e=>e.match?`<mark class="wui-cmd-mark">${t(e.text)}</mark>`:t(e.text)).join(``))}let d=this._recentsHost();for(let e of this.querySelectorAll(`[role="group"]`))d?.contains(e)||(e.hidden=![...e.querySelectorAll(r)].some(e=>!e.hidden));let f=this.querySelector(`[role="listbox"]`);f&&(f.hidden=u===0);let p=this.querySelector(`.wui-cmd-empty`);p&&(p.textContent=a&&u===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`hidden.bs.modal`,this._onModalHidden),this._modal=null}};export{d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{c as t}from"./wuiHttp-BC8co934.js";import{n,r,t as i}from"./anchorOverlay-WcDeH46q.js";var a=Object.freeze([`👍`,`❤️`,`🎉`,`😄`,`👀`,`🙏`]),o=Object.freeze([`post`,`reply`,`edit`,`delete`,`react`]),s=Object.freeze({listName:`Comments`,empty:`No comments yet.`,deleted:`This comment was deleted.`,edited:`Edited`,reply:`Reply`,edit:`Edit`,delete:`Delete`,cancel:`Cancel`,save:`Save`,post:`Comment`,confirmDelete:`Delete this comment?`,composerLabel:`Add a comment`,composerPlaceholder:`Write a comment. Type @ to mention someone.`,replyLabel:e=>`Reply to ${e}`,replyPlaceholder:`Write a reply`,editLabel:`Edit comment`,repliesName:e=>`Replies to ${e}`,reactions:`Reactions`,addReaction:`Add a reaction`,pickerName:`Choose a reaction`,emptyBody:`Write something first.`,done:Object.freeze({post:`Comment posted.`,reply:`Reply posted.`,edit:`Comment saved.`,delete:`Comment deleted.`,react:``}),failed:Object.freeze({forbidden:`You do not have permission to do this.`,client:`This did not go through. Refresh the page and try again.`,validation:`This was not accepted. Check it and try again.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`})}),c=`[data-wui-items]`,l=`[data-wui-picker]`,u=`[data-wui-composer]`,d=`[data-wui-comment]`,f=`[data-wui-live]`,p=e=>typeof e?.message==`string`&&e.message?e.message:s.failed.server,m=class extends e{constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this),this._onDocClick=e=>{this._pickerFor&&!this.querySelector(l)?.contains(e.target)&&!this._pickerFor.button.contains(e.target)&&this._closePicker(!1)},this._repositionPicker=()=>{this._pickerFor&&i(this._pickerFor.button,this.querySelector(l))}}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;delete this.people,this.people=e}this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),this._handPeople(this.querySelector(`${u} wui-mention-input`)))}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:[...this.querySelectorAll(`:scope > [data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:a}_onClick(e){let t=e.target.closest?.(`[data-wui-emoji]`);if(t&&this.contains(t)&&!t.disabled){let e=t.closest(l),n=e?this._pickerFor?.comment:t.closest(d);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=e.target.closest?.(`[data-wui-action]`);if(!n||!this.contains(n)||n.disabled)return;let r=n.closest(d);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:this._send(`delete`,{commentId:r.getAttribute(`data-wui-comment`)},{comment:r,scope:r});break;case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(n.closest(`[data-wui-reply], [data-wui-editor]`),!0);break;case`post`:case`send`:this._sendFrom(n);break}}_onKeyDown(e){let t=this.querySelector(l);if(this._pickerFor&&t?.contains(e.target)){let n=[...t.querySelectorAll(`[data-wui-emoji]`)],r=n.indexOf(e.target);e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),n[(r+(e.key===`ArrowRight`?1:-1)+n.length)%n.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let n=e.target.closest?.(`[data-wui-reply], [data-wui-editor]`);if(n&&this.contains(n)){e.preventDefault(),e.stopPropagation(),this._closeSlot(n,!0);return}let r=e.target.closest?.(`[data-wui-confirm]`);r&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(r.closest(d),!0))}_onSubmitKey(e){let t=(e.target.closest?.(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`))?.querySelector(`[data-wui-action="send"], [data-wui-action="post"]`);t&&!t.disabled&&this._sendFrom(t)}_openReply(e,t){let n=e?.querySelector(`:scope > [data-wui-reply]`);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e.querySelector(`.wui-comment-author`)?.textContent.trim()||``;this._fillSlot(n,{label:s.replyLabel(r),placeholder:s.replyPlaceholder,value:``,send:s.reply,opener:t})}_openEditor(e,t){let n=e?.querySelector(`:scope > .wui-comment-row [data-wui-editor]`);if(!n||!n.hidden)return;let r=n.parentElement.querySelector(`:scope > [data-wui-text]`);r&&(r.hidden=!0),this._fillSlot(n,{label:s.editLabel,placeholder:``,value:e.getAttribute(`data-value`)??``,send:s.save,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:a}){let o=this.ownerDocument,c=o.createElement(`wui-mention-input`);c.className=`wui-mention-input`,c.setAttribute(`label`,t),n&&c.setAttribute(`placeholder`,n),c.setAttribute(`rows`,`2`),c.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`])this.hasAttribute(e)&&c.setAttribute(e,this.getAttribute(e));let l=o.createElement(`div`);l.className=`wui-comment-form-actions`,l.append(this._button(`btn btn-primary btn-sm`,`send`,i),this._button(`btn btn-ghost btn-sm`,`cancel`,s.cancel));let u=o.createElement(`div`);u.className=`wui-comment-error`,u.setAttribute(`data-wui-error`,``),u.hidden=!0,e.replaceChildren(c,l,u),this._handPeople(c),e.hidden=!1,this._openers??=new WeakMap,this._openers.set(e,a),c.focus();let d=c.querySelector(`textarea`);d?.setSelectionRange(d.value.length,d.value.length)}_button(e,t,n){let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=e,r.setAttribute(`data-wui-action`,t),r.textContent=n,r}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=e.parentElement?.querySelector(`:scope > [data-wui-text]`);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=e?.querySelector(`:scope > .wui-comment-row`),n=t?.querySelector(`[data-wui-confirm]`),r=t?.querySelector(`[data-wui-actions]`);n&&(n.hidden=!1,r&&(r.hidden=!0),n.querySelector(`[data-wui-action="cancel-delete"]`)?.focus())}_closeConfirm(e,t){let n=e?.querySelector(`:scope > .wui-comment-row`),r=n?.querySelector(`[data-wui-confirm]`),i=n?.querySelector(`[data-wui-actions]`);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&i?.querySelector(`[data-wui-action="delete"]`)?.focus()}_openPicker(e,t){let r=this.querySelector(l);!r||!e||(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),r.hidden=!1,i(t,r),n(this,this._repositionPicker),this.ownerDocument.addEventListener(`click`,this._onDocClick,!0),r.querySelector(`[data-wui-emoji]`)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;this._pickerFor=null;let n=this.querySelector(l);n&&(n.hidden=!0),t.button.setAttribute(`aria-expanded`,`false`),r(this),this.ownerDocument.removeEventListener(`click`,this._onDocClick,!0),e&&t.button.isConnected&&t.button.focus()}_react(e,t){t&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=e.closest(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,s.emptyBody),n?.focus();return}let i=t.closest(d);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let a=i??n?.querySelector(`:scope > .wui-comment-row`)??this;this._showError(a,null);let o=[...r.querySelectorAll(`button, textarea`)].filter(e=>!e.disabled);for(let e of o)e.disabled=!0;let c=await this._persist({intent:e,...t});for(let e of o)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let l=t.commentId??null,u=t.parentId??null;if(c.ok){c.html!=null&&this._swapItems(c.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),s.done[e]&&this._announce(s.done[e]),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:l,parentId:u}}));return}c.kind===`session`||c.kind===`aborted`||(this._showError(a.isConnected?a:this,c.message),this._announce(c.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:c.kind,message:c.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:p(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!1,kind:`client`,message:s.failed.client};let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n!=null&&r.set(t,n);let i=await t(n,{method:`POST`,body:r});return i.ok?{ok:!0,html:i.html}:{ok:!1,kind:i.kind,message:i.message||s.failed[i.kind]||s.failed.server}}_swapItems(e){let t=this.querySelector(c);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=n.content.querySelector(c);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!i.disabled)return;let a=e=>e?[...this.querySelectorAll(d)].find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>a(e)?.querySelector(`:scope > .wui-comment-row`),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=o(t.parentId)?.querySelector(`[data-wui-action="reply"]`);else if(e===`edit`)s=o(t.commentId)?.querySelector(`[data-wui-action="edit"]`);else if(e===`react`){let e=o(t.commentId);s=[...e?.querySelectorAll(`button[data-wui-emoji]`)??[]].find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??e?.querySelector(`[data-wui-action="react-menu"]`)}s??=this.querySelector(`${u} textarea`),s?.focus()}_showError(e,t){let n=e?.querySelector?.(`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=this.querySelector(`:scope > ${f}`);!t||!e||(t.textContent=``,t.textContent=e)}};export{m as i,a as n,s as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{t}from"./tourOpenMark-nPeAJFSo.js";var n={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-primary-text":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay-lg":`0 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},r=e=>`var(${e}, ${n[e]})`,i=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${r(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${r(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${r(`--color-surface`)}; border: 1px solid ${r(`--color-border`)}; border-radius: ${r(`--wui-radius-lg`)}; box-shadow: ${r(`--wui-shadow-overlay-lg`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${r(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${r(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${r(`--color-primary-ink`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${r(`--color-border`)}; border-bottom: 1px solid ${r(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${r(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${r(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${r(`--color-primary`)}; background: ${r(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${r(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${r(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${r(`--color-primary`)}; border-color: ${r(`--color-primary`)}; color: ${r(`--color-primary-text`)}; } .btn-primary:hover { background: ${r(`--color-primary-hover`)}; border-color: ${r(`--color-primary-hover`)}; } .btn-outline-secondary { border-color: ${r(`--color-text-muted`)}; color: ${r(`--color-text-muted`)}; } .btn-outline-secondary:hover { background: ${r(`--color-bg-muted`)}; color: ${r(`--color-text`)}; } .btn-link { font-weight: 400; color: ${r(`--color-primary-ink`)}; text-decoration: underline; } .btn-link:hover { color: ${r(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 480px) { :host, :host([position="bottom-right"]) { left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; } } `,a=`wui-consent-save`,o=`[data-consent-settings]`,s=`tour-open`,c={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},l=[`analytics`,`functional`,`marketing`],u=0,d=class extends e{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`]}constructor(){super(),u+=1,this._uid=`wui-consent-${u}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(o)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null}get position(){return this.getAttribute(`position`)===`bottom-right`?`bottom-right`:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||c.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||c.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||c.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||c.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||c.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||c.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get preferences(){return{...this._preferences}}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[t]})}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect()}_syncTour(){this.toggleAttribute(s,document.documentElement.hasAttribute(t))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,n=this.policyHref?` <a class="wui-consent-banner-policy" href="${m(this.policyHref)}">${p(this.policyLabel)}</a>`:``,r=this._root();r.innerHTML=`${r===this?``:`<style>${i}</style>`} <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden> <h2 class="wui-consent-banner-heading" id="${t}-heading">${p(this.heading)}</h2> <p class="wui-consent-banner-description" id="${t}-description">${p(this.description)}${n}</p> <div class="wui-consent-banner-settings" hidden> ${f(t,`essential`,c.essentialLabel,c.essentialDescription,!0)} ${f(t,`analytics`,c.analyticsLabel,this.analyticsDescription,!1)} ${f(t,`functional`,c.functionalLabel,this.functionalDescription,!1)} ${f(t,`marketing`,c.marketingLabel,this.marketingDescription,!1)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${c.settingsLabel}</button> <button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${c.rejectLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${c.acceptLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${c.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save({analytics:!0,functional:!0,marketing:!0})),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save({analytics:!1,functional:!1,marketing:!1})),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(a,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_switchValues(){let e={};for(let t of l)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of l){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function f(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${p(n)}</label> </div> <p class="wui-consent-banner-category-description">${p(r)}</p> </div>`}var p=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),m=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);export{d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{f as t}from"./formatters-BAE__8ye.js";var n=48,r=1200,i=10,a=50,o=[`start`,`end`],s=8,c={comfortable:54,cozy:48,compact:40},l={resize:e=>e?`Resize ${e} column`:`Resize column`,width:e=>`${e} pixels`,rows:e=>`${t(e,{decimals:0})} ${e===1?`row`:`rows`}`,saved:e=>e?`${e} saved.`:`Row saved.`,savedMany:e=>`${t(e,{decimals:0})} rows saved.`,notSaved:(e,t)=>`${e?`${e} was not saved.`:`Row was not saved.`}${t?` ${t}`:``}`},u=e=>t(e,{decimals:0}),d=e=>Math.min(r,Math.max(48,Math.round(Number(e)||0)));function f(e,t,n=[]){let r=new Map(n.map(e=>[e,[]]));return e.forEach((e,n)=>{let i=t(e,n);r.has(i)||r.set(i,[]),r.get(i).push(e)}),[...r].filter(([,e])=>e.length>0).map(([e,t])=>({key:e,items:t}))}function p({scrollTop:e,viewport:t,rowHeight:n,count:r,overscan:i=8}){let a=n>0?n:c.comfortable,o=Math.floor(Math.max(0,e)/a),s=Math.max(0,o-i);s-=s%2;let l=Math.min(r,o+Math.ceil(Math.max(0,t)/a)+i),u=Math.min(s,l);return{start:u,end:l,before:u*a,after:Math.max(0,r-l)*a}}var m=e=>`wui-widths:${e}`;function h(e){if(!e)return{};try{let t=JSON.parse(window.localStorage.getItem(m(e))||`{}`),n={};for(let[e,r]of Object.entries(t||{}))Number.isFinite(r)&&(n[e]=d(r));return n}catch{return{}}}function g(e,t){if(e)try{Object.keys(t).length?window.localStorage.setItem(m(e),JSON.stringify(t)):window.localStorage.removeItem(m(e))}catch{}}var _=(e,t)=>`--wui-pin-${e}-${t}`,v=`--wui-pin-at`,y=(e,t)=>`var(${_(e,t)}, 0px)`;function b(e){let t=e.map(()=>null),n=-1;e.forEach((e,t)=>{e===`start`&&(n=t)});let r=0;for(let i=0;i<=n;i++)(e[i]===`start`||e[i]===`lead`)&&(t[i]={side:`start`,ordinal:r++,edge:!1});n>=0&&(t[n].edge=!0);let i=-1;r=0;for(let n=e.length-1;n>=0;n--)e[n]===`end`&&(t[n]={side:`end`,ordinal:r++,edge:!1},i=n);return i>=0&&(t[i].edge=!0),t}var x=e=>e?`wui-pin-${e.side}${e.edge?` wui-pin-${e.side}-edge`:``}`:``,S=200,C=220,w=`cubic-bezier(0.22, 1, 0.36, 1)`,T=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,E=e=>e.getAttribute(`data-row-key`)??e;function D(e){let t=[...e];if(t.length>200)return null;let n=new Map;for(let e of t)e.hidden||n.set(E(e),e.offsetTop);return n}function O(e,t){let n=[...e];if(!t||n.length>200||T())return 0;let r=0;for(let e of n){if(e.hidden||typeof e.animate!=`function`)continue;let n=t.get(E(e));if(n===void 0)continue;let i=n-e.offsetTop;Math.abs(i)<1||(e.animate([{transform:`translateY(${i}px)`},{transform:`translateY(0)`}],{duration:220,easing:w}),r++)}return r}function k(e,t){if(!e||!t)return!1;let n=new Set(t),r=new Set(e),i=e.filter(e=>n.has(e)),a=t.filter(e=>r.has(e));return i.some((e,t)=>e!==a[t])}var A=[`saving`,`error`],j=`data-wui-save-state`,M=`wui-row-save-error`,N=e=>e.querySelector(`:scope > .wui-name-cell`)??[...e.cells].find(e=>!e.matches(`.wui-select-cell, .wui-expand-cell`))??null;function P(e){let t=N(e);if(!t)return``;let n=t.querySelector(`.u-name`);if(n)return n.textContent.trim();let r=``;for(let e of t.childNodes)e.nodeType===1&&e.classList.contains(`wui-row-save-error`)||(r+=e.textContent);return r.replace(/\s+/g,` `).trim()}function F(e,t,n=``){if(t!==null&&!A.includes(t))throw Error(`A row's save state is ${A.join(` or `)} (or null to clear it), not "${t}".`);e.querySelector(`:scope > * > .${M}`)?.remove(),t===null?e.removeAttribute(j):e.setAttribute(j,t),t===`saving`?e.setAttribute(`aria-busy`,`true`):e.removeAttribute(`aria-busy`);let r=t===`error`&&n?N(e):null;if(r){let t=e.ownerDocument.createElement(`span`);t.className=M,t.textContent=n,r.append(t)}}function I(e,t){let n=[];if(!e)return n;for(let[r,i]of e){let e=t.get(r);i.state!==`saving`||!e||e.state===`saving`||n.push({label:e.label,ok:e.state!==`error`,message:e.message||``})}return n}function L(e){let t=e.filter(e=>e.ok),n=[];t.length===1?n.push(l.saved(t[0].label)):t.length>1&&n.push(l.savedMany(t.length));for(let t of e)t.ok||n.push(l.notSaved(t.label,t.message));return n.join(` `)}var R=`.wui-col-resize`,z=`.wui-group-row, .wui-virtual-spacer`,B=`.wui-select-cell, .wui-expand-cell`,V=`<svg class="wui-icon" data-icon="chevron-down" width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="vertical-align:-.125em"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="M19.92 8.95l-6.52 6.52c-.77.77-2.03.77-2.8 0L4.08 8.95"></path></svg>`,H=e=>e.hasAttribute(`data-wui-skeleton`)||!!e.querySelector(`:scope > td > .skeleton`),U=class extends e{constructor(){super(),this._frame=0,this._headDirty=!0,this._rowsDirty=!0,this._frozenSig=null,this._natural=[],this._widths={},this._collapsed=new Set,this._groupOrder=[],this._items=[],this._range=null,this._drag=null,this._userSized=!1,this._swallowClick=!1,this._mo=null,this._ro=null,this._fonts=null,this._onPointerDown=e=>this._startDrag(e),this._onKeyDown=e=>this._key(e),this._onClick=e=>this._click(e),this._onDblClick=e=>{let t=e.target.closest?.(R);t&&this.contains(t)&&this._reset(t.closest(`th`))},this._onScroll=()=>{this.hasAttribute(`virtual`)&&this._schedule()},this._onFonts=()=>{this._userSized||this._drag||this._frozenSig===null||!this.hasAttribute(`resizable`)||(this._frozenSig=null,this._schedule())}}connectedCallback(){this._widths=h(this.getAttribute(`view-key`)),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick,!0),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._fonts=this.ownerDocument.fonts??null,this._fonts?.addEventListener(`loadingdone`,this._onFonts),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(e=>this._mutated(e)),this._mo.observe(this,{childList:!0,subtree:!0})),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._schedule()),this._ro.observe(this)),this._headDirty=!0,this._rowsDirty=!0,this._schedule()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick,!0),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`scroll`,this._onScroll),this._fonts?.removeEventListener(`loadingdone`,this._onFonts),this._fonts=null,this._mo?.disconnect(),this._ro?.disconnect(),this._mo=null,this._ro=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0,this._drag=null}refresh(){this._headDirty=!0,this._rowsDirty=!0,this._run()}get _table(){return this.querySelector(`:scope > table`)}_headCells(e){let t=e.tHead?.rows[0];return t?[...t.cells]:[]}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._run()})}_mutated(e){for(let t of e){let e=t.target.nodeType===1?t.target:t.target.parentElement;e&&((e.closest(`thead`)||e===this._table||e===this)&&(this._headDirty=!0),(e.closest(`tbody, tfoot`)||e===this._table||e===this)&&(this._rowsDirty=!0))}this._schedule()}_run(){let e=this._table;if(!e)return;let t=this._headDirty,n=this._rowsDirty;this._headDirty=!1,this._rowsDirty=!1,n&&this.hasAttribute(`group-by`)&&this._group(e),this._pins(e,t||n),this.hasAttribute(`resizable`)&&(t&&this._handles(e),this._layout(e)),this.hasAttribute(`virtual`)&&this._virtual(e,t||n),this._mo?.takeRecords()}_pins(e,t){let n=this._headCells(e),r=n.map(e=>{let t=e.dataset.pin;return t===`start`||t===`end`?t:e.matches(B)?`lead`:null});if(!r.some(e=>e===`start`||e===`end`))return;let i=b(r);i.forEach((e,t)=>{e&&this._ro?.observe(n[t])});let a=e=>n[e].getBoundingClientRect().width,o=0;i.forEach((t,n)=>{t?.side===`start`&&(this._setVar(e,_(`start`,t.ordinal),o),o+=a(n))}),o=0;for(let t=i.length-1;t>=0;t--){let n=i[t];n?.side===`end`&&(this._setVar(e,_(`end`,n.ordinal),o),o+=a(t))}if(t)for(let t of e.rows)t.matches(`${z}, .wui-row-expanded`)||t.cells.length!==n.length||i.forEach((e,n)=>{if(!e)return;let r=t.cells[n];r.classList.contains(`wui-pin-${e.side}`)||r.classList.add(`wui-pin-${e.side}`),e.edge&&!r.classList.contains(`wui-pin-${e.side}-edge`)&&r.classList.add(`wui-pin-${e.side}-edge`);let i=y(e.side,e.ordinal);r.style.getPropertyValue(`--wui-pin-at`)!==i&&r.style.setProperty(v,i)})}_setVar(e,t,n){let r=`${Math.round(n*100)/100}px`;e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}_resizable(e){return e.map((t,n)=>n<e.length-1&&!t.matches(B))}_handles(e){let t=this._headCells(e),n=this._resizable(t);t.forEach((e,t)=>{if(!n[t]||e.querySelector(R))return;let i=e.ownerDocument.createElement(`span`);i.className=`wui-col-resize`,i.setAttribute(`role`,`separator`),i.setAttribute(`aria-orientation`,`vertical`),i.setAttribute(`aria-valuemin`,`48`),i.setAttribute(`aria-valuemax`,String(r)),i.setAttribute(`tabindex`,`0`);let a=e.textContent.trim();i.setAttribute(`aria-label`,l.resize(a)),a&&!e.hasAttribute(`aria-label`)&&e.setAttribute(`aria-label`,a),e.classList.add(`wui-col-resizable`),e.appendChild(i)})}_hasRows(e){for(let t of e.tBodies)for(let e of t.rows)if(!e.matches(z)&&!H(e))return!0;return!1}_signature(e){return e.map(e=>e.dataset.key||e.textContent.trim()).join(``)}_layout(e){let t=this._headCells(e),n=this._signature(t);!t.length||n===this._frozenSig||(this._hasRows(e)?this._freeze(e,t,n):this._applyRemembered(t))}_applyRemembered(e){for(let t of e){let e=t.dataset.key&&this._widths[t.dataset.key];e&&(t.style.width=`${e}px`);let n=t.querySelector(R);n&&this._handleValue(n,d(e||t.getBoundingClientRect().width))}}_freeze(e,t,n){e.style.tableLayout=``,e.style.width=``,e.removeAttribute(`data-wui-fixed`);for(let e of t)e.hasAttribute(`data-wui-width`)&&(e.style.width=``,e.removeAttribute(`data-wui-width`));this._natural=t.map(e=>e.getBoundingClientRect().width),t.forEach((e,n)=>{if(n===t.length-1||e.matches(B))return;let r=e.dataset.key&&this._widths[e.dataset.key];this._setWidth(e,r||this._natural[n])}),e.style.tableLayout=`fixed`,e.setAttribute(`data-wui-fixed`,``),this._frozenSig=n,this._fitTable(e,t)}_setWidth(e,t){let n=d(t);e.style.width=`${n}px`,e.setAttribute(`data-wui-width`,``);let r=e.querySelector(R);return r&&this._handleValue(r,n),n}_handleValue(e,t){e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,l.width(t))}_fitTable(e,t){let n=t.length-1,r=this._natural[n]||0;for(let e=0;e<n;e++)r+=Number.parseFloat(t[e].style.width)||this._natural[e]||0;e.style.width=`max(100%, ${Math.round(r)}px)`}_ensureFrozen(e){let t=this._headCells(e),n=this._signature(t);return n!==this._frozenSig&&this._freeze(e,t,n),t}_resizeTo(e,t,n){let r=this._table;if(!r)return;let i=this._ensureFrozen(r);this._userSized=!0,this._setWidth(e,t),this._fitTable(r,i),n&&this._remember(e),this._pins(r,!1)}_remember(e){let t=e.dataset.key;t&&(this._widths={...this._widths,[t]:Number.parseFloat(e.style.width)},g(this.getAttribute(`view-key`),this._widths))}_reset(e){let t=this._table;if(!e||!t)return;let n=this._ensureFrozen(t);this._userSized=!0;let r=e.dataset.key;if(r&&r in this._widths){let{[r]:e,...t}=this._widths;this._widths=t,g(this.getAttribute(`view-key`),this._widths)}this._setWidth(e,this._natural[n.indexOf(e)]||0),this._fitTable(t,n),this._pins(t,!1)}_rtl(){return getComputedStyle(this).direction===`rtl`}_startDrag(e){let t=e.target.closest?.(R);if(!t||!this.contains(t)||e.button!==0)return;e.preventDefault(),e.stopPropagation();let n=t.closest(`th`),r=this._table;if(!n||!r)return;this._ensureFrozen(r);let i={th:n,x:e.clientX,from:n.getBoundingClientRect().width,dir:this._rtl()?-1:1,moved:!1};this._drag=i,t.setPointerCapture?.(e.pointerId),t.classList.add(`is-dragging`);let a=e=>{let t=(e.clientX-i.x)*i.dir;Math.abs(t)>1&&(i.moved=!0),this._resizeTo(n,i.from+t,!1)},o=e=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o),t.classList.remove(`is-dragging`),this._drag=null,e.type===`pointercancel`?this._resizeTo(n,i.from,!1):i.moved&&this._remember(n),this._swallowClick=!0,setTimeout(()=>{this._swallowClick=!1},0)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}_key(e){let t=e.target.closest?.(R);if(!t||!this.contains(t))return;let n=t.closest(`th`);if(e.key===`Enter`||e.key===` `){e.preventDefault(),e.stopPropagation();return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),this._reset(n);return}if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),e.stopPropagation();let r=this._table;if(!r)return;this._ensureFrozen(r);let i=e.shiftKey?50:10,a=e.key===`ArrowRight`!==this._rtl(),o=Number.parseFloat(n.style.width)||n.getBoundingClientRect().width;this._resizeTo(n,o+(a?i:-i),!0)}_click(e){let t=!!e.target.closest?.(R);if(this._swallowClick||t){e.stopPropagation(),(t||this._swallowClick)&&e.preventDefault(),this._swallowClick=!1;return}if(!this.hasAttribute(`group-by`))return;let n=(e.target.closest?.(`.wui-group-toggle`))?.closest(`.wui-group-row`);if(!n||!this.contains(n))return;let r=n.dataset.groupKey;this._collapsed.has(r)?this._collapsed.delete(r):this._collapsed.add(r),this._showGroup(n,!this._collapsed.has(r));let i=this._table;i&&this.hasAttribute(`virtual`)&&(this._virtual(i,!0),this._mo?.takeRecords())}_group(e){let t=this.getAttribute(`group-by`),n=this._headCells(e),r=n.findIndex(e=>e.dataset.key===t);if(r<0)throw Error(`<wui-data-table group-by="${t}"> needs a header cell with data-key="${t}".`);let i=e.tBodies[0];if(!i)return;let a=[...i.rows].filter(e=>!e.matches(z));if(a.some(H))return;let o=this.ownerDocument,s=new Map([...i.querySelectorAll(`:scope > tr.wui-group-row`)].map(e=>[e.dataset.groupKey,e])),c=f(a,e=>e.dataset.group??e.cells[r]?.textContent.trim()??``,this._groupOrder);this._groupOrder=c.map(e=>e.key);let d=o.createDocumentFragment(),p=c.map(e=>{let t=s.get(e.key)??this._groupRow(o,e.key);return s.delete(e.key),t.querySelector(`.wui-group-cell`).colSpan=n.length,t.querySelector(`.wui-group-count`).textContent=u(e.items.length),t.querySelector(`.wui-group-rows`).textContent=`, ${l.rows(e.items.length)}`,d.append(t,...e.items),[t,e.key]});for(let e of s.values())e.remove();i.insertBefore(d,this._bottom?.parentNode===i?this._bottom:null);for(let[e,t]of p)this._showGroup(e,!this._collapsed.has(t))}_groupRow(e,t){let n=e.createElement(`tr`);n.className=`wui-group-row`,n.dataset.groupKey=t;let r=e.createElement(`th`);r.className=`wui-group-cell`,r.scope=`rowgroup`;let i=e.createElement(`button`);i.type=`button`,i.className=`wui-group-toggle`,i.innerHTML=V;let a=e.createElement(`span`);a.className=`wui-group-label`,a.textContent=t;let o=e.createElement(`span`);o.className=`wui-group-count`,o.setAttribute(`aria-hidden`,`true`);let s=e.createElement(`span`);return s.className=`visually-hidden wui-group-rows`,i.append(a,o,s),r.append(i),n.append(r),n}_showGroup(e,t){if(e){e.querySelector(`.wui-group-toggle`)?.setAttribute(`aria-expanded`,String(t));for(let n=e.nextElementSibling;n&&!n.matches(z);n=n.nextElementSibling)n.hidden=!t}}_spacer(e,t){if(t?.parentNode===e)return t;let n=e.ownerDocument,r=n.createElement(`tr`);return r.className=`wui-virtual-spacer`,r.setAttribute(`aria-hidden`,`true`),r.append(n.createElement(`td`)),r}_virtual(e,t){let n=e.tBodies[0];if(!n)return;if(t){this._top=this._spacer(n,this._top),this._bottom=this._spacer(n,this._bottom),n.firstElementChild!==this._top&&n.insertBefore(this._top,n.firstChild),n.lastElementChild!==this._bottom&&n.append(this._bottom);let t=Math.max(1,this._headCells(e).length);this._top.cells[0].colSpan=t,this._bottom.cells[0].colSpan=t,this._items=[...n.rows].filter(e=>!e.classList.contains(`wui-virtual-spacer`)&&!e.hidden),this._range=null,e.setAttribute(`aria-rowcount`,String(this._items.length+1)),e.tHead?.rows[0]?.setAttribute(`aria-rowindex`,`1`),this._items.forEach((e,t)=>e.setAttribute(`aria-rowindex`,String(t+2))),this._rowHeight>0||(this._rowHeight=this._measureRow(e))}let r=e.tHead?.getBoundingClientRect().height||0,i=p({scrollTop:this.scrollTop-r,viewport:this.clientHeight,rowHeight:this._rowHeight,count:this._items.length}),a=this._range;if(a&&a.start===i.start&&a.end===i.end)return;let o=a?Math.min(a.start,i.start):0,s=a?Math.max(a.end,i.end):this._items.length;for(let e=o;e<s;e++){let t=e<i.start||e>=i.end,n=this._items[e];n.classList.contains(`wui-virtual-off`)!==t&&n.classList.toggle(`wui-virtual-off`,t)}this._range=i,this._top.hidden=i.before===0,this._bottom.hidden=i.after===0,this._top.cells[0].style.height=`${i.before}px`,this._bottom.cells[0].style.height=`${i.after}px`}_measureRow(e){let t=this._items.find(e=>!e.classList.contains(`wui-group-row`)&&!e.classList.contains(`wui-virtual-off`))?.getBoundingClientRect().height;return t>0?t:e.classList.contains(`wui-table-compact`)?c.compact:e.classList.contains(`wui-table-cozy`)?c.cozy:c.comfortable}};export{F as A,_ as C,P as D,h as E,p as M,g as N,k as O,x as S,O as T,u as _,v as a,D as b,a as c,C as d,j as f,d as g,s as h,l as i,I as j,L as k,c as l,A as m,r as n,o,M as p,n as r,i as s,U as t,S as u,f as v,b as w,y as x,N as y};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";import{t as i}from"./iconGlyphs.g-CUm_mfze.js";import{n as a}from"./optionLabel-DOZb8ERB.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./calendarMath-BC2wGCD-.js";var m=`Asia/Kolkata`,h=3,g=[`today`,`last7Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],_={today:`Today`,last7Days:`Last 7 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},v=e=>String(e).padStart(2,`0`),y=e=>`${e.getUTCFullYear()}-${v(e.getUTCMonth()+1)}-${v(e.getUTCDate())}`;function b(e=new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:m,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function x(e,t=new Date){let{y:n,m:r,d:i}=f(b(t)),a=(e,t,n)=>y(new Date(Date.UTC(e,t,n))),o=_[e];switch(e){case`today`:return{label:o,start:a(n,r,i),end:a(n,r,i)};case`last7Days`:return{label:o,start:a(n,r,i-6),end:a(n,r,i)};case`thisMonth`:return{label:o,start:a(n,r,1),end:a(n,r+1,0)};case`lastMonth`:return{label:o,start:a(n,r-1,1),end:a(n,r,0)};case`thisFinancialYear`:{let e=r>=h?n:n-1;return{label:o,start:a(e,h,1),end:a(e+1,h,0)}}default:return null}}function S(e){console.warn(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function C(e,t=new Date){let n=String(e??``).trim();if(!n)return[];let r;if(n.startsWith(`[`))try{r=JSON.parse(n)}catch{return S(`the attribute is not valid JSON`),[]}else r=n.split(`,`).map(e=>e.trim());let i=[];for(let e of r)if(typeof e==`string`){let n=x(e,t);n?i.push(n):S(`"${e}" is not one of ${g.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&f(e.start)&&f(e.end)?i.push({label:e.label,start:e.start,end:e.end}):S(`an item needs a label and ISO start and end dates, or a preset name`);return i}var w=class extends e{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return o(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${u(this._start)||`Start`} to ${u(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=f(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:o}=this._label(),s=this.getAttribute(`aria-label`),c=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
2
|
+
<div class="daterange">
|
|
3
|
+
<button type="button" class="input daterange-trigger${n}${o?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${s?` aria-label="${a(s)}"`:``}${c?` aria-describedby="${a(c)}"`:``}>
|
|
4
|
+
<span data-range-label class="${o?`search-select-placeholder`:``}">${a(r)}</span>
|
|
5
|
+
${i(`calendar`)}
|
|
6
|
+
</button>
|
|
7
|
+
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
8
|
+
</div>`,this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n||``,r.disabled=this.hasAttribute(`disabled`)}_limits(){let e=f(this.getAttribute(`min`)),t=f(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,t){let n=this._firstDay(),r=(new Date(e,t,1).getDay()-n+7)%7,i=c(e,t),a=this._limits(),o=l.map((e,t)=>l[(t+n)%7]).map(e=>`<span>${e}</span>`).join(``),u=(e,t,n,r)=>{let i=s(e,t,n),o=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${i}"${o?` disabled`:``}>${n}</button>`},f=``,m=d(e,t-1),h=c(m.y,m.m);for(let e=r-1;e>=0;e--)f+=u(m.y,m.m,h-e,!0);for(let n=1;n<=i;n++)f+=u(e,t,n,!1);let g=d(e,t+1),_=(7-(r+i)%7)%7;for(let e=1;e<=_;e++)f+=u(g.y,g.m,e,!0);return`
|
|
9
|
+
<div class="daterange-cal">
|
|
10
|
+
<div class="datepicker-month-label">${p[t]} ${e}</div>
|
|
11
|
+
<div class="datepicker-weekdays">${o}</div>
|
|
12
|
+
<div class="datepicker-grid" role="grid">${f}</div>
|
|
13
|
+
</div>`}_presetsHtml(){if(!this._presetList?.length)return``;let e=this._limits(),t=t=>{let n=f(t);return e(n.y,n.m,n.d)};return`<div class="wui-daterange-presets" role="group" aria-label="Quick ranges">${this._presetList.map((e,n)=>`<button type="button" class="wui-daterange-preset" data-preset="${n}"${t(e.start)||t(e.end)?` disabled`:``}>${a(e.label)}</button>`).join(``)}</div>`}_renderView(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=d(this._viewY,this._viewM+1),n=this._presetsHtml(),r=`
|
|
14
|
+
<div class="daterange-head">
|
|
15
|
+
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${i(`chevron-left`)}</button>
|
|
16
|
+
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${i(`chevron-right`)}</button>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="daterange-cals">
|
|
19
|
+
${this._monthHtml(this._viewY,this._viewM)}
|
|
20
|
+
${this._monthHtml(t.y,t.m)}
|
|
21
|
+
</div>
|
|
22
|
+
<div class="datepicker-foot">
|
|
23
|
+
<span class="daterange-hint" data-range-hint></span>
|
|
24
|
+
<button type="button" class="datepicker-link" data-clear>Clear</button>
|
|
25
|
+
</div>`;e.classList.toggle(`wui-daterange-pop--presets`,n!==``),e.innerHTML=n?`${n}<div class="wui-daterange-main">${r}</div>`:r,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}e.querySelectorAll(`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${u(this._start)} to ${u(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){r(e,t,{clampHeight:!0})}_pick(e){if(!this._start||this._start&&this._end){this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint();return}if(new Date(e).getTime()<new Date(this._start).getTime()){this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){this._teardown();let e=this.querySelector(`.daterange-trigger`),r=this.querySelector(`.daterange-pop`),i=this.querySelector(`.daterange`);if(!e||!r)return;let a=()=>!r.hidden,o=()=>{a()&&this._position(e,r)};this._open=()=>{let n=f(this._start);if(n)this._viewY=n.y,this._viewM=n.m;else{let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=C(this.getAttribute(`presets`)),this._renderView(),r.hidden=!1,i?.classList.add(`open`),this._position(e,r),t(this,o),e.setAttribute(`aria-expanded`,`true`)},this._close=()=>{r.hidden=!0,this._hover=``,i?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),n(this)},e.addEventListener(`click`,()=>a()?this._close():this._open()),r.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=d(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`[data-preset]`);if(n&&!n.disabled){let e=this._presetList?.[Number(n.dataset.preset)];e&&this._applyPreset(e);return}let r=e.target.closest(`.datepicker-day[data-iso]`);r&&!r.disabled&&this._pick(r.dataset.iso)}),r.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,a()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{a()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),a()&&t(this,o)},this._bindGlobal(),this._syncMirrors()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),n(this)}disconnectedCallback(){this._teardown()}};export{w as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=[50,90],n=10,r=100;function i(e,i=t){let a=Array.isArray(e)?e:String(e??``).split(`,`),o=[];for(let e of a){if(typeof e==`string`&&e.trim()===``)return i;let t=Number(e);if(!Number.isFinite(t)||t<n||t>r)return i;o.includes(t)||o.push(t)}return o.length?o.sort((e,t)=>e-t):i}function a({points:e,index:t,visible:n,velocity:r,canDismiss:i}){let a=i?-1:0;if(Math.abs(r)>=.5)return r>0?Math.max(t-1,a):Math.min(t+1,e.length-1);if(i&&n<e[0]/2)return-1;let o=0;for(let t=1;t<e.length;t++)Math.abs(e[t]-n)<Math.abs(e[o]-n)&&(o=t);return o}var o=`(max-width: 767.98px)`,s=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,c=4,l=0,u=new WeakSet;function d(e){u.has(e)||(u.add(e),e.addEventListener(`click`,t=>{let n=t.target?.closest?.(`[data-wui-drawer-open]`);if(!n)return;let r=n.getAttribute(`data-wui-drawer-open`).replace(/^#/,``),i=e.getElementById(r);typeof i?.show==`function`&&(t.preventDefault(),i.show(n))}))}var f=class extends e{static get observedAttributes(){return[`open`,`snap-points`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._locked=!1,this._opener=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onClick=e=>this._click(e),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e)}connectedCallback(){this._doc=this.ownerDocument,d(this._doc),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this._media=typeof matchMedia==`function`?matchMedia(o):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)?this._open():this.setAttribute(`inert`,``)}disconnectedCallback(){this._endDrag(),this._shown&&this._release(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return i(this.getAttribute(`snap-points`),t)}_sheet(){return!!this._media?.matches}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!t)return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;this._shown=!0;let e=this._doc;this._opener??=e.activeElement;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.removeAttribute(`inert`),this._locked||(this._locked=!0,l++,e.body.classList.add(`wui-drawer-locked`)),e.addEventListener(`keydown`,this._onKeyDown),this._focusIn()}_close(){if(!this._shown)return;this._endDrag(),this.setAttribute(`inert`,``);let e=this._doc,t=this._opener,n=e.activeElement;this._release(),this._opener=null,t?.isConnected&&(n===e.body||this.contains(n))&&t.focus?.()}_release(){this._shown=!1,this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._locked&&(this._locked=!1,l--,l<=0&&(l=0,this._doc?.body.classList.remove(`wui-drawer-locked`)))}_panel(){return this.querySelector(`.wui-drawer-panel`)}_focusables(){let e=this._panel();return e?Array.from(e.querySelectorAll(s)).filter(e=>!e.closest(`[hidden],[inert]`)):[]}_focusIn(){let e=this._panel();if(!e)return;let t=e.querySelector(`[data-autofocus]`),n=this._sheet()?null:this._focusables().find(e=>e.closest(`.wui-drawer-body`));(t||n||e).focus?.()}_requestClose(){let e=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}));return e&&this.hide(),e}_click(e){if(!this.isOpen)return;let t=e.target;(t.closest?.(`[data-wui-drawer-close]`)||t.closest?.(`[data-wui-drawer-backdrop]`)&&!this.hasAttribute(`static`))&&this._requestClose()}_keyDown(e){if(e.key===`Escape`){if(e.defaultPrevented||this.hasAttribute(`static`))return;e.preventDefault(),this._requestClose();return}if(e.key===`Tab`){this._trapTab(e);return}e.target?.closest?.(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_trapTab(e){let t=this._focusables(),n=this._panel();if(!t.length){e.preventDefault(),n?.focus?.();return}let r=t[0],i=t[t.length-1],a=this._doc.activeElement;!n?.contains(a)||a===n?(e.preventDefault(),(e.shiftKey?i:r).focus()):e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};e.key in n&&(e.preventDefault(),this._setSnap(n[e.key]))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target?.closest?.(`[data-wui-drawer-grip]`);!t||e.target.closest(`button`)||(this._drag={grip:t,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},t.setPointerCapture?.(e.pointerId),t.addEventListener(`pointermove`,this._onPointerMove),t.addEventListener(`pointerup`,this._onPointerUp),t.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){return this._doc.defaultView.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<c)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(i[i.length-1]-i[this._snap])/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let o=this._points(),s=this._viewport(),c=(o[this._snap]/100*s-i)/(s/100),l=!this.hasAttribute(`static`),u=a({points:o,index:this._snap,visible:c,velocity:r,canDismiss:l});u>=0?this._setSnap(u):this._requestClose()}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}};export{f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";var i=300,a=150,o=`.wui-hover-card-trigger`,s=`.wui-hover-card-panel`,c=`a[href],button,input,select,textarea,[tabindex]`,l=0,u=class extends e{constructor(){super(),this._doc=null,this._timer=null,this._described=null,this._refocusing=!1,this._onOver=e=>{if(e.pointerType===`touch`||e.pointerType===`pen`)return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._schedule(!0)},this._onOut=e=>{e.pointerType===`touch`||e.pointerType===`pen`||this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{this._refocusing||(this._zone(e.target)===`trigger`?this._schedule(!0):this._zone(e.target)===`panel`&&this._clear())},this._onFocusOut=e=>{this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this.isOpen)return;let t=this._panel?.contains(this.ownerDocument.activeElement);this._clear(),this._setOpen(!1),t&&(this._refocusing=!0,this._anchor?.focus(),this._refocusing=!1)}}get isOpen(){return this._panel?.hasAttribute(`data-open`)??!1}connectedCallback(){this._doc=this.ownerDocument,this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut)}disconnectedCallback(){this._clear(),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._doc?.removeEventListener(`keydown`,this._onKeyDown),n(this),this._doc=null}get _trigger(){return this.querySelector(o)}get _panel(){return this.querySelector(s)}get _anchor(){let e=this._trigger;return e?.querySelector(c)??e}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_delay(e,t){let n=Number(this.getAttribute(e));return this.hasAttribute(e)&&Number.isFinite(n)&&n>=0?n:t}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this.isOpen===e)return;let t=e?this._delay(`open-delay`,i):this._delay(`close-delay`,a);this._timer=setTimeout(()=>{this._timer=null,this._setOpen(e)},t)}_setOpen(e){let r=this._panel;!r||this.isOpen===e||(e?(r.setAttribute(`data-open`,``),this._reposition(),t(this,()=>this._reposition()),this._doc?.addEventListener(`keydown`,this._onKeyDown),this._describe(r)):(r.removeAttribute(`data-open`),n(this),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._described?.removeAttribute(`aria-describedby`),this._described=null),this.dispatchEvent(new CustomEvent(e?`wui:hover-card:open`:`wui:hover-card:close`,{bubbles:!0})))}_reposition(){this.isOpen&&r(this._trigger,this._panel,{clampHeight:!0})}_describe(e){let t=this._anchor;t&&(e.id||=`wui-hover-card-${++l}`,t.setAttribute(`aria-describedby`,e.id),this._described=t)}};export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import"./formatters-BAE__8ye.js";import{c as t}from"./wuiHttp-BC8co934.js";import{o as n}from"./calendarMath-BC2wGCD-.js";var r=Object.freeze([`text`,`number`,`select`,`date`,`textarea`]),i=2e3,a=Object.freeze({edit:e=>`Edit ${e}: `,readOnly:e=>`${e}: `,saved:e=>`${e} saved.`,notSaved:(e,t)=>`${e} was not saved. ${t}`,failed:Object.freeze({forbidden:`You do not have permission to change this.`,client:`This could not be saved. Refresh the page and try again.`,validation:`This value was not accepted. Check it and try again.`,server:`Something went wrong on our side, so this was not saved. Try again in a moment.`,network:`Could not reach the server, so this was not saved. Check your connection and try again.`})});function o(e,{type:t=`text`,options:r,placeholder:i}={}){let a=e==null?``:String(e);if(a===``)return{text:i||`-`,empty:!0};if(t===`date`)return{text:n(a)||a,empty:!1};if(t===`select`){let e=r?.find(e=>String(e.value)===a);return{text:typeof e?.label==`string`?e.label:a,empty:!1}}return{text:a,empty:!1}}var s=`[data-wui-display]`,c=`[data-wui-value]`,l=`[data-wui-editor]`,u=`[data-wui-control]`,d=`[data-wui-error]`,f=`[data-wui-live]`,p=`[aria-expanded="true"]`,m=new Set([`select`,`date`]),h=e=>typeof e?.message==`string`&&e.message?e.message:a.failed.server,g=class extends e{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._wired=!1,this._editing=!1,this._busy=!1,this._draft=null,this._pressed=!1,this._popupOpen=!1,this._savedTimer=null,this._onClick=this._onClick.bind(this),this._onKeyCapture=this._onKeyCapture.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onChange=this._onChange.bind(this)}connectedCallback(){this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`auxclick`,this._onClick),this.addEventListener(`keydown`,this._onKeyCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`change`,this._onChange))}disconnectedCallback(){clearTimeout(this._savedTimer),this._savedTimer=null,this._releasePress()}attributeChangedCallback(e){e===`disabled`&&this.hasAttribute(`disabled`)&&this.cancel()}edit(){if(this._editing||this._busy||this.hasAttribute(`disabled`))return;let e=this.querySelector(s),t=this.querySelector(l),n=this._control();!e||!t||!n||(this._editing=!0,this._setState(null),n.value=this._draft??this._value(),e.hidden=!0,t.hidden=!1,this.setAttribute(`data-wui-editing`,``),this._focusControl(n))}cancel(){this._editing&&(this._draft=null,this._setError(null),this.getAttribute(`data-wui-state`)===`error`&&this._setState(null),this._close())}_onClick(e){e.stopPropagation(),e.type===`click`&&!this._editing&&this.querySelector(s)?.contains(e.target)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(l)?.querySelector(p))}_onKeyDown(e){if(!this._editing){(e.key===`Enter`||e.key===` `)&&e.stopPropagation();return}if(e.stopPropagation(),this._popupOpen)return;if(e.key===`Escape`){e.preventDefault(),this.cancel();return}let t=this._type();e.key!==`Enter`||m.has(t)||t===`textarea`&&!(e.ctrlKey||e.metaKey)||(e.preventDefault(),this._commit(this._control()?.value??``))}_onFocusOut(e){if(!this._editing||this._pressed)return;let t=e.relatedTarget;t&&this.contains(t)||document.hasFocus()&&this._commit(this._control()?.value??``)}_onPointerDown(){this._editing&&(this._pressed=!0,document.addEventListener(`pointerup`,this._onPointerUp,!0),document.addEventListener(`pointercancel`,this._onPointerUp,!0))}_onPointerUp(){this._releasePress(),setTimeout(()=>{this._pressed=!1,this._editing&&!this.contains(document.activeElement)&&document.hasFocus()&&this._commit(this._control()?.value??``)},0)}_releasePress(){document.removeEventListener(`pointerup`,this._onPointerUp,!0),document.removeEventListener(`pointercancel`,this._onPointerUp,!0)}_onChange(e){if(!this._editing||!m.has(this._type()))return;let t=this._control();!t||e.target!==t||queueMicrotask(()=>this._commit(t.value))}async _commit(e){if(!this._editing||this._busy)return;let t=this._value();if(e===t){this.cancel();return}let n=typeof this.validate==`function`?this.validate(e):null;if(n){this._setError(n),this._announce(n);return}let r=this.hasAttribute(`controlled`);this._draft=null,this._setError(null),this._busy=!0,this._setState(`saving`),this.setAttribute(`aria-busy`,`true`);let o=r?null:this._readShown();r||this._showValue(e),this._close();let s=await this._persist(e,r);this._busy=!1,this.removeAttribute(`aria-busy`);let c=this.getAttribute(`label`)||``;if(s.ok){this.setAttribute(`value`,e),!r&&s.text&&this._showText(s.text,!1),this._setState(`saved`),this._savedTimer=setTimeout(()=>this._setState(null),i),this._announce(a.saved(c)),this._fire(`wui:inline-edit:saved`,{value:e,previous:t});return}if(o&&this._restoreShown(o),s.kind===`session`||s.kind===`aborted`){this._setState(null);return}this._draft=e,this._setState(`error`),this._setError(s.message),this._announce(a.notSaved(c,s.message)),this._fire(`wui:inline-edit:failed`,{value:e,previous:t,kind:s.kind,message:s.message})}async _persist(e,n){if(n){if(typeof this.save!=`function`)return{ok:!0};try{return await this.save(e),{ok:!0}}catch(e){return{ok:!1,kind:`server`,message:h(e)}}}let r=this.getAttribute(`action`);if(!r)return{ok:!0};let i=await t(r,{method:`POST`,body:new URLSearchParams({[this.getAttribute(`name`)||`value`]:e})});return i.ok?{ok:!0,text:i.html.trim()}:{ok:!1,kind:i.kind,message:i.message||a.failed[i.kind]||a.failed.server}}_close(){let e=this.querySelector(s),t=this.querySelector(l),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),t?.querySelector(p)?.click(),n&&e?.focus()}_focusControl(e){if(!m.has(this._type())){e.focus(),e.select?.();return}let t=e.querySelector(`button`);t&&(t.focus(),t.getAttribute(`aria-expanded`)!==`true`&&t.click())}_showValue(e){if(e===``){this._showText(this.getAttribute(`placeholder`)||`-`,!0);return}let t=this._type(),r=e;if(t===`date`)r=n(e)||e;else if(t===`select`){let t=[...this._control()?.querySelectorAll(`[data-value]`)??[]].find(t=>t.getAttribute(`data-value`)===e);t&&(r=t.textContent.trim())}this._showText(r,!1)}_readShown(){let e=this.querySelector(c);return e?{html:e.innerHTML,empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(c);t&&(t.innerHTML=e.html,t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(c);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=this.querySelector(d),n=this._control();t&&(t.textContent=e||``,t.hidden=!e),e?n?.setAttribute(`aria-invalid`,`true`):n?.removeAttribute(`aria-invalid`)}_setState(e){clearTimeout(this._savedTimer),this._savedTimer=null,e?this.setAttribute(`data-wui-state`,e):this.removeAttribute(`data-wui-state`)}_announce(e){let t=this.querySelector(f);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){return this.querySelector(u)}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return r.includes(e)?e:`text`}};export{o as a,g as i,a as n,r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{f as t}from"./formatters-BAE__8ye.js";import{t as n}from"./iconGlyphs.g-CUm_mfze.js";var r=`a.wui-lightbox-item`,i=1,a=4,o=.5,s=2,c=50,l=6,u=300,d=300;function f(e){return Number.isFinite(e)?Math.min(a,Math.max(i,e)):i}function p(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function m(e,t){return Math.abs(e)<c||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function h(e){let t=String(e??``).split(/[?#]/)[0].split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function g(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}function _(e,t,r){let i=g(`button`,`u-action wui-lightbox-btn ${r}`,{type:`button`,"aria-label":t,title:t});return i.style.setProperty(`--wui-action-size`,`40px`),i.innerHTML=n(e,{size:20}),i}var v=class extends e{constructor(){super(),this._ui=null,this._index=0,this._zoom=i,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._lockedOverflow=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target?.closest?.(r);if(!t||!this.contains(t))return;let n=this._links().indexOf(t);n<0||(e.preventDefault(),this.open(n))}}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||`Image viewer`}set label(e){this.setAttribute(`label`,String(e??``))}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}_links(){return[...this.querySelectorAll(r)]}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||h(t)}})}open(e=0){let t=this._items();return t.length?(this._ui||(this._returnTo=document.activeElement,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))),this._show(e,t),this._ui.close.focus(),!0):!1}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null,this._lockedOverflow!==null&&(document.documentElement.style.overflow=this._lockedOverflow,this._lockedOverflow=null))}_build(){let e=g(`div`,`wui-lightbox-overlay`,{role:`dialog`,"aria-modal":`true`,"aria-label":this.label,tabindex:`-1`}),t=g(`div`,`wui-lightbox-bar`),r=g(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),i=g(`div`,`wui-lightbox-tools`),a=_(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),s=_(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),c=g(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});c.style.setProperty(`--wui-action-size`,`40px`),c.innerHTML=n(`download`,{size:20}),c.hidden=!this.download;let l=_(`x`,`Close`,`wui-lightbox-close`);i.append(a,s,c,l),t.append(r,i);let u=g(`div`,`wui-lightbox-stage`),d=_(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),f=_(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),p=g(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),m=g(`p`,`wui-lightbox-status`,{role:`status`});u.append(p,m,d,f);let h=g(`p`,`wui-lightbox-caption`);e.append(t,u,h);let v={root:e,count:r,zoomOut:a,zoomIn:s,download:c,close:l,stage:u,prev:d,next:f,image:p,status:m,caption:h};this._ui=v,l.addEventListener(`click`,()=>this.close()),d.addEventListener(`click`,()=>this.step(-1)),f.addEventListener(`click`,()=>this.step(1)),a.addEventListener(`click`,()=>this._setZoom(this._zoom-o)),s.addEventListener(`click`,()=>this._setZoom(this._zoom+o)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),u.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),u.addEventListener(`pointermove`,e=>this._onPointerMove(e)),u.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),u.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),u.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),p.addEventListener(`load`,()=>{this._ui===v&&(m.textContent=``,u.removeAttribute(`aria-busy`),p.hidden=!1,this._applyTransform())}),p.addEventListener(`error`,()=>{this._ui===v&&(u.removeAttribute(`aria-busy`),p.hidden=!0,m.textContent=`This image can't be shown.`)}),this.append(e),this._lockedOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,n){let r=this._ui,a=Math.min(n.length-1,Math.max(0,Math.trunc(Number(e))||0)),o=n[a],s=a!==this._index||!r.image.getAttribute(`src`);if(this._index=a,this._zoom=i,this._pan={x:0,y:0},r.count.textContent=`${t(a+1,{decimals:0})} of ${t(n.length,{decimals:0})}`,r.caption.textContent=o.caption,r.caption.hidden=!o.caption,r.download.href=o.src,r.download.setAttribute(`download`,o.name),r.prev.hidden=r.next.hidden=n.length<2,r.stage.setAttribute(`aria-busy`,`true`),r.status.textContent=``,r.image.hidden=!1,r.image.alt=o.alt||o.caption,r.image.src=o.src,this._applyTransform(),this._syncZoomButtons(),n.length>1)for(let e of[n[(a+1)%n.length],n[(a-1+n.length)%n.length]])new Image().src=e.src;s&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:a}}))}_syncZoomButtons(){this._ui.zoomOut.disabled=this._zoom<=i,this._ui.zoomIn.disabled=this._zoom>=a;let e=document.activeElement;(e===this._ui.zoomOut||e===this._ui.zoomIn)&&e.disabled&&this._ui.close.focus()}_setZoom(e){this._ui&&(this._zoom=f(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._ui;return p(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._ui;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>i)}_onKeyDown(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close();else if(e.key===`Tab`)this._trapTab(e);else if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+o)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-o)):e.key===`0`&&(e.preventDefault(),this._setZoom(i))}_trapTab(e){let t=[...this._ui.root.querySelectorAll(`button, a[href]`)].filter(e=>!e.hidden&&!e.disabled);if(!t.length){e.preventDefault();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||!this._ui.root.contains(i))?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||!this._ui.root.contains(i))&&(e.preventDefault(),n.focus())}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){if(!e.target.closest(`.wui-lightbox-nav`))if(this._ui.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let[e,t]=[...this._pointers.values()];this._gesture={kind:`pinch`,distance:Math.hypot(e.x-t.x,e.y-t.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===this._ui.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(!(!t||!this._pointers.has(e.pointerId))){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let[e,n]=[...this._pointers.values()];this._setZoom(t.zoom*Math.hypot(e.x-n.x,e.y-n.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>l&&(t.moved=!0),this._zoom>i&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._ui.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,a=e.clientY-n.startY;if(n.moved){this._zoom===i&&this.step(m(r,a));return}if(!(e.timeStamp-n.startTime>u)){if(!n.onImage){this.close();return}e.timeStamp-this._lastTap<d?(this._lastTap=-1/0,this._setZoom(this._zoom>i?i:s)):this._lastTap=e.timeStamp}}};export{v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{f as t}from"./formatters-BAE__8ye.js";import{c as n}from"./wuiHttp-BC8co934.js";import{n as r,r as i,t as a}from"./anchorOverlay-WcDeH46q.js";import{n as o}from"./listboxKeyNav-DMIvs9d6.js";var s=/^[A-Za-z0-9_.:-]{1,64}$/,c=/@(\\+)\[|@\[([^[\]\n]{1,100})\]\(([A-Za-z0-9_.:-]{1,64})\)/g,l=/@(\\*)\[/g;function u(e){return String(e??``).replace(/[[\]\r\n]+/g,` `).replace(/\s+/g,` `).trim().slice(0,100)}var d=e=>e.replace(l,(e,t)=>`@\\${t}[`);function f(e){let t=String(e??``),n=[],r=e=>{if(!e)return;let t=n[n.length-1];t&&`text`in t?t.text+=e:n.push({text:e})},i=0;for(let e of t.matchAll(c))r(t.slice(i,e.index)),e[1]===void 0?n.push({id:e[3],label:e[2]}):r(`@${e[1].slice(1)}[`),i=e.index+e[0].length;return r(t.slice(i)),n}function p(e){let t=``,n=[];for(let r of f(e)){if(`text`in r){t+=r.text;continue}let e=`@${r.label}`;n.push({start:t.length,end:t.length+e.length,id:r.id,label:r.label}),t+=e}return{text:t,mentions:n}}function m(e,t=[]){let n=String(e??``),r=[...t].sort((e,t)=>e.start-t.start),i=``,a=0;for(let e of r)e.start<a||n.slice(e.start,e.end)!==`@${e.label}`||!s.test(e.id)||(i+=d(n.slice(a,e.start)),i+=`@[${e.label}](${e.id})`,a=e.end);return i+d(n.slice(a))}function h(e){let t=[];for(let n of f(e))`id`in n&&!t.includes(n.id)&&t.push(n.id);return t}var g=8,_=40,v=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${t(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),y=`[data-wui-control]`,b=`[data-wui-field]`,x=`[data-wui-menu]`,S=`[data-wui-live]`,C=0,w=e=>e&&s.test(String(e.value??``))&&u(e.label)!==``;function T(e){let t=e.ownerDocument;e.id||=`wui-mention-${++C}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,v.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var E=class extends e{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(y)||T(this);let e=this._control(),t=this.querySelector(b)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return m(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);if(!this._wired){this._pendingValue=t;return}t!==this.value&&this._load(t)}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(w):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(y)}_menu(){return this.querySelector(x)}_load(e){let{text:t,mentions:n}=p(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(b);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();if(!t){this._close();return}this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh())}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>u(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);if(!n){this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}));return}this._fetchPeople(n,e,t)},this._debounce())}async _fetchPeople(e,t,r){this._abort?.abort();let i=new AbortController;this._abort=i,this.loading=!0;let a=await n(`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,{signal:i.signal});if(r!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this.loading=!1;return}let o=this.ownerDocument.createElement(`template`);o.innerHTML=a.html,this._peopleProp=[...o.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(w),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!!(e&&!e.hidden)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=u(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this._loading?v.searching:`${v.noMatch} “${this._query.text}”`,e.appendChild(t)}let i=this._isOpen();e.hidden=!1,i||r(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?v.found(this._results.length):`${v.noMatch}.`)}_position(){a(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),i(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);o(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}));return}e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=u(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(v.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(S);t&&(t.textContent=``,t.textContent=e)}};export{s as a,m as c,E as i,h as l,g as n,u as o,v as r,p as s,_ as t,f as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";import{t as i}from"./listboxKeyNav-DMIvs9d6.js";var a=`[role="menuitem"]`,o=`data-open`,s=4,c=e=>e instanceof Element?e:e?.parentElement??null,l=e=>e.getAttribute(`aria-disabled`)===`true`,u=class extends e{constructor(){super(),this._navPanel=null,this._nav=i({getVisibleOptions:()=>this._navPanel?this._rows(this._navPanel):[],getActive:()=>this._navPanel?this._rows(this._navPanel).indexOf(document.activeElement):-1,setActive:e=>this._rows(this._navPanel)[e]?.focus({preventScroll:!0})}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onMouseOver=e=>this._handleMouseOver(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onFocusOut=e=>{let t=e.relatedTarget;this._openMenu()&&t instanceof Node&&!this.contains(t)&&this.close()},this._onPointerDown=e=>{this._openMenu()&&!this.contains(e.target)&&this.close()}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseover`,this._onMouseOver),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e,{focus:t=null}={}){let n=this._menus().find(t=>this._triggerOf(t).dataset.key===e);n&&this._openTop(n,t)}close(e=!1){let t=this._openMenu();if(t){for(let e of this._panelOf(t).querySelectorAll(`.wui-menubar-sub > [${o}]`))this._setSub(e.parentElement,!1);this._setTop(t,!1),n(this),this._nav.teardown(),e&&this._triggerOf(t).focus({preventScroll:!0})}}_menus(){return[...this.children].filter(e=>e.classList.contains(`wui-menubar-menu`))}_triggerOf(e){return e.children[0]}_panelOf(e){return e.children[1]}_openMenu(){return this._menus().find(e=>this._panelOf(e)?.hasAttribute(o))??null}_rows(e){let t=[];for(let n of e.children){let e=n.getAttribute(`role`)===`menuitem`?n:n.classList.contains(`wui-menubar-sub`)?n.children[0]:null;e&&!l(e)&&t.push(e)}return t}_setTop(e,t){this._panelOf(e).toggleAttribute(o,t),this._triggerOf(e).setAttribute(`aria-expanded`,String(t))}_setSub(e,t){let n=e.children[1];if(!t)for(let e of n.querySelectorAll(`.wui-menubar-sub > [${o}]`))this._setSub(e.parentElement,!1);n.toggleAttribute(o,t),e.children[0].setAttribute(`aria-expanded`,String(t)),t?this._placeSub(n):(n.removeAttribute(`data-side`),n.style.removeProperty(`--wui-menubar-sub-offset`))}_openTop(e,n){let i=this._openMenu();i&&i!==e&&this.close();let a=this._triggerOf(e),o=this._panelOf(e);if(this._setTop(e,!0),r(a,o),t(this,()=>{let e=this._openMenu();e&&r(this._triggerOf(e),this._panelOf(e))}),n){let e=this._rows(o);(n===`last`?e[e.length-1]:e[0])?.focus({preventScroll:!0})}}_openSub(e,t){let n=e.parentElement;for(let t of n.children)t!==e&&t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1);this._setSub(e,!0),t&&this._rows(e.children[1])[0]?.focus({preventScroll:!0})}_placeSub(e){e.removeAttribute(`data-side`),e.style.removeProperty(`--wui-menubar-sub-offset`),e.getBoundingClientRect().right>window.innerWidth-s&&e.setAttribute(`data-side`,`start`);let t=e.getBoundingClientRect().bottom-(window.innerHeight-s);t>0&&e.style.setProperty(`--wui-menubar-sub-offset`,`${-t}px`)}_handleFocusIn(e){let t=c(e.target)?.closest(`.wui-menubar-trigger`);if(!(!t||!this.contains(t)))for(let e of this._menus())this._triggerOf(e).tabIndex=this._triggerOf(e)===t?0:-1}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=c(e.target)?.closest(a);!t||!this.contains(t)||(t.classList.contains(`wui-menubar-trigger`)?this._barKey(e,t):this._menuKey(e,t))}_barKey(e,t){let n=this._menus(),r=n.findIndex(e=>this._triggerOf(e)===t),i=this._openMenu()!==null,a=t=>{e.preventDefault(),i&&!l(this._triggerOf(t))?this._openTop(t,`first`):this._triggerOf(t).focus({preventScroll:!0})};e.key===`ArrowRight`?a(n[(r+1)%n.length]):e.key===`ArrowLeft`?a(n[(r-1+n.length)%n.length]):e.key===`Home`?a(n[0]):e.key===`End`?a(n[n.length-1]):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!l(t)?(e.preventDefault(),this._openTop(n[r],e.key===`ArrowDown`?`first`:`last`)):e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),this.close(!0))}_menuKey(e,t){let n=t.closest(`[role="menu"]`);if(!n)return;let r=n.classList.contains(`wui-menubar-subpanel`),i=t.closest(`.wui-menubar-menu`),a=this._rows(n),o=a.indexOf(t);if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),a.length&&a[(o+(e.key===`ArrowDown`?1:-1)+a.length)%a.length].focus({preventScroll:!0});else if(e.key===`ArrowRight`)e.preventDefault(),t.hasAttribute(`aria-haspopup`)?this._openSub(t.parentElement,!0):this._adjacent(i,1);else if(e.key===`ArrowLeft`)if(e.preventDefault(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this._adjacent(i,-1);else if(e.key===`Escape`)if(e.preventDefault(),e.stopPropagation(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this.close(!0);else e.key===`Tab`?this.close(!0):e.key===` `?(e.preventDefault(),t.click()):(this._navPanel=n,this._nav.handler(e))}_adjacent(e,t){let n=this._menus(),r=n[(n.indexOf(e)+t+n.length)%n.length];r&&r!==e&&!l(this._triggerOf(r))&&this._openTop(r,`first`)}_handleClick(e){let t=c(e.target)?.closest(a);if(!t||!this.contains(t))return;let n=e.detail===0;if(t.classList.contains(`wui-menubar-trigger`)){if(l(t))return;let e=t.parentElement;this._openMenu()===e?this.close():this._openTop(e,n?`first`:null),(!n||!this._openMenu())&&t.focus({preventScroll:!0});return}if(l(t)){e.preventDefault(),e.stopPropagation();return}if(t.hasAttribute(`aria-haspopup`)){e.preventDefault(),this._openSub(t.parentElement,n);return}let r=t.closest(`.wui-menubar-menu`),i=r?this._triggerOf(r).dataset.key:void 0;this.close(!0),this.dispatchEvent(new CustomEvent(`wui-menubar:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,menu:i??null}}))}_handleMouseOver(e){let t=c(e.target)?.closest(a);if(!t||!this.contains(t)||l(t))return;if(t.classList.contains(`wui-menubar-trigger`)){let e=t.parentElement;this._openMenu()&&this._openMenu()!==e&&(this._openTop(e,null),t.focus({preventScroll:!0}));return}t!==document.activeElement&&t.focus({preventScroll:!0});let n=t.parentElement.classList.contains(`wui-menubar-sub`)&&t.parentElement.children[0]===t?t.parentElement:null;if(n)n.children[1].hasAttribute(o)||this._openSub(n,!1);else{let e=t.closest(`[role="menu"]`);for(let t of e.children)t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1)}}_teardown(){this.close(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseover`,this._onMouseOver),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}};export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=`data-open`,n=8,r=`.wui-nav-menu-link`,i=e=>e instanceof Element?e:e?.parentElement??null,a=class extends e{constructor(){super(),this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusOut=e=>{let t=this._openItem(),n=e.relatedTarget;t&&n instanceof Node&&!t.contains(n)&&this._set(t,!1)},this._onPointerDown=e=>{let t=this._openItem();t&&!t.contains(e.target)&&this._set(t,!1)},this._onResize=()=>{let e=this._openItem();e&&this._align(e.children[1])}}connectedCallback(){this._teardown(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e){let t=this._items().find(t=>this._isTrigger(t.children[0])&&t.children[0].dataset.key===e);t&&this._set(t,!0)}close(e=!1){let t=this._openItem();t&&(this._set(t,!1),e&&t.children[0].focus({preventScroll:!0}))}_items(){return[...this.querySelectorAll(`.wui-nav-menu-item`)]}_openItem(){return this._items().find(e=>e.children[1]?.hasAttribute(t))??null}_isTrigger(e){return!!e?.classList.contains(`wui-nav-menu-trigger`)}_entries(){return this._items().map(e=>e.children[0])}_links(e){return[...e.children[1]?.querySelectorAll(r)??[]]}_set(e,n){let r=e.children[0],i=e.children[1];if(i){if(n){let t=this._openItem();t&&t!==e&&this._set(t,!1)}i.hasAttribute(t)!==n&&(i.toggleAttribute(t,n),r.setAttribute(`aria-expanded`,String(n)),n?(this._align(i),window.addEventListener(`resize`,this._onResize)):(i.removeAttribute(`data-align`),this._openItem()||window.removeEventListener(`resize`,this._onResize)),this.dispatchEvent(new CustomEvent(`wui-navigation-menu:toggle`,{bubbles:!0,detail:{key:r.dataset.key??null,open:n}})))}}_align(e){e.removeAttribute(`data-align`),e.getBoundingClientRect().right>window.innerWidth-n&&e.setAttribute(`data-align`,`end`)}_handleClick(e){let n=i(e.target),a=n?.closest(`.wui-nav-menu-trigger`);if(a&&this.contains(a)){let e=a.parentElement;this._set(e,!e.children[1].hasAttribute(t));return}let o=n?.closest(r);o&&this.contains(o)&&this.close()}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=i(e.target)?.closest(`.wui-nav-menu-trigger, .wui-nav-menu-toplink, .wui-nav-menu-link`);if(!t||!this.contains(t))return;let n=this._openItem();if(e.key===`Escape`){if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.contains(t);this._set(n,!1),r&&n.children[0].focus({preventScroll:!0});return}if(t.matches(r)){this._linkKey(e,t);return}let a=this._entries(),o=a.indexOf(t);if(e.key===`ArrowRight`||e.key===`ArrowLeft`||e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?0:e.key===`End`?a.length-1:(o+(e.key===`ArrowRight`?1:-1)+a.length)%a.length;n&&this._set(n,!1),a[t].focus({preventScroll:!0})}else if(e.key===`ArrowDown`&&this._isTrigger(t)){e.preventDefault();let n=t.parentElement;this._set(n,!0),this._links(n)[0]?.focus({preventScroll:!0})}}_linkKey(e,t){let n=t.closest(`.wui-nav-menu-item`),r=this._links(n),i=r.indexOf(t);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),r[(i+(e.key===`ArrowDown`?1:-1)+r.length)%r.length].focus({preventScroll:!0})):e.key===`Home`?(e.preventDefault(),r[0].focus({preventScroll:!0})):e.key===`End`&&(e.preventDefault(),r[r.length-1].focus({preventScroll:!0}))}_teardown(){let e=this._openItem();e&&this._set(e,!1),window.removeEventListener(`resize`,this._onResize),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}};export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{c as t}from"./wuiHttp-BC8co934.js";import{c as n,i as r,n as i,s as a}from"./notificationDays-pYmoU0g6.js";var o=`.wui-notification-center-trigger`,s=`.wui-notification-center-panel`,c=`.wui-notification-center-count`,l=`.wui-notification-center-live`,u=`.wui-notification-center-markall`,d=`.wui-notification-center-item`,f=`wui-notification-center-item-read`,p=`.wui-notification-center-unread-label`,m=class extends e{constructor(){super(),this._doc=null,this._unread=0,this._busy=!1,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onOutside=e=>{this.contains(e.target)||this.close()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}connectedCallback(){this._doc=this.ownerDocument,this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`mousedown`,this._onOutside),this.addEventListener(`focusout`,this._onFocusOut),this._syncOpen()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`mousedown`,this._onOutside),this.removeEventListener(`focusout`,this._onFocusOut),this._doc=null}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(this.setAttribute(`open`,``),this._syncOpen(),this.querySelector(s)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&this.querySelector(o)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(o)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${d}:not(.${f})`).length}_click(e){let t=e.target.closest?.(`${o}, ${u}, ${d}`);if(!(!t||!this.contains(t))){if(t.matches(o)){this.toggle();return}this.hasAttribute(`controlled`)||(t.matches(u)?this._markAll():this._markItem(t))}}_key(e){if(e.key===`Escape`&&this.isOpen){e.preventDefault(),this.close({restoreFocus:!0});return}if(!this.isOpen||!this.querySelector(s)?.contains(e.target))return;let t={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`}[e.key];if(t===void 0)return;let n=[...this.querySelectorAll(d)];if(n.length===0)return;let r=n.indexOf(e.target.closest(d)),i;i=t===`first`?0:t===`last`?n.length-1:r===-1?t===1?0:n.length-1:Math.min(n.length-1,Math.max(0,r+t)),e.preventDefault(),n[i].focus()}_markItem(e){e.classList.contains(f)||(this._applyRead(e),this._unread=Math.max(0,this._unread-1),this._render(),this._say(n(this._unread)),this._emitRead([e.dataset.id].filter(Boolean),!1))}async _markAll(){if(this._busy)return;let e=[...this.querySelectorAll(`${d}:not(.${f})`)];if(e.length===0&&this._unread===0)return;let n=e.map(e=>e.dataset.id).filter(Boolean),r=this.getAttribute(`read-action`);if(r){this._setBusy(!0);let e=new URLSearchParams;for(let t of n)e.append(`ids`,t);let a=await t(r,{method:`POST`,body:e});if(this._setBusy(!1),!a.ok){if(a.kind===`session`||a.kind===`aborted`)return;let e=a.message||i.failed[a.kind]||i.failed.server;this._say(e),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:a.kind,message:e}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(i.allRead),this._emitRead(n,!0)}_applyRead(e){e.classList.add(f),e.querySelector(p)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(u);t&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=this.querySelector(c);e&&(e.textContent=r(this._unread),e.hidden=this._unread===0),this.querySelector(o)?.setAttribute(`aria-label`,a(this.getAttribute(`label`)||i.label,this._unread));let t=this.querySelector(u);t&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(l);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=`.wui-onboarding-card`,n=`.wui-onboarding-steps`,r=`.wui-onboarding-toggle`,i=`.wui-onboarding-dismiss`,a=`.wui-onboarding-restore`,o=`wui-onboarding:`,s=class extends e{constructor(){super(),this._onClick=e=>{let t=e.target instanceof Element?e.target:null;t&&(t.closest(i)?this.dismiss():t.closest(a)?this.restore():t.closest(r)&&this.toggle())}}connectedCallback(){this.addEventListener(`click`,this._onClick),this._stored()===`dismissed`&&this._setDismissed(!0)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick)}get dismissed(){return this.querySelector(t)?.hidden===!0}get collapsed(){return this.querySelector(n)?.hidden===!0}dismiss(){this.dismissed||(this._setDismissed(!0),this._store(`dismissed`),this.querySelector(a)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:dismiss`,{bubbles:!0})))}restore(){this.dismissed&&(this._setDismissed(!1),this._store(null),this.querySelector(r)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:restore`,{bubbles:!0})))}toggle(){let e=this.querySelector(n);if(!e)return;let t=!e.hidden;e.hidden=t,this.querySelector(r)?.setAttribute(`aria-expanded`,String(!t)),this.dispatchEvent(new CustomEvent(`wui:onboarding:collapse`,{bubbles:!0,detail:{collapsed:t}}))}_setDismissed(e){let n=this.querySelector(t),r=this.querySelector(a);n&&(n.hidden=e),r&&(r.hidden=!e)}_key(){let e=this.getAttribute(`storage-key`);return e?o+e:null}_stored(){let e=this._key();if(!e)return null;try{return window.localStorage.getItem(e)}catch{return null}}_store(e){let t=this._key();if(t)try{e?window.localStorage.setItem(t,e):window.localStorage.removeItem(t)}catch{}}};export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";var i=`data-wui-overflow-hidden`,a=`[aria-selected="true"], .active`,o=`.chip-body, input, a[href], button:not(.chip-remove)`,s=1,c=0,l=e=>Number.parseFloat(e)||0,u=e=>{let t=e.getAttribute(`data-overflow-label`);if(t)return t;let n=[],r=e=>{for(let t of e.childNodes)if(t.nodeType===3){let e=t.textContent.trim();e&&n.push(e)}else t.nodeType===1&&!t.matches(`svg, img, [aria-hidden='true']`)&&r(t)};return r(e),n.join(` `)},d=e=>e.matches(`button, a[href], label, input`)?e:e.querySelector(o),f=class extends e{constructor(){super(),this._more=null,this._menu=null,this._hiddenKey=``,this._ro=null,this._mo=null,this._observedList=null,this._doc=null,this._onDocDown=e=>{!this._menu.hidden&&!this.contains(e.target)&&this._close(!1)}}connectedCallback(){this.classList.add(`wui-overflow`),this._build(),this._doc=this.ownerDocument,this._doc.addEventListener(`pointerdown`,this._onDocDown,!0),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.layout()),this._ro.observe(this)),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(()=>this.layout()),this._watch()),this.layout()}disconnectedCallback(){this._ro?.disconnect(),this._mo?.disconnect(),this._ro=null,this._mo=null,this._observedList=null,this._doc?.removeEventListener(`pointerdown`,this._onDocDown,!0),this._doc=null,n(this)}static get observedAttributes(){return[`label`]}attributeChangedCallback(){this._more&&(this._more.firstChild.textContent=this._label())}_label(){return this.getAttribute(`label`)||`More`}_list(){return this.querySelector(`[data-wui-overflow-list]`)}_items(e){return[...e.children].filter(e=>!e.hasAttribute(`data-wui-overflow-skip`))}_build(){if(this._more)return;let e=`wui-overflow-menu-${++c}`,t=this.ownerDocument.createElement(`button`);t.type=`button`,t.className=`wui-overflow-more`,t.hidden=!0,t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,`false`),t.setAttribute(`aria-controls`,e),t.append(this._label());let n=this.ownerDocument.createElement(`div`);n.className=`wui-overflow-menu`,n.id=e,n.setAttribute(`role`,`menu`),n.hidden=!0,this.append(t,n),this._more=t,this._menu=n,t.addEventListener(`click`,()=>this._menu.hidden?this._open(!1):this._close(!0)),t.addEventListener(`keydown`,e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),this._open(!0))}),n.addEventListener(`keydown`,e=>this._onMenuKey(e))}_watch(){let e=this._list();!this._mo||e===this._observedList||(this._mo.disconnect(),this._observedList=e,e&&this._mo.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`aria-selected`,`disabled`,`aria-disabled`,`data-overflow-label`]}))}layout(){let e=this._list();if(this._watch(),!e||!this._more)return;let t=this._items(e);for(let e of t)e.removeAttribute(i);this._more.hidden=!0;let n=this.clientWidth,r=[];if(n>0&&t.length){let i=getComputedStyle(e),o=l(i.columnGap),c=l(i.paddingLeft)+l(i.paddingRight)+l(i.borderLeftWidth)+l(i.borderRightWidth),u=t.map(e=>e.offsetWidth);if(u.reduce((e,t)=>e+t,0)+o*(t.length-1)>n-c+s){this._more.hidden=!1;let e=n-c-this._more.offsetWidth-l(getComputedStyle(this).columnGap),i=this.hasAttribute(`keep`)?this.getAttribute(`keep`):a,s=new Set(i?t.filter(e=>e.matches(i)):[]),d=0,f=0;for(let e of s)d+=u[t.indexOf(e)]+(f?o:0),f+=1;for(let n=0;n<t.length;n+=1){if(s.has(t[n]))continue;let r=d+u[n]+(f?o:0);if(r>e)break;s.add(t[n]),d=r,f+=1}r=t.filter(e=>!s.has(e))}}for(let e of r)e.setAttribute(i,``);this._more.hidden=r.length===0,r.length?this._menu.hidden||this._fill(r):this._close(!1);let o=r.map(e=>t.indexOf(e)).join(`,`);o!==this._hiddenKey&&(this._hiddenKey=o,this.dispatchEvent(new CustomEvent(`wui-overflow-change`,{bubbles:!0,detail:{hidden:r.length}})))}_hiddenItems(){let e=this._list();return e?this._items(e).filter(e=>e.hasAttribute(i)):[]}_fill(e){this._menu.replaceChildren();for(let t of e){let e=this.ownerDocument.createElement(`button`);e.type=`button`,e.className=`wui-overflow-item`,e.tabIndex=-1;let n=t.querySelector(`input[type=checkbox], input[type=radio]`);n?(e.setAttribute(`role`,n.type===`radio`?`menuitemradio`:`menuitemcheckbox`),e.setAttribute(`aria-checked`,String(n.checked))):e.setAttribute(`role`,`menuitem`);let r=d(t),i=!r||r.disabled||r.getAttribute(`aria-disabled`)===`true`||t.matches(`.disabled, [aria-disabled='true']`);i&&e.setAttribute(`aria-disabled`,`true`),e.textContent=u(t),e.addEventListener(`click`,()=>{i||this._choose(t,r)}),this._menu.append(e)}}_choose(e,t){this._close(!1),t.click(),this.layout();let n=!e.hasAttribute(i)&&e.matches(`button, a[href]`)?e:this._more;n.hidden||n.focus()}_open(e){let n=this._hiddenItems();if(!n.length)return;this._fill(n),this._menu.hidden=!1,this._more.setAttribute(`aria-expanded`,`true`);let i=()=>r(this._more,this._menu);i(),t(this,i),e&&this._menu.firstElementChild?.focus()}_close(e){!this._menu||this._menu.hidden||(this._menu.hidden=!0,this._more.setAttribute(`aria-expanded`,`false`),n(this),e&&this._more.focus())}_onMenuKey(e){let t=[...this._menu.children],n=t.indexOf(this.ownerDocument.activeElement),r=null;if(e.key===`ArrowDown`)r=t[(n+1)%t.length];else if(e.key===`ArrowUp`)r=t[(n-1+t.length)%t.length];else if(e.key===`Home`)r=t[0];else if(e.key===`End`)r=t[t.length-1];else if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close(!0);return}else if(e.key===`Tab`){this._close(!1);return}else return;e.preventDefault(),r?.focus()}};export{f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=`.wui-rating-star`,n=`wui-rating-star-preview`,r=`wui-rating-previewing`,i=[`wui-rating-star-full`,`wui-rating-star-half`,`wui-rating-star-empty`],a=class extends e{constructor(){super(),this._onChange=e=>{let t=e.target;t?.type===`radio`&&this._fill(Number(t.value))},this._onOver=e=>{if(this.hasAttribute(`disabled`))return;let n=e.target.closest?.(t);n&&this._preview(Number(n.dataset.value))},this._onLeave=()=>this._preview(0)}connectedCallback(){this.addEventListener(`change`,this._onChange),this.addEventListener(`mouseover`,this._onOver),this.addEventListener(`mouseleave`,this._onLeave)}disconnectedCallback(){this.removeEventListener(`change`,this._onChange),this.removeEventListener(`mouseover`,this._onOver),this.removeEventListener(`mouseleave`,this._onLeave)}_fill(e){for(let n of this.querySelectorAll(t))n.classList.remove(...i),n.classList.add(Number(n.dataset.value)<=e?i[0]:i[2])}_preview(e){this.classList.toggle(r,e>0);for(let r of this.querySelectorAll(t))r.classList.toggle(n,e>0&&Number(r.dataset.value)<=e)}};export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{a as t,d as n}from"./shortcutKeys-BQiDpsTJ.js";var r=class extends e{constructor(){super(),this._doc=null,this._onKeyDown=e=>{this.hasAttribute(`keys`)&&n(e,{j:()=>this._press(`.wui-record-pager-next`),k:()=>this._press(`.wui-record-pager-prev`)},this.closest(`[${t}]`))}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc=null}_press(e){let t=this.querySelector(e);!t||t.disabled||t.getAttribute(`aria-disabled`)===`true`||t.click()}};export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{h as t,u as n}from"./formatters-BAE__8ye.js";var r=6e4,i=60*r,a=24*i,o=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function s(e,s=Date.now()){let c=t(e);if(!Number.isFinite(c))return`-`;let l=s-c,u=Math.abs(l);if(u>=7*a)return n(c);if(u<r)return`just now`;let[d,f]=u<i?[Math.floor(u/r),`minute`]:u<a?[Math.floor(u/i),`hour`]:[Math.floor(u/a),`day`];return l>0?`${o(d,f)} ago`:`in ${o(d,f)}`}function c(e){let r=t(e);return Number.isFinite(r)?`${n(r,{pattern:`datetime`})} IST`:`-`}var l=3e4,u=new Set,d=null,f=()=>{if(!(typeof document<`u`&&document.hidden))for(let e of u)e.refresh()},p=e=>{u.add(e),u.size===1&&(d=setInterval(f,l),document.addEventListener(`visibilitychange`,f))},m=e=>{u.delete(e),u.size===0&&(clearInterval(d),d=null,document.removeEventListener(`visibilitychange`,f))},h=class extends e{constructor(){super(),this._observer=null}connectedCallback(){this.refresh(),p(this),this._observer=new MutationObserver(()=>this.refresh()),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`datetime`]})}disconnectedCallback(){m(this),this._observer?.disconnect(),this._observer=null}refresh(){let e=this.querySelector(`time[datetime]`);if(!e)return;let t=s(e.getAttribute(`datetime`));e.textContent!==t&&(e.textContent=t)}};export{s as n,c as r,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=`wui-resizable-panel`,n=`wui-resizable-handle`,r=5,i=20,a=10,o=`wui-resizable:`,s=.001,c=0,l=e=>e.reduce((e,t)=>e+t,0),u=(e,t,n)=>Math.min(Math.max(e,t),n),d=e=>Math.round(e*10)/10,f=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<s);function p(e,t,n){let r=e.map((e,r)=>u(e,t[r],n[r]));for(let e=0;e<r.length;e++){let e=100-l(r);if(Math.abs(e)<s)break;let i=r.map((r,i)=>e>0?n[i]-r:r-t[i]),a=l(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*i[n]/a)}return r}function m(e,t,n,r){let i=e[t]+e[t+1];return[Math.max(n[t],i-r[t+1]),Math.min(r[t],i-n[t+1])]}function h(e,t,n,r,i){let[a,o]=m(e,t,r,i);if(a>o)return e;let s=e[t]+e[t+1],c=u(e[t]+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function g(e){let t=e.filter(e=>e===null).length,n=l(e.filter(e=>e!==null));if(t>0&&n<100)return e.map(e=>e??(100-n)/t);let r=e.map(e=>e??1),i=l(r);return r.map(e=>e*100/i)}var _=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t));return Number.isFinite(n)&&n>0?n:null},v=class extends e{constructor(){super(),this._panels=[],this._handles=[],this._mins=[],this._maxs=[],this._defaults=[],this._sizes=null,this._drag=null,this._observer=null,this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e,!1),this._onPointerCancel=e=>this._pointerUp(e,!0),this._onKeyDown=e=>this._keyDown(e),this._onDoubleClick=e=>this._reset(e)}connectedCallback(){this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`pointercancel`,this._onPointerCancel),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`dblclick`,this._onDoubleClick),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0})),this._sync()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`pointercancel`,this._onPointerCancel),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`dblclick`,this._onDoubleClick),this._observer?.disconnect(),this._observer=null,this._drag=null}get sizes(){return this._sizes?[...this._sizes]:[]}get _vertical(){return this.getAttribute(`direction`)===`vertical`}_sync(){let e=[...this.children];this._panels=e.filter(e=>e.classList.contains(t)),this._handles=e.filter(e=>e.classList.contains(n));let r=this._panels.length;if(r===0)return;this._mins=this._panels.map(e=>_(e,`data-min-size`)??a),this._maxs=this._panels.map(e=>_(e,`data-max-size`)??100),this._defaults=p(g(this._panels.map(e=>_(e,`data-default-size`))),this._mins,this._maxs);let i=this._sizes&&this._sizes.length===r?this._sizes:null;this._sizes=p(i??this._load(r)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++c}`;this._render()}_render(){this._panels.forEach((e,t)=>{e.style.flex=`${d(this._sizes[t])} 1 0px`});for(let e of this._handles){let t=this._indexOf(e);if(t<0)continue;let[n,r]=m(this._sizes,t,this._mins,this._maxs);e.setAttribute(`aria-controls`,this._panels[t].id),e.setAttribute(`aria-valuenow`,String(Math.round(this._sizes[t]))),e.setAttribute(`aria-valuemin`,String(Math.ceil(n-s))),e.setAttribute(`aria-valuemax`,String(Math.floor(r+s)))}}_indexOf(e){let t=this._panels.indexOf(e.previousElementSibling);return t>=0&&e.nextElementSibling===this._panels[t+1]?t:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${n}`):null;if(!t||t.parentElement!==this)return null;let r=this._indexOf(t);return r<0?null:{handle:t,index:r}}_storageKey(){let e=this.getAttribute(`storage-key`);return e?o+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return Array.isArray(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=this._mins[t]-s&&e<=this._maxs[t]+s)&&Math.abs(l(n)-100)<.5?n:null}catch{return null}}_save(){let e=this._storageKey();if(e)try{globalThis.localStorage?.setItem(e,JSON.stringify(this._sizes.map(d)))}catch{}}_commit(e){f(e,this._sizes)||(this._save(),this.dispatchEvent(new CustomEvent(`wui-resizable:change`,{bubbles:!0,detail:{sizes:this.sizes}})))}_pointerDown(e){let t=this._handleFor(e);if(!t||e.pointerType===`mouse`&&e.button!==0)return;let n=this._panels.reduce((e,t)=>{let n=t.getBoundingClientRect();return e+(this._vertical?n.height:n.width)},0);n<=0||(e.preventDefault(),t.handle.setPointerCapture?.(e.pointerId),t.handle.focus?.({preventScroll:!0}),this._drag={...t,pointerId:e.pointerId,start:this._vertical?e.clientY:e.clientX,before:[...this._sizes],room:n,flip:!this._vertical&&getComputedStyle(this).direction===`rtl`},this.classList.add(`is-dragging`),t.handle.classList.add(`is-active`))}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.pointerId)return;let n=(this._vertical?e.clientY:e.clientX)-t.start,r=(t.flip?-n:n)*100/t.room;this._sizes=h(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;if(!(!n||e.pointerId!==n.pointerId)){if(this._drag=null,this.classList.remove(`is-dragging`),n.handle.classList.remove(`is-active`),n.handle.releasePointerCapture?.(e.pointerId),t){this._sizes=n.before,this._render();return}this._commit(n.before)}}_keyDown(e){let t=this._handleFor(e);if(!t||e.altKey||e.ctrlKey||e.metaKey)return;let[n,a]=this._vertical?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`],o=!this._vertical&&getComputedStyle(this).direction===`rtl`,s=e.shiftKey?i:r,c;if(e.key===n)c=o?s:-s;else if(e.key===a)c=o?-s:s;else if(e.key===`Home`)c=-1/0;else if(e.key===`End`)c=1/0;else return;e.preventDefault();let l=[...this._sizes];this._sizes=h(l,t.index,c,this._mins,this._maxs),this._render(),this._commit(l)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes];this._sizes=[...this._defaults],this._render(),this._commit(t)}};export{v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{m as t}from"./formatters-BAE__8ye.js";var n=/^[0-9]$/,r=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,i=class extends e{static get observedAttributes(){return[`value`,`format`,`unit`,`decimals`,`duration`]}constructor(){super(),this._connected=!1,this._signature=null,this._digits=[],this._reels=[]}connectedCallback(){this._connected=!0,this._draw(!1)}disconnectedCallback(){this._connected=!1}attributeChangedCallback(){this._connected&&this._draw(!0)}_text(){let e=this.getAttribute(`value`),n=e===null||e.trim()===``?NaN:Number(e);if(!Number.isFinite(n))return null;let r=this.getAttribute(`decimals`);return t(n,{style:this.getAttribute(`format`)||`number`,unit:this.getAttribute(`unit`)||void 0,decimals:r===null||r===``?void 0:Number(r)})}_showText(e){let t=this.querySelector(`.wui-rolling-number-text`);!t||t.textContent===e||(t.firstChild?t.firstChild.nodeValue=e:t.append(e))}_clear(e){e.replaceChildren(),this.removeAttribute(`data-ready`),this._signature=null,this._digits=[],this._reels=[]}_draw(e){let t=this.querySelector(`.wui-rolling-number-roll`);if(!t)return;let i=this._text();if(i===null){this._clear(t);return}if(this._showText(i),r()){this._clear(t);return}let a=Number(this.getAttribute(`duration`));this.getAttribute(`duration`)&&Number.isFinite(a)&&a>=0?this.style.setProperty(`--wui-roll-duration`,`${a}ms`):this.style.removeProperty(`--wui-roll-duration`);let o=[...i],s=o.filter(e=>n.test(e)).map(Number),c=o.map(e=>n.test(e)?`#`:e).join(``);if(e&&c===this._signature){this._reels.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(s[t]))),this._digits=s;return}let l=this._digits,u=[],d=[],f=0;for(let t of o){if(!n.test(t)){let e=document.createElement(`span`);e.className=`wui-rolling-number-char`,e.textContent=t,d.push(e);continue}let r=document.createElement(`span`);r.className=`wui-rolling-number-digit`;let i=document.createElement(`span`);i.className=`wui-rolling-number-reel`;for(let e=0;e<10;e+=1){let t=document.createElement(`span`);t.textContent=String(e),i.append(t)}let a=s.length-1-f,o=e?l[l.length-1-a]??0:s[f];i.style.setProperty(`--wui-roll-digit`,String(o)),r.append(i),d.push(r),u.push(i),f+=1}t.replaceChildren(...d),e&&(t.offsetWidth,u.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(s[t])))),this._signature=c,this._digits=s,this._reels=u,this.setAttribute(`data-ready`,``)}};export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{a as t,c as n,d as r,f as i,l as a,m as o,p as s,u as c}from"./shortcutKeys-BQiDpsTJ.js";var l=class extends e{constructor(){super(),this._doc=null,this._onKeyDown=e=>this._keydown(e),this._onClick=e=>this._click(e),this._onDocClick=e=>{this.open&&!this.contains(e.target)&&this.setOpen(!1,{focus:!1})}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`click`,this._onDocClick),this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`click`,this._onDocClick),this.removeEventListener(`click`,this._onClick),this._doc=null}get open(){let e=this._sheet();return!!(e&&!e.hidden)}set open(e){let t=e===!0||e===``||e===`true`;t!==this.open&&this.setOpen(t)}setOpen(e,{focus:t=!0}={}){let n=this._sheet();if(!n)return;n.hidden=!e;let r=this.querySelector(`.wui-shortcut-toggle`);r?.setAttribute(`aria-expanded`,String(e)),t&&(e?n.querySelector(`.wui-shortcut-close`)?.focus():r?.focus())}_sheet(){return this.querySelector(`.wui-shortcut-sheet`)}_scope(){return this.closest(`[${t}]`)}_items(){let e=this.getAttribute(`items`);return e?[...(this._scope()??this._doc).querySelectorAll(e)]:[]}_click(e){let t=e.target;t instanceof Element&&(t.closest(`.wui-shortcut-toggle`)?this.setOpen(!this.open):t.closest(`.wui-shortcut-close`)&&this.setOpen(!1))}_tickFocused(){let e=this._items(),t=this._doc.activeElement,n=t?.closest?.(`li, tr`),r=e.find(e=>e===t||e.contains(t)||n?.contains(e));(r?.closest(`li, tr`)??r)?.querySelector(`input[type="checkbox"]`)?.click()}_focusSearch(){let e=this.getAttribute(`search`);((this._scope()??this._doc).querySelector(e)??this._doc.querySelector(e))?.focus()}_keydown(e){if(e.defaultPrevented)return;let t=s(e);if(!t)return;if(t===`esc`&&this.open){e.preventDefault(),this.setOpen(!1);return}let l=this._scope(),u={help:()=>this.setOpen(!this.open)};if(this.getAttribute(`items`)&&(u.j=()=>c(this._items(),1),u.k=()=>c(this._items(),-1),u.x=()=>this._tickFocused()),this.getAttribute(`search`)&&(u.slash=()=>this._focusSearch()),u[t]){r(e,u,l);return}if(t===`enter`||o(this._doc)||!n(e.target,l)||a(e.target))return;let d=i(t),f=[...this.querySelectorAll(`.wui-shortcut-keys [data-shortcut]`)].find(e=>e.dataset.shortcut===d);if(!f)return;let p=(l??this._doc).querySelector(`[aria-current="true"]`)?.closest(`[data-key]`)?.dataset.key??null;if(!this.dispatchEvent(new CustomEvent(`wui:shortcut`,{bubbles:!0,cancelable:!0,detail:{key:d,itemKey:p}}))){e.preventDefault();return}let m=f.dataset.target?this._doc.querySelector(f.dataset.target):null;m&&(e.preventDefault(),m.click())}};export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=3,n=`Show more`,r=`Show less`,i=class extends e{constructor(){super(),this._width=-1,this._observer=null,this._toggle=null,this._onClick=()=>this.toggle()}connectedCallback(){if(this._toggle=this.querySelector(`.wui-show-more-toggle`),!this._toggle)return;let e=Number.parseInt(this.getAttribute(`lines`),10);this.style.setProperty(`--wui-show-more-lines`,String(e>=1?e:t)),this._toggle.addEventListener(`click`,this._onClick),this._sync(),this._check(),typeof ResizeObserver<`u`&&(this._observer=new ResizeObserver(()=>{this.clientWidth!==this._width&&this._check()}),this._observer.observe(this))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._toggle?.removeEventListener(`click`,this._onClick),this._toggle=null}get expanded(){return this.hasAttribute(`expanded`)}toggle(e=!this.expanded){this.toggleAttribute(`expanded`,!!e),this._sync(),this.dispatchEvent(new CustomEvent(`wui:show-more:toggle`,{bubbles:!0,detail:{expanded:this.expanded}}))}_sync(){let e=this.expanded;this._toggle.setAttribute(`aria-expanded`,String(e)),this._toggle.textContent=e?this.getAttribute(`less-label`)||r:this.getAttribute(`more-label`)||n}_check(){let e=this.querySelector(`.wui-show-more-body`);if(!e)return;this._width=this.clientWidth;let t=this.expanded;t&&this.removeAttribute(`expanded`);let n=e.scrollHeight>e.clientHeight+1;t&&this.setAttribute(`expanded`,``),this._toggle.hidden=!n}};export{i as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";import{t as i}from"./tourOpenMark-nPeAJFSo.js";var a=`
|
|
2
2
|
:host {
|
|
3
3
|
all: initial;
|
|
4
|
-
${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay":`0 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-primary-text":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`}).map(([e,t])=>` ${e}: ${t};`).join(`
|
|
4
|
+
${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay":`0 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-primary-text":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`}).map(([e,t])=>` ${e}: ${t};`).join(`
|
|
5
5
|
`)}
|
|
6
6
|
}
|
|
7
7
|
*, *::before, *::after {
|
|
@@ -56,8 +56,8 @@ ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg
|
|
|
56
56
|
color: var(--color-text-muted);
|
|
57
57
|
}
|
|
58
58
|
.btn-outline-secondary:hover {
|
|
59
|
-
background: var(--color-
|
|
60
|
-
color:
|
|
59
|
+
background: var(--color-bg-muted);
|
|
60
|
+
color: var(--color-text);
|
|
61
61
|
}
|
|
62
62
|
.btn-link {
|
|
63
63
|
font-weight: 400;
|
|
@@ -116,8 +116,8 @@ ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg
|
|
|
116
116
|
outline: none;
|
|
117
117
|
}
|
|
118
118
|
.wui-tour-card:focus-visible {
|
|
119
|
-
outline:
|
|
120
|
-
outline-offset:
|
|
119
|
+
outline: var(--wui-focus-ring-width) solid var(--color-focus-ring);
|
|
120
|
+
outline-offset: var(--wui-focus-ring-offset);
|
|
121
121
|
}
|
|
122
122
|
.wui-tour-position {
|
|
123
123
|
margin: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";var t=class extends e{constructor(){super(),this._measure=()=>this.measure(),this._resize=null,this._mutation=null,this._ownTabindex=!1}connectedCallback(){this.measure(),this.addEventListener(`mouseover`,this._measure),typeof ResizeObserver<`u`&&(this._resize=new ResizeObserver(this._measure),this._resize.observe(this)),this._mutation=new MutationObserver(this._measure),this._mutation.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){this.removeEventListener(`mouseover`,this._measure),this._resize?.disconnect(),this._mutation?.disconnect(),this._resize=null,this._mutation=null}measure(){let e=this.querySelector(`.wui-truncate-text`);if(e){if(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight){this.setAttribute(`data-wui-tip`,e.textContent.replace(/\s+/g,` `).trim()),this.hasAttribute(`tabindex`)||(this.setAttribute(`tabindex`,`0`),this._ownTabindex=!0);return}this.removeAttribute(`data-wui-tip`),this._ownTabindex&&=(this.removeAttribute(`tabindex`),!1)}}};export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";var i=`wui-whats-new-read`,a=`wui-whats-new:`,o=`data-open`,s=`data-wui-unread`,c=0,l=class extends e{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this._doc=null,this._seen=``,this._observer=null,this._onTriggerClick=()=>this.isOpen?this.close(!0):this.open(),this._onKeyDown=e=>{e.key===`Escape`&&this.isOpen&&(e.stopPropagation(),this.close(!0))},this._onPointerDown=e=>{this.isOpen&&!this.contains(e.target)&&this.close(!1)}}get isOpen(){return this.hasAttribute(o)}get _trigger(){return this.querySelector(`.wui-whats-new-trigger`)}get _panel(){return this.querySelector(`.wui-whats-new-panel`)}connectedCallback(){this._doc=this.ownerDocument;let e=this._panel,t=this._trigger;!e||!t||(e.id||=`wui-whats-new-${++c}`,t.setAttribute(`aria-controls`,e.id),t.setAttribute(`aria-expanded`,`false`),t.addEventListener(`click`,this._onTriggerClick),this.addEventListener(`keydown`,this._onKeyDown),this._seen=this._load(),this._refresh(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._refresh()),this._observer.observe(e,{childList:!0,subtree:!0})))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._trigger?.removeEventListener(`click`,this._onTriggerClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this.removeAttribute(o),this._doc=null}attributeChangedCallback(e,t,n){t===n||!this._doc||(this._seen=this._load(),this._refresh())}open(){let e=this._panel;!e||this.isOpen||(this.setAttribute(o,``),this._trigger?.setAttribute(`aria-expanded`,`true`),this._place(),t(this,()=>this._place()),this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0),e.focus({preventScroll:!0}),this._markRead())}close(e){this.isOpen&&(this.removeAttribute(o),this._trigger?.setAttribute(`aria-expanded`,`false`),this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this._refresh(),e&&this._trigger?.focus())}_place(){r(this._trigger,this._panel,{clampHeight:!0})}_entries(){return[...this.querySelectorAll(`.wui-whats-new-entry`)].map(e=>({entry:e,date:e.querySelector(`time[datetime]`)?.getAttribute(`datetime`)??``}))}_newest(){return this._entries().reduce((e,{date:t})=>t>e?t:e,``)}_refresh(){let e=this._entries(),t=0;for(let{entry:n,date:r}of e){let e=r>this._seen;e&&t++,!(this.isOpen&&n.hasAttribute(s))&&n.toggleAttribute(s,e)}this.toggleAttribute(s,t>0)}_markRead(){let e=this._newest();!e||e<=this._seen||(this._seen=e,this._save(e),this.toggleAttribute(s,!1),this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{through:e}})))}_storage(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{return{store:this.ownerDocument.defaultView.localStorage,key:a+e}}catch{return null}}_load(){let e=this._storage();return e?e.store.getItem(e.key)??``:this._seen}_save(e){let t=this._storage();t&&t.store.setItem(t.key,e)}};export{l as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=2e3;async function t(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),!!n}catch{return!1}}export{t as n,e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCarousel-C33Z8FBt.js";e(`wui-carousel`,t);export{t as WuiCarousel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCodeBlock-BcLJhLBJ.js";e(`wui-code-block`,t);export{t as WuiCodeBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCommandPalette-
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCommandPalette-B5OB6lsf.js";e(`wui-command-palette`,t);export{t as WuiCommandPalette};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{i as t,n,r,t as i}from"../WuiCommentThread-Bww7P_cu.js";import"./mention-input.js";e(`wui-comment-thread`,t);export{i as COMMENT_INTENTS,n as COMMENT_REACTIONS,r as COMMENT_TEXT,t as WuiCommentThread};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiConsentBanner-
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiConsentBanner-DWdHLSx9.js";e(`wui-consent-banner`,t);export{t as WuiConsentBanner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{A as t,C as n,D as r,E as i,M as a,N as o,O as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,g,h as _,i as v,j as y,k as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A,w as j,x as M,y as N}from"../WuiDataTable-tR8Lp4XZ.js";e(`wui-data-table`,O);export{C as COLUMN_MAX_WIDTH,E as COLUMN_MIN_WIDTH,v as DATA_TABLE_TEXT,d as PIN_AT_VAR,w as PIN_SIDES,D as RESIZE_STEP,p as RESIZE_STEP_LARGE,x as ROW_HEIGHTS,k as ROW_MOVE_LIMIT,m as ROW_MOVE_MS,h as ROW_SAVE_ATTR,T as ROW_SAVE_ERROR_CLASS,S as ROW_SAVE_STATES,_ as VIRTUAL_OVERSCAN,O as WuiDataTable,g as clampColumnWidth,u as groupCount,A as groupItems,N as identityCell,f as measureRows,M as pinAtValue,c as pinClasses,n as pinOffsetVar,j as planPins,l as playRowMoves,i as readColumnWidths,r as rowLabel,s as rowOrderChanged,b as saveOutcomeText,t as setRowSaveState,y as settledRows,a as virtualRange,o as writeColumnWidths};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDateRange-
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDateRange-B5sO9usZ.js";e(`wui-date-range`,t);export{t as WuiDateRange};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDrawer-BuvDLR6M.js";e(`wui-drawer`,t);export{t as WuiDrawer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiHoverCard-CNEawHmO.js";e(`wui-hover-card`,t);export{t as WuiHoverCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,i as n,n as r,r as i,t as a}from"../WuiInlineEdit-CI-3C7yP.js";e(`wui-inline-edit`,n);export{a as INLINE_EDIT_SAVED_MS,r as INLINE_EDIT_TEXT,i as INLINE_EDIT_TYPES,n as WuiInlineEdit,t as inlineEditText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiLightbox-hluak_-q.js";e(`wui-lightbox`,t);export{t as WuiLightbox};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../WuiMentionInput-DW7N1Zne.js";e(`wui-mention-input`,r);export{t as MENTION_ID_PATTERN,l as MENTION_MAX_QUERY,a as MENTION_MAX_RESULTS,s as MENTION_TEXT,r as WuiMentionInput,o as mentionLabel,c as mentionTextFromValue,n as mentionValueFromText,i as mentionedIds,u as parseMentionValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiMenubar-D2tb_3eU.js";e(`wui-menubar`,t);export{t as WuiMenubar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiNavigationMenu-BsLnvz2Y.js";e(`wui-navigation-menu`,t);export{t as WuiNavigationMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiNotificationCenter-DKdvaSbm.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiOnboardingChecklist-s2DG6PZ0.js";e(`wui-onboarding-checklist`,t);export{t as WuiOnboardingChecklist};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiOverflow-CB3j6q6n.js";e(`wui-overflow`,t);export{t as WuiOverflow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiRating-BzeW6iDC.js";e(`wui-rating`,t);export{t as WuiRating};
|