@getvitops/core 0.1.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/README.md +29 -0
- package/css/animation.css +526 -0
- package/css/global.css +17 -0
- package/css/index.css +58 -0
- package/css/layout.css +723 -0
- package/css/patterns/anchor-link.css +66 -0
- package/css/patterns/banner.css +64 -0
- package/css/patterns/carousel.css +269 -0
- package/css/patterns/cluster.css +64 -0
- package/css/patterns/code.css +17 -0
- package/css/patterns/combobox.css +97 -0
- package/css/patterns/comment.css +88 -0
- package/css/patterns/copy.css +82 -0
- package/css/patterns/details.css +87 -0
- package/css/patterns/dialog.css +99 -0
- package/css/patterns/drawer.css +108 -0
- package/css/patterns/dropdown.css +45 -0
- package/css/patterns/forms.css +335 -0
- package/css/patterns/grouped.css +86 -0
- package/css/patterns/horizontal-scroll.css +40 -0
- package/css/patterns/icon.css +72 -0
- package/css/patterns/lightbox.css +156 -0
- package/css/patterns/list.css +272 -0
- package/css/patterns/marquee.css +68 -0
- package/css/patterns/masonry.css +40 -0
- package/css/patterns/media.css +70 -0
- package/css/patterns/nav.css +241 -0
- package/css/patterns/notification.css +114 -0
- package/css/patterns/overlay.css +28 -0
- package/css/patterns/popover.css +68 -0
- package/css/patterns/pull-quote.css +71 -0
- package/css/patterns/scroll-based.css +227 -0
- package/css/patterns/scroll-target.css +124 -0
- package/css/patterns/separator.css +130 -0
- package/css/patterns/sitenav.css +582 -0
- package/css/patterns/split-link.css +113 -0
- package/css/patterns/splitter.css +212 -0
- package/css/patterns/stack.css +67 -0
- package/css/patterns/sticky.css +127 -0
- package/css/patterns/subgrid.css +178 -0
- package/css/patterns/svg.css +166 -0
- package/css/patterns/table.css +106 -0
- package/css/patterns/tag.css +75 -0
- package/css/patterns/text-effects.css +317 -0
- package/css/patterns/tooltip.css +68 -0
- package/css/patterns/tree.css +126 -0
- package/css/utilities.css +351 -0
- package/dist/deferred.js +1 -0
- package/dist/elements.js +887 -0
- package/dist/polyfills/adoptedStyleSheets.js +1 -0
- package/dist/polyfills/css-anchor-positioning-fn.js +17 -0
- package/dist/polyfills/global.esm.js +1 -0
- package/dist/polyfills/popover.js +63 -0
- package/dist/polyfills/template-shadowroot.js +24 -0
- package/dist/polyfills/webcomponents-bundle.js +27 -0
- package/dist/polyfills.js +1 -0
- package/package.json +33 -0
package/dist/elements.js
ADDED
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const e=globalThis,t=e.ShadowRoot&&(e.ShadyCSS===void 0||e.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,n=Symbol(),r=new WeakMap;var i=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,n=this.t;if(t&&e===void 0){let t=n!==void 0&&n.length===1;t&&(e=r.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&r.set(n,e))}return e}toString(){return this.cssText}};const a=e=>new i(typeof e==`string`?e:e+``,void 0,n),o=(e,...t)=>new i(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,n),s=(n,r)=>{if(t)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let t of r){let r=document.createElement(`style`),i=e.litNonce;i!==void 0&&r.setAttribute(`nonce`,i),r.textContent=t.cssText,n.appendChild(r)}},c=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return a(t)})(e):e,{is:l,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:ee,getOwnPropertySymbols:te,getPrototypeOf:ne}=Object,f=globalThis,re=f.trustedTypes,ie=re?re.emptyScript:``,ae=f.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/
|
|
12
|
+
switch(t){case Boolean:e=e?ie:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},oe=(e,t)=>!l(e,t),se={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:oe};Symbol.metadata??=Symbol(`metadata`),f.litPropertyMetadata??=new WeakMap;var h=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&u(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(p(`elementProperties`)))return;let e=ne(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(p(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p(`properties`))){let e=this.properties,t=[...ee(e),...te(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(c(e))}else e!==void 0&&t.push(c(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?m:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?m:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??oe)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};h.elementStyles=[],h.shadowRootOptions={mode:`open`},h[p(`elementProperties`)]=new Map,h[p(`finalized`)]=new Map,ae?.({ReactiveElement:h}),(f.reactiveElementVersions??=[]).push(`2.1.2`);
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2017 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
const g=globalThis,ce=e=>e,_=g.trustedTypes,le=_?_.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ue=`$lit$`,v=`lit$${Math.random().toFixed(9).slice(2)}$`,y=`?`+v,de=`<${y}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,fe=Array.isArray,pe=e=>fe(e)||typeof e?.[Symbol.iterator]==`function`,me=`[
|
|
19
|
+
\f\r]`,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,he=/-->/g,ge=/>/g,w=RegExp(`>|${me}(?:([^\\s"'>=/]+)(${me}*=${me}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),_e=/'/g,ve=/"/g,ye=/^(?:script|style|textarea|title)$/i,T=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),E=Symbol.for(`lit-noChange`),D=Symbol.for(`lit-nothing`),be=new WeakMap,O=b.createTreeWalker(b,129);function xe(e,t){if(!fe(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return le===void 0?t:le.createHTML(t)}const Se=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=C;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===C?c[1]===`!--`?o=he:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=w):(ye.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=w):o=ge:o===w?c[0]===`>`?(o=i??C,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?w:c[3]===`"`?ve:_e):o===ve||o===_e?o=w:o===he||o===ge?o=C:(o=w,i=void 0);let d=o===w&&e[t+1].startsWith(`/>`)?` `:``;a+=o===C?n+de:l>=0?(r.push(s),n.slice(0,l)+ue+n.slice(l)+v+d):n+v+(l===-2?t:d)}return[xe(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]};var k=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Se(t,n);if(this.el=e.createElement(l,r),O.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=O.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ue)){let t=u[o++],n=i.getAttribute(e).split(v),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?we:r[1]===`?`?Te:r[1]===`@`?Ee:M}),i.removeAttribute(e)}else e.startsWith(v)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(ye.test(i.tagName)){let e=i.textContent.split(v),t=e.length-1;if(t>0){i.textContent=_?_.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],x()),O.nextNode(),c.push({type:2,index:++a});i.append(e[t],x())}}}else if(i.nodeType===8)if(i.data===y)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(v,e+1))!==-1;)c.push({type:7,index:a}),e+=v.length-1}a++}}static createElement(e,t){let n=b.createElement(`template`);return n.innerHTML=e,n}};function A(e,t,n=e,r){if(t===E)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=S(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=A(e,i._$AS(e,t.values),i,r)),t}var Ce=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??b).importNode(t,!0);O.currentNode=r;let i=O.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new j(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new De(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=O.nextNode(),a++)}return O.currentNode=b,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},j=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=A(this,e,t),S(e)?e===D||e==null||e===``?(this._$AH!==D&&this._$AR(),this._$AH=D):e!==this._$AH&&e!==E&&this._(e):e._$litType$===void 0?e.nodeType===void 0?pe(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==D&&S(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=k.createElement(xe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Ce(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=be.get(e.strings);return t===void 0&&be.set(e.strings,t=new k(e)),t}k(t){fe(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(x()),this.O(x()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=ce(e).nextSibling;ce(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=D,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=D}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=A(this,e,t,0),a=!S(e)||e!==this._$AH&&e!==E,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=A(this,r[n+o],t,o),s===E&&(s=this._$AH[o]),a||=!S(s)||s!==this._$AH[o],s===D?e=D:e!==D&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},we=class extends M{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===D?void 0:e}},Te=class extends M{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==D)}},Ee=class extends M{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=A(this,e,t,0)??D)===E)return;let n=this._$AH,r=e===D&&n!==D||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==D&&(n===D||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},De=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){A(this,e)}};const Oe={M:ue,P:v,A:y,C:1,L:Se,R:Ce,D:pe,V:A,I:j,H:M,N:Te,U:Ee,B:we,F:De},ke=g.litHtmlPolyfillSupport;ke?.(k,j),(g.litHtmlVersions??=[]).push(`3.3.3`);const Ae=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new j(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},N=globalThis
|
|
20
|
+
/**
|
|
21
|
+
* @license
|
|
22
|
+
* Copyright 2017 Google LLC
|
|
23
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
|
+
*/
|
|
25
|
+
;var P=class extends h{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ae(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};P._$litElement$=!0,P.finalized=!0,N.litElementHydrateSupport?.({LitElement:P});const je=N.litElementPolyfillSupport;je?.({LitElement:P}),(N.litElementVersions??=[]).push(`4.2.2`);var Me=Object.defineProperty,Ne=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t,n)=>(Ne(e,typeof t==`symbol`?t:t+``,n),n),Pe=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},I=(e,t)=>{if(Object(t)!==t)throw TypeError(`Cannot use the "in" operator on this value`);return e.has(t)},L=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},Fe=(e,t,n)=>(Pe(e,t,`access private method`),n);
|
|
26
|
+
/**
|
|
27
|
+
* @license
|
|
28
|
+
* Copyright Google LLC All Rights Reserved.
|
|
29
|
+
*
|
|
30
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
31
|
+
* found in the LICENSE file at https://angular.io/license
|
|
32
|
+
*/
|
|
33
|
+
function Ie(e,t){return Object.is(e,t)}
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright Google LLC All Rights Reserved.
|
|
37
|
+
*
|
|
38
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
39
|
+
* found in the LICENSE file at https://angular.io/license
|
|
40
|
+
*/
|
|
41
|
+
let R=null,z=!1,B=1;const V=Symbol(`SIGNAL`);function H(e){let t=R;return R=e,t}function Le(){return R}function Re(){return z}const U={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function W(e){if(z)throw Error(typeof ngDevMode<`u`&&ngDevMode?`Assertion error: signal read during notification phase`:``);if(R===null)return;R.consumerOnSignalRead(e);let t=R.nextProducerIndex++;if(q(R),t<R.producerNode.length&&R.producerNode[t]!==e&&K(R)){let e=R.producerNode[t];G(e,R.producerIndexOfThis[t])}R.producerNode[t]!==e&&(R.producerNode[t]=e,R.producerIndexOfThis[t]=K(R)?qe(e,R,t):0),R.producerLastReadVersion[t]=e.version}function ze(){B++}function Be(e){if(!(!e.dirty&&e.lastCleanEpoch===B)){if(!e.producerMustRecompute(e)&&!Ke(e)){e.dirty=!1,e.lastCleanEpoch=B;return}e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=B}}function Ve(e){if(e.liveConsumerNode===void 0)return;let t=z;z=!0;try{for(let t of e.liveConsumerNode)t.dirty||Ue(t)}finally{z=t}}function He(){return R?.consumerAllowSignalWrites!==!1}function Ue(e){var t;e.dirty=!0,Ve(e),(t=e.consumerMarkedDirty)==null||t.call(e.wrapper??e)}function We(e){return e&&(e.nextProducerIndex=0),H(e)}function Ge(e,t){if(H(t),!(!e||e.producerNode===void 0||e.producerIndexOfThis===void 0||e.producerLastReadVersion===void 0)){if(K(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)G(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function Ke(e){q(e);for(let t=0;t<e.producerNode.length;t++){let n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version||(Be(n),r!==n.version))return!0}return!1}function qe(e,t,n){var r;if(Je(e),q(e),e.liveConsumerNode.length===0){(r=e.watched)==null||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=qe(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function G(e,t){var n;if(Je(e),q(e),typeof ngDevMode<`u`&&ngDevMode&&t>=e.liveConsumerNode.length)throw Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(e.liveConsumerNode.length===1){(n=e.unwatched)==null||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)G(e.producerNode[t],e.producerIndexOfThis[t])}let r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){let n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];q(r),r.producerIndexOfThis[n]=t}}function K(e){return e.consumerIsAlwaysLive||(e?.liveConsumerNode?.length??0)>0}function q(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}function Je(e){e.liveConsumerNode??=[],e.liveConsumerIndexOfThis??=[]}
|
|
42
|
+
/**
|
|
43
|
+
* @license
|
|
44
|
+
* Copyright Google LLC All Rights Reserved.
|
|
45
|
+
*
|
|
46
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
47
|
+
* found in the LICENSE file at https://angular.io/license
|
|
48
|
+
*/
|
|
49
|
+
function Ye(e){if(Be(e),W(e),e.value===$e)throw e.error;return e.value}function Xe(e){let t=Object.create(et);t.computation=e;let n=()=>Ye(t);return n[V]=t,n}const Ze=Symbol(`UNSET`),Qe=Symbol(`COMPUTING`),$e=Symbol(`ERRORED`),et={...U,value:Ze,dirty:!0,error:null,equal:Ie,producerMustRecompute(e){return e.value===Ze||e.value===Qe},producerRecomputeValue(e){if(e.value===Qe)throw Error(`Detected cycle in computations.`);let t=e.value;e.value=Qe;let n=We(e),r,i=!1;try{r=e.computation.call(e.wrapper),i=t!==Ze&&t!==$e&&e.equal.call(e.wrapper,t,r)}catch(t){r=$e,e.error=t}finally{Ge(e,n)}if(i){e.value=t;return}e.value=r,e.version++}};
|
|
50
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright Google LLC All Rights Reserved.
|
|
53
|
+
*
|
|
54
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
55
|
+
* found in the LICENSE file at https://angular.io/license
|
|
56
|
+
*/
|
|
57
|
+
function tt(){throw Error()}let nt=tt;function rt(){nt()}
|
|
58
|
+
/**
|
|
59
|
+
* @license
|
|
60
|
+
* Copyright Google LLC All Rights Reserved.
|
|
61
|
+
*
|
|
62
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
63
|
+
* found in the LICENSE file at https://angular.io/license
|
|
64
|
+
*/
|
|
65
|
+
function it(e){let t=Object.create(st);t.value=e;let n=()=>(W(t),t.value);return n[V]=t,n}function at(){return W(this),this.value}function ot(e,t){He()||rt(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,ct(e))}const st={...U,equal:Ie,value:void 0};function ct(e){e.version++,ze(),Ve(e)}
|
|
66
|
+
/**
|
|
67
|
+
* @license
|
|
68
|
+
* Copyright 2024 Bloomberg Finance L.P.
|
|
69
|
+
*
|
|
70
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
71
|
+
* you may not use this file except in compliance with the License.
|
|
72
|
+
* You may obtain a copy of the License at
|
|
73
|
+
*
|
|
74
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
75
|
+
*
|
|
76
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
77
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
78
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
79
|
+
* See the License for the specific language governing permissions and
|
|
80
|
+
* limitations under the License.
|
|
81
|
+
*/
|
|
82
|
+
const J=Symbol(`node`);var Y;(e=>{var t,n,r,i;class a{constructor(r,i={}){L(this,n),F(this,t);let a=it(r)[V];if(this[J]=a,a.wrapper=this,i){let t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.get`);return at.call(this[J])}set(t){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.set`);if(Re())throw Error(`Writes to signals not permitted during Watcher callback`);let n=this[J];ot(n,t)}}t=J,n=new WeakSet,e.isState=e=>typeof e==`object`&&I(n,e),e.State=a;class o{constructor(t,n){L(this,i),F(this,r);let a=Xe(t)[V];if(a.consumerAllowSignalWrites=!0,this[J]=a,a.wrapper=this,n){let t=n.equals;t&&(a.equal=t),a.watched=n[e.subtle.watched],a.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw TypeError(`Wrong receiver type for Signal.Computed.prototype.get`);return Ye(this[J])}}r=J,i=new WeakSet,e.isComputed=e=>typeof e==`object`&&I(i,e),e.Computed=o,(t=>{var n,r,i,a;function o(e){let t,n=null;try{n=H(null),t=e()}finally{H(n)}return t}t.untrack=o;function s(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called introspectSources without a Computed or Watcher argument`);return t[J].producerNode?.map(e=>e.wrapper)??[]}t.introspectSources=s;function c(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called introspectSinks without a Signal argument`);return t[J].liveConsumerNode?.map(e=>e.wrapper)??[]}t.introspectSinks=c;function l(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called hasSinks without a Signal argument`);let n=t[J].liveConsumerNode;return n?n.length>0:!1}t.hasSinks=l;function u(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called hasSources without a Computed or Watcher argument`);let n=t[J].producerNode;return n?n.length>0:!1}t.hasSources=u;class d{constructor(e){L(this,r),L(this,i),F(this,n);let t=Object.create(U);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[J]=t}watch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Fe(this,i,a).call(this,t);let n=this[J];n.dirty=!1;let r=H(n);for(let e of t)W(e[J]);H(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Fe(this,i,a).call(this,t);let n=this[J];q(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){G(n.producerNode[e],n.producerIndexOfThis[e]);let t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){let t=n.producerIndexOfThis[e],r=n.producerNode[e];Je(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw TypeError(`Called getPending without Watcher receiver`);return this[J].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}}n=J,r=new WeakSet,i=new WeakSet,a=function(t){for(let n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw TypeError(`Called watch/unwatch without a Computed or State argument`)},e.isWatcher=e=>I(r,e),t.Watcher=d;function ee(){return Le()?.wrapper}t.currentComputed=ee,t.watched=Symbol(`watched`),t.unwatched=Symbol(`unwatched`)})(e.subtle||={})})(Y||={});
|
|
83
|
+
/**
|
|
84
|
+
* @license
|
|
85
|
+
* Copyright 2023 Google LLC
|
|
86
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
87
|
+
*/let lt=!1;const ut=new Y.subtle.Watcher(()=>{lt||(lt=!0,queueMicrotask(()=>{lt=!1;for(let e of ut.getPending())e.get();ut.watch()}))}),dt=Symbol(`SignalWatcherBrand`),ft=new FinalizationRegistry(e=>{e.unwatch(...Y.subtle.introspectSources(e))}),pt=new WeakMap;function mt(e){return!0===e[dt]?(console.warn(`SignalWatcher should not be applied to the same class more than once.`),e):class extends e{constructor(){super(...arguments),this._$St=new Map,this._$So=new Y.State(0),this._$Si=!1}_$Sl(){var e;let t=[],n=[];this._$St.forEach((e,r)=>{(e?.beforeUpdate?t:n).push(r)});let r=this.h?.getPending().filter(e=>e!==this._$Su&&!this._$St.has(e));t.forEach(e=>e.get()),(e=this._$Su)==null||e.get(),r.forEach(e=>e.get()),n.forEach(e=>e.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(this.h!==void 0)return;this._$Su=new Y.Computed(()=>{this._$So.get(),super.performUpdate()});let e=this.h=new Y.subtle.Watcher(function(){let e=pt.get(this);e!==void 0&&(!1===e._$Si&&(new Set(this.getPending()).has(e._$Su)?e.requestUpdate():e._$Sv()),this.watch())});pt.set(e,this),ft.register(this,e),e.watch(this._$Su),e.watch(...Array.from(this._$St).map(([e])=>e))}_$Sp(){if(this.h===void 0)return;let e=!1;this.h.unwatch(...Y.subtle.introspectSources(this.h).filter(t=>{let n=!0!==this._$St.get(t)?.manualDispose;return n&&this._$St.delete(t),e||=!n,n})),e||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(e,t){var n;this._$S_();let r=new Y.Computed(()=>{e()});return this.h.watch(r),this._$St.set(r,t),(n=t?.beforeUpdate)!=null&&n?Y.subtle.untrack(()=>r.get()):this.updateComplete.then(()=>Y.subtle.untrack(()=>r.get())),()=>{this._$St.delete(r),this.h.unwatch(r),!1===this.isConnected&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{!1===this.isConnected&&this._$Sp()})}}}
|
|
88
|
+
/**
|
|
89
|
+
* @license
|
|
90
|
+
* Copyright 2017 Google LLC
|
|
91
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
92
|
+
*/
|
|
93
|
+
const ht={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},gt=e=>(...t)=>({_$litDirective$:e,values:t});var _t=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
|
|
94
|
+
/**
|
|
95
|
+
* @license
|
|
96
|
+
* Copyright 2020 Google LLC
|
|
97
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
|
+
*/const{I:vt}=Oe,yt=e=>e.strings===void 0,X=(e,t)=>{
|
|
99
|
+
/**
|
|
100
|
+
* @license
|
|
101
|
+
* Copyright 2017 Google LLC
|
|
102
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
+
*/
|
|
104
|
+
let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),X(e,t);return!0},Z=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},bt=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Ct(t)}};function xt(e){this._$AN===void 0?this._$AM=e:(Z(this),this._$AM=e,bt(this))}function St(e,t=!1,n=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let e=n;e<r.length;e++)X(r[e],!1),Z(r[e]);else r!=null&&(X(r,!1),Z(r));else X(this,e)}const Ct=e=>{e.type==ht.CHILD&&(e._$AP??=St,e._$AQ??=xt)};var wt=class extends _t{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),bt(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(X(this,e),Z(this))}setValue(e){if(yt(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};
|
|
105
|
+
/**
|
|
106
|
+
* @license
|
|
107
|
+
* Copyright 2023 Google LLC
|
|
108
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
109
|
+
*/
|
|
110
|
+
let Tt=!1;const Et=new Y.subtle.Watcher(async()=>{Tt||(Tt=!0,queueMicrotask(()=>{Tt=!1;for(let e of Et.getPending())e.get();Et.watch()}))}),Dt=gt(class extends wt{_$S_(){this._$Sm===void 0&&(this._$Sj=new Y.Computed(()=>{let e=this._$SW?.get();return this.setValue(e),e}),this._$Sm=this._$Sk?.h??Et,this._$Sm.watch(this._$Sj),Y.subtle.untrack(()=>this._$Sj?.get()))}_$Sp(){this._$Sm!==void 0&&(this._$Sm.unwatch(this._$SW),this._$Sm=void 0)}render(e){return Y.subtle.untrack(()=>e.get())}update(e,[t]){return this._$Sk??=e.options?.host,t!==this._$SW&&this._$SW!==void 0&&this._$Sp(),this._$SW=t,this._$S_(),Y.subtle.untrack(()=>this._$SW.get())}disconnected(){this._$Sp()}reconnected(){this._$S_()}}),Q=(e=>(t,...n)=>e(t,...n.map(e=>e instanceof Y.State||e instanceof Y.Computed?Dt(e):e)))(T)
|
|
111
|
+
/**
|
|
112
|
+
* @license
|
|
113
|
+
* Copyright 2023 Google LLC
|
|
114
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* @license
|
|
118
|
+
* Copyright 2023 Google LLC
|
|
119
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
120
|
+
*/
|
|
121
|
+
;Y.State,Y.Computed;const Ot=mt(P);var $=class extends Ot{static styles=[];getSlottedNodes(e=[]){let t=this.shadowRoot?.querySelector(`slot`);if(!t)return[];let n=t.assignedNodes({flatten:!0});return e.length===0?n:n.filter(t=>e.includes(t.tagName.toLowerCase()))}},kt=class{host;options;handleEl=null;isDragging=!1;rafId=null;pendingPosition=null;containerRect=null;currentPosition=.5;prefersReducedMotion=!1;constructor(e,t){this.host=e,this.options={handleSelector:t.handleSelector,orientation:t.orientation??`horizontal`,smooth:t.smooth??!0,onDrag:t.onDrag??(()=>{}),onDragStart:t.onDragStart??(()=>{}),onDragEnd:t.onDragEnd??(()=>{}),keyboardStep:t.keyboardStep??.01,keyboardLargeStep:t.keyboardLargeStep??.1},e.addController(this)}hostConnected(){this.prefersReducedMotion=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}hostUpdated(){this.setupHandle()}hostDisconnected(){this.cleanup()}get shouldSmooth(){return this.options.smooth&&!this.prefersReducedMotion}setupHandle(){let e=this.host.renderRoot.querySelector(this.options.handleSelector);e!==this.handleEl&&(this.handleEl&&(this.handleEl.removeEventListener(`pointerdown`,this.onPointerDown),this.handleEl.removeEventListener(`keydown`,this.onKeyDown)),this.handleEl=e,this.handleEl&&(this.handleEl.addEventListener(`pointerdown`,this.onPointerDown),this.handleEl.addEventListener(`keydown`,this.onKeyDown),this.handleEl.hasAttribute(`tabindex`)||this.handleEl.setAttribute(`tabindex`,`0`),this.handleEl.hasAttribute(`role`)||this.handleEl.setAttribute(`role`,`separator`),this.handleEl.setAttribute(`aria-valuemin`,`0`),this.handleEl.setAttribute(`aria-valuemax`,`100`),this.updateAriaValue(this.currentPosition)))}onPointerDown=e=>{if(e.button!==0)return;e.preventDefault(),this.isDragging=!0,this.handleEl?.setPointerCapture(e.pointerId);let t=this.handleEl?.parentElement;this.containerRect=t?.getBoundingClientRect()??null,document.addEventListener(`pointermove`,this.onPointerMove),document.addEventListener(`pointerup`,this.onPointerUp),document.addEventListener(`pointercancel`,this.onPointerUp),this.handleEl?.classList.add(`dragging`),this.options.onDragStart(),this.processPointerEvent(e)};onPointerMove=e=>{this.isDragging&&this.processPointerEvent(e)};processPointerEvent(e){if(!this.containerRect)return;let{orientation:t}=this.options,n=this.containerRect,r;if(t===`horizontal`){let t=e.clientX-n.left;r=Math.max(0,Math.min(1,t/n.width))}else{let t=e.clientY-n.top;r=Math.max(0,Math.min(1,t/n.height))}this.pendingPosition=r,this.shouldSmooth&&this.rafId===null&&(this.rafId=requestAnimationFrame(this.flushPosition))}flushPosition=()=>{this.rafId=null,this.pendingPosition!==null&&this.isDragging&&(this.currentPosition=this.pendingPosition,this.updateAriaValue(this.currentPosition),this.options.onDrag(this.currentPosition))};onPointerUp=e=>{if(!this.isDragging)return;this.isDragging=!1,this.handleEl?.releasePointerCapture(e.pointerId),this.containerRect=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null);let t=this.pendingPosition??this.currentPosition;this.currentPosition=t,this.pendingPosition=null,this.updateAriaValue(t),this.options.onDragEnd(t),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),document.removeEventListener(`pointercancel`,this.onPointerUp),this.handleEl?.classList.remove(`dragging`)};onKeyDown=e=>{let{orientation:t,keyboardStep:n,keyboardLargeStep:r}=this.options,i=e.shiftKey?r:n,a=0;if(t===`horizontal`?e.key===`ArrowLeft`?a=-i:e.key===`ArrowRight`&&(a=i):e.key===`ArrowUp`?a=-i:e.key===`ArrowDown`&&(a=i),e.key===`Home`){e.preventDefault(),this.currentPosition=0,this.updateAriaValue(0),this.options.onDrag(0),this.options.onDragEnd(0);return}if(e.key===`End`){e.preventDefault(),this.currentPosition=1,this.updateAriaValue(1),this.options.onDrag(1),this.options.onDragEnd(1);return}if(a!==0){e.preventDefault();let t=Math.max(0,Math.min(1,this.currentPosition+a));this.currentPosition=t,this.updateAriaValue(t),this.options.onDrag(t),this.options.onDragEnd(t)}};updateAriaValue(e){let t=Math.round(e*100);this.handleEl?.setAttribute(`aria-valuenow`,String(t))}cleanup(){this.handleEl&&(this.handleEl.removeEventListener(`pointerdown`,this.onPointerDown),this.handleEl.removeEventListener(`keydown`,this.onKeyDown)),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),document.removeEventListener(`pointercancel`,this.onPointerUp),this.rafId!==null&&cancelAnimationFrame(this.rafId)}setPosition(e){this.currentPosition=Math.max(0,Math.min(1,e)),this.updateAriaValue(this.currentPosition)}getPosition(){return this.currentPosition}updateOptions(e){Object.assign(this.options,e)}},At=class extends ${static styles=[$.styles,o`
|
|
122
|
+
:host {
|
|
123
|
+
--_offset: var(--offset, 0.5);
|
|
124
|
+
--_handle-size: var(--handle-size, 8px);
|
|
125
|
+
--_handle-color: var(--handle-color, oklch(0.85 0 0));
|
|
126
|
+
--_handle-hover: var(--handle-hover-color, oklch(0.7 0 0));
|
|
127
|
+
--_min-size: var(--min-panel-size, 100px);
|
|
128
|
+
|
|
129
|
+
display: block;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.splitter {
|
|
133
|
+
display: grid;
|
|
134
|
+
block-size: 100%;
|
|
135
|
+
inline-size: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host(:not([vertical])) .splitter {
|
|
139
|
+
grid-template-columns:
|
|
140
|
+
calc(var(--_offset) * (100% - var(--_handle-size)))
|
|
141
|
+
var(--_handle-size)
|
|
142
|
+
calc((1 - var(--_offset)) * (100% - var(--_handle-size)));
|
|
143
|
+
grid-template-rows: 1fr;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([vertical]) .splitter {
|
|
147
|
+
grid-template-rows:
|
|
148
|
+
calc(var(--_offset) * (100% - var(--_handle-size)))
|
|
149
|
+
var(--_handle-size)
|
|
150
|
+
calc((1 - var(--_offset)) * (100% - var(--_handle-size)));
|
|
151
|
+
grid-template-columns: 1fr;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.panel {
|
|
155
|
+
overflow: auto;
|
|
156
|
+
min-inline-size: 0;
|
|
157
|
+
min-block-size: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.panel--start {
|
|
161
|
+
grid-area: 1 / 1;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host(:not([vertical])) .panel--end {
|
|
165
|
+
grid-area: 1 / 3;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host([vertical]) .panel--end {
|
|
169
|
+
grid-area: 3 / 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.handle {
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
background: var(--_handle-color);
|
|
175
|
+
transition: background-color 0.15s ease;
|
|
176
|
+
position: relative;
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.handle:hover,
|
|
183
|
+
.handle:focus-visible {
|
|
184
|
+
background: var(--_handle-hover);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.handle:focus-visible {
|
|
188
|
+
outline: 2px solid oklch(0.6 0.2 250);
|
|
189
|
+
outline-offset: -2px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Horizontal handle */
|
|
193
|
+
:host(:not([vertical])) .handle {
|
|
194
|
+
cursor: col-resize;
|
|
195
|
+
grid-area: 1 / 2;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Vertical handle */
|
|
199
|
+
:host([vertical]) .handle {
|
|
200
|
+
cursor: row-resize;
|
|
201
|
+
grid-area: 2 / 1;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Handle grip indicator */
|
|
205
|
+
.handle::after {
|
|
206
|
+
content: '';
|
|
207
|
+
background: currentColor;
|
|
208
|
+
opacity: 0.3;
|
|
209
|
+
border-radius: 1px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
:host(:not([vertical])) .handle::after {
|
|
213
|
+
inline-size: 2px;
|
|
214
|
+
block-size: 24px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
:host([vertical]) .handle::after {
|
|
218
|
+
inline-size: 24px;
|
|
219
|
+
block-size: 2px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* Dragging state */
|
|
223
|
+
.handle.dragging {
|
|
224
|
+
background: var(--_handle-hover);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.handle.dragging::after {
|
|
228
|
+
opacity: 0.5;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Touch-friendly hit area */
|
|
232
|
+
@media (any-pointer: coarse) {
|
|
233
|
+
:host(:not([vertical])) .handle {
|
|
234
|
+
min-inline-size: 44px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
:host([vertical]) .handle {
|
|
238
|
+
min-block-size: 44px;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Reduced motion */
|
|
243
|
+
@media (prefers-reduced-motion: reduce) {
|
|
244
|
+
.handle {
|
|
245
|
+
transition: none;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
`];static properties={position:{type:Number},vertical:{type:Boolean,reflect:!0},discrete:{type:Boolean,reflect:!0},minSize:{type:Number,attribute:`min-size`},maxSize:{type:Number,attribute:`max-size`},keyboardStep:{type:Number,attribute:`keyboard-step`},collapseThreshold:{type:Number,attribute:`collapse-threshold`},snapPoints:{type:String,attribute:`snap-points`},snapDistance:{type:Number,attribute:`snap-distance`},_offset:{state:!0}};dragController;containerSize=0;constructor(){super(),this.position=50,this.vertical=!1,this.discrete=!1,this.minSize=100,this.maxSize=0,this.keyboardStep=1,this.collapseThreshold=0,this.snapPoints=``,this.snapDistance=10,this._offset=.5,this.initDragController()}initDragController(){this.dragController=new kt(this,{handleSelector:`[part="handle"]`,orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,onDragStart:()=>this.handleDragStart(),onDrag:e=>this.handleDrag(e),onDragEnd:e=>this.handleDragEnd(e),keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}willUpdate(e){e.has(`position`)&&!e.has(`_offset`)&&(this._offset=this.position/100,this.dragController.setPosition(this._offset)),(e.has(`vertical`)||e.has(`discrete`)||e.has(`keyboardStep`))&&this.dragController.updateOptions({orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}handleDragStart(){let e=this.renderRoot.querySelector(`.splitter`);if(e){let t=e.getBoundingClientRect();this.containerSize=this.vertical?t.height:t.width}}applyConstraints(e){let t=e;if(this.containerSize>0){let e=this.minSize/this.containerSize,n=this.maxSize>0?this.maxSize/this.containerSize:1-e;t=Math.max(e,Math.min(1-e,t)),t=Math.min(n,t)}if(this.snapPoints&&this.containerSize>0){let e=this.snapPoints.split(`,`).map(e=>parseFloat(e.trim())/100),n=this.snapDistance/this.containerSize;for(let r of e)if(Math.abs(t-r)<n){t=r;break}}if(this.collapseThreshold>0){let e=this.collapseThreshold/100;t<e?t=0:t>1-e&&(t=1)}return t}handleDrag(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset))}handleDragEnd(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset)),this.dispatchEvent(new CustomEvent(`split-change`,{detail:{position:this._offset*100},bubbles:!0,composed:!0}))}render(){return T`
|
|
249
|
+
<div class="splitter" part="container" style="--_offset: ${this._offset}">
|
|
250
|
+
<div class="panel panel--start" part="panel-start">
|
|
251
|
+
<slot name="start"></slot>
|
|
252
|
+
</div>
|
|
253
|
+
<div
|
|
254
|
+
class="handle"
|
|
255
|
+
part="handle"
|
|
256
|
+
role="separator"
|
|
257
|
+
aria-label="Panel resize handle"
|
|
258
|
+
aria-orientation="${this.vertical?`vertical`:`horizontal`}"
|
|
259
|
+
></div>
|
|
260
|
+
<div class="panel panel--end" part="panel-end">
|
|
261
|
+
<slot name="end"></slot>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
`}};customElements.get(`wc-split-panel`)||customElements.define(`wc-split-panel`,At);var jt=class extends ${static styles=[$.styles,o`
|
|
265
|
+
:host {
|
|
266
|
+
--_offset: var(--offset, 0.5);
|
|
267
|
+
--_handle-size: var(--handle-size, 40px);
|
|
268
|
+
--_handle-color: var(--handle-color, white);
|
|
269
|
+
--_line-color: var(--line-color, white);
|
|
270
|
+
--_line-width: var(--line-width, 2px);
|
|
271
|
+
|
|
272
|
+
display: block;
|
|
273
|
+
position: relative;
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
touch-action: pan-y;
|
|
276
|
+
user-select: none;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:host([vertical]) {
|
|
280
|
+
touch-action: pan-x;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.container {
|
|
284
|
+
position: relative;
|
|
285
|
+
display: grid;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.after,
|
|
289
|
+
.before {
|
|
290
|
+
grid-area: 1 / 1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.after ::slotted(img),
|
|
294
|
+
.before ::slotted(img) {
|
|
295
|
+
display: block;
|
|
296
|
+
inline-size: 100%;
|
|
297
|
+
block-size: auto;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.before {
|
|
301
|
+
clip-path: inset(0 calc((1 - var(--_offset)) * 100%) 0 0);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
:host([vertical]) .before {
|
|
305
|
+
clip-path: inset(0 0 calc((1 - var(--_offset)) * 100%) 0);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* Handle positioning */
|
|
309
|
+
.handle {
|
|
310
|
+
position: absolute;
|
|
311
|
+
inset-block: 0;
|
|
312
|
+
inset-inline-start: calc(var(--_offset) * 100%);
|
|
313
|
+
translate: -50% 0;
|
|
314
|
+
inline-size: var(--_handle-size);
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
align-items: center;
|
|
318
|
+
cursor: ew-resize;
|
|
319
|
+
z-index: 1;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:host([vertical]) .handle {
|
|
323
|
+
inset-block: auto;
|
|
324
|
+
inset-block-start: calc(var(--_offset) * 100%);
|
|
325
|
+
inset-inline: 0;
|
|
326
|
+
translate: 0 -50%;
|
|
327
|
+
flex-direction: row;
|
|
328
|
+
cursor: ns-resize;
|
|
329
|
+
block-size: var(--_handle-size);
|
|
330
|
+
inline-size: 100%;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/* Divider line */
|
|
334
|
+
.handle::before {
|
|
335
|
+
content: '';
|
|
336
|
+
position: absolute;
|
|
337
|
+
inset-block: 0;
|
|
338
|
+
inset-inline-start: 50%;
|
|
339
|
+
translate: -50% 0;
|
|
340
|
+
inline-size: var(--_line-width);
|
|
341
|
+
background: var(--_line-color);
|
|
342
|
+
box-shadow: 0 0 4px oklch(0 0 0 / 0.3);
|
|
343
|
+
pointer-events: none;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
:host([vertical]) .handle::before {
|
|
347
|
+
inset-inline: 0;
|
|
348
|
+
inset-block: auto;
|
|
349
|
+
inset-block-start: 50%;
|
|
350
|
+
translate: 0 -50%;
|
|
351
|
+
inline-size: 100%;
|
|
352
|
+
block-size: var(--_line-width);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* Grip button */
|
|
356
|
+
.grip {
|
|
357
|
+
position: absolute;
|
|
358
|
+
inset-block-start: 50%;
|
|
359
|
+
inset-inline-start: 50%;
|
|
360
|
+
translate: -50% -50%;
|
|
361
|
+
inline-size: var(--_handle-size);
|
|
362
|
+
block-size: var(--_handle-size);
|
|
363
|
+
background: var(--_handle-color);
|
|
364
|
+
border-radius: 50%;
|
|
365
|
+
box-shadow: 0 2px 8px oklch(0 0 0 / 0.2);
|
|
366
|
+
display: flex;
|
|
367
|
+
align-items: center;
|
|
368
|
+
justify-content: center;
|
|
369
|
+
transition:
|
|
370
|
+
scale 0.15s ease,
|
|
371
|
+
box-shadow 0.15s ease;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* Grip arrows */
|
|
375
|
+
.grip::before,
|
|
376
|
+
.grip::after {
|
|
377
|
+
content: '';
|
|
378
|
+
position: absolute;
|
|
379
|
+
border: 5px solid transparent;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.grip::before {
|
|
383
|
+
border-inline-end-color: oklch(0.3 0 0);
|
|
384
|
+
inset-inline-start: 6px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.grip::after {
|
|
388
|
+
border-inline-start-color: oklch(0.3 0 0);
|
|
389
|
+
inset-inline-end: 6px;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
:host([vertical]) .grip::before {
|
|
393
|
+
border-inline-end-color: transparent;
|
|
394
|
+
border-block-end-color: oklch(0.3 0 0);
|
|
395
|
+
inset-inline-start: auto;
|
|
396
|
+
inset-block-start: 6px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
:host([vertical]) .grip::after {
|
|
400
|
+
border-inline-start-color: transparent;
|
|
401
|
+
border-block-start-color: oklch(0.3 0 0);
|
|
402
|
+
inset-inline-end: auto;
|
|
403
|
+
inset-block-end: 6px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* Hover/focus states */
|
|
407
|
+
.handle:hover .grip,
|
|
408
|
+
.handle:focus-visible .grip {
|
|
409
|
+
scale: 1.1;
|
|
410
|
+
box-shadow: 0 4px 12px oklch(0 0 0 / 0.3);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.handle:focus-visible {
|
|
414
|
+
outline: none;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.handle:focus-visible .grip {
|
|
418
|
+
outline: 2px solid oklch(0.6 0.2 250);
|
|
419
|
+
outline-offset: 2px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/* Dragging state */
|
|
423
|
+
.handle.dragging .grip {
|
|
424
|
+
scale: 1.15;
|
|
425
|
+
box-shadow: 0 6px 16px oklch(0 0 0 / 0.35);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/* Reduced motion */
|
|
429
|
+
@media (prefers-reduced-motion: reduce) {
|
|
430
|
+
.grip {
|
|
431
|
+
transition: none;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* Touch-friendly hit area */
|
|
436
|
+
@media (any-pointer: coarse) {
|
|
437
|
+
.handle {
|
|
438
|
+
min-inline-size: 44px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
:host([vertical]) .handle {
|
|
442
|
+
min-block-size: 44px;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* Screen reader only */
|
|
447
|
+
.visually-hidden {
|
|
448
|
+
position: absolute;
|
|
449
|
+
width: 1px;
|
|
450
|
+
height: 1px;
|
|
451
|
+
padding: 0;
|
|
452
|
+
margin: -1px;
|
|
453
|
+
overflow: hidden;
|
|
454
|
+
clip: rect(0, 0, 0, 0);
|
|
455
|
+
white-space: nowrap;
|
|
456
|
+
border: 0;
|
|
457
|
+
}
|
|
458
|
+
`];static properties={position:{type:Number},vertical:{type:Boolean,reflect:!0},discrete:{type:Boolean,reflect:!0},keyboardStep:{type:Number,attribute:`keyboard-step`},beforeLabel:{type:String,attribute:`before-label`},afterLabel:{type:String,attribute:`after-label`},_offset:{type:Number,state:!0}};dragController;constructor(){super(),this.init(),this.initDragController()}init(){this.position=50,this.vertical=!1,this.discrete=!1,this.keyboardStep=1,this.beforeLabel=`Before`,this.afterLabel=`After`,this._offset=.5}initDragController(){this.dragController=new kt(this,{handleSelector:`[part="handle"]`,orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,onDrag:e=>this.handleDrag(e),onDragEnd:e=>this.handleDragEnd(e),keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}willUpdate(e){e.has(`position`)&&!e.has(`_offset`)&&(this._offset=this.position/100,this.dragController.setPosition(this._offset)),(e.has(`vertical`)||e.has(`discrete`)||e.has(`keyboardStep`))&&this.dragController.updateOptions({orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}handleDrag(e){this._offset=e,this.style.setProperty(`--_offset`,String(this._offset))}handleDragEnd(e){this._offset=e,this.style.setProperty(`--_offset`,String(this._offset)),this.dispatchEvent(new CustomEvent(`compare-change`,{detail:{position:this._offset*100},bubbles:!0,composed:!0}))}render(){return T`
|
|
459
|
+
<div class="container" part="container" style="--_offset: ${this._offset}">
|
|
460
|
+
<div class="after" part="after" aria-label="${this.afterLabel}">
|
|
461
|
+
<slot name="after"></slot>
|
|
462
|
+
</div>
|
|
463
|
+
<div class="before" part="before" aria-label="${this.beforeLabel}">
|
|
464
|
+
<slot name="before"></slot>
|
|
465
|
+
</div>
|
|
466
|
+
<div
|
|
467
|
+
class="handle"
|
|
468
|
+
part="handle"
|
|
469
|
+
role="separator"
|
|
470
|
+
aria-label="Image comparison handle"
|
|
471
|
+
aria-orientation="${this.vertical?`vertical`:`horizontal`}"
|
|
472
|
+
>
|
|
473
|
+
<div class="grip" part="grip">
|
|
474
|
+
<span class="visually-hidden">Drag to compare</span>
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
`}};customElements.get(`wc-image-compare`)||customElements.define(`wc-image-compare`,jt);var Mt=class extends ${static properties={duration:{type:Number,reflect:!0},exit:{type:Number}};createRenderRoot(){return this}render(){return E}#e;constructor(){super(),this.duration=0,this.exit=200}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,this.#t),this.duration>0&&(this.#e=setTimeout(()=>this.dismiss(),this.duration))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`click`,this.#t),this.#e&&clearTimeout(this.#e)}#t=e=>{e.target?.closest(`[data-dismiss]`)&&(e.preventDefault(),this.dismiss())};dismiss(){this.#e&&=(clearTimeout(this.#e),void 0);let e=new CustomEvent(`dismiss`,{bubbles:!0,cancelable:!0});if(!this.dispatchEvent(e))return;let t=matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(this.exit<=0||t){this.remove();return}this.style.transition=`opacity ${this.exit}ms ease, scale ${this.exit}ms ease`,this.style.opacity=`0`,this.style.scale=`0.97`;let n=!1,r=()=>{n||(n=!0,this.remove())};this.addEventListener(`transitionend`,r,{once:!0}),setTimeout(r,this.exit+50)}};customElements.get(`wc-dismissable`)||customElements.define(`wc-dismissable`,Mt);var Nt=class extends ${static styles=[$.styles,o`
|
|
479
|
+
:host {
|
|
480
|
+
display: inline-flex;
|
|
481
|
+
align-items: center;
|
|
482
|
+
gap: 0.5rem;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.copy__button {
|
|
486
|
+
display: none;
|
|
487
|
+
align-items: center;
|
|
488
|
+
justify-content: center;
|
|
489
|
+
min-inline-size: var(--copy-size, 2.5rem);
|
|
490
|
+
min-block-size: var(--copy-size, 2.5rem);
|
|
491
|
+
padding: var(--copy-padding, 0.5rem);
|
|
492
|
+
background: var(--copy-bg, transparent);
|
|
493
|
+
border: var(--copy-border, none);
|
|
494
|
+
border-radius: var(--copy-radius, 0.375rem);
|
|
495
|
+
cursor: pointer;
|
|
496
|
+
transition:
|
|
497
|
+
background-color 0.15s ease,
|
|
498
|
+
transform 0.1s ease;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
:host(copy-button:defined) .copy__button {
|
|
502
|
+
display: inline-flex;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.copy__button:hover {
|
|
506
|
+
background: var(--copy-hover-bg, oklch(0.9 0 0));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.copy__button:active {
|
|
510
|
+
transform: scale(0.95);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.copy__button:focus-visible {
|
|
514
|
+
outline: 2px solid var(--copy-focus-color, oklch(0.6 0.2 250));
|
|
515
|
+
outline-offset: 2px;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.copy__icon {
|
|
519
|
+
inline-size: 1.25em;
|
|
520
|
+
block-size: 1.25em;
|
|
521
|
+
background-color: currentColor;
|
|
522
|
+
mask-size: contain;
|
|
523
|
+
mask-repeat: no-repeat;
|
|
524
|
+
mask-position: center;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.copy__icon--copy {
|
|
528
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M208 0H332.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V336c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V48c0-26.5 21.5-48 48-48zM48 128h80v64H64V448H256V416h64v48c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V176c0-26.5 21.5-48 48-48z'/%3E%3C/svg%3E");
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.copy__icon--success {
|
|
532
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z'/%3E%3C/svg%3E");
|
|
533
|
+
color: var(--copy-success-color, oklch(0.6 0.2 145));
|
|
534
|
+
}
|
|
535
|
+
`];static properties={value:{type:String},label:{type:String},_copied:{type:Boolean,state:!0}};constructor(){super(),this.init()}init(){this.value=void 0,this.label=`Copy to clipboard`,this._copied=!1}_timeoutId;disconnectedCallback(){super.disconnectedCallback(),this._timeoutId&&clearTimeout(this._timeoutId)}_handleCopy=async()=>{let e=this.value??this.getSlottedNodes().map(e=>e.textContent).join(``).trim();if(!(e==null||e===``)){console.log(`copying value:`,e);try{await navigator.clipboard.writeText(e),this._copied=!0,this._timeoutId=setTimeout(()=>{this._copied=!1},2e3),this.dispatchEvent(new CustomEvent(`copy`,{detail:{value:this.value},bubbles:!0,composed:!0}))}catch(e){console.error(`Failed to copy:`,e),this.dispatchEvent(new CustomEvent(`copy-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}};render(){let e=this._copied?`copy__icon copy__icon--success`:`copy__icon copy__icon--copy`;return Q`
|
|
536
|
+
<slot></slot>
|
|
537
|
+
<button
|
|
538
|
+
class="copy__button"
|
|
539
|
+
part="button"
|
|
540
|
+
type="button"
|
|
541
|
+
aria-label=${this._copied?`Copied!`:this.label}
|
|
542
|
+
@click=${this._handleCopy}
|
|
543
|
+
>
|
|
544
|
+
<span class=${e} part="icon" aria-hidden="true"></span>
|
|
545
|
+
</button>
|
|
546
|
+
`}};customElements.get(`copy-button`)||customElements.define(`copy-button`,Nt);var Pt=class extends ${static properties={autoplay:{type:Number,reflect:!0}};createRenderRoot(){return this}#e=[];#t=[];#n=!1;#r=!1;#i=null;#a=!1;#o=null;#s=!1;init(){this.autoplay=0}constructor(){super(),this.init()}connectedCallback(){super.connectedCallback(),this.hasAttribute(`role`)||this.setAttribute(`role`,`region`),this.hasAttribute(`aria-roledescription`)||this.setAttribute(`aria-roledescription`,`carousel`),this.#e=[...this.children].filter(e=>!e.hasAttribute(`slot`)),!(this.#e.length<2)&&(this.#n=this.classList.contains(`carousel--auto-pages`),this.#n||(this.#c(),this.#d(),this.addEventListener(`scrollsnapchange`,this.#p)),!this.autoplay&&this.hasAttribute(`autoplay`)&&(this.autoplay=Number(this.getAttribute(`autoplay`))||0),this.#s=matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.autoplay>0&&(this.#y(),this.#s?(this.#a=!0,this.setAttribute(`aria-live`,`polite`),this.#b()):this.#m(),this.addEventListener(`pointerenter`,this.#g),this.addEventListener(`pointerleave`,this.#_),this.addEventListener(`focusin`,this.#g),this.addEventListener(`focusout`,this.#_)))}disconnectedCallback(){super.disconnectedCallback(),this.#n||(this.removeEventListener(`scrollsnapchange`,this.#p),this.#u()),this.removeEventListener(`pointerenter`,this.#g),this.removeEventListener(`pointerleave`,this.#_),this.removeEventListener(`focusin`,this.#g),this.removeEventListener(`focusout`,this.#_),this.#h(),this.#o&&=(this.#o.removeEventListener(`click`,this.#v),this.#o.hasAttribute(`slot`)||this.#o.remove(),null),this.removeAttribute(`aria-live`)}#c(){let e=[],t=[];for(let n=0;n<this.#e.length;n++)e.push(this.#l(this.#e[n],n)),t.push(this.#l(this.#e[n],n));for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);for(let e of t)this.append(e);this.#t=[...e,...t]}#l(e,t){let n=e.cloneNode(!0);n.setAttribute(`data-carousel-clone`,String(t)),n.setAttribute(`aria-hidden`,`true`);for(let e of[n,...n.querySelectorAll(`[tabindex], a, button, input, select, textarea`)])e.tabIndex=-1;return n}#u(){for(let e of this.#t)e.remove();this.#t=[]}#d(){requestAnimationFrame(()=>{let e=this.#e[0];e&&(this.style.scrollBehavior=`auto`,this.scrollLeft=e.offsetLeft-this.offsetLeft-(parseFloat(getComputedStyle(this).scrollPaddingLeft)||0)+(parseFloat(getComputedStyle(this).paddingLeft)||0),requestAnimationFrame(()=>{this.style.scrollBehavior=``}))})}#f(){this.scrollBy({left:this.clientWidth,behavior:`smooth`})}#p=e=>{if(this.#r){this.#r=!1;return}let t=e.snapTargetInline;if(!t||!t.hasAttribute(`data-carousel-clone`))return;let n=Number(t.getAttribute(`data-carousel-clone`)),r=this.#e[n];if(!r)return;let i=r.offsetLeft-t.offsetLeft;this.#r=!0,this.style.scrollBehavior=`auto`,this.scrollLeft+=i,requestAnimationFrame(()=>{this.style.scrollBehavior=``})};#m(){this.#i||this.autoplay<=0||(this.#a=!1,this.#i=setInterval(()=>this.#f(),this.autoplay),this.setAttribute(`aria-live`,`off`),this.#b())}#h(){this.#i&&=(clearInterval(this.#i),null)}#g=()=>{this.#h(),this.#a=!0,this.setAttribute(`aria-live`,`polite`),this.#b()};#_=()=>{this.#s||this.#m()};#v=()=>{this.#a?(this.#s=!1,this.#m()):this.#g()};#y(){let e=this.querySelector(`[slot="autoplay"]`);if(e)this.#o=e;else{let e=document.createElement(`button`);e.type=`button`,this.append(e),this.#o=e}this.#o.setAttribute(`part`,`autoplay`),this.#o.addEventListener(`click`,this.#v),this.#b()}#b(){this.#o&&(this.#o.setAttribute(`aria-label`,this.#a?`Play`:`Pause`),this.#o.setAttribute(`aria-pressed`,String(!this.#a)),this.#o.hasAttribute(`slot`)||(this.#o.textContent=this.#a?`▶`:`⏸`))}};customElements.get(`wc-carousel`)||customElements.define(`wc-carousel`,Pt);var Ft=class extends ${static properties={breakpoint:{type:String,reflect:!0},projection:{type:Boolean,reflect:!0},singular:{type:Boolean,reflect:!0}};createRenderRoot(){return this}#e=[];#t=[];#n=[];#r=null;#i=null;#a=null;#o=[];#s=[];#c=0;#l=!1;#u=null;#d=0;init(){this.breakpoint=`40rem`,this.projection=!1,this.singular=!1}constructor(){super(),this.init()}connectedCallback(){super.connectedCallback(),this.#f(),this.#e.length!==0&&(this.#m(),this.projection&&(this.#p(),this.#h(),this.#g(),this.singular&&(this.classList.add(`entries--singular`),this.#v(0))),this.#d=this.#b(),this.#x())}disconnectedCallback(){super.disconnectedCallback(),this.#u?.disconnect(),this.#u=null,this.#a?.remove(),this.#a=null,this.#o=[],this.#i?this.#i.remove():this.#r?.remove(),this.#r=null,this.#i=null,this.#s=[],this.classList.remove(`entries--wide`,`entries--projection`,`entries--singular`)}#f(){this.#e=[];let e=new Set,t=new Map,n=null;for(let r of this.children){let i=r.tagName.toLowerCase();if(/^h[1-6]$/.test(i))n=r;else if(i===`dl`&&n){let i=new Map,a=r.querySelectorAll(`dt`),o=r.querySelectorAll(`dd`);for(let n=0;n<a.length;n++){let r=a[n].textContent?.trim()??``,s=o[n]?.innerHTML??``;if(r){i.set(r,s),e.add(r);let o=a[n].getAttribute(`data-label`);o&&!t.has(r)&&t.set(r,o)}}this.#e.push({title:n.innerHTML,heading:n,dl:r,properties:i}),n=null}}this.#t=[...e],this.#n=this.#t.map(e=>t.get(e)??e)}#p(){this.classList.add(`entries--projection`)}#m(){let e=document.createElement(`table`);e.classList.add(`entries__table`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElement(`thead`),n=document.createElement(`tr`),r=document.createElement(`th`);r.textContent=``,n.appendChild(r),this.#s=[];for(let e of this.#t){let t=document.createElement(`th`);t.textContent=e,n.appendChild(t),this.#s.push(t)}t.appendChild(n),e.appendChild(t);let i=document.createElement(`tbody`);for(let e of this.#e){let t=document.createElement(`tr`),n=document.createElement(`td`);n.innerHTML=e.title,n.style.fontWeight=`600`,t.appendChild(n);for(let n of this.#t){let r=document.createElement(`td`);r.innerHTML=e.properties.get(n)??``,t.appendChild(r)}i.appendChild(t)}e.appendChild(i),this.appendChild(e),this.#r=e}#h(){if(!this.#r)return;let e=document.createElement(`div`);e.classList.add(`entries__scroll`),this.#r.replaceWith(e),e.appendChild(this.#r),this.#i=e}#g(){let e=document.createElement(`nav`);e.classList.add(`entries__nav`),e.setAttribute(`aria-label`,`Column selector`),e.setAttribute(`aria-hidden`,`true`),this.#o=this.#t.map((t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.classList.add(`entries__nav-btn`),r.textContent=this.#n[n]??t,r.setAttribute(`aria-pressed`,String(n===0)),r.addEventListener(`click`,()=>this.#_(n)),e.appendChild(r),r}),this.#i.before(e),this.#a=e}#_(e){this.#c=e;for(let t=0;t<this.#o.length;t++)this.#o[t].setAttribute(`aria-pressed`,String(t===e));if(this.singular)this.#v(e);else{let t=this.#s[e];t&&this.#i&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`start`})}this.dispatchEvent(new CustomEvent(`entries-column-change`,{detail:{column:e,header:this.#t[e]},bubbles:!0,composed:!0}))}#v(e){if(!this.#r)return;let t=e+1;for(let e of this.#r.rows)for(let n=1;n<e.cells.length;n++)e.cells[n].hidden=n!==t}#y(){if(this.#r)for(let e of this.#r.rows)for(let t=1;t<e.cells.length;t++)e.cells[t].hidden=!1}#b(){let e=this.breakpoint||`40rem`,t=document.createElement(`div`);t.style.width=e,t.style.position=`absolute`,t.style.visibility=`hidden`,this.appendChild(t);let n=t.offsetWidth;return t.remove(),n}#x(){this.#u=new ResizeObserver(this.#S),this.#u.observe(this)}#S=e=>{let t=e[0];if(!t)return;let n=t.contentBoxSize?.[0]?.inlineSize??t.contentRect.width;this.#l=n>=this.#d,this.#l?(this.classList.add(`entries--wide`),this.singular&&this.projection&&this.#y()):(this.classList.remove(`entries--wide`),this.singular&&this.projection&&this.#v(this.#c))}};customElements.get(`wc-entries`)||customElements.define(`wc-entries`,Ft);var It=class extends ${static styles=[$.styles,o`
|
|
547
|
+
:host {
|
|
548
|
+
display: none;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
:host(:defined) {
|
|
552
|
+
display: inline-flex;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.toggle__group {
|
|
556
|
+
display: inline-flex;
|
|
557
|
+
border-radius: var(--color-scheme-toggle-radius, 0.5rem);
|
|
558
|
+
overflow: hidden;
|
|
559
|
+
border: var(--color-scheme-toggle-border, 1px solid oklch(0.5 0 0 / 0.2));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.toggle__segment {
|
|
563
|
+
display: inline-flex;
|
|
564
|
+
align-items: center;
|
|
565
|
+
justify-content: center;
|
|
566
|
+
gap: 0.375rem;
|
|
567
|
+
padding: var(--color-scheme-toggle-padding, 0.5rem 0.75rem);
|
|
568
|
+
border: none;
|
|
569
|
+
background: var(--color-scheme-toggle-bg, oklch(0.95 0 0));
|
|
570
|
+
color: var(--color-scheme-toggle-color, oklch(0.3 0 0));
|
|
571
|
+
font-size: var(--color-scheme-toggle-font-size, 0.875rem);
|
|
572
|
+
font-family: inherit;
|
|
573
|
+
cursor: pointer;
|
|
574
|
+
transition:
|
|
575
|
+
background-color 0.15s ease,
|
|
576
|
+
color 0.15s ease;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.toggle__segment:not(:last-child) {
|
|
580
|
+
border-inline-end: 1px solid oklch(0.5 0 0 / 0.15);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.toggle__segment:hover {
|
|
584
|
+
background: var(--color-scheme-toggle-hover-bg, oklch(0.9 0 0));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.toggle__segment[aria-pressed='true'] {
|
|
588
|
+
background: var(--color-scheme-toggle-active-bg, oklch(0.25 0.02 260));
|
|
589
|
+
color: var(--color-scheme-toggle-active-color, oklch(0.95 0 0));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.toggle__segment:focus-visible {
|
|
593
|
+
outline: 2px solid var(--color-scheme-toggle-focus-color, oklch(0.6 0.2 250));
|
|
594
|
+
outline-offset: 2px;
|
|
595
|
+
z-index: 1;
|
|
596
|
+
position: relative;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.toggle__icon {
|
|
600
|
+
inline-size: 1em;
|
|
601
|
+
block-size: 1em;
|
|
602
|
+
flex-shrink: 0;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/* Sun icon */
|
|
606
|
+
.toggle__icon--light {
|
|
607
|
+
background: currentColor;
|
|
608
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
|
|
609
|
+
mask-size: contain;
|
|
610
|
+
mask-repeat: no-repeat;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/* Moon icon */
|
|
614
|
+
.toggle__icon--dark {
|
|
615
|
+
background: currentColor;
|
|
616
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
|
|
617
|
+
mask-size: contain;
|
|
618
|
+
mask-repeat: no-repeat;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/* System icon (monitor) */
|
|
622
|
+
.toggle__icon--system {
|
|
623
|
+
background: currentColor;
|
|
624
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2' ry='2'/%3E%3Cline x1='8' y1='21' x2='16' y2='21'/%3E%3Cline x1='12' y1='17' x2='12' y2='21'/%3E%3C/svg%3E");
|
|
625
|
+
mask-size: contain;
|
|
626
|
+
mask-repeat: no-repeat;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.toggle__label {
|
|
630
|
+
display: none;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
@container (min-width: 400px) {
|
|
634
|
+
.toggle__label {
|
|
635
|
+
display: inline;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
@media (prefers-reduced-motion: reduce) {
|
|
640
|
+
.toggle__segment {
|
|
641
|
+
transition: none;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
`];static properties={scheme:{type:String,reflect:!0}};_mediaQuery=null;_boundMediaHandler=null;constructor(){super(),this.init()}init(){this.scheme=`system`}connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia(`(prefers-color-scheme: dark)`),this._boundMediaHandler=this._handleMediaChange.bind(this),this._mediaQuery.addEventListener(`change`,this._boundMediaHandler),this._applyColorScheme()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery&&this._boundMediaHandler&&this._mediaQuery.removeEventListener(`change`,this._boundMediaHandler),document.documentElement.style.removeProperty(`color-scheme`),delete document.documentElement.dataset.theme}_handleMediaChange(e){this.scheme===`system`&&this.requestUpdate()}_applyColorScheme(){let e=document.documentElement;this.scheme===`system`?(e.style.removeProperty(`color-scheme`),delete e.dataset.theme):(e.style.colorScheme=`${this.scheme} only`,e.dataset.theme=this.scheme)}_handleSegmentClick(e){this.scheme!==e&&(this.scheme=e,this._applyColorScheme(),this.dispatchEvent(new CustomEvent(`scheme-change`,{detail:{scheme:this.scheme},bubbles:!0,composed:!0})))}updated(e){e.has(`scheme`)&&this._applyColorScheme()}_getEffectiveScheme(){return this.scheme===`system`?this._mediaQuery?.matches?`dark`:`light`:this.scheme}render(){return this._getEffectiveScheme(),Q`
|
|
645
|
+
<div class="toggle__group" role="group" aria-label="Color scheme" part="group">
|
|
646
|
+
<button
|
|
647
|
+
class="toggle__segment"
|
|
648
|
+
part="system"
|
|
649
|
+
type="button"
|
|
650
|
+
aria-pressed=${this.scheme===`system`}
|
|
651
|
+
@click=${()=>this._handleSegmentClick(`system`)}
|
|
652
|
+
>
|
|
653
|
+
<span class="toggle__icon toggle__icon--system" aria-hidden="true"></span>
|
|
654
|
+
<span class="toggle__label">System</span>
|
|
655
|
+
</button>
|
|
656
|
+
<button
|
|
657
|
+
class="toggle__segment"
|
|
658
|
+
part="light"
|
|
659
|
+
type="button"
|
|
660
|
+
aria-pressed=${this.scheme===`light`}
|
|
661
|
+
@click=${()=>this._handleSegmentClick(`light`)}
|
|
662
|
+
>
|
|
663
|
+
<span class="toggle__icon toggle__icon--light" aria-hidden="true"></span>
|
|
664
|
+
<span class="toggle__label">Light</span>
|
|
665
|
+
</button>
|
|
666
|
+
<button
|
|
667
|
+
class="toggle__segment"
|
|
668
|
+
part="dark"
|
|
669
|
+
type="button"
|
|
670
|
+
aria-pressed=${this.scheme===`dark`}
|
|
671
|
+
@click=${()=>this._handleSegmentClick(`dark`)}
|
|
672
|
+
>
|
|
673
|
+
<span class="toggle__icon toggle__icon--dark" aria-hidden="true"></span>
|
|
674
|
+
<span class="toggle__label">Dark</span>
|
|
675
|
+
</button>
|
|
676
|
+
</div>
|
|
677
|
+
`}};customElements.get(`color-scheme-toggle`)||customElements.define(`color-scheme-toggle`,It);var Lt=class extends ${static styles=[$.styles,o`
|
|
678
|
+
:host {
|
|
679
|
+
--_gap: var(--multi-field-gap, 0.5rem);
|
|
680
|
+
--_input-padding: var(--multi-field-input-padding, 0.5rem 0.75rem);
|
|
681
|
+
--_radius: var(--multi-field-border-radius, 0.375rem);
|
|
682
|
+
--_border-color: var(--multi-field-border-color, oklch(0.8 0 0));
|
|
683
|
+
--_focus-color: var(--multi-field-focus-color, oklch(0.6 0.2 250));
|
|
684
|
+
--_button-bg: var(--multi-field-button-bg, oklch(0.95 0 0));
|
|
685
|
+
--_button-hover-bg: var(--multi-field-button-hover-bg, oklch(0.9 0 0));
|
|
686
|
+
--_delete-color: var(--multi-field-delete-color, oklch(0.6 0.2 25));
|
|
687
|
+
--_delete-hover-bg: var(--multi-field-delete-hover-bg, oklch(0.95 0.05 25));
|
|
688
|
+
|
|
689
|
+
display: block;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.container {
|
|
693
|
+
display: flex;
|
|
694
|
+
flex-direction: column;
|
|
695
|
+
gap: var(--_gap);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
.entries {
|
|
699
|
+
display: flex;
|
|
700
|
+
flex-direction: column;
|
|
701
|
+
gap: var(--_gap);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.entry {
|
|
705
|
+
display: flex;
|
|
706
|
+
align-items: center;
|
|
707
|
+
gap: var(--_gap);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.entry__input {
|
|
711
|
+
flex: 1;
|
|
712
|
+
padding: var(--_input-padding);
|
|
713
|
+
border: 1px solid var(--_border-color);
|
|
714
|
+
border-radius: var(--_radius);
|
|
715
|
+
font: inherit;
|
|
716
|
+
background: transparent;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
.entry__input:focus-visible {
|
|
720
|
+
outline: 2px solid var(--_focus-color);
|
|
721
|
+
outline-offset: 2px;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
.entry__input:disabled {
|
|
725
|
+
opacity: 0.6;
|
|
726
|
+
cursor: not-allowed;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.entry__delete {
|
|
730
|
+
display: inline-flex;
|
|
731
|
+
align-items: center;
|
|
732
|
+
justify-content: center;
|
|
733
|
+
min-inline-size: 2rem;
|
|
734
|
+
min-block-size: 2rem;
|
|
735
|
+
padding: 0.25rem;
|
|
736
|
+
background: transparent;
|
|
737
|
+
border: 1px solid transparent;
|
|
738
|
+
border-radius: var(--_radius);
|
|
739
|
+
color: var(--_delete-color);
|
|
740
|
+
cursor: pointer;
|
|
741
|
+
transition: background-color 0.15s ease;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.entry__delete:hover:not(:disabled) {
|
|
745
|
+
background: var(--_delete-hover-bg);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.entry__delete:focus-visible {
|
|
749
|
+
outline: 2px solid var(--_focus-color);
|
|
750
|
+
outline-offset: 2px;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
.entry__delete:disabled {
|
|
754
|
+
opacity: 0.3;
|
|
755
|
+
cursor: not-allowed;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
.entry__delete-icon {
|
|
759
|
+
inline-size: 1rem;
|
|
760
|
+
block-size: 1rem;
|
|
761
|
+
background-color: currentColor;
|
|
762
|
+
mask-size: contain;
|
|
763
|
+
mask-repeat: no-repeat;
|
|
764
|
+
mask-position: center;
|
|
765
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z'/%3E%3C/svg%3E");
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.actions {
|
|
769
|
+
display: flex;
|
|
770
|
+
gap: var(--_gap);
|
|
771
|
+
flex-wrap: wrap;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.action-button {
|
|
775
|
+
display: inline-flex;
|
|
776
|
+
align-items: center;
|
|
777
|
+
gap: 0.375rem;
|
|
778
|
+
padding: 0.5rem 0.75rem;
|
|
779
|
+
background: var(--_button-bg);
|
|
780
|
+
border: 1px solid var(--_border-color);
|
|
781
|
+
border-radius: var(--_radius);
|
|
782
|
+
font: inherit;
|
|
783
|
+
font-size: 0.875em;
|
|
784
|
+
cursor: pointer;
|
|
785
|
+
transition: background-color 0.15s ease;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.action-button:hover:not(:disabled) {
|
|
789
|
+
background: var(--_button-hover-bg);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.action-button:focus-visible {
|
|
793
|
+
outline: 2px solid var(--_focus-color);
|
|
794
|
+
outline-offset: 2px;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.action-button:disabled {
|
|
798
|
+
opacity: 0.5;
|
|
799
|
+
cursor: not-allowed;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
.action-button__icon {
|
|
803
|
+
inline-size: 0.875rem;
|
|
804
|
+
block-size: 0.875rem;
|
|
805
|
+
background-color: currentColor;
|
|
806
|
+
mask-size: contain;
|
|
807
|
+
mask-repeat: no-repeat;
|
|
808
|
+
mask-position: center;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
.action-button__icon--add {
|
|
812
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z'/%3E%3C/svg%3E");
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
.action-button__icon--clear {
|
|
816
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath d='M290.7 57.4L57.4 290.7c-25 25-25 65.5 0 90.5l80 80c12 12 28.3 18.7 45.3 18.7H288h9.4H512c17.7 0 32-14.3 32-32s-14.3-32-32-32H387.9L518.6 285.3c25-25 25-65.5 0-90.5L381.3 57.4c-25-25-65.5-25-90.5 0zM297.4 416H288l-105.4 0-80-80L227.3 211.3 364.7 348.7 297.4 416z'/%3E%3C/svg%3E");
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/* Hidden slot for initial values */
|
|
820
|
+
.initial-slot {
|
|
821
|
+
display: none;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/* Reduced motion */
|
|
825
|
+
@media (prefers-reduced-motion: reduce) {
|
|
826
|
+
.entry__delete,
|
|
827
|
+
.action-button {
|
|
828
|
+
transition: none;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
`];static properties={name:{type:String},type:{type:String},placeholder:{type:String},protectDefaults:{type:Boolean,attribute:`protect-defaults`},min:{type:Number},max:{type:Number},addLabel:{type:String,attribute:`add-label`},clearLabel:{type:String,attribute:`clear-label`},deleteLabel:{type:String,attribute:`delete-label`},_entries:{type:Array,state:!0},_initialized:{type:Boolean,state:!0}};constructor(){super(),this.init()}init(){this.name=void 0,this.type=`text`,this.placeholder=``,this.protectDefaults=!1,this.min=1,this.max=0,this.addLabel=`Add`,this.clearLabel=`Clear`,this.deleteLabel=`Delete`,this._entries=[],this._initialized=!1,this._idCounter=0}_generateId(){return`entry-${++this._idCounter}`}_initializeFromSlot(){if(this._initialized)return;let e=this.getSlottedNodes([`input`]),t=[];for(let n of e){let e=n,r=e.value||e.getAttribute(`value`)||``;t.push({id:this._generateId(),value:r,isDefault:!0})}for(;t.length<this.min;)t.push({id:this._generateId(),value:``,isDefault:!1});t.length===0&&t.push({id:this._generateId(),value:``,isDefault:!1}),this._entries=t,this._initialized=!0}firstUpdated(){this._initializeFromSlot()}willUpdate(e){if(e.has(`min`)&&this._initialized)for(;this._entries.length<this.min;)this._entries=[...this._entries,{id:this._generateId(),value:``,isDefault:!1}]}_getValues(){return this._entries.map(e=>e.value)}_dispatchChange(){this.dispatchEvent(new CustomEvent(`multi-field-change`,{detail:{values:this._getValues()},bubbles:!0,composed:!0}))}_handleInput(e,t){let n=t.target;this._entries=this._entries.map(t=>t.id===e?{...t,value:n.value}:t),this._dispatchChange()}_handleAdd=()=>{if(this.max>0&&this._entries.length>=this.max)return;let e={id:this._generateId(),value:``,isDefault:!1};this._entries=[...this._entries,e],this.dispatchEvent(new CustomEvent(`multi-field-add`,{bubbles:!0,composed:!0})),this._dispatchChange(),this.updateComplete.then(()=>{let e=this.renderRoot.querySelectorAll(`.entry__input`);e[e.length-1]?.focus()})};_handleDelete(e){let t=this._entries.find(t=>t.id===e);if(!t||this.protectDefaults&&t.isDefault||this._entries.length<=this.min)return;let n=t.value;this._entries=this._entries.filter(t=>t.id!==e),this.dispatchEvent(new CustomEvent(`multi-field-delete`,{detail:{value:n},bubbles:!0,composed:!0})),this._dispatchChange()}_handleClear=()=>{let e;for(e=this.protectDefaults?this._entries.filter(e=>e.isDefault):[];e.length<this.min;)e.push({id:this._generateId(),value:``,isDefault:!1});this._entries=e,this.dispatchEvent(new CustomEvent(`multi-field-clear`,{bubbles:!0,composed:!0})),this._dispatchChange()};_canDelete(e){return!(this._entries.length<=this.min||this.protectDefaults&&e.isDefault)}_canAdd(){return!(this.max>0&&this._entries.length>=this.max)}_canClear(){return this.protectDefaults?this._entries.some(e=>!e.isDefault):this._entries.length>this.min}render(){return Q`
|
|
832
|
+
<div class="container" part="container">
|
|
833
|
+
<div class="initial-slot">
|
|
834
|
+
<slot @slotchange=${this._initializeFromSlot}></slot>
|
|
835
|
+
</div>
|
|
836
|
+
|
|
837
|
+
<div class="entries" part="entries" role="list">
|
|
838
|
+
${this._entries.map(e=>Q`
|
|
839
|
+
<div class="entry" part="entry" role="listitem">
|
|
840
|
+
<input
|
|
841
|
+
class="entry__input"
|
|
842
|
+
part="input"
|
|
843
|
+
type=${this.type}
|
|
844
|
+
name=${this.name?`${this.name}[]`:``}
|
|
845
|
+
placeholder=${this.placeholder}
|
|
846
|
+
.value=${e.value}
|
|
847
|
+
@input=${t=>this._handleInput(e.id,t)}
|
|
848
|
+
?data-default=${e.isDefault}
|
|
849
|
+
/>
|
|
850
|
+
<button
|
|
851
|
+
type="button"
|
|
852
|
+
class="entry__delete"
|
|
853
|
+
part="delete-button"
|
|
854
|
+
aria-label=${this.deleteLabel}
|
|
855
|
+
?disabled=${!this._canDelete(e)}
|
|
856
|
+
@click=${()=>this._handleDelete(e.id)}
|
|
857
|
+
>
|
|
858
|
+
<span class="entry__delete-icon" aria-hidden="true"></span>
|
|
859
|
+
</button>
|
|
860
|
+
</div>
|
|
861
|
+
`)}
|
|
862
|
+
</div>
|
|
863
|
+
|
|
864
|
+
<div class="actions" part="actions">
|
|
865
|
+
<button
|
|
866
|
+
type="button"
|
|
867
|
+
class="action-button"
|
|
868
|
+
part="add-button"
|
|
869
|
+
?disabled=${!this._canAdd()}
|
|
870
|
+
@click=${this._handleAdd}
|
|
871
|
+
>
|
|
872
|
+
<span class="action-button__icon action-button__icon--add" aria-hidden="true"></span>
|
|
873
|
+
<slot name="add-label">${this.addLabel}</slot>
|
|
874
|
+
</button>
|
|
875
|
+
<button
|
|
876
|
+
type="button"
|
|
877
|
+
class="action-button"
|
|
878
|
+
part="clear-button"
|
|
879
|
+
?disabled=${!this._canClear()}
|
|
880
|
+
@click=${this._handleClear}
|
|
881
|
+
>
|
|
882
|
+
<span class="action-button__icon action-button__icon--clear" aria-hidden="true"></span>
|
|
883
|
+
<slot name="clear-label">${this.clearLabel}</slot>
|
|
884
|
+
</button>
|
|
885
|
+
</div>
|
|
886
|
+
</div>
|
|
887
|
+
`}};customElements.get(`multi-field`)||customElements.define(`multi-field`,Lt);
|