@telperion/elements 5.1.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-manifest.json +1 -1
- package/button/button.element.cjs +16 -8
- package/button/button.element.cjs.map +1 -1
- package/button/button.element.js +16 -8
- package/button/button.element.js.map +1 -1
- package/button/index.d.cts +3 -0
- package/button/index.d.ts +3 -0
- package/fesm/elements.mjs +85 -8
- package/fesm/elements.mjs.map +1 -1
- package/iife/button/index.js +16 -11
- package/iife/button/index.js.map +1 -1
- package/iife/elements.js +30 -25
- package/iife/elements.js.map +1 -1
- package/iife/select/index.js +18 -18
- package/iife/select/index.js.map +1 -1
- package/package.json +1 -1
- package/select/index.d.cts +75 -0
- package/select/index.d.ts +75 -0
- package/select/select.element.cjs +69 -0
- package/select/select.element.cjs.map +1 -1
- package/select/select.element.js +69 -0
- package/select/select.element.js.map +1 -1
package/iife/elements.js
CHANGED
|
@@ -4,12 +4,12 @@ var TelperionElements=function(t){"use strict";function e(t,e,r,n){var s,i=argum
|
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
const n=globalThis,s=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;let a=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(e,t))}return t}toString(){return this.cssText}};const l=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1],t[0]);return new a(r,t,i)},c=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:h,defineProperty:d,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:
|
|
7
|
+
const n=globalThis,s=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;let a=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(e,t))}return t}toString(){return this.cssText}};const l=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[n+1],t[0]);return new a(r,t,i)},c=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:h,defineProperty:d,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,f=globalThis,m=f.trustedTypes,y=m?m.emptyScript:"",b=f.reactiveElementPolyfillSupport,E=(t,e)=>t,S={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},w=(t,e)=>!h(t,e),C={attribute:!0,type:String,converter:S,reflect:!1,useDefault:!1,hasChanged:w};
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/Symbol.metadata??=Symbol("metadata"),
|
|
12
|
+
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=C){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&d(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:s}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const i=n?.call(this);s?.call(this,e),this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??C}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;const t=v(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){const t=this.properties,e=[...u(t),...g(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(s)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const r of e){const e=document.createElement("style"),s=n.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=r.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const s=(void 0!==r.converter?.toAttribute?r.converter:S).toAttribute(e,r.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:S;this._$Em=n;const i=s.fromAttribute(e,t.type);this[n]=i??this._$Ej?.get(n)??i,this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){const n=this.constructor,s=this[t];if(r??=n.getPropertyOptions(t),!((r.hasChanged??w)(s,e)||r.useDefault&&r.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:s},i){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==s||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,r,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[E("elementProperties")]=new Map,$[E("finalized")]=new Map,b?.({ReactiveElement:$}),(f.reactiveElementVersions??=[]).push("2.1.1");
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
@@ -36,7 +36,7 @@ const ht=t=>(e,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(t,e)}
|
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/function gt(t){return ut({...t,state:!0,attribute:!1})}var
|
|
39
|
+
*/function gt(t){return ut({...t,state:!0,attribute:!1})}var vt=Object.defineProperty,ft=(t,e,r)=>(((t,e,r)=>{e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r),mt=(t,e)=>{if(Object(e)!==e)throw TypeError('Cannot use the "in" operator on this value');return t.has(e)},yt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},bt=(t,e,r)=>(((t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)})(t,e,"access private method"),r);
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -82,7 +82,7 @@ function(){throw new Error};function Vt(){return At(this),this.value}function zt
|
|
|
82
82
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
83
83
|
* See the License for the specific language governing permissions and
|
|
84
84
|
* limitations under the License.
|
|
85
|
-
*/(t))}const Bt=(()=>({..._t,equal:Et,value:void 0}))();const qt=Symbol("node");var Ft;(t=>{var e,r,n,s;e=qt,r=new WeakSet,t.isState=t=>"object"==typeof t&&mt(r,t),t.State=class{constructor(n,s={}){yt(this,r),
|
|
85
|
+
*/(t))}const Bt=(()=>({..._t,equal:Et,value:void 0}))();const qt=Symbol("node");var Ft;(t=>{var e,r,n,s;e=qt,r=new WeakSet,t.isState=t=>"object"==typeof t&&mt(r,t),t.State=class{constructor(n,s={}){yt(this,r),ft(this,e);const i=
|
|
86
86
|
/**
|
|
87
87
|
* @license
|
|
88
88
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -90,7 +90,7 @@ function(){throw new Error};function Vt(){return At(this),this.value}function zt
|
|
|
90
90
|
* Use of this source code is governed by an MIT-style license that can be
|
|
91
91
|
* found in the LICENSE file at https://angular.io/license
|
|
92
92
|
*/
|
|
93
|
-
function(t){const e=Object.create(Bt);e.value=t;const r=()=>(At(e),e.value);return r[$t]=e,r}(n),o=i[$t];if(this[qt]=o,o.wrapper=this,s){const e=s.equals;e&&(o.equal=e),o.watched=s[t.subtle.watched],o.unwatched=s[t.subtle.unwatched]}}get(){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return Vt.call(this[qt])}set(e){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(wt)throw new Error("Writes to signals not permitted during Watcher callback");zt(this[qt],e)}};n=qt,s=new WeakSet,t.isComputed=t=>"object"==typeof t&&mt(s,t),t.Computed=class{constructor(e,r){yt(this,s),
|
|
93
|
+
function(t){const e=Object.create(Bt);e.value=t;const r=()=>(At(e),e.value);return r[$t]=e,r}(n),o=i[$t];if(this[qt]=o,o.wrapper=this,s){const e=s.equals;e&&(o.equal=e),o.watched=s[t.subtle.watched],o.unwatched=s[t.subtle.unwatched]}}get(){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return Vt.call(this[qt])}set(e){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(wt)throw new Error("Writes to signals not permitted during Watcher callback");zt(this[qt],e)}};n=qt,s=new WeakSet,t.isComputed=t=>"object"==typeof t&&mt(s,t),t.Computed=class{constructor(e,r){yt(this,s),ft(this,n);const i=function(t){const e=Object.create(Wt);e.computation=t;const r=()=>Mt(e);return r[$t]=e,r}(e),o=i[$t];if(o.consumerAllowSignalWrites=!0,this[qt]=o,o.wrapper=this,r){const e=r.equals;e&&(o.equal=e),o.watched=r[t.subtle.watched],o.unwatched=r[t.subtle.unwatched]}}get(){if(!(0,t.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return Mt(this[qt])}},(e=>{var r,n,s,i;e.untrack=function(t){let e,r=null;try{r=kt(null),e=t()}finally{kt(r)}return e},e.introspectSources=function(e){var r;if(!(0,t.isComputed)(e)&&!(0,t.isWatcher)(e))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(r=e[qt].producerNode)?void 0:r.map(t=>t.wrapper))??[]},e.introspectSinks=function(e){var r;if(!(0,t.isComputed)(e)&&!(0,t.isState)(e))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(r=e[qt].liveConsumerNode)?void 0:r.map(t=>t.wrapper))??[]},e.hasSinks=function(e){if(!(0,t.isComputed)(e)&&!(0,t.isState)(e))throw new TypeError("Called hasSinks without a Signal argument");const r=e[qt].liveConsumerNode;return!!r&&r.length>0},e.hasSources=function(e){if(!(0,t.isComputed)(e)&&!(0,t.isWatcher)(e))throw new TypeError("Called hasSources without a Computed or Watcher argument");const r=e[qt].producerNode;return!!r&&r.length>0};r=qt,n=new WeakSet,s=new WeakSet,i=function(e){for(const r of e)if(!(0,t.isComputed)(r)&&!(0,t.isState)(r))throw new TypeError("Called watch/unwatch without a Computed or State argument")},t.isWatcher=t=>mt(n,t),e.Watcher=class{constructor(t){yt(this,n),yt(this,s),ft(this,r);let e=Object.create(_t);e.wrapper=this,e.consumerMarkedDirty=t,e.consumerIsAlwaysLive=!0,e.consumerAllowSignalWrites=!1,e.producerNode=[],this[qt]=e}watch(...e){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");bt(this,s,i).call(this,e);const r=this[qt];r.dirty=!1;const n=kt(r);for(const t of e)At(t[qt]);kt(n)}unwatch(...e){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");bt(this,s,i).call(this,e);const r=this[qt];Pt(r);for(let t=r.producerNode.length-1;t>=0;t--)if(e.includes(r.producerNode[t].wrapper)){Rt(r.producerNode[t],r.producerIndexOfThis[t]);const e=r.producerNode.length-1;if(r.producerNode[t]=r.producerNode[e],r.producerIndexOfThis[t]=r.producerIndexOfThis[e],r.producerNode.length--,r.producerIndexOfThis.length--,r.nextProducerIndex--,t<r.producerNode.length){const e=r.producerIndexOfThis[t],n=r.producerNode[t];Lt(n),n.liveConsumerIndexOfThis[e]=t}}}getPending(){if(!(0,t.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[qt].producerNode.filter(t=>t.dirty).map(t=>t.wrapper)}},e.currentComputed=function(){var t;return null==(t=St)?void 0:t.wrapper},e.watched=Symbol("watched"),e.unwatched=Symbol("unwatched")})(t.subtle||(t.subtle={}))})(Ft||(Ft={}));
|
|
94
94
|
/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2023 Google LLC
|
|
@@ -128,17 +128,17 @@ const Qt=2;let Xt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,
|
|
|
128
128
|
* Copyright 2023 Google LLC
|
|
129
129
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
130
130
|
*/
|
|
131
|
-
Ft.State,Ft.Computed;const de=(t,e)=>new Ft.State(t,e),pe=(t,e)=>new Ft.Computed(t,e);var ue,ge;const fe=Symbol("ThaRoute:fragment"),ve=Symbol("ThaRoute:path-pattern");function me(){}t.ThaRoute=class extends lt{constructor(){super(...arguments),this[ue]=de(this.#t()),this[ge]=null,this.path=null,this.#e=new MutationObserver(()=>{this[fe].set(this.#t())})}static{ue=fe,ge=ve}#e;connectedCallback(){super.connectedCallback(),this.#e.observe(this,{childList:!0})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"path"===t)this[ve]=r?new URLPattern({pathname:r}):null}#t(){const t=this.querySelector("template");return t?new WeakRef(t.content):null}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}},e([ut({type:String}),r("design:type",Object)],t.ThaRoute.prototype,"path",void 0),t.ThaRoute=e([ht("tha-route")],t.ThaRoute);const ye=function(t){return!0===t[Jt]?(console.warn("SignalWatcher should not be applied to the same class more than once."),t):class extends t{constructor(){super(...arguments),this._$St=new Map,this._$So=new Ft.State(0),this._$Si=!1}_$Sl(){var t,e;const r=[],n=[];this._$St.forEach((t,e)=>{((null==t?void 0:t.beforeUpdate)?r:n).push(e)});const s=null===(t=this.h)||void 0===t?void 0:t.getPending().filter(t=>t!==this._$Su&&!this._$St.has(t));r.forEach(t=>t.get()),null===(e=this._$Su)||void 0===e||e.get(),s.forEach(t=>t.get()),n.forEach(t=>t.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(void 0!==this.h)return;this._$Su=new Ft.Computed(()=>{this._$So.get(),super.performUpdate()});const t=this.h=new Ft.subtle.Watcher(function(){const t=Yt.get(this);void 0!==t&&(!1===t._$Si&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});Yt.set(t,this),Kt.register(this,t),t.watch(this._$Su),t.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(void 0===this.h)return;let t=!1;this.h.unwatch(...Ft.subtle.introspectSources(this.h).filter(e=>{var r;const n=!0!==(null===(r=this._$St.get(e))||void 0===r?void 0:r.manualDispose);return n&&this._$St.delete(e),t||(t=!n),n})),t||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(t,e){var r;this._$S_();const n=new Ft.Computed(()=>{t()});return this.h.watch(n),this._$St.set(n,e),null!==(r=null==e?void 0:e.beforeUpdate)&&void 0!==r&&r?Ft.subtle.untrack(()=>n.get()):this.updateComplete.then(()=>Ft.subtle.untrack(()=>n.get())),()=>{this._$St.delete(n),this.h.unwatch(n),!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()})}}}(lt);function be(){return be=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},be.apply(null,arguments)}var Ee;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(Ee||(Ee={}));var Se="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function we(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var Ce="beforeunload",$e="popstate";function ke(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=De(r.location.hash.substr(1)),e=t.pathname,s=void 0===e?"/":e,i=t.search,o=void 0===i?"":i,a=t.hash,l=void 0===a?"":a,c=n.state||{};return[c.idx,Se({pathname:s,search:o,hash:l,state:c.usr||null,key:c.key||"default"})]}var i=null;function o(){if(i)p.call(i),i=null;else{var t=Ee.Pop,e=s(),r=e[0],n=e[1];if(p.length)if(null!=r){var o=c-r;o&&(i={action:t,location:n,retry:function(){y(-1*o)}},y(o))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(t)}}r.addEventListener($e,o),r.addEventListener("hashchange",function(){Te(s()[1])!==Te(h)&&o()});var a=Ee.Pop,l=s(),c=l[0],h=l[1],d=Oe(),p=Oe();function u(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var n=r.location.href,s=n.indexOf("#");e=-1===s?n:n.slice(0,s)}return e}()+"#"+("string"==typeof t?t:Te(t))}function g(t,e){return void 0===e&&(e=null),Se(be({pathname:h.pathname,hash:"",search:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function f(t,e){return[{usr:t.state,key:t.key,idx:e},u(t)]}function v(t,e,r){return!p.length||(p.call({action:t,location:e,retry:r}),!1)}function m(t){a=t;var e=s();c=e[0],h=e[1],d.call({action:a,location:h})}function y(t){n.go(t)}null==c&&(c=0,n.replaceState(be({},n.state,{idx:c}),""));var b={get action(){return a},get location(){return h},createHref:u,push:function t(e,s){var i=Ee.Push,o=g(e,s);if("production"!==process.env.NODE_ENV&&we("/"===o.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(e)+")"),v(i,o,function(){t(e,s)})){var a=f(o,c+1),l=a[0],h=a[1];try{n.pushState(l,"",h)}catch(t){r.location.assign(h)}m(i)}},replace:function t(e,r){var s=Ee.Replace,i=g(e,r);if("production"!==process.env.NODE_ENV&&we("/"===i.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(e)+")"),v(s,i,function(){t(e,r)})){var o=f(i,c),a=o[0],l=o[1];n.replaceState(a,"",l),m(s)}},go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(t){return d.push(t)},block:function(t){var e=p.push(t);return 1===p.length&&r.addEventListener(Ce,Ae),function(){e(),p.length||r.removeEventListener(Ce,Ae)}}};return b}function _e(t,e,r){return Math.min(Math.max(t,e),r)}function Ae(t){t.preventDefault(),t.returnValue=""}function Oe(){var t=[];return{get length(){return t.length},push:function(e){return t.push(e),function(){t=t.filter(function(t){return t!==e})}},call:function(e){t.forEach(function(t){return t&&t(e)})}}}function xe(){return Math.random().toString(36).substr(2,8)}function Te(t){var e=t.pathname,r=void 0===e?"/":e,n=t.search,s=void 0===n?"":n,i=t.hash,o=void 0===i?"":i;return s&&"?"!==s&&(r+="?"===s.charAt(0)?s:"?"+s),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}function De(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const Re={},Ne=de("browser");function Pe(t){let e=Re[t];if(!e){switch(t){case"browser":e=function(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=r.location,e=t.pathname,s=t.search,i=t.hash,o=n.state||{};return[o.idx,Se({pathname:e,search:s,hash:i,state:o.usr||null,key:o.key||"default"})]}var i=null;r.addEventListener($e,function(){if(i)d.call(i),i=null;else{var t=Ee.Pop,e=s(),r=e[0],n=e[1];if(d.length)if(null!=r){var o=l-r;o&&(i={action:t,location:n,retry:function(){m(-1*o)}},m(o))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else v(t)}});var o=Ee.Pop,a=s(),l=a[0],c=a[1],h=Oe(),d=Oe();function p(t){return"string"==typeof t?t:Te(t)}function u(t,e){return void 0===e&&(e=null),Se(be({pathname:c.pathname,hash:"",search:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function g(t,e){return[{usr:t.state,key:t.key,idx:e},p(t)]}function f(t,e,r){return!d.length||(d.call({action:t,location:e,retry:r}),!1)}function v(t){o=t;var e=s();l=e[0],c=e[1],h.call({action:o,location:c})}function m(t){n.go(t)}null==l&&(l=0,n.replaceState(be({},n.state,{idx:l}),""));var y={get action(){return o},get location(){return c},createHref:p,push:function t(e,s){var i=Ee.Push,o=u(e,s);if(f(i,o,function(){t(e,s)})){var a=g(o,l+1),c=a[0],h=a[1];try{n.pushState(c,"",h)}catch(t){r.location.assign(h)}v(i)}},replace:function t(e,r){var s=Ee.Replace,i=u(e,r);if(f(s,i,function(){t(e,r)})){var o=g(i,l),a=o[0],c=o[1];n.replaceState(a,"",c),v(s)}},go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(t){return h.push(t)},block:function(t){var e=d.push(t);return 1===d.length&&r.addEventListener(Ce,Ae),function(){e(),d.length||r.removeEventListener(Ce,Ae)}}};return y}();break;case"hash":e=ke();break;default:e=function(t){void 0===t&&(t={});var e=t,r=e.initialEntries,n=void 0===r?["/"]:r,s=e.initialIndex,i=n.map(function(t){var e=Se(be({pathname:"/",search:"",hash:"",state:null,key:xe()},"string"==typeof t?De(t):t));return"production"!==process.env.NODE_ENV&&we("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),o=_e(null==s?i.length-1:s,0,i.length-1),a=Ee.Pop,l=i[o],c=Oe(),h=Oe();function d(t,e){return void 0===e&&(e=null),Se(be({pathname:l.pathname,search:"",hash:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function p(t,e,r){return!h.length||(h.call({action:t,location:e,retry:r}),!1)}function u(t,e){a=t,l=e,c.call({action:a,location:l})}function g(t){var e=_e(o+t,0,i.length-1),r=Ee.Pop,n=i[e];p(r,n,function(){g(t)})&&(o=e,u(r,n))}var f={get index(){return o},get action(){return a},get location(){return l},createHref:function(t){return"string"==typeof t?t:Te(t)},push:function t(e,r){var n=Ee.Push,s=d(e,r);"production"!==process.env.NODE_ENV&&we("/"===l.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(e)+")"),p(n,s,function(){t(e,r)})&&(o+=1,i.splice(o,i.length,s),u(n,s))},replace:function t(e,r){var n=Ee.Replace,s=d(e,r);"production"!==process.env.NODE_ENV&&we("/"===l.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(e)+")"),p(n,s,function(){t(e,r)})&&(i[o]=s,u(n,s))},go:g,back:function(){g(-1)},forward:function(){g(1)},listen:function(t){return c.push(t)},block:function(t){return h.push(t)}};return f}()}Re[t]=e}return e}pe(()=>Pe(Ne.get()));const Le=Symbol("HistoryManaged:history"),Me=Symbol("HistoryManaged:historyType"),Ie=t=>{var n,s;class i extends t{constructor(){super(...arguments),this.history=void 0,this.#r=de(this.history),this.#n=pe(()=>{const t=this.closest("tha-router-config, tha-router-outlet");return t?.[Me]?.get()}),this[n]=pe(()=>this.#r.get()??this.#n.get()??Ne.get()),this[s]=pe(()=>Pe(this[Me].get()))}static{n=Me,s=Le}#r;#n;attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"history"===t)this.#r.set(r)}}return e([ut({type:String}),r("design:type",Object)],i.prototype,"history",void 0),i};function Ue(t=me){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var He;const We=Symbol("ThaRouterOutlet:renderRoute"),je=Symbol("ThaRouterOutlet:params");function Ve(t){return!!t}function ze(t){return t.filter(Ve)}t.ThaRouterOutlet=class extends ye{constructor(){super(...arguments),this.#s=de(void 0),this.#i=de(null),this.#o=pe(()=>this.#i.get()?.deref()?.[fe].get()??null),this.#a=pe(()=>{const t=this.#s.get()?.deref(),e=this.#i.get()?.deref(),r=e?.[ve];if(!t||!r)return null;const{location:{pathname:n}}=t[Le].get();return r.exec(n,"http://dummy.base")?.pathname.groups??null}),this[He]=pe(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[je].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#l=me,this.#c=me,this.#h=me,this.for=null,this.routePath=null,this.routeID=void 0}#s;#i;#o;#a;#l;#c;#h;connectedCallback(){super.connectedCallback(),Ue(()=>{this.bindToRouter()}),this.#l=this.updateEffect(()=>{Array.from(this.renderRoot.children).forEach(t=>t.remove());const t=this.#o.get()?.deref()??null;t&&this.renderRoot.appendChild(t.cloneNode(!0))}),this.#c=this.updateEffect(()=>{const t=this.#i.get()?.deref()??null;this.routePath=t?.getAttribute("path")??null,this.routeID=t?.id?t?.id:void 0}),this.#h=this.updateEffect(()=>{const t=this[je].get();Array.from(this.attributes).filter(t=>t.name.startsWith("param-")).filter(e=>!(e.name.slice(6)in t)).forEach(t=>{this.removeAttribute(t.name)});for(const[e,r]of Object.entries(t))this.setAttribute(`param-${e}`,r??"");this.params=t})}bindToRouter(t){if(!t)if(this.for){t=this.getRootNode().querySelector(`tha-router#${this.for}`)??void 0}else t=this.closest("tha-router")??void 0;const e=this.#s?.get()?.deref()??null;return e===t?e:(e?.assignOutlet(null),t?.assignOutlet(this),this.#s.set(t?new WeakRef(t):void 0),t??null)}[(He=je,We)](t){this.#i.set(t?new WeakRef(t):null)}disconnectedCallback(){super.disconnectedCallback(),this.#s?.get()?.deref()?.assignOutlet(null);try{this.#l(),this.#c(),this.#h()}catch{}}createRenderRoot(){return this}},e([gt(),r("design:type",Object)],t.ThaRouterOutlet.prototype,"params",void 0),e([ut({type:String}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"for",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routePath",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routeID",void 0),t.ThaRouterOutlet=e([ht("tha-router-outlet")],t.ThaRouterOutlet),t.ThaRouter=class extends(Ie(ye)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=l`
|
|
131
|
+
Ft.State,Ft.Computed;const de=(t,e)=>new Ft.State(t,e),pe=(t,e)=>new Ft.Computed(t,e);var ue,ge;const ve=Symbol("ThaRoute:fragment"),fe=Symbol("ThaRoute:path-pattern");function me(){}t.ThaRoute=class extends lt{constructor(){super(...arguments),this[ue]=de(this.#t()),this[ge]=null,this.path=null,this.#e=new MutationObserver(()=>{this[ve].set(this.#t())})}static{ue=ve,ge=fe}#e;connectedCallback(){super.connectedCallback(),this.#e.observe(this,{childList:!0})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"path"===t)this[fe]=r?new URLPattern({pathname:r}):null}#t(){const t=this.querySelector("template");return t?new WeakRef(t.content):null}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}},e([ut({type:String}),r("design:type",Object)],t.ThaRoute.prototype,"path",void 0),t.ThaRoute=e([ht("tha-route")],t.ThaRoute);const ye=function(t){return!0===t[Jt]?(console.warn("SignalWatcher should not be applied to the same class more than once."),t):class extends t{constructor(){super(...arguments),this._$St=new Map,this._$So=new Ft.State(0),this._$Si=!1}_$Sl(){var t,e;const r=[],n=[];this._$St.forEach((t,e)=>{((null==t?void 0:t.beforeUpdate)?r:n).push(e)});const s=null===(t=this.h)||void 0===t?void 0:t.getPending().filter(t=>t!==this._$Su&&!this._$St.has(t));r.forEach(t=>t.get()),null===(e=this._$Su)||void 0===e||e.get(),s.forEach(t=>t.get()),n.forEach(t=>t.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(void 0!==this.h)return;this._$Su=new Ft.Computed(()=>{this._$So.get(),super.performUpdate()});const t=this.h=new Ft.subtle.Watcher(function(){const t=Yt.get(this);void 0!==t&&(!1===t._$Si&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});Yt.set(t,this),Kt.register(this,t),t.watch(this._$Su),t.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(void 0===this.h)return;let t=!1;this.h.unwatch(...Ft.subtle.introspectSources(this.h).filter(e=>{var r;const n=!0!==(null===(r=this._$St.get(e))||void 0===r?void 0:r.manualDispose);return n&&this._$St.delete(e),t||(t=!n),n})),t||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(t,e){var r;this._$S_();const n=new Ft.Computed(()=>{t()});return this.h.watch(n),this._$St.set(n,e),null!==(r=null==e?void 0:e.beforeUpdate)&&void 0!==r&&r?Ft.subtle.untrack(()=>n.get()):this.updateComplete.then(()=>Ft.subtle.untrack(()=>n.get())),()=>{this._$St.delete(n),this.h.unwatch(n),!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()})}}}(lt);function be(){return be=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},be.apply(null,arguments)}var Ee;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(Ee||(Ee={}));var Se="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function we(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var Ce="beforeunload",$e="popstate";function ke(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=De(r.location.hash.substr(1)),e=t.pathname,s=void 0===e?"/":e,i=t.search,o=void 0===i?"":i,a=t.hash,l=void 0===a?"":a,c=n.state||{};return[c.idx,Se({pathname:s,search:o,hash:l,state:c.usr||null,key:c.key||"default"})]}var i=null;function o(){if(i)p.call(i),i=null;else{var t=Ee.Pop,e=s(),r=e[0],n=e[1];if(p.length)if(null!=r){var o=c-r;o&&(i={action:t,location:n,retry:function(){y(-1*o)}},y(o))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(t)}}r.addEventListener($e,o),r.addEventListener("hashchange",function(){Te(s()[1])!==Te(h)&&o()});var a=Ee.Pop,l=s(),c=l[0],h=l[1],d=Oe(),p=Oe();function u(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var n=r.location.href,s=n.indexOf("#");e=-1===s?n:n.slice(0,s)}return e}()+"#"+("string"==typeof t?t:Te(t))}function g(t,e){return void 0===e&&(e=null),Se(be({pathname:h.pathname,hash:"",search:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function v(t,e){return[{usr:t.state,key:t.key,idx:e},u(t)]}function f(t,e,r){return!p.length||(p.call({action:t,location:e,retry:r}),!1)}function m(t){a=t;var e=s();c=e[0],h=e[1],d.call({action:a,location:h})}function y(t){n.go(t)}null==c&&(c=0,n.replaceState(be({},n.state,{idx:c}),""));var b={get action(){return a},get location(){return h},createHref:u,push:function t(e,s){var i=Ee.Push,o=g(e,s);if("production"!==process.env.NODE_ENV&&we("/"===o.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(e)+")"),f(i,o,function(){t(e,s)})){var a=v(o,c+1),l=a[0],h=a[1];try{n.pushState(l,"",h)}catch(t){r.location.assign(h)}m(i)}},replace:function t(e,r){var s=Ee.Replace,i=g(e,r);if("production"!==process.env.NODE_ENV&&we("/"===i.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(e)+")"),f(s,i,function(){t(e,r)})){var o=v(i,c),a=o[0],l=o[1];n.replaceState(a,"",l),m(s)}},go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(t){return d.push(t)},block:function(t){var e=p.push(t);return 1===p.length&&r.addEventListener(Ce,Ae),function(){e(),p.length||r.removeEventListener(Ce,Ae)}}};return b}function _e(t,e,r){return Math.min(Math.max(t,e),r)}function Ae(t){t.preventDefault(),t.returnValue=""}function Oe(){var t=[];return{get length(){return t.length},push:function(e){return t.push(e),function(){t=t.filter(function(t){return t!==e})}},call:function(e){t.forEach(function(t){return t&&t(e)})}}}function xe(){return Math.random().toString(36).substr(2,8)}function Te(t){var e=t.pathname,r=void 0===e?"/":e,n=t.search,s=void 0===n?"":n,i=t.hash,o=void 0===i?"":i;return s&&"?"!==s&&(r+="?"===s.charAt(0)?s:"?"+s),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}function De(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const Re={},Ne=de("browser");function Pe(t){let e=Re[t];if(!e){switch(t){case"browser":e=function(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=r.location,e=t.pathname,s=t.search,i=t.hash,o=n.state||{};return[o.idx,Se({pathname:e,search:s,hash:i,state:o.usr||null,key:o.key||"default"})]}var i=null;r.addEventListener($e,function(){if(i)d.call(i),i=null;else{var t=Ee.Pop,e=s(),r=e[0],n=e[1];if(d.length)if(null!=r){var o=l-r;o&&(i={action:t,location:n,retry:function(){m(-1*o)}},m(o))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else f(t)}});var o=Ee.Pop,a=s(),l=a[0],c=a[1],h=Oe(),d=Oe();function p(t){return"string"==typeof t?t:Te(t)}function u(t,e){return void 0===e&&(e=null),Se(be({pathname:c.pathname,hash:"",search:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function g(t,e){return[{usr:t.state,key:t.key,idx:e},p(t)]}function v(t,e,r){return!d.length||(d.call({action:t,location:e,retry:r}),!1)}function f(t){o=t;var e=s();l=e[0],c=e[1],h.call({action:o,location:c})}function m(t){n.go(t)}null==l&&(l=0,n.replaceState(be({},n.state,{idx:l}),""));var y={get action(){return o},get location(){return c},createHref:p,push:function t(e,s){var i=Ee.Push,o=u(e,s);if(v(i,o,function(){t(e,s)})){var a=g(o,l+1),c=a[0],h=a[1];try{n.pushState(c,"",h)}catch(t){r.location.assign(h)}f(i)}},replace:function t(e,r){var s=Ee.Replace,i=u(e,r);if(v(s,i,function(){t(e,r)})){var o=g(i,l),a=o[0],c=o[1];n.replaceState(a,"",c),f(s)}},go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(t){return h.push(t)},block:function(t){var e=d.push(t);return 1===d.length&&r.addEventListener(Ce,Ae),function(){e(),d.length||r.removeEventListener(Ce,Ae)}}};return y}();break;case"hash":e=ke();break;default:e=function(t){void 0===t&&(t={});var e=t,r=e.initialEntries,n=void 0===r?["/"]:r,s=e.initialIndex,i=n.map(function(t){var e=Se(be({pathname:"/",search:"",hash:"",state:null,key:xe()},"string"==typeof t?De(t):t));return"production"!==process.env.NODE_ENV&&we("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),o=_e(null==s?i.length-1:s,0,i.length-1),a=Ee.Pop,l=i[o],c=Oe(),h=Oe();function d(t,e){return void 0===e&&(e=null),Se(be({pathname:l.pathname,search:"",hash:""},"string"==typeof t?De(t):t,{state:e,key:xe()}))}function p(t,e,r){return!h.length||(h.call({action:t,location:e,retry:r}),!1)}function u(t,e){a=t,l=e,c.call({action:a,location:l})}function g(t){var e=_e(o+t,0,i.length-1),r=Ee.Pop,n=i[e];p(r,n,function(){g(t)})&&(o=e,u(r,n))}var v={get index(){return o},get action(){return a},get location(){return l},createHref:function(t){return"string"==typeof t?t:Te(t)},push:function t(e,r){var n=Ee.Push,s=d(e,r);"production"!==process.env.NODE_ENV&&we("/"===l.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(e)+")"),p(n,s,function(){t(e,r)})&&(o+=1,i.splice(o,i.length,s),u(n,s))},replace:function t(e,r){var n=Ee.Replace,s=d(e,r);"production"!==process.env.NODE_ENV&&we("/"===l.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(e)+")"),p(n,s,function(){t(e,r)})&&(i[o]=s,u(n,s))},go:g,back:function(){g(-1)},forward:function(){g(1)},listen:function(t){return c.push(t)},block:function(t){return h.push(t)}};return v}()}Re[t]=e}return e}pe(()=>Pe(Ne.get()));const Le=Symbol("HistoryManaged:history"),Me=Symbol("HistoryManaged:historyType"),Ie=t=>{var n,s;class i extends t{constructor(){super(...arguments),this.history=void 0,this.#r=de(this.history),this.#n=pe(()=>{const t=this.closest("tha-router-config, tha-router-outlet");return t?.[Me]?.get()}),this[n]=pe(()=>this.#r.get()??this.#n.get()??Ne.get()),this[s]=pe(()=>Pe(this[Me].get()))}static{n=Me,s=Le}#r;#n;attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"history"===t)this.#r.set(r)}}return e([ut({type:String}),r("design:type",Object)],i.prototype,"history",void 0),i};function Ue(t=me){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var He;const We=Symbol("ThaRouterOutlet:renderRoute"),je=Symbol("ThaRouterOutlet:params");function Ve(t){return!!t}function ze(t){return t.filter(Ve)}t.ThaRouterOutlet=class extends ye{constructor(){super(...arguments),this.#s=de(void 0),this.#i=de(null),this.#o=pe(()=>this.#i.get()?.deref()?.[ve].get()??null),this.#a=pe(()=>{const t=this.#s.get()?.deref(),e=this.#i.get()?.deref(),r=e?.[fe];if(!t||!r)return null;const{location:{pathname:n}}=t[Le].get();return r.exec(n,"http://dummy.base")?.pathname.groups??null}),this[He]=pe(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[je].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#l=me,this.#c=me,this.#h=me,this.for=null,this.routePath=null,this.routeID=void 0}#s;#i;#o;#a;#l;#c;#h;connectedCallback(){super.connectedCallback(),Ue(()=>{this.bindToRouter()}),this.#l=this.updateEffect(()=>{Array.from(this.renderRoot.children).forEach(t=>t.remove());const t=this.#o.get()?.deref()??null;t&&this.renderRoot.appendChild(t.cloneNode(!0))}),this.#c=this.updateEffect(()=>{const t=this.#i.get()?.deref()??null;this.routePath=t?.getAttribute("path")??null,this.routeID=t?.id?t?.id:void 0}),this.#h=this.updateEffect(()=>{const t=this[je].get();Array.from(this.attributes).filter(t=>t.name.startsWith("param-")).filter(e=>!(e.name.slice(6)in t)).forEach(t=>{this.removeAttribute(t.name)});for(const[e,r]of Object.entries(t))this.setAttribute(`param-${e}`,r??"");this.params=t})}bindToRouter(t){if(!t)if(this.for){t=this.getRootNode().querySelector(`tha-router#${this.for}`)??void 0}else t=this.closest("tha-router")??void 0;const e=this.#s?.get()?.deref()??null;return e===t?e:(e?.assignOutlet(null),t?.assignOutlet(this),this.#s.set(t?new WeakRef(t):void 0),t??null)}[(He=je,We)](t){this.#i.set(t?new WeakRef(t):null)}disconnectedCallback(){super.disconnectedCallback(),this.#s?.get()?.deref()?.assignOutlet(null);try{this.#l(),this.#c(),this.#h()}catch{}}createRenderRoot(){return this}},e([gt(),r("design:type",Object)],t.ThaRouterOutlet.prototype,"params",void 0),e([ut({type:String}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"for",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routePath",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routeID",void 0),t.ThaRouterOutlet=e([ht("tha-router-outlet")],t.ThaRouterOutlet),t.ThaRouter=class extends(Ie(ye)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=l`
|
|
132
132
|
tha-router {
|
|
133
133
|
& > :not(tha-router-outlet) {
|
|
134
134
|
display: none;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
`.toString(),document.head.appendChild(t)}#d=new MutationObserver(e=>{e.filter(t=>"childList"===t.type).length&&this.#p.set(Array.from(this.children).filter(e=>e instanceof t.ThaRoute).map(t=>new WeakRef(t)))});#u=me;#g=me;#
|
|
137
|
+
`.toString(),document.head.appendChild(t)}#d=new MutationObserver(e=>{e.filter(t=>"childList"===t.type).length&&this.#p.set(Array.from(this.children).filter(e=>e instanceof t.ThaRoute).map(t=>new WeakRef(t)))});#u=me;#g=me;#v=me;#p=de([]);#f=de(null);#m=de(null);connectedCallback(){super.connectedCallback(),this.#d.observe(this,{childList:!0}),this.#u=this.updateEffect(()=>{const t=this.#f.get()?.deref()??null,e=this.#m.get()?.deref()??null;e?.[We](t)}),this.#g=this.updateEffect(()=>{const t=this[Le].get();this.#v(),this.#y({location:this[Le].get().location,action:"POP"}),this.#v=t?t.listen(this.#y):me}),Ue(()=>{this.#y({location:this[Le].get().location,action:"POP"})})}assignOutlet(t){this.#m.set(t?new WeakRef(t):null)}#y=t=>{const e=this.#p.get().map(t=>t.deref()).filter(Boolean);for(const r of e){const e=r[fe];if(e?.test({pathname:t.location.pathname}))return void this.#f.set(new WeakRef(r))}this.#f.set(null)};disconnectedCallback(){super.disconnectedCallback();try{this.#u(),this.#g()}catch{}this.#d.disconnect(),this.#v()}createRenderRoot(){return this}},t.ThaRouter=e([ht("tha-router")],t.ThaRouter),t.ThaRouterLink=class extends(Ie(ye)){constructor(){super(...arguments),this.to=null,this.active=!1,this.#b=me,this.#v=me,this.#E=de(null),this.#S=pe(()=>{const t=this.#E.get();if(!t||"back"===t||"forward"===t)return null;try{return new URLPattern({pathname:t})}catch{return null}}),this.#w=t=>{const e=this[Le].get();if(console.log(this[Me].get()),"back"===this.to)return e.back();if("forward"===this.to)return e.forward();const r=e.location.pathname+e.location.search+e.location.hash;let n=this.to;if(n?.startsWith(".")){const t=ze(r.split("/")),e=ze(n.split("/"));for(const r of e)".."===r?t.pop():"."!==r&&t.push(r);n="/"+t.join("/")}n=n?.replaceAll("//","/"),this[Le].get()?.push(n||"/")}}static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-link-styles"),t.textContent=l`
|
|
138
138
|
tha-router-link {
|
|
139
139
|
cursor: pointer;
|
|
140
140
|
}
|
|
141
|
-
`.toString(),document.head.appendChild(t)}#b;#
|
|
141
|
+
`.toString(),document.head.appendChild(t)}#b;#v;#E;#S;connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#w),this.#b=this.updateEffect(()=>{const t=this[Le].get(),e=this.#S.get();this.active=e?.test({pathname:t?.location.pathname??""})??!1,this.#v=t?.listen(()=>{this.active=e?.test({pathname:t.location.pathname})??!1})??me})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"to"===t)this.#E.set(r)}#w;disconnectedCallback(){super.disconnectedCallback();try{this.#b()}catch{}this.#v(),this.removeEventListener("click",this.#w)}createRenderRoot(){return this}},e([ut({type:String}),r("design:type",Object)],t.ThaRouterLink.prototype,"to",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.ThaRouterLink.prototype,"active",void 0),t.ThaRouterLink=e([ht("tha-router-link")],t.ThaRouterLink),t.ThaRouterConfig=class extends(Ie(ye)){#C=me;connectedCallback(){super.connectedCallback(),document.head.contains(this)&&(console.log("ThaRouterConfig: Setting global history type to",this[Me].get()),this.#C=this.updateEffect(()=>{Ne.set(this[Me].get())}))}disconnectedCallback(){super.disconnectedCallback();try{this.#C()}catch{}}createRenderRoot(){return this}},t.ThaRouterConfig=e([ht("tha-router-config")],t.ThaRouterConfig),t.ThaRouterParam=class extends ye{constructor(){super(...arguments),this.#m=de(null),this.#$=de(""),this.#k=pe(()=>this.#m.get()?.[je]?.get()[this.#$.get()]),this.name=""}#m;#$;#k;connectedCallback(){super.connectedCallback();const t=this.closest("tha-router-outlet");if(!t)throw new Error("<tha-router-param> must be used within a <tha-router-outlet>.");this.#m.set(t)}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"name"===t)this.#$.set(r??"")}render(){return he`${this.#k}`}},e([ut({type:String}),r("design:type",String)],t.ThaRouterParam.prototype,"name",void 0),t.ThaRouterParam=e([ht("tha-router-param")],t.ThaRouterParam);const Be=Symbol("Accept Drop"),qe=Symbol("Register Handle"),Fe=Symbol("Unregister Handle");var Ge,Ze;class Je extends DragEvent{static#_=["thadrag","thadragstart","thadragend","thadropzoneenter","thadropzoneleave","thadropzoneover","thadropped"];static#A=["thadrop","thadropend","thadragenter","thadragleave","thadragover"];get#O(){return Ge.#A.includes(this.type)?this.dropzoneTarget:Ge.#_.includes(this.type)?this.dragTarget:new WeakRef(this.target)}get name(){return this.#O.deref()?.name}get dragData(){return this.dragTarget.deref()?.dragData}constructor(t,{dragTarget:e,dropzoneTarget:r},n){super(t,n),this.dragTarget=e,this.dropzoneTarget=r}acceptDrop(t){this.dragTarget.deref()?.[Be](this.dropzoneTarget,t)}}let Ke;function Ye(t,e){if(null===t||""===t)return 0;const r=Number(t);if(!Number.isFinite(r))return 0;const n=Math.trunc(r);return n>=0?Math.min(n,e):Math.max(0,e+n+1)}Ge=Je,t.DragElement=class extends lt{constructor(){super(...arguments),this.dragData={},this.preDragData={boundingRect:null,dragStartEvent:null,styles:{pointerEvents:""}},this.#x=null,this.#T=null,this.#D=new Set,this.draggingStrategy="move",this.dragging=!1,this.dragend=!1,this.draggedOver=null,this.dropAccepted=!1,this.#R=t=>{if(!this.#N(t))return t.preventDefault();t.stopPropagation(),t.dataTransfer?.setDragImage(Ze.TRANSPARENT_IMAGE,0,0),t.dataTransfer.effectAllowed=this.draggingStrategy,document.addEventListener("dragover",this.#P),this.#L(t),this.#M(),Ue().then(()=>{if(this.style.pointerEvents="none",this.dragging=!0,this.replaceClone){const t=this.#I();this.#T=new WeakRef(t),this.parentElement.insertBefore(t,this.nextSibling)}this.dispatchEvent(new Je("thadragstart",{dragTarget:new WeakRef(this)},t))})},this.#U=t=>{document.removeEventListener("dragover",this.#P),this.dragend=!0;const e=getComputedStyle(this).transitionDuration.match(/\d*\.?\d+/g)?.map(Number).some(t=>t>0),r=()=>{this.replaceClone&&this.clone?.remove(),this.style.pointerEvents=this.preDragData.styles.pointerEvents,["--tha-width","--tha-height","--tha-left","--tha-top","--tha-x","--tha-y","--tha-cx","--tha-cy"].forEach(t=>{this.style.removeProperty(t)}),["width","height","left","right","top","bottom"].forEach(t=>{this.style.removeProperty(`--tha-target-${t}`)});const e=this.#x,r=this.dropAccepted;this.dragging=!1,this.dragend=!1,this.draggedOver=null,this.dropAccepted=!1,this.#x=null,r&&e&&e.deref()?.dispatchEvent(new Je("thadropend",{dragTarget:new WeakRef(this),dropzoneTarget:e},t)),this.dispatchEvent(new Je("thadragend",{dragTarget:new WeakRef(this)},t))};e?this.addEventListener("transitionend",r,{once:!0}):r()},this.#H=t=>{const{x:e,y:r}=t;this.style.setProperty("--tha-cx",`${e}px`),this.style.setProperty("--tha-cy",`${r}px`)},this.#W=t=>{this.draggedOver=t.dropzoneTarget?.deref()?.name??""},this.#j=()=>{this.draggedOver=null}}static{Ze=this}static{this.DRAG_DATA_OBSERVER=new MutationObserver(t=>{for(const{attributeName:e,target:r}of t){if(!e?.startsWith("data-drag-"))continue;const t=r;t.dragData[e.replace("data-drag-","")]=t.getAttribute(e)}})}static{this.styles=l`
|
|
142
142
|
:host {
|
|
143
143
|
--tha-diff-x: calc(var(--tha-cx) - var(--tha-x));
|
|
144
144
|
--tha-diff-y: calc(var(--tha-cy) - var(--tha-y));
|
|
@@ -176,7 +176,7 @@ Ft.State,Ft.Computed;const de=(t,e)=>new Ft.State(t,e),pe=(t,e)=>new Ft.Computed
|
|
|
176
176
|
width: var(--tha-target-width);
|
|
177
177
|
height: var(--tha-target-height);
|
|
178
178
|
}
|
|
179
|
-
`}static{this.TRANSPARENT_IMAGE=new Image(1,1),this.TRANSPARENT_IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==";const t=this.GLOBAL_STYLE=document.createElement("style");t.innerHTML="\n @property --tha-offset-x {\n syntax: '<length>';\n initial-value: 0px;\n inherits: true;\n }\n\n @property --tha-offset-y {\n syntax: '<length>';\n initial-value: 0px;\n inherits: true;\n }\n ",document.head.appendChild(t)}#x;#T;#D;get clone(){return this.#T.deref()}connectedCallback(){super.connectedCallback(),this.draggable=!0,this.#V(),this.addEventListener("dragstart",this.#R),this.addEventListener("dragend",this.#U),this.addEventListener("drag",this.#H),this.addEventListener("thadropzoneenter",this.#W),this.addEventListener("thadropzoneleave",this.#j)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("dragstart",this.#R),this.removeEventListener("dragend",this.#U),this.removeEventListener("drag",this.#H),this.removeEventListener("thadropzoneenter",this.#W),this.removeEventListener("thadropzoneleave",this.#j)}render(){return B`<slot></slot>`}[Be](t,e){if(this.dropAccepted=!0,this.#x=t,!e)return;const{width:r,height:n,left:s,right:i,top:o,bottom:a}=e;for(const t in{width:r,height:n,left:s,right:i,top:o,bottom:a})this.style.setProperty(`--tha-target-${t}`,`${e[t]}px`)}[qe](t){this.#D.add(t)}[Fe](t){this.#D.delete(t)}#V(){Ze.DRAG_DATA_OBSERVER.observe(this,{attributes:!0});for(const{name:t,value:e}of Object.values(this.attributes).filter(t=>t.name.startsWith("data-drag-")))this.dragData[t.replace("data-drag-","")]=e}#R;#U;#H;#W;#j;#I(){const t=document.createElement("tha-drag-clone");return Object.values(this.attributes).filter(t=>!["dragging","replaceclone","draggable"].includes(t.name)).forEach(e=>{t.attributes.setNamedItem(e.cloneNode())}),this.childNodes.forEach(e=>{t.appendChild(e.cloneNode(!0))}),t}#L(t){this.preDragData.boundingRect=this.getBoundingClientRect(),this.preDragData.dragStartEvent=t,this.preDragData.styles.pointerEvents=this.style.pointerEvents}#M(){const{boundingRect:{width:t,height:e,left:r,top:n},dragStartEvent:{x:s,y:i}}=this.preDragData,o={width:t,height:e,left:r,top:n,x:s,y:i};for(const t in o)this.style.setProperty(`--tha-${t}`,`${o[t]}px`)}#P(t){t.preventDefault()}#N(t){return!this.disabled&&(!this.#D.size||!!this.#D.has(t.target))}},e([ut({type:String}),r("design:type",String)],t.DragElement.prototype,"name",void 0),e([ut({type:String,reflect:!0}),r("design:type",String)],t.DragElement.prototype,"draggingStrategy",void 0),e([ut({type:String}),r("design:type",String)],t.DragElement.prototype,"dragGroup",void 0),e([ut({type:Boolean}),r("design:type",Boolean)],t.DragElement.prototype,"replaceClone",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dragging",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dragend",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"draggedOver",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dropAccepted",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Boolean)],t.DragElement.prototype,"disabled",void 0),t.DragElement=Ze=e([ht("tha-drag")],t.DragElement),document.addEventListener("thadragstart",t=>{Ke=t}),t.DropZoneElement=class extends lt{constructor(){super(...arguments),this.#z=0,this.accept=[],this.name="",this.itemDragged=null,this.acceptableDrag=!1,this.#B=t=>{this.accept.length&&!this.accept.includes(t.name)||(this.acceptableDrag=!0)},this.#q=()=>{this.itemDragged=null,this.acceptableDrag=!1,this.#z=0},this.#F=t=>{this.#G()&&(++this.#z>1||(this.itemDragged=Ke.name??"",this.#Z("thadragenter","thadropzoneenter",t)))},this.#J=t=>{this.#G()&&(--this.#z>0||(this.itemDragged=null,this.#Z("thadragleave","thadropzoneleave",t)))},this.#K=t=>{this.#G()&&this.#Z("thadragover","thadropzoneover",t)},this.#Y=t=>{this.#G()&&this.#Z("thadrop","thadropped",t)}}static{this.styles=l``}#z;render(){return B`<slot></slot>`}connectedCallback(){super.connectedCallback(),document.addEventListener("thadragstart",this.#B),document.addEventListener("thadragend",this.#q),document.addEventListener("thadropend",this.#q),this.addEventListener("dragenter",this.#F),this.addEventListener("dragleave",this.#J),this.addEventListener("dragover",this.#K),this.addEventListener("drop",this.#Y)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("thadragstart",this.#B),document.removeEventListener("thadragend",this.#q),document.removeEventListener("thadropend",this.#q),this.removeEventListener("dragenter",this.#F),this.removeEventListener("dragleave",this.#J),this.removeEventListener("dragover",this.#K),this.removeEventListener("drop",this.#Y)}#B;#q;#F;#J;#K;#Y;#G(){return!Ke.name||!this.accept.length||this.accept.includes(Ke.name)}#Z(t,e,r){const{dragTarget:n}=Ke,s=new WeakRef(this);this.dispatchEvent(new Je(t,{dragTarget:n,dropzoneTarget:s},r)),n.deref()?.dispatchEvent(new Je(e,{dragTarget:n,dropzoneTarget:s},r))}},e([ut({converter:t=>(t??"").split(",").map(t=>t.trim())}),r("design:type",Array)],t.DropZoneElement.prototype,"accept",void 0),e([ut({type:String}),r("design:type",Object)],t.DropZoneElement.prototype,"name",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.DropZoneElement.prototype,"itemDragged",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DropZoneElement.prototype,"acceptableDrag",void 0),t.DropZoneElement=e([ht("tha-dropzone")],t.DropZoneElement),t.DragHandleElement=class extends lt{get#Q(){for(const e of function*(t){for(;t.parentElement;)yield t=t.parentElement}(this))if(e instanceof t.DragElement)return e;return null}connectedCallback(){super.connectedCallback(),this.draggable=!0,this.#Q?.[qe](this)}disconnectedCallback(){super.disconnectedCallback(),this.#Q?.[Fe](this)}render(){return B`<slot></slot>`}},t.DragHandleElement=e([ht("tha-drag-handle")],t.DragHandleElement),t.DetailsSetElement=class extends lt{constructor(){super(...arguments),this.maxOpenItems=0,this.toggleOn="summary",this.#X=[],this.#tt=new Map,this.#et=new Map,this.#rt=new WeakMap,this.#nt=()=>{this.#st()},this.#it=()=>{this.#ot()},this.#at=t=>{const e=t.target;e instanceof HTMLDetailsElement&&e.parentElement===this&&this.#lt(e)},this.#ct=t=>{this.#lt(t)},this.#ht=t=>{if(t.defaultPrevented)return;const e=t.target;if(!(e instanceof Element))return;const r=e.closest("summary");if(!r)return;const n=r.parentElement;if(!(n instanceof HTMLDetailsElement))return;if(n.parentElement!==this)return;if(r!==n.querySelector(":scope > summary"))return;"marker"===this.#dt(n)&&0!==t.detail&&r.querySelector("[tp-summary-marker]")&&(e.closest("[tp-summary-marker]")||t.preventDefault())}}static{const t=this.GLOBAL_STYLE=document.createElement("style");t.textContent='\n tp-details-set {\n display: block;\n interpolate-size: allow-keywords;\n }\n\n tp-details-set > details::details-content {\n block-size: 0;\n overflow: clip;\n transition:\n block-size var(--tp-details-set-transition-duration, 0.3s)\n var(--tp-details-set-transition-easing, ease),\n content-visibility var(--tp-details-set-transition-duration, 0.3s)\n var(--tp-details-set-transition-easing, ease)\n allow-discrete;\n }\n\n tp-details-set > details[open]::details-content {\n block-size: auto;\n }\n\n /* Hide the native disclosure marker when the consumer has supplied at\n least one custom marker via <template summary-marker>. */\n tp-details-set > details > summary:has(> [tp-summary-marker]) {\n list-style: none;\n }\n tp-details-set > details > summary:has(> [tp-summary-marker])::-webkit-details-marker {\n display: none;\n }\n tp-details-set > details > summary:has(> [tp-summary-marker])::marker {\n content: "";\n }\n ',document.head.appendChild(t)}#X;#tt;#pt;#et;#rt;createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener("toggle",this.#at,{capture:!0}),this.addEventListener("click",this.#ht,{capture:!0}),this.#pt=new MutationObserver(this.#it),this.#pt.observe(this,{childList:!0}),this.#ot()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("toggle",this.#at,{capture:!0}),this.removeEventListener("click",this.#ht,{capture:!0}),this.#pt?.disconnect(),this.#pt=void 0;for(const t of this.#tt.values())t.disconnect();this.#tt.clear();for(const t of this.#et.values())t.disconnect();this.#et.clear(),this.#X=[]}updated(t){t.has("maxOpenItems")&&this.#ut()}render(){return B``}#ot(){const t=new Set(this.#gt());for(const[e,r]of this.#tt)t.has(e)||(r.disconnect(),this.#tt.delete(e));this.#X=this.#X.filter(e=>t.has(e));for(const e of t)if(!this.#tt.has(e)){const t=new MutationObserver(()=>this.#ct(e));t.observe(e,{attributes:!0,attributeFilter:["open"]}),this.#tt.set(e,t),e.open&&!this.#X.includes(e)&&this.#X.push(e)}this.#ut(),this.#ft(),this.#st()}#ft(){const t=new Set(this.#vt());for(const[e,r]of this.#et)t.has(e)||(r.disconnect(),this.#et.delete(e));for(const e of t)if(!this.#et.has(e)){const t=new MutationObserver(this.#nt);t.observe(e,{attributes:!0,attributeFilter:["index","summary-marker"]}),t.observe(e.content,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.#et.set(e,t)}}#nt;#st(){const t=this.#vt();for(const e of this.#gt()){const r=e.querySelector(":scope > summary");r instanceof HTMLElement&&this.#mt(r,t)}}#mt(t,e){let r=this.#rt.get(t);r||(r=new Map,this.#rt.set(t,r));for(const e of r.values())for(const r of e)r.parentNode===t&&t.removeChild(r);r.clear();for(const n of e){const e=n.content.cloneNode(!0),s=Array.from(e.childNodes);if(0===s.length)continue;for(const t of s)t instanceof Element&&t.setAttribute("tp-summary-marker","");const i=Ye(n.getAttribute("index"),t.childNodes.length),o=t.childNodes[i]??null;t.insertBefore(e,o),r.set(n,s)}}#vt(){return Array.from(this.children).filter(t=>t instanceof HTMLTemplateElement&&t.hasAttribute("summary-marker"))}#gt(){return Array.from(this.children).filter(t=>t instanceof HTMLDetailsElement)}#it;#at;#ct;#ht;#dt(t){const e=t.getAttribute("toggle-on");return"marker"===e||"summary"===e?e:"marker"===this.toggleOn?"marker":"summary"}#lt(t){const e=this.#X.includes(t);t.open&&!e?(this.#X.push(t),this.#ut()):!t.open&&e&&(this.#X=this.#X.filter(e=>e!==t))}#ut(){const t=this.maxOpenItems;if(!Number.isFinite(t)||t<=0)return;const e=[];for(;this.#X.length>t;){const t=this.#X.shift();if(!t)break;t.open&&(t.open=!1,e.push(t))}e.length>0&&this.dispatchEvent(new CustomEvent("tp-details-set-change",{bubbles:!0,composed:!0,detail:{opened:[],closed:e}}))}},e([ut({type:Number,reflect:!0,attribute:"max-open-items"}),r("design:type",Object)],t.DetailsSetElement.prototype,"maxOpenItems",void 0),e([ut({reflect:!0,attribute:"toggle-on"}),r("design:type",String)],t.DetailsSetElement.prototype,"toggleOn",void 0),t.DetailsSetElement=e([ht("tp-details-set")],t.DetailsSetElement);const Qe={};const Xe={popInline:"center",targetInline:"center",popBlock:"bottom",targetBlock:"top"},tr=new Set(["start","center","end"]),er=new Set(["top","middle","bottom"]),rr={start:["end","start"],center:["center","center"],end:["start","end"]},nr={top:["bottom","top"],middle:["middle","middle"],bottom:["top","bottom"]};function sr(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return tr.has(t)?rr[t]:null}return 2===e.length&&tr.has(e[0])&&tr.has(e[1])?[e[0],e[1]]:null}function ir(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return er.has(t)?nr[t]:null}return 2===e.length&&er.has(e[0])&&er.has(e[1])?[e[0],e[1]]:null}t.PopoverElement=class extends lt{constructor(){var t;super(...arguments),this.mode="auto",this.target=null,this.position=null,this.trigger="click",this.#yt=((t="tp-popover")in Qe||(Qe[t]=function*(t){let e=0;for(;;)yield`${t}-${e++}`}(t)),Qe[t].next().value),this.#bt=null,this.#Et=!1,this.#St=[]}static{this.styles=(()=>{const t=l`
|
|
179
|
+
`}static{this.TRANSPARENT_IMAGE=new Image(1,1),this.TRANSPARENT_IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==";const t=this.GLOBAL_STYLE=document.createElement("style");t.innerHTML="\n @property --tha-offset-x {\n syntax: '<length>';\n initial-value: 0px;\n inherits: true;\n }\n\n @property --tha-offset-y {\n syntax: '<length>';\n initial-value: 0px;\n inherits: true;\n }\n ",document.head.appendChild(t)}#x;#T;#D;get clone(){return this.#T.deref()}connectedCallback(){super.connectedCallback(),this.draggable=!0,this.#V(),this.addEventListener("dragstart",this.#R),this.addEventListener("dragend",this.#U),this.addEventListener("drag",this.#H),this.addEventListener("thadropzoneenter",this.#W),this.addEventListener("thadropzoneleave",this.#j)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("dragstart",this.#R),this.removeEventListener("dragend",this.#U),this.removeEventListener("drag",this.#H),this.removeEventListener("thadropzoneenter",this.#W),this.removeEventListener("thadropzoneleave",this.#j)}render(){return B`<slot></slot>`}[Be](t,e){if(this.dropAccepted=!0,this.#x=t,!e)return;const{width:r,height:n,left:s,right:i,top:o,bottom:a}=e;for(const t in{width:r,height:n,left:s,right:i,top:o,bottom:a})this.style.setProperty(`--tha-target-${t}`,`${e[t]}px`)}[qe](t){this.#D.add(t)}[Fe](t){this.#D.delete(t)}#V(){Ze.DRAG_DATA_OBSERVER.observe(this,{attributes:!0});for(const{name:t,value:e}of Object.values(this.attributes).filter(t=>t.name.startsWith("data-drag-")))this.dragData[t.replace("data-drag-","")]=e}#R;#U;#H;#W;#j;#I(){const t=document.createElement("tha-drag-clone");return Object.values(this.attributes).filter(t=>!["dragging","replaceclone","draggable"].includes(t.name)).forEach(e=>{t.attributes.setNamedItem(e.cloneNode())}),this.childNodes.forEach(e=>{t.appendChild(e.cloneNode(!0))}),t}#L(t){this.preDragData.boundingRect=this.getBoundingClientRect(),this.preDragData.dragStartEvent=t,this.preDragData.styles.pointerEvents=this.style.pointerEvents}#M(){const{boundingRect:{width:t,height:e,left:r,top:n},dragStartEvent:{x:s,y:i}}=this.preDragData,o={width:t,height:e,left:r,top:n,x:s,y:i};for(const t in o)this.style.setProperty(`--tha-${t}`,`${o[t]}px`)}#P(t){t.preventDefault()}#N(t){return!this.disabled&&(!this.#D.size||!!this.#D.has(t.target))}},e([ut({type:String}),r("design:type",String)],t.DragElement.prototype,"name",void 0),e([ut({type:String,reflect:!0}),r("design:type",String)],t.DragElement.prototype,"draggingStrategy",void 0),e([ut({type:String}),r("design:type",String)],t.DragElement.prototype,"dragGroup",void 0),e([ut({type:Boolean}),r("design:type",Boolean)],t.DragElement.prototype,"replaceClone",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dragging",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dragend",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"draggedOver",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DragElement.prototype,"dropAccepted",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Boolean)],t.DragElement.prototype,"disabled",void 0),t.DragElement=Ze=e([ht("tha-drag")],t.DragElement),document.addEventListener("thadragstart",t=>{Ke=t}),t.DropZoneElement=class extends lt{constructor(){super(...arguments),this.#z=0,this.accept=[],this.name="",this.itemDragged=null,this.acceptableDrag=!1,this.#B=t=>{this.accept.length&&!this.accept.includes(t.name)||(this.acceptableDrag=!0)},this.#q=()=>{this.itemDragged=null,this.acceptableDrag=!1,this.#z=0},this.#F=t=>{this.#G()&&(++this.#z>1||(this.itemDragged=Ke.name??"",this.#Z("thadragenter","thadropzoneenter",t)))},this.#J=t=>{this.#G()&&(--this.#z>0||(this.itemDragged=null,this.#Z("thadragleave","thadropzoneleave",t)))},this.#K=t=>{this.#G()&&this.#Z("thadragover","thadropzoneover",t)},this.#Y=t=>{this.#G()&&this.#Z("thadrop","thadropped",t)}}static{this.styles=l``}#z;render(){return B`<slot></slot>`}connectedCallback(){super.connectedCallback(),document.addEventListener("thadragstart",this.#B),document.addEventListener("thadragend",this.#q),document.addEventListener("thadropend",this.#q),this.addEventListener("dragenter",this.#F),this.addEventListener("dragleave",this.#J),this.addEventListener("dragover",this.#K),this.addEventListener("drop",this.#Y)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("thadragstart",this.#B),document.removeEventListener("thadragend",this.#q),document.removeEventListener("thadropend",this.#q),this.removeEventListener("dragenter",this.#F),this.removeEventListener("dragleave",this.#J),this.removeEventListener("dragover",this.#K),this.removeEventListener("drop",this.#Y)}#B;#q;#F;#J;#K;#Y;#G(){return!Ke.name||!this.accept.length||this.accept.includes(Ke.name)}#Z(t,e,r){const{dragTarget:n}=Ke,s=new WeakRef(this);this.dispatchEvent(new Je(t,{dragTarget:n,dropzoneTarget:s},r)),n.deref()?.dispatchEvent(new Je(e,{dragTarget:n,dropzoneTarget:s},r))}},e([ut({converter:t=>(t??"").split(",").map(t=>t.trim())}),r("design:type",Array)],t.DropZoneElement.prototype,"accept",void 0),e([ut({type:String}),r("design:type",Object)],t.DropZoneElement.prototype,"name",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.DropZoneElement.prototype,"itemDragged",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.DropZoneElement.prototype,"acceptableDrag",void 0),t.DropZoneElement=e([ht("tha-dropzone")],t.DropZoneElement),t.DragHandleElement=class extends lt{get#Q(){for(const e of function*(t){for(;t.parentElement;)yield t=t.parentElement}(this))if(e instanceof t.DragElement)return e;return null}connectedCallback(){super.connectedCallback(),this.draggable=!0,this.#Q?.[qe](this)}disconnectedCallback(){super.disconnectedCallback(),this.#Q?.[Fe](this)}render(){return B`<slot></slot>`}},t.DragHandleElement=e([ht("tha-drag-handle")],t.DragHandleElement),t.DetailsSetElement=class extends lt{constructor(){super(...arguments),this.maxOpenItems=0,this.toggleOn="summary",this.#X=[],this.#tt=new Map,this.#et=new Map,this.#rt=new WeakMap,this.#nt=()=>{this.#st()},this.#it=()=>{this.#ot()},this.#at=t=>{const e=t.target;e instanceof HTMLDetailsElement&&e.parentElement===this&&this.#lt(e)},this.#ct=t=>{this.#lt(t)},this.#ht=t=>{if(t.defaultPrevented)return;const e=t.target;if(!(e instanceof Element))return;const r=e.closest("summary");if(!r)return;const n=r.parentElement;if(!(n instanceof HTMLDetailsElement))return;if(n.parentElement!==this)return;if(r!==n.querySelector(":scope > summary"))return;"marker"===this.#dt(n)&&0!==t.detail&&r.querySelector("[tp-summary-marker]")&&(e.closest("[tp-summary-marker]")||t.preventDefault())}}static{const t=this.GLOBAL_STYLE=document.createElement("style");t.textContent='\n tp-details-set {\n display: block;\n interpolate-size: allow-keywords;\n }\n\n tp-details-set > details::details-content {\n block-size: 0;\n overflow: clip;\n transition:\n block-size var(--tp-details-set-transition-duration, 0.3s)\n var(--tp-details-set-transition-easing, ease),\n content-visibility var(--tp-details-set-transition-duration, 0.3s)\n var(--tp-details-set-transition-easing, ease)\n allow-discrete;\n }\n\n tp-details-set > details[open]::details-content {\n block-size: auto;\n }\n\n /* Hide the native disclosure marker when the consumer has supplied at\n least one custom marker via <template summary-marker>. */\n tp-details-set > details > summary:has(> [tp-summary-marker]) {\n list-style: none;\n }\n tp-details-set > details > summary:has(> [tp-summary-marker])::-webkit-details-marker {\n display: none;\n }\n tp-details-set > details > summary:has(> [tp-summary-marker])::marker {\n content: "";\n }\n ',document.head.appendChild(t)}#X;#tt;#pt;#et;#rt;createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener("toggle",this.#at,{capture:!0}),this.addEventListener("click",this.#ht,{capture:!0}),this.#pt=new MutationObserver(this.#it),this.#pt.observe(this,{childList:!0}),this.#ot()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("toggle",this.#at,{capture:!0}),this.removeEventListener("click",this.#ht,{capture:!0}),this.#pt?.disconnect(),this.#pt=void 0;for(const t of this.#tt.values())t.disconnect();this.#tt.clear();for(const t of this.#et.values())t.disconnect();this.#et.clear(),this.#X=[]}updated(t){t.has("maxOpenItems")&&this.#ut()}render(){return B``}#ot(){const t=new Set(this.#gt());for(const[e,r]of this.#tt)t.has(e)||(r.disconnect(),this.#tt.delete(e));this.#X=this.#X.filter(e=>t.has(e));for(const e of t)if(!this.#tt.has(e)){const t=new MutationObserver(()=>this.#ct(e));t.observe(e,{attributes:!0,attributeFilter:["open"]}),this.#tt.set(e,t),e.open&&!this.#X.includes(e)&&this.#X.push(e)}this.#ut(),this.#vt(),this.#st()}#vt(){const t=new Set(this.#ft());for(const[e,r]of this.#et)t.has(e)||(r.disconnect(),this.#et.delete(e));for(const e of t)if(!this.#et.has(e)){const t=new MutationObserver(this.#nt);t.observe(e,{attributes:!0,attributeFilter:["index","summary-marker"]}),t.observe(e.content,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.#et.set(e,t)}}#nt;#st(){const t=this.#ft();for(const e of this.#gt()){const r=e.querySelector(":scope > summary");r instanceof HTMLElement&&this.#mt(r,t)}}#mt(t,e){let r=this.#rt.get(t);r||(r=new Map,this.#rt.set(t,r));for(const e of r.values())for(const r of e)r.parentNode===t&&t.removeChild(r);r.clear();for(const n of e){const e=n.content.cloneNode(!0),s=Array.from(e.childNodes);if(0===s.length)continue;for(const t of s)t instanceof Element&&t.setAttribute("tp-summary-marker","");const i=Ye(n.getAttribute("index"),t.childNodes.length),o=t.childNodes[i]??null;t.insertBefore(e,o),r.set(n,s)}}#ft(){return Array.from(this.children).filter(t=>t instanceof HTMLTemplateElement&&t.hasAttribute("summary-marker"))}#gt(){return Array.from(this.children).filter(t=>t instanceof HTMLDetailsElement)}#it;#at;#ct;#ht;#dt(t){const e=t.getAttribute("toggle-on");return"marker"===e||"summary"===e?e:"marker"===this.toggleOn?"marker":"summary"}#lt(t){const e=this.#X.includes(t);t.open&&!e?(this.#X.push(t),this.#ut()):!t.open&&e&&(this.#X=this.#X.filter(e=>e!==t))}#ut(){const t=this.maxOpenItems;if(!Number.isFinite(t)||t<=0)return;const e=[];for(;this.#X.length>t;){const t=this.#X.shift();if(!t)break;t.open&&(t.open=!1,e.push(t))}e.length>0&&this.dispatchEvent(new CustomEvent("tp-details-set-change",{bubbles:!0,composed:!0,detail:{opened:[],closed:e}}))}},e([ut({type:Number,reflect:!0,attribute:"max-open-items"}),r("design:type",Object)],t.DetailsSetElement.prototype,"maxOpenItems",void 0),e([ut({reflect:!0,attribute:"toggle-on"}),r("design:type",String)],t.DetailsSetElement.prototype,"toggleOn",void 0),t.DetailsSetElement=e([ht("tp-details-set")],t.DetailsSetElement);const Qe={};const Xe={popInline:"center",targetInline:"center",popBlock:"bottom",targetBlock:"top"},tr=new Set(["start","center","end"]),er=new Set(["top","middle","bottom"]),rr={start:["end","start"],center:["center","center"],end:["start","end"]},nr={top:["bottom","top"],middle:["middle","middle"],bottom:["top","bottom"]};function sr(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return tr.has(t)?rr[t]:null}return 2===e.length&&tr.has(e[0])&&tr.has(e[1])?[e[0],e[1]]:null}function ir(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return er.has(t)?nr[t]:null}return 2===e.length&&er.has(e[0])&&er.has(e[1])?[e[0],e[1]]:null}t.PopoverElement=class extends lt{constructor(){var t;super(...arguments),this.mode="auto",this.target=null,this.position=null,this.trigger="click",this.#yt=((t="tp-popover")in Qe||(Qe[t]=function*(t){let e=0;for(;;)yield`${t}-${e++}`}(t)),Qe[t].next().value),this.#bt=null,this.#Et=!1,this.#St=[]}static{this.styles=(()=>{const t=l`
|
|
180
180
|
tp-popover {
|
|
181
181
|
--tp-popover-inline-position: attr(data-ti type(*));
|
|
182
182
|
--tp-popover-block-position: attr(data-tb type(*));
|
|
@@ -252,7 +252,7 @@ let ar=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.val
|
|
|
252
252
|
* Copyright 2022 Google LLC
|
|
253
253
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
254
254
|
*/
|
|
255
|
-
function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addInitializer(function(){new ar(this,{context:t,callback:t=>{r.set.call(this,t)},subscribe:e})}):r.constructor.addInitializer(r=>{new ar(r,{context:t,callback:t=>{r[n]=t},subscribe:e})})}}const pr=Symbol("tp-select");class ur{#O;#Tt;#Dt=!1;constructor(t,e={}){const{attributes:r=!0,childList:n=!0,characterData:s=!0}=e;this.#O=t,this.clone=t.cloneNode(!0),this.#Tt=new MutationObserver(t=>this.#Rt(t)),this.#Tt.observe(t,{attributes:r,childList:n,characterData:s,subtree:!0})}disconnect(){this.#Dt||(this.#Dt=!0,this.#Tt.disconnect())}#Rt(t){for(const e of t){const t=this.#Nt(e.target);if(!t)continue;const r=this.#Pt(t);if(r)switch(e.type){case"attributes":this.#Lt(e,r);break;case"characterData":r.nodeValue=e.target.nodeValue;break;case"childList":this.#Mt(e.target,r)}}}#Lt(t,e){const r=t.attributeName;if(!r)return;const n=t.attributeNamespace??null,s=t.target,i=n?s.getAttributeNS(n,r):s.getAttribute(r);null===i?n?e.removeAttributeNS(n,r):e.removeAttribute(r):n?e.setAttributeNS(n,r,i):e.setAttribute(r,i)}#Mt(t,e){for(;e.firstChild;)e.removeChild(e.firstChild);for(const r of Array.from(t.childNodes))e.appendChild(r.cloneNode(!0))}#Nt(t){if(t===this.#O)return[];const e=[];let r=t;for(;r&&r!==this.#O;){const t=r.parentNode;if(!t)return null;e.push(Array.prototype.indexOf.call(t.childNodes,r)),r=t}return r===this.#O?e.reverse():null}#Pt(t){let e=this.clone;for(const r of t){const t=e.childNodes[r];if(!t)return null;e=t}return e}}const gr=Symbol("select:register-option"),
|
|
255
|
+
function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addInitializer(function(){new ar(this,{context:t,callback:t=>{r.set.call(this,t)},subscribe:e})}):r.constructor.addInitializer(r=>{new ar(r,{context:t,callback:t=>{r[n]=t},subscribe:e})})}}const pr=Symbol("tp-select");class ur{#O;#Tt;#Dt=!1;constructor(t,e={}){const{attributes:r=!0,childList:n=!0,characterData:s=!0}=e;this.#O=t,this.clone=t.cloneNode(!0),this.#Tt=new MutationObserver(t=>this.#Rt(t)),this.#Tt.observe(t,{attributes:r,childList:n,characterData:s,subtree:!0})}disconnect(){this.#Dt||(this.#Dt=!0,this.#Tt.disconnect())}#Rt(t){for(const e of t){const t=this.#Nt(e.target);if(!t)continue;const r=this.#Pt(t);if(r)switch(e.type){case"attributes":this.#Lt(e,r);break;case"characterData":r.nodeValue=e.target.nodeValue;break;case"childList":this.#Mt(e.target,r)}}}#Lt(t,e){const r=t.attributeName;if(!r)return;const n=t.attributeNamespace??null,s=t.target,i=n?s.getAttributeNS(n,r):s.getAttribute(r);null===i?n?e.removeAttributeNS(n,r):e.removeAttribute(r):n?e.setAttributeNS(n,r,i):e.setAttribute(r,i)}#Mt(t,e){for(;e.firstChild;)e.removeChild(e.firstChild);for(const r of Array.from(t.childNodes))e.appendChild(r.cloneNode(!0))}#Nt(t){if(t===this.#O)return[];const e=[];let r=t;for(;r&&r!==this.#O;){const t=r.parentNode;if(!t)return null;e.push(Array.prototype.indexOf.call(t.childNodes,r)),r=t}return r===this.#O?e.reverse():null}#Pt(t){let e=this.clone;for(const r of t){const t=e.childNodes[r];if(!t)return null;e=t}return e}}const gr=Symbol("select:register-option"),vr=Symbol("select:unregister-option"),fr=Symbol("option:should-register-to-select");var mr,yr;t.SelectedContentElement=class extends ye{static{this.styles=(()=>{const t=l`
|
|
256
256
|
tp-selected-content {
|
|
257
257
|
display: inline-block;
|
|
258
258
|
|
|
@@ -266,7 +266,7 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#It=new WeakMap;createRenderRoot(){return this}render(){const t=this.select?.placeholder??"",e=this.select?.selectedOptions.get().map(t=>t.deref()).filter(Boolean)??[],r=this.#Ut(e);return e.length?r.map(t=>B`${t}`):B`<slot name="placeholder"><span part="placeholder">${t}</span></slot>`}#Ut(t){return t.map(t=>{let e=this.#It.get(t);return e||(e=new ur(t),this.#It.set(t,e),e.clone.setAttribute("part","selected-content-option"),e.clone[
|
|
269
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#It=new WeakMap;createRenderRoot(){return this}render(){const t=this.select?.placeholder??"",e=this.select?.selectedOptions.get().map(t=>t.deref()).filter(Boolean)??[],r=this.#Ut(e);return e.length?r.map(t=>B`${t}`):B`<slot name="placeholder"><span part="placeholder">${t}</span></slot>`}#Ut(t){return t.map(t=>{let e=this.#It.get(t);return e||(e=new ur(t),this.#It.set(t,e),e.clone.setAttribute("part","selected-content-option"),e.clone[fr]=!1),e.clone})}},e([dr({context:pr,subscribe:!0}),gt(),r("design:type",Function)],t.SelectedContentElement.prototype,"select",void 0),t.SelectedContentElement=e([ht("tp-selected-content")],t.SelectedContentElement),t.OptionElement=class extends ye{constructor(){super(...arguments),this[mr]=!0,this.value=""}static{mr=fr}static{this.styles=(()=>{const t=l`
|
|
270
270
|
tp-option:not([part="selected-content-option"]) {
|
|
271
271
|
display: block;
|
|
272
272
|
cursor: pointer;
|
|
@@ -285,7 +285,7 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}connectedCallback(){super.connectedCallback(),this[
|
|
288
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}connectedCallback(){super.connectedCallback(),this[fr]&&this.select?.[gr](this)}disconnectedCallback(){super.disconnectedCallback(),this[fr]&&this.select?.[vr](this)}willUpdate(t){if(!this[fr])return;const e=this.select?.selectedOptions.get().some(t=>t.deref()===this)??!1;this.toggleAttribute("selected",e)}createRenderRoot(){return this}render(){return B``}},e([dr({context:pr,subscribe:!0}),gt(),r("design:type",Function)],t.OptionElement.prototype,"select",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.OptionElement.prototype,"value",void 0),t.OptionElement=e([ht("tp-option")],t.OptionElement);class br extends Event{constructor(t,e){super("change",{bubbles:!0,composed:!1,cancelable:!1,...e}),this.value=t.value,this.selectedOptions=t.selectedOptions}}t.SelectElement=class extends ye{static{yr=this}static{this.formAssociated=!0}static{this.ALLOWED_OPTION_ELEMENTS=[t.OptionElement]}static{this.styles=l`
|
|
289
289
|
:host {
|
|
290
290
|
position: relative;
|
|
291
291
|
display: inline-flex;
|
|
@@ -328,7 +328,7 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
328
328
|
border: none;
|
|
329
329
|
padding: 0;
|
|
330
330
|
}
|
|
331
|
-
`}#Ht
|
|
331
|
+
`}#Ht;get#Wt(){return this.shadowRoot?.querySelector("tp-popover")}#k;get value(){return this.#k.get()}set value(t){Ue(()=>{const e=t.split(",").map(t=>t.trim()),r=Array.from(this.#Ht);this.selectedOptions.set(e.map(t=>r.find(e=>e.value===t)).filter(Boolean).map(t=>new WeakRef(t)))})}#jt;get placeholder(){return this.#jt.get()}set placeholder(t){this.#Vt(this.#jt,"placeholder",t)}#zt;#Bt;#qt;constructor(){super(),this.#Ht=new Set,this.self=this,this.selectedOptions=de([]),this.#k=pe(()=>this.selectedOptions.get().map(t=>t.deref()?.value??"").filter(Boolean).join(",")),this.#jt=de("Select an option"),this.max=1,this.name=null,this.disabled=!1,this.required=!1,this.open=!1,this.#Bt="",this.#qt=null,this.#zt=this.attachInternals()}get internals(){return this.#zt}get form(){return this.#zt.form}get validity(){return this.#zt.validity}get validationMessage(){return this.#zt.validationMessage}get willValidate(){return this.#zt.willValidate}checkValidity(){return this.#zt.checkValidity()}reportValidity(){return this.#zt.reportValidity()}createRenderRoot(){const e=super.createRenderRoot();return e.adoptedStyleSheets=[...e.adoptedStyleSheets,t.PopoverElement.styles.styleSheet,t.SelectedContentElement.styles.styleSheet,t.OptionElement.styles.styleSheet],e}connectedCallback(){super.connectedCallback(),this.#Bt=this.value}disconnectedCallback(){super.disconnectedCallback()}render(){return B`
|
|
332
332
|
<div pseudo="button" part="button">
|
|
333
333
|
<slot name="button">
|
|
334
334
|
<tp-selected-content part="selected-content"></tp-selected-content>
|
|
@@ -340,14 +340,14 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
340
340
|
<tp-popover
|
|
341
341
|
position="start to start / bottom"
|
|
342
342
|
target="[pseudo=button]"
|
|
343
|
-
@click=${this.#
|
|
344
|
-
@toggle=${this.#
|
|
343
|
+
@click=${this.#Ft}
|
|
344
|
+
@toggle=${this.#Gt}
|
|
345
345
|
part="popover">
|
|
346
346
|
<slot name="popover">
|
|
347
347
|
<slot></slot>
|
|
348
348
|
</slot>
|
|
349
349
|
</tp-popover>
|
|
350
|
-
`}updated(t){if(super.updated(t),t.has("max")&&Number.isFinite(this.max)){const t=this.selectedOptions.get();t.length>this.max&&this.selectedOptions.set(t.slice(t.length-this.max))}}willUpdate(t){this.#
|
|
350
|
+
`}updated(t){if(super.updated(t),t.has("max")&&Number.isFinite(this.max)){const t=this.selectedOptions.get();t.length>this.max&&this.selectedOptions.set(t.slice(t.length-this.max))}}willUpdate(t){this.#Zt(),this.#Jt()}formResetCallback(){this.value=this.#Bt}formDisabledCallback(t){this.disabled=t}formStateRestoreCallback(t){if(null!=t)if("string"!=typeof t){if(t instanceof FormData){const e=[];t.forEach(t=>{"string"==typeof t&&e.push(t)}),this.value=e.join(",")}}else this.value=t;else this.value=""}#Zt(){const t=""===this.value?[]:this.value.split(",");if(1===this.max)this.#zt.setFormValue(t[0]??"");else{const e=new FormData,r=this.name??"";for(const n of t)e.append(r,n);this.#zt.setFormValue(e)}this.required&&0===t.length?this.#zt.setValidity({valueMissing:!0},"Please select an option."):this.#zt.setValidity({})}#Jt(){const t=this.value;if(t===this.#qt)return;const e=null===this.#qt;if(this.#qt=t,e)return;const r=this.selectedOptions.get().map(t=>t.deref()).filter(Boolean);this.dispatchEvent(new br({value:t,selectedOptions:r}))}selectOption(t){const e=this.selectedOptions.get();if(e.find(e=>e.deref()===t))return;const r=[...e,new WeakRef(t)],n=r.length>this.max?r.slice(r.length-this.max):r;this.selectedOptions.set(n)}deselectOption(t){const e=this.selectedOptions.get().find(e=>e.deref()===t);e&&this.selectedOptions.set(this.selectedOptions.get().filter(t=>t!==e))}toggleOption(t){this.selectedOptions.get().find(e=>e.deref()===t)?this.deselectOption(t):this.selectOption(t)}togglePopover(){return this.#Wt.togglePopover()}hidePopover(){this.#Wt.hidePopover()}showPopover(){this.#Wt.showPopover()}[gr](t){this.#Ht.add(t)}[vr](t){this.#Ht.delete(t);const e=this.selectedOptions.get(),r=e.find(e=>e.deref()===t);r&&this.selectedOptions.set(e.filter(t=>t!==r))}#Ft(t){if(this.disabled)return;const e=function(t,e){const r=t.indexOf(e);return r<0?[]:t.slice(0,r)}(t.composedPath(),this).find(t=>yr.ALLOWED_OPTION_ELEMENTS.some(e=>t instanceof e));if(!e)return;this.toggleOption(e);if(this.selectedOptions.get().length>=this.max){const t=this.shadowRoot?.querySelector("tp-popover");t?.hidePopover()}}#Gt(t){this.open="open"===t.newState}#Vt(t,e,r){const n=t.get();n!==r&&(t.set(r),this.requestUpdate(e,n))}},e([function({context:t}){return(e,r)=>{const n=new WeakMap;if("object"==typeof r)return{get(){return e.get.call(this)},set(t){return n.get(this).setValue(t),e.set.call(this,t)},init(e){return n.set(this,new hr(this,{context:t,initialValue:e})),e}};{e.constructor.addInitializer(e=>{n.set(e,new hr(e,{context:t}))});const s=Object.getOwnPropertyDescriptor(e,r);let i;if(void 0===s){const t=new WeakMap;i={get(){return t.get(this)},set(e){n.get(this).setValue(e),t.set(this,e)},configurable:!0,enumerable:!0}}else{const t=s.set;i={...s,set(e){n.get(this).setValue(e),t?.call(this,e)}}}return void Object.defineProperty(e,r,i)}}}({context:pr}),r("design:type",t.SelectElement)],t.SelectElement.prototype,"self",void 0),e([ut({type:String,reflect:!0,noAccessor:!0}),r("design:type",String),r("design:paramtypes",[String])],t.SelectElement.prototype,"value",null),e([ut({type:String,reflect:!0,noAccessor:!0}),r("design:type",String),r("design:paramtypes",[String])],t.SelectElement.prototype,"placeholder",null),e([ut({reflect:!0,converter:{fromAttribute:t=>{if(null==t||""===t)return 1;const e=String(t).trim().toLowerCase();if("infinite"===e)return Number.POSITIVE_INFINITY;const r=Number(e);return Number.isFinite(r)&&r>=1?Math.floor(r):1},toAttribute:t=>Number.isFinite(t)?String(t):"infinite"}}),r("design:type",Number)],t.SelectElement.prototype,"max",void 0),e([ut({type:String,reflect:!0}),r("design:type",Object)],t.SelectElement.prototype,"name",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.SelectElement.prototype,"disabled",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.SelectElement.prototype,"required",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.SelectElement.prototype,"open",void 0),t.SelectElement=yr=e([ht("tp-select"),r("design:paramtypes",[])],t.SelectElement);class Er extends lt{constructor(){super(...arguments),this.color="contrast",this.shade=500,this.mixer="none"}static{this.rootStyles=(()=>{const t=l`
|
|
351
351
|
@layer properties {
|
|
352
352
|
:root {
|
|
353
353
|
--tp-color-white: hsl(0 0% 100%);
|
|
@@ -397,6 +397,9 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
397
397
|
${Er.shadedElementStyles}
|
|
398
398
|
--tp-button-color: var(--tp-calc-element-color);
|
|
399
399
|
--tp-button-contrast-color: var(--tp-calc-contrast-color);
|
|
400
|
+
--tp-button-active-mixer-color: transparent;
|
|
401
|
+
--tp-button-active-mixer-percentage: 10%;
|
|
402
|
+
--tp-button-active-color: color-mix(in xyz, var(--tp-button-color) var(--tp-button-active-mixer-percentage), var(--tp-button-active-mixer-color) calc(100% - var(--tp-button-active-mixer-percentage)));
|
|
400
403
|
display: inline-block;
|
|
401
404
|
border: 1px solid transparent;
|
|
402
405
|
cursor: pointer;
|
|
@@ -428,25 +431,27 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
428
431
|
&[variant="ghost"] {
|
|
429
432
|
padding-inline: 1em;
|
|
430
433
|
padding-block: 0.5em;
|
|
434
|
+
|
|
435
|
+
&:hover {
|
|
436
|
+
background-color: var(--tp-button-active-color);
|
|
437
|
+
}
|
|
431
438
|
}
|
|
432
439
|
|
|
433
440
|
&[variant="outline"],
|
|
434
441
|
&[variant="ghost"] {
|
|
435
442
|
color: var(--tp-button-color);
|
|
436
443
|
background-color: transparent;
|
|
444
|
+
}
|
|
437
445
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
446
|
+
&[variant="solid"],
|
|
447
|
+
&[variant="text"] {
|
|
448
|
+
--tp-button-active-mixer-color: var(--tp-color-black);
|
|
449
|
+
--tp-button-active-mixer-percentage: 80%;
|
|
441
450
|
}
|
|
442
451
|
|
|
443
452
|
&[variant="solid"] {
|
|
444
453
|
background-color: var(--tp-button-color);
|
|
445
454
|
color: var(--tp-button-contrast-color);
|
|
446
|
-
|
|
447
|
-
&:hover {
|
|
448
|
-
background-color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
449
|
-
}
|
|
450
455
|
}
|
|
451
456
|
|
|
452
457
|
&[variant="outline"] {
|
|
@@ -462,11 +467,11 @@ function dr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
462
467
|
background-color: transparent;
|
|
463
468
|
|
|
464
469
|
&:hover {
|
|
465
|
-
color:
|
|
470
|
+
color: var(--tp-button-active-color);
|
|
466
471
|
text-decoration: underline;
|
|
467
472
|
}
|
|
468
473
|
}
|
|
469
474
|
}
|
|
470
475
|
}
|
|
471
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#
|
|
476
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#zt;constructor(){super(),this.variant="solid",this.type="button",this.disabled=!1,this.#w=t=>{if(this.disabled)return t.preventDefault(),void t.stopImmediatePropagation();const e=this.#zt.form;e&&("submit"===this.type?e.requestSubmit():"reset"===this.type&&e.reset())},this.#Kt=t=>{this.disabled||" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.click())},this.#zt=this.attachInternals(),this.#zt.role="button"}get form(){return this.#zt.form}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||this.setAttribute("tabindex",this.disabled?"-1":"0"),this.addEventListener("click",this.#w),this.addEventListener("keydown",this.#Kt)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.#w),this.removeEventListener("keydown",this.#Kt)}updated(t){super.updated?.(t),t.has("disabled")&&(this.setAttribute("tabindex",this.disabled?"-1":"0"),this.#zt.ariaDisabled=this.disabled?"true":"false")}#w;#Kt;createRenderRoot(){return this}render(){return B``}},e([ut({type:String,reflect:!0}),r("design:type",String)],t.ButtonElement.prototype,"variant",void 0),e([ut({type:String,reflect:!0}),r("design:type",String)],t.ButtonElement.prototype,"type",void 0),e([ut({type:Boolean,reflect:!0}),r("design:type",Object)],t.ButtonElement.prototype,"disabled",void 0),t.ButtonElement=e([ht("tp-button"),r("design:paramtypes",[])],t.ButtonElement),t.SelectChangeEvent=br,t.ThaDragEvent=Je,t}({});
|
|
472
477
|
//# sourceMappingURL=elements.js.map
|