@telperion/elements 5.4.1 → 5.4.3
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/custom-elements.json +4409 -0
- package/fesm/elements.mjs +19 -9
- package/fesm/elements.mjs.map +1 -1
- package/iife/elements.js +19 -19
- package/iife/elements.js.map +1 -1
- package/iife/router/index.js +16 -16
- package/iife/router/index.js.map +1 -1
- package/iife/select/index.js +26 -26
- package/iife/select/index.js.map +1 -1
- package/package.json +17 -16
- package/router/history-managed.cjs +3 -1
- package/router/history-managed.cjs.map +1 -1
- package/router/history-managed.js +3 -1
- package/router/history-managed.js.map +1 -1
- package/select/select.element.cjs +16 -9
- package/select/select.element.cjs.map +1 -1
- package/select/select.element.js +16 -9
- package/select/select.element.js.map +1 -1
package/iife/elements.js
CHANGED
|
@@ -15,7 +15,7 @@ const n=globalThis,s=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow
|
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const k=globalThis,
|
|
18
|
+
const k=globalThis,_=k.trustedTypes,A=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,O="$lit$",x=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+x,D=`<${T}>`,R=document,N=()=>R.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,M="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,j=/>/g,H=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,W=/"/g,z=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...r)=>({_$litType$:t,strings:e,values:r}))(1),q=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),G=new WeakMap,Z=R.createTreeWalker(R,129);function J(t,e){if(!L(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const K=(t,e)=>{const r=t.length-1,n=[];let s,i=2===e?"<svg>":3===e?"<math>":"",o=I;for(let e=0;e<r;e++){const r=t[e];let a,l,c=-1,h=0;for(;h<r.length&&(o.lastIndex=h,l=o.exec(r),null!==l);)h=o.lastIndex,o===I?"!--"===l[1]?o=U:void 0!==l[1]?o=j:void 0!==l[2]?(z.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=H):void 0!==l[3]&&(o=H):o===H?">"===l[0]?(o=s??I,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?H:'"'===l[3]?W:V):o===W||o===V?o=H:o===U||o===j?o=I:(o=H,s=void 0);const d=o===H&&t[e+1].startsWith("/>")?" ":"";i+=o===I?r+D:c>=0?(n.push(a),r.slice(0,c)+O+r.slice(c)+x+d):r+x+(-2===c?e:d)}return[J(t,i+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class Y{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let s=0,i=0;const o=t.length-1,a=this.parts,[l,c]=K(t,e);if(this.el=Y.createElement(l,r),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Z.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(O)){const e=c[i++],r=n.getAttribute(t).split(x),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:r,ctor:"."===o[1]?rt:"?"===o[1]?nt:"@"===o[1]?st:et}),n.removeAttribute(t)}else t.startsWith(x)&&(a.push({type:6,index:s}),n.removeAttribute(t));if(z.test(n.tagName)){const t=n.textContent.split(x),e=t.length-1;if(e>0){n.textContent=_?_.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],N()),Z.nextNode(),a.push({type:2,index:++s});n.append(t[e],N())}}}else if(8===n.nodeType)if(n.data===T)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(x,t+1));)a.push({type:7,index:s}),t+=x.length-1}s++}}static createElement(t,e){const r=R.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,n){if(e===q)return e;let s=void 0!==n?r._$Co?.[n]:r._$Cl;const i=P(e)?void 0:e._$litDirective$;return s?.constructor!==i&&(s?._$AO?.(!1),void 0===i?s=void 0:(s=new i(t),s._$AT(t,r,n)),void 0!==n?(r._$Co??=[])[n]=s:r._$Cl=s),void 0!==s&&(e=Q(t,s._$AS(t,e.values),s,n)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??R).importNode(e,!0);Z.currentNode=n;let s=Z.nextNode(),i=0,o=0,a=r[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new tt(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new it(s,this,t)),this._$AV.push(e),a=r[++o]}i!==a?.index&&(s=Z.nextNode(),i++)}return Z.currentNode=R,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),P(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==q&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>L(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==F&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(R.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Y.createElement(J(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new X(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new Y(t)),e}k(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const s of t)n===e.length?e.push(r=new tt(this.O(N()),this.O(N()),this,this.options)):r=e[n],r._$AI(s),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,s){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=F}_$AI(t,e=this,r,n){const s=this.strings;let i=!1;if(void 0===s)t=Q(this,t,e,0),i=!P(t)||t!==this._$AH&&t!==q,i&&(this._$AH=t);else{const n=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=Q(this,n[r+o],e,o),a===q&&(a=this._$AH[o]),i||=!P(a)||a!==this._$AH[o],a===F?t=F:t!==F&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}i&&!n&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}class nt extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==F)}}class st extends et{constructor(t,e,r,n,s){super(t,e,r,n,s),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??F)===q)return;const r=this._$AH,n=t===F&&r!==F||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==F&&(r===F||n);n&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const ot=k.litHtmlPolyfillSupport;ot?.(Y,tt),(k.litHtmlVersions??=[]).push("3.3.1");const at=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
@@ -51,14 +51,14 @@ function Et(t,e){return Object.is(t,e)}
|
|
|
51
51
|
*
|
|
52
52
|
* Use of this source code is governed by an MIT-style license that can be
|
|
53
53
|
* found in the LICENSE file at https://angular.io/license
|
|
54
|
-
*/let St=null,wt=!1,Ct=1;const $t=Symbol("SIGNAL");function kt(t){const e=St;return St=t,e}const
|
|
54
|
+
*/let St=null,wt=!1,Ct=1;const $t=Symbol("SIGNAL");function kt(t){const e=St;return St=t,e}const _t={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function At(t){if(wt)throw new Error("undefined"!=typeof ngDevMode&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===St)return;St.consumerOnSignalRead(t);const e=St.nextProducerIndex++;if(Pt(St),e<St.producerNode.length&&St.producerNode[e]!==t&&Nt(St)){Rt(St.producerNode[e],St.producerIndexOfThis[e])}St.producerNode[e]!==t&&(St.producerNode[e]=t,St.producerIndexOfThis[e]=Nt(St)?Dt(t,St,e):0),St.producerLastReadVersion[e]=t.version}function Ot(t){if(t.dirty||t.lastCleanEpoch!==Ct){if(!t.producerMustRecompute(t)&&!function(t){Pt(t);for(let e=0;e<t.producerNode.length;e++){const r=t.producerNode[e],n=t.producerLastReadVersion[e];if(n!==r.version)return!0;if(Ot(r),n!==r.version)return!0}return!1}(t))return t.dirty=!1,void(t.lastCleanEpoch=Ct);t.producerRecomputeValue(t),t.dirty=!1,t.lastCleanEpoch=Ct}}function xt(t){if(void 0===t.liveConsumerNode)return;const e=wt;wt=!0;try{for(const e of t.liveConsumerNode)e.dirty||Tt(e)}finally{wt=e}}function Tt(t){var e;t.dirty=!0,xt(t),null==(e=t.consumerMarkedDirty)||e.call(t.wrapper??t)}function Dt(t,e,r){var n;if(Lt(t),Pt(t),0===t.liveConsumerNode.length){null==(n=t.watched)||n.call(t.wrapper);for(let e=0;e<t.producerNode.length;e++)t.producerIndexOfThis[e]=Dt(t.producerNode[e],t,e)}return t.liveConsumerIndexOfThis.push(r),t.liveConsumerNode.push(e)-1}function Rt(t,e){var r;if(Lt(t),Pt(t),"undefined"!=typeof ngDevMode&&ngDevMode&&e>=t.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${e} is out of bounds of ${t.liveConsumerNode.length} consumers)`);if(1===t.liveConsumerNode.length){null==(r=t.unwatched)||r.call(t.wrapper);for(let e=0;e<t.producerNode.length;e++)Rt(t.producerNode[e],t.producerIndexOfThis[e])}const n=t.liveConsumerNode.length-1;if(t.liveConsumerNode[e]=t.liveConsumerNode[n],t.liveConsumerIndexOfThis[e]=t.liveConsumerIndexOfThis[n],t.liveConsumerNode.length--,t.liveConsumerIndexOfThis.length--,e<t.liveConsumerNode.length){const r=t.liveConsumerIndexOfThis[e],n=t.liveConsumerNode[e];Pt(n),n.producerIndexOfThis[r]=e}}function Nt(t){var e;return t.consumerIsAlwaysLive||((null==(e=null==t?void 0:t.liveConsumerNode)?void 0:e.length)??0)>0}function Pt(t){t.producerNode??(t.producerNode=[]),t.producerIndexOfThis??(t.producerIndexOfThis=[]),t.producerLastReadVersion??(t.producerLastReadVersion=[])}function Lt(t){t.liveConsumerNode??(t.liveConsumerNode=[]),t.liveConsumerIndexOfThis??(t.liveConsumerIndexOfThis=[])}
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright Google LLC All Rights Reserved.
|
|
58
58
|
*
|
|
59
59
|
* Use of this source code is governed by an MIT-style license that can be
|
|
60
60
|
* found in the LICENSE file at https://angular.io/license
|
|
61
|
-
*/function Mt(t){if(Ot(t),
|
|
61
|
+
*/function Mt(t){if(Ot(t),At(t),t.value===jt)throw t.error;return t.value}const It=Symbol("UNSET"),Ut=Symbol("COMPUTING"),jt=Symbol("ERRORED"),Ht=(()=>({..._t,value:It,dirty:!0,error:null,equal:Et,producerMustRecompute:t=>t.value===It||t.value===Ut,producerRecomputeValue(t){if(t.value===Ut)throw new Error("Detected cycle in computations.");const e=t.value;t.value=Ut;const r=function(t){return t&&(t.nextProducerIndex=0),kt(t)}(t);let n,s=!1;try{n=t.computation.call(t.wrapper);s=e!==It&&e!==jt&&t.equal.call(t.wrapper,e,n)}catch(e){n=jt,t.error=e}finally{!function(t,e){if(kt(e),t&&void 0!==t.producerNode&&void 0!==t.producerIndexOfThis&&void 0!==t.producerLastReadVersion){if(Nt(t))for(let e=t.nextProducerIndex;e<t.producerNode.length;e++)Rt(t.producerNode[e],t.producerIndexOfThis[e]);for(;t.producerNode.length>t.nextProducerIndex;)t.producerNode.pop(),t.producerLastReadVersion.pop(),t.producerIndexOfThis.pop()}}(t,r)}s?t.value=e:(t.value=n,t.version++)}}))();let Vt=
|
|
62
62
|
/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -66,7 +66,7 @@ function Et(t,e){return Object.is(t,e)}
|
|
|
66
66
|
* Use of this source code is governed by an MIT-style license that can be
|
|
67
67
|
* found in the LICENSE file at https://angular.io/license
|
|
68
68
|
*/
|
|
69
|
-
function(){throw new Error};function
|
|
69
|
+
function(){throw new Error};function Wt(){return At(this),this.value}function zt(t,e){!1===(null==St?void 0:St.consumerAllowSignalWrites)&&Vt(),t.equal.call(t.wrapper,t.value,e)||(t.value=e,function(t){t.version++,Ct++,xt(t)}
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
72
72
|
* Copyright 2024 Bloomberg Finance L.P.
|
|
@@ -82,7 +82,7 @@ function(){throw new Error};function Vt(){return _t(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=(()=>({...
|
|
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 _t(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=()=>(
|
|
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 Wt.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(Ht);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
|
|
@@ -171,17 +171,17 @@ Ft.State,Ft.Computed;const pe=(t,e)=>new Ft.State(t,e),ue=(t,e)=>new Ft.Computed
|
|
|
171
171
|
&[color="danger"] { --tp-element-color: var(--tp-color-danger); }
|
|
172
172
|
&[color="warning"] { --tp-element-color: var(--tp-color-warning); }
|
|
173
173
|
&[color="neutral"] { --tp-element-color: var(--tp-color-neutral); }
|
|
174
|
-
`}willUpdate(t){t.has("shade")&&(this.mixer=500===this.shade?"none":this.shade>500?"black":"white")}}e([ut({type:String,reflect:!0}),r("design:type",String)],be.prototype,"color",void 0),e([ut({type:Number,reflect:!0,converter(t,e){const r=Number(t);return isNaN(r)?500:function(t,e,r){return Math.max(Math.min(e,r),t)}(0,1e3,r)}}),r("design:type",Number)],be.prototype,"shade",void 0),e([ut({type:String,reflect:!0}),r("design:type",String)],be.prototype,"mixer",void 0);const Ee=Qt(lt),Se=Qt(be);function we(){return we=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},we.apply(null,arguments)}var Ce;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(Ce||(Ce={}));var $e="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function ke(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var Ae="beforeunload",_e="popstate";function Oe(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=Pe(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,$e({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=Ce.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&&ke(!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(){Ne(s()[1])!==Ne(h)&&o()});var a=Ce.Pop,l=s(),c=l[0],h=l[1],d=De(),p=De();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:Ne(t))}function g(t,e){return void 0===e&&(e=null),$e(we({pathname:h.pathname,hash:"",search:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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(we({},n.state,{idx:c}),""));var b={get action(){return a},get location(){return h},createHref:u,push:function t(e,s){var i=Ce.Push,o=g(e,s);if("production"!==process.env.NODE_ENV&&ke("/"===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=Ce.Replace,i=g(e,r);if("production"!==process.env.NODE_ENV&&ke("/"===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(Ae,Te),function(){e(),p.length||r.removeEventListener(Ae,Te)}}};return b}function xe(t,e,r){return Math.min(Math.max(t,e),r)}function Te(t){t.preventDefault(),t.returnValue=""}function De(){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 Re(){return Math.random().toString(36).substr(2,8)}function Ne(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 Pe(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 Le={},Me=pe("browser");function Ie(t){let e=Le[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,$e({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=Ce.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&&ke(!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=Ce.Pop,a=s(),l=a[0],c=a[1],h=De(),d=De();function p(t){return"string"==typeof t?t:Ne(t)}function u(t,e){return void 0===e&&(e=null),$e(we({pathname:c.pathname,hash:"",search:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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(we({},n.state,{idx:l}),""));var y={get action(){return o},get location(){return c},createHref:p,push:function t(e,s){var i=Ce.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=Ce.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(Ae,Te),function(){e(),d.length||r.removeEventListener(Ae,Te)}}};return y}();break;case"hash":e=Oe();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=$e(we({pathname:"/",search:"",hash:"",state:null,key:Re()},"string"==typeof t?Pe(t):t));return"production"!==process.env.NODE_ENV&&ke("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),o=xe(null==s?i.length-1:s,0,i.length-1),a=Ce.Pop,l=i[o],c=De(),h=De();function d(t,e){return void 0===e&&(e=null),$e(we({pathname:l.pathname,search:"",hash:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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=xe(o+t,0,i.length-1),r=Ce.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:Ne(t)},push:function t(e,r){var n=Ce.Push,s=d(e,r);"production"!==process.env.NODE_ENV&&ke("/"===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=Ce.Replace,s=d(e,r);"production"!==process.env.NODE_ENV&&ke("/"===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}()}Le[t]=e}return e}ue(()=>Ie(Me.get()));const Ue=Symbol("HistoryManaged:history"),He=Symbol("HistoryManaged:historyType"),We=t=>{var n,s;class i extends t{constructor(){super(...arguments),this.history=void 0,this.#r=pe(this.history),this.#n=ue(()=>{const t=this.closest("tha-router-config, tha-router-outlet");return t?.[He]?.get()}),this[n]=ue(()=>this.#r.get()??this.#n.get()??Me.get()),this[s]=ue(()=>Ie(this[He].get()))}static{n=He,s=Ue}#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 je(t=ye){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var Ve;const ze=Symbol("ThaRouterOutlet:renderRoute"),Be=Symbol("ThaRouterOutlet:params");function qe(t){return!!t}function Fe(t){return t.filter(qe)}t.ThaRouterOutlet=class extends Ee{constructor(){super(...arguments),this.#s=pe(void 0),this.#i=pe(null),this.#o=ue(()=>this.#i.get()?.deref()?.[fe].get()??null),this.#a=ue(()=>{const t=this.#s.get()?.deref(),e=this.#i.get()?.deref(),r=e?.[me];if(!t||!r)return null;const{location:{pathname:n}}=t[Ue].get();return r.exec(n,"http://dummy.base")?.pathname.groups??null}),this[Ve]=ue(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[Be].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#l=ye,this.#c=ye,this.#h=ye,this.for=null,this.routePath=null,this.routeID=void 0}#s;#i;#o;#a;#l;#c;#h;connectedCallback(){super.connectedCallback(),je(()=>{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[Be].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)}[(Ve=Be,ze)](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(We(Ee)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=l`
|
|
174
|
+
`}willUpdate(t){t.has("shade")&&(this.mixer=500===this.shade?"none":this.shade>500?"black":"white")}}e([ut({type:String,reflect:!0}),r("design:type",String)],be.prototype,"color",void 0),e([ut({type:Number,reflect:!0,converter(t,e){const r=Number(t);return isNaN(r)?500:function(t,e,r){return Math.max(Math.min(e,r),t)}(0,1e3,r)}}),r("design:type",Number)],be.prototype,"shade",void 0),e([ut({type:String,reflect:!0}),r("design:type",String)],be.prototype,"mixer",void 0);const Ee=Qt(lt),Se=Qt(be);function we(){return we=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},we.apply(null,arguments)}var Ce;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(Ce||(Ce={}));var $e="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function ke(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var _e="beforeunload",Ae="popstate";function Oe(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function s(){var t=Pe(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,$e({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=Ce.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&&ke(!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(Ae,o),r.addEventListener("hashchange",function(){Ne(s()[1])!==Ne(h)&&o()});var a=Ce.Pop,l=s(),c=l[0],h=l[1],d=De(),p=De();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:Ne(t))}function g(t,e){return void 0===e&&(e=null),$e(we({pathname:h.pathname,hash:"",search:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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(we({},n.state,{idx:c}),""));var b={get action(){return a},get location(){return h},createHref:u,push:function t(e,s){var i=Ce.Push,o=g(e,s);if("production"!==process.env.NODE_ENV&&ke("/"===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=Ce.Replace,i=g(e,r);if("production"!==process.env.NODE_ENV&&ke("/"===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(_e,Te),function(){e(),p.length||r.removeEventListener(_e,Te)}}};return b}function xe(t,e,r){return Math.min(Math.max(t,e),r)}function Te(t){t.preventDefault(),t.returnValue=""}function De(){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 Re(){return Math.random().toString(36).substr(2,8)}function Ne(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 Pe(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 Le={},Me=pe("browser");function Ie(t){let e=Le[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,$e({pathname:e,search:s,hash:i,state:o.usr||null,key:o.key||"default"})]}var i=null;r.addEventListener(Ae,function(){if(i)d.call(i),i=null;else{var t=Ce.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&&ke(!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=Ce.Pop,a=s(),l=a[0],c=a[1],h=De(),d=De();function p(t){return"string"==typeof t?t:Ne(t)}function u(t,e){return void 0===e&&(e=null),$e(we({pathname:c.pathname,hash:"",search:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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(we({},n.state,{idx:l}),""));var y={get action(){return o},get location(){return c},createHref:p,push:function t(e,s){var i=Ce.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=Ce.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(_e,Te),function(){e(),d.length||r.removeEventListener(_e,Te)}}};return y}();break;case"hash":e=Oe();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=$e(we({pathname:"/",search:"",hash:"",state:null,key:Re()},"string"==typeof t?Pe(t):t));return"production"!==process.env.NODE_ENV&&ke("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),o=xe(null==s?i.length-1:s,0,i.length-1),a=Ce.Pop,l=i[o],c=De(),h=De();function d(t,e){return void 0===e&&(e=null),$e(we({pathname:l.pathname,search:"",hash:""},"string"==typeof t?Pe(t):t,{state:e,key:Re()}))}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=xe(o+t,0,i.length-1),r=Ce.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:Ne(t)},push:function t(e,r){var n=Ce.Push,s=d(e,r);"production"!==process.env.NODE_ENV&&ke("/"===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=Ce.Replace,s=d(e,r);"production"!==process.env.NODE_ENV&&ke("/"===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}()}Le[t]=e}return e}ue(()=>Ie(Me.get()));const Ue=Symbol("HistoryManaged:history"),je=Symbol("HistoryManaged:historyType"),He=t=>{var n,s;class i extends t{constructor(){super(...arguments),this.history=void 0,this.#r=pe(this.history),this.#n=ue(()=>{const t=this.parentElement?.closest("tha-router-config, tha-router-outlet");return t?.[je]?.get()}),this[n]=ue(()=>this.#r.get()??this.#n.get()??Me.get()),this[s]=ue(()=>Ie(this[je].get()))}static{n=je,s=Ue}#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 Ve(t=ye){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var We;const ze=Symbol("ThaRouterOutlet:renderRoute"),Be=Symbol("ThaRouterOutlet:params");function qe(t){return!!t}function Fe(t){return t.filter(qe)}t.ThaRouterOutlet=class extends Ee{constructor(){super(...arguments),this.#s=pe(void 0),this.#i=pe(null),this.#o=ue(()=>this.#i.get()?.deref()?.[fe].get()??null),this.#a=ue(()=>{const t=this.#s.get()?.deref(),e=this.#i.get()?.deref(),r=e?.[me];if(!t||!r)return null;const{location:{pathname:n}}=t[Ue].get();return r.exec(n,"http://dummy.base")?.pathname.groups??null}),this[We]=ue(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[Be].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#l=ye,this.#c=ye,this.#h=ye,this.for=null,this.routePath=null,this.routeID=void 0}#s;#i;#o;#a;#l;#c;#h;connectedCallback(){super.connectedCallback(),Ve(()=>{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[Be].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)}[(We=Be,ze)](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(He(Ee)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=l`
|
|
175
175
|
tha-router {
|
|
176
176
|
& > :not(tha-router-outlet) {
|
|
177
177
|
display: none;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
`.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=ye;#g=ye;#v=ye;#p=pe([]);#f=pe(null);#m=pe(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?.[ze](t)}),this.#g=this.updateEffect(()=>{const t=this[Ue].get();this.#v(),this.#y({location:this[Ue].get().location,action:"POP"}),this.#v=t?t.listen(this.#y):ye}),
|
|
180
|
+
`.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=ye;#g=ye;#v=ye;#p=pe([]);#f=pe(null);#m=pe(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?.[ze](t)}),this.#g=this.updateEffect(()=>{const t=this[Ue].get();this.#v(),this.#y({location:this[Ue].get().location,action:"POP"}),this.#v=t?t.listen(this.#y):ye}),Ve(()=>{this.#y({location:this[Ue].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[me];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(He(Ee)){constructor(){super(...arguments),this.to=null,this.active=!1,this.#b=ye,this.#v=ye,this.#E=pe(null),this.#S=ue(()=>{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[Ue].get();if(console.log(this[je].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=Fe(r.split("/")),e=Fe(n.split("/"));for(const r of e)".."===r?t.pop():"."!==r&&t.push(r);n="/"+t.join("/")}n=n?.replaceAll("//","/"),this[Ue].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`
|
|
181
181
|
tha-router-link {
|
|
182
182
|
cursor: pointer;
|
|
183
183
|
}
|
|
184
|
-
`.toString(),document.head.appendChild(t)}#b;#v;#E;#S;connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#w),this.#b=this.updateEffect(()=>{const t=this[Ue].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})??ye})}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(
|
|
184
|
+
`.toString(),document.head.appendChild(t)}#b;#v;#E;#S;connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#w),this.#b=this.updateEffect(()=>{const t=this[Ue].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})??ye})}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(He(Ee)){#C=ye;connectedCallback(){super.connectedCallback(),document.head.contains(this)&&(console.log("ThaRouterConfig: Setting global history type to",this[je].get()),this.#C=this.updateEffect(()=>{Me.set(this[je].get())}))}disconnectedCallback(){super.disconnectedCallback();try{this.#C()}catch{}}createRenderRoot(){return this}},t.ThaRouterConfig=e([ht("tha-router-config")],t.ThaRouterConfig),t.ThaRouterParam=class extends Ee{constructor(){super(...arguments),this.#m=pe(null),this.#$=pe(""),this.#k=ue(()=>this.#m.get()?.[Be]?.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 de`${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 Ge=Symbol("Accept Drop"),Ze=Symbol("Register Handle"),Je=Symbol("Unregister Handle");var Ke,Ye;class Qe extends DragEvent{static#_=["thadrag","thadragstart","thadragend","thadropzoneenter","thadropzoneleave","thadropzoneover","thadropped"];static#A=["thadrop","thadropend","thadragenter","thadragleave","thadragover"];get#O(){return Ke.#A.includes(this.type)?this.dropzoneTarget:Ke.#_.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()?.[Ge](this.dropzoneTarget,t)}}let Xe;function tr(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)}Ke=Qe,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(Ye.TRANSPARENT_IMAGE,0,0),t.dataTransfer.effectAllowed=this.draggingStrategy,document.addEventListener("dragover",this.#P),this.#L(t),this.#M(),Ve().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 Qe("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 Qe("thadropend",{dragTarget:new WeakRef(this),dropzoneTarget:e},t)),this.dispatchEvent(new Qe("thadragend",{dragTarget:new WeakRef(this)},t))};e?this.addEventListener("transitionend",r,{once:!0}):r()},this.#j=t=>{const{x:e,y:r}=t;this.style.setProperty("--tha-cx",`${e}px`),this.style.setProperty("--tha-cy",`${r}px`)},this.#H=t=>{this.draggedOver=t.dropzoneTarget?.deref()?.name??""},this.#V=()=>{this.draggedOver=null}}static{Ye=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`
|
|
185
185
|
:host {
|
|
186
186
|
--tha-diff-x: calc(var(--tha-cx) - var(--tha-x));
|
|
187
187
|
--tha-diff-y: calc(var(--tha-cy) - var(--tha-y));
|
|
@@ -219,7 +219,7 @@ Ft.State,Ft.Computed;const pe=(t,e)=>new Ft.State(t,e),ue=(t,e)=>new Ft.Computed
|
|
|
219
219
|
width: var(--tha-target-width);
|
|
220
220
|
height: var(--tha-target-height);
|
|
221
221
|
}
|
|
222
|
-
`}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>`}[Ge](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`)}[Ze](t){this.#D.add(t)}[Je](t){this.#D.delete(t)}#V(){Ye.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=Ye=e([ht("tha-drag")],t.DragElement),document.addEventListener("thadragstart",t=>{Xe=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=Xe.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!Xe.name||!this.accept.length||this.accept.includes(Xe.name)}#Z(t,e,r){const{dragTarget:n}=Xe,s=new WeakRef(this);this.dispatchEvent(new Qe(t,{dragTarget:n,dropzoneTarget:s},r)),n.deref()?.dispatchEvent(new Qe(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?.[Ze](this)}disconnectedCallback(){super.disconnectedCallback(),this.#Q?.[Je](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=tr(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 er={};const rr={popInline:"center",targetInline:"center",popBlock:"bottom",targetBlock:"top"},nr=new Set(["start","center","end"]),sr=new Set(["top","middle","bottom"]),ir={start:["end","start"],center:["center","center"],end:["start","end"]},or={top:["bottom","top"],middle:["middle","middle"],bottom:["top","bottom"]};function ar(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return nr.has(t)?ir[t]:null}return 2===e.length&&nr.has(e[0])&&nr.has(e[1])?[e[0],e[1]]:null}function lr(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return sr.has(t)?or[t]:null}return 2===e.length&&sr.has(e[0])&&sr.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 er||(er[t]=function*(t){let e=0;for(;;)yield`${t}-${e++}`}(t)),er[t].next().value),this.#bt=null,this.#Et=!1,this.#St=[]}static{this.styles=(()=>{const t=l`
|
|
222
|
+
`}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.#W(),this.addEventListener("dragstart",this.#R),this.addEventListener("dragend",this.#U),this.addEventListener("drag",this.#j),this.addEventListener("thadropzoneenter",this.#H),this.addEventListener("thadropzoneleave",this.#V)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("dragstart",this.#R),this.removeEventListener("dragend",this.#U),this.removeEventListener("drag",this.#j),this.removeEventListener("thadropzoneenter",this.#H),this.removeEventListener("thadropzoneleave",this.#V)}render(){return B`<slot></slot>`}[Ge](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`)}[Ze](t){this.#D.add(t)}[Je](t){this.#D.delete(t)}#W(){Ye.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;#j;#H;#V;#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=Ye=e([ht("tha-drag")],t.DragElement),document.addEventListener("thadragstart",t=>{Xe=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=Xe.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!Xe.name||!this.accept.length||this.accept.includes(Xe.name)}#Z(t,e,r){const{dragTarget:n}=Xe,s=new WeakRef(this);this.dispatchEvent(new Qe(t,{dragTarget:n,dropzoneTarget:s},r)),n.deref()?.dispatchEvent(new Qe(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?.[Ze](this)}disconnectedCallback(){super.disconnectedCallback(),this.#Q?.[Je](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=tr(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 er={};const rr={popInline:"center",targetInline:"center",popBlock:"bottom",targetBlock:"top"},nr=new Set(["start","center","end"]),sr=new Set(["top","middle","bottom"]),ir={start:["end","start"],center:["center","center"],end:["start","end"]},or={top:["bottom","top"],middle:["middle","middle"],bottom:["top","bottom"]};function ar(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return nr.has(t)?ir[t]:null}return 2===e.length&&nr.has(e[0])&&nr.has(e[1])?[e[0],e[1]]:null}function lr(t){const e=t.trim().split(/\s+to\s+/);if(1===e.length){const t=e[0];return sr.has(t)?or[t]:null}return 2===e.length&&sr.has(e[0])&&sr.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 er||(er[t]=function*(t){let e=0;for(;;)yield`${t}-${e++}`}(t)),er[t].next().value),this.#bt=null,this.#Et=!1,this.#St=[]}static{this.styles=(()=>{const t=l`
|
|
223
223
|
tp-popover {
|
|
224
224
|
--tp-popover-inline-position: attr(data-ti type(*));
|
|
225
225
|
--tp-popover-block-position: attr(data-tb type(*));
|
|
@@ -257,7 +257,7 @@ Ft.State,Ft.Computed;const pe=(t,e)=>new Ft.State(t,e),ue=(t,e)=>new Ft.Computed
|
|
|
257
257
|
inset-block-end: anchor(var(--tp-popover-block-position));
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#yt;#bt;get anchorElement(){return this.#bt}get anchorName(){return`--${this.#yt}`}#Et;#St;createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.#wt(),this.#Ct(),this.#$t(),this.#kt()}disconnectedCallback(){super.disconnectedCallback(),this.#
|
|
260
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#yt;#bt;get anchorElement(){return this.#bt}get anchorName(){return`--${this.#yt}`}#Et;#St;createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.#wt(),this.#Ct(),this.#$t(),this.#kt()}disconnectedCallback(){super.disconnectedCallback(),this.#_t(),this.#At()}updated(t){t.has("mode")&&this.#wt(),t.has("target")&&(this.#Ct(),this.#kt()),t.has("position")&&this.#$t(),t.has("trigger")&&this.#kt()}render(){return B``}#wt(){const t="manual"===this.mode?"manual":"auto";this.getAttribute("popover")!==t&&this.setAttribute("popover",t)}#Ot(){const t=this.target;if(t)try{const e=this.getRootNode().querySelector(t);if(e instanceof HTMLElement)return e;console.warn(`<tp-popover>: target "${t}" did not resolve to an HTMLElement; using parentElement.`)}catch{console.warn(`<tp-popover>: invalid target selector "${t}"; using parentElement.`)}const e=this.parentElement;if(e instanceof HTMLElement)return e;const r=this.getRootNode();return r instanceof ShadowRoot&&r.host instanceof HTMLElement?r.host:null}#Ct(){const t=this.#Ot();t!==this.#bt?(this.#At(),this.#bt=t,t&&this.#xt(t)):t&&this.#xt(t)}#xt(t){const e=`--${this.#yt}`,r=t.style.getPropertyValue("anchor-name").trim();if(r&&r!==e)return this.style.setProperty("position-anchor",r),void(this.#Et=!1);t.style.setProperty("anchor-name",e),this.style.setProperty("position-anchor",e),this.#Et=!0}#At(){if(this.#bt&&this.#Et){const t=`--${this.#yt}`;this.#bt.style.getPropertyValue("anchor-name").trim()===t&&this.#bt.style.removeProperty("anchor-name")}this.#bt=null,this.#Et=!1,this.style.removeProperty("position-anchor")}#$t(){let t=function(t){if(!t)return null;const e=t.trim().toLowerCase();if(!e)return null;if(!e.includes("/")){const t=ar(e);if(t){const[e,r]=or.middle;return{popInline:t[0],targetInline:t[1],popBlock:e,targetBlock:r}}const r=lr(e);if(r){const[t,e]=ir.center;return{popInline:t,targetInline:e,popBlock:r[0],targetBlock:r[1]}}return null}const r=e.split("/");if(2!==r.length)return null;const n=ar(r[0]),s=lr(r[1]);return n&&s?{popInline:n[0],targetInline:n[1],popBlock:s[0],targetBlock:s[1]}:null}(this.position);this.position&&!t&&console.warn(`<tp-popover>: invalid position "${this.position}"; using default.`),t??=rr,this.dataset.pi=t.popInline,this.dataset.ti=t.targetInline,this.dataset.pb=t.popBlock,this.dataset.tb=t.targetBlock}#_t(){for(const t of this.#St)t();this.#St=[]}#kt(){this.#_t();const t=this.#bt;if(t){if("click"===this.trigger){const e=t=>{if(!t.composedPath().includes(this))try{this.togglePopover()}catch{}};return t.addEventListener("click",e),void this.#St.push(()=>t.removeEventListener("click",e))}if("hover"===this.trigger){let e=null;const r=()=>{null!==e&&(clearTimeout(e),e=null)},n=()=>{r();try{this.showPopover()}catch{}},s=()=>{r(),e=setTimeout(()=>{try{this.hidePopover()}catch{}},120)};t.addEventListener("pointerenter",n),t.addEventListener("pointerleave",s),t.addEventListener("focusin",n),t.addEventListener("focusout",s),this.addEventListener("pointerenter",r),this.addEventListener("pointerleave",s),this.addEventListener("focusin",r),this.addEventListener("focusout",s),this.#St.push(()=>{r(),t.removeEventListener("pointerenter",n),t.removeEventListener("pointerleave",s),t.removeEventListener("focusin",n),t.removeEventListener("focusout",s),this.removeEventListener("pointerenter",r),this.removeEventListener("pointerleave",s),this.removeEventListener("focusin",r),this.removeEventListener("focusout",s)})}}}},e([ut({reflect:!0}),r("design:type",String)],t.PopoverElement.prototype,"mode",void 0),e([ut({reflect:!0}),r("design:type",Object)],t.PopoverElement.prototype,"target",void 0),e([ut({reflect:!0}),r("design:type",Object)],t.PopoverElement.prototype,"position",void 0),e([ut({reflect:!0}),r("design:type",String)],t.PopoverElement.prototype,"trigger",void 0),t.PopoverElement=e([ht("tp-popover")],t.PopoverElement);
|
|
261
261
|
/**
|
|
262
262
|
* @license
|
|
263
263
|
* Copyright 2021 Google LLC
|
|
@@ -295,7 +295,7 @@ let hr=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.val
|
|
|
295
295
|
* Copyright 2022 Google LLC
|
|
296
296
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
297
297
|
*/
|
|
298
|
-
function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addInitializer(function(){new hr(this,{context:t,callback:t=>{r.set.call(this,t)},subscribe:e})}):r.constructor.addInitializer(r=>{new hr(r,{context:t,callback:t=>{r[n]=t},subscribe:e})})}}const vr=Symbol("tp-select");class
|
|
298
|
+
function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addInitializer(function(){new hr(this,{context:t,callback:t=>{r.set.call(this,t)},subscribe:e})}):r.constructor.addInitializer(r=>{new hr(r,{context:t,callback:t=>{r[n]=t},subscribe:e})})}}class vr extends Promise{static#Tt=ye;static#Dt=ye;#Rt=!1;#Nt=!1;#Pt=ye;#Lt=ye;get resolved(){return this.#Rt}get rejected(){return this.#Nt}get finished(){return this.#Rt||this.#Nt}constructor(t=ye){super((e,r)=>{vr.#Tt=e,vr.#Dt=r,t(e,r)}),this.#Pt=vr.#Tt,this.#Lt=vr.#Dt,vr.#Tt=ye,vr.#Dt=ye}resolve(...t){if(this.finished)throw new Error("Promise is already finished");this.#Rt=!0,this.#Pt(...t)}reject(...t){if(this.finished)throw new Error("Promise is already finished");this.#Nt=!0,this.#Lt(...t)}bindTo(t){t.then(t=>{this.resolve(t)}).catch(t=>this.reject(t))}}const fr=function(){const t=new WeakMap,e=new Map,r=(r,n,s)=>{const i=new vr,o=setTimeout(()=>{i.resolve(n)},r),a={openPromise:i,id:o};return t.set(i,a),s&&e.set(s,a),i};return Object.defineProperties(r,{FINISHED_ALREADY:{writable:!1,value:Symbol("Timeout finished already")},IDENTIFIER_NOT_FOUND:{writable:!1,value:Symbol("Timeout not found via identifier")},TIMEOUT_CANCELLED:{writable:!1,value:Symbol("Timeout cancelled")}}),r.cancel=async(n,s)=>{const{FINISHED_ALREADY:i,IDENTIFIER_NOT_FOUND:o,TIMEOUT_CANCELLED:a}=r;let l;if(void 0===s&&(s=a),l="symbol"==typeof n?e.get(n):t.get(n),!l)throw o;if(l.openPromise.finished)throw i;clearTimeout(l.id),l.openPromise.reject(s),"symbol"==typeof n&&e.delete(n)},r}();const mr=new Map;function yr(t,e,r=180,n=null,...s){let i,o;if(mr.has(t)){const e=mr.get(t);i=e.timeout,o=e.promise,fr.cancel(i)}else o=new vr;return i=fr(r),mr.set(t,{promise:o,timeout:i}),i.then(()=>{mr.delete(t);const r=e.call(n,...s);return o.bindTo(async function(t){return await t}(r)),r}).catch(t=>{t!==fr.TIMEOUT_CANCELLED&&o.reject(t)}),o}const br=Symbol("tp-select");class Er{#O;#Mt;#It=!1;constructor(t,e={}){const{attributes:r=!0,childList:n=!0,characterData:s=!0}=e;this.#O=t,this.clone=t.cloneNode(!0),this.#Mt=new MutationObserver(t=>this.#Ut(t)),this.#Mt.observe(t,{attributes:r,childList:n,characterData:s,subtree:!0})}disconnect(){this.#It||(this.#It=!0,this.#Mt.disconnect())}#Ut(t){for(const e of t){const t=this.#jt(e.target);if(!t)continue;const r=this.#Ht(t);if(r)switch(e.type){case"attributes":this.#Vt(e,r);break;case"characterData":r.nodeValue=e.target.nodeValue;break;case"childList":this.#Wt(e.target,r)}}}#Vt(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)}#Wt(t,e){for(;e.firstChild;)e.removeChild(e.firstChild);for(const r of Array.from(t.childNodes))e.appendChild(r.cloneNode(!0))}#jt(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}#Ht(t){let e=this.clone;for(const r of t){const t=e.childNodes[r];if(!t)return null;e=t}return e}}const Sr=Symbol("select:register-option"),wr=Symbol("select:unregister-option"),Cr=Symbol("option:should-register-to-select");var $r,kr;t.SelectedContentElement=class extends Ee{static{this.styles=(()=>{const t=l`
|
|
299
299
|
tp-selected-content {
|
|
300
300
|
display: inline-block;
|
|
301
301
|
|
|
@@ -309,7 +309,7 @@ function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#
|
|
312
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#zt=new WeakMap;createRenderRoot(){return this}render(){const t=this.select?.placeholder??"",e=this.select?.selectedOptions.get().map(t=>t.deref()).filter(Boolean)??[],r=this.#Bt(e);return e.length?r.map(t=>B`${t}`):B`<slot name="placeholder"><span part="placeholder">${t}</span></slot>`}#Bt(t){return t.map(t=>{let e=this.#zt.get(t);return e||(e=new Er(t),this.#zt.set(t,e),e.clone.setAttribute("part","selected-content-option"),e.clone[Cr]=!1),e.clone})}},e([gr({context:br,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 Ee{constructor(){super(...arguments),this[$r]=!0,this.value=""}static{$r=Cr}static{this.styles=(()=>{const t=l`
|
|
313
313
|
tp-option:not([part="selected-content-option"]) {
|
|
314
314
|
display: block;
|
|
315
315
|
cursor: pointer;
|
|
@@ -328,7 +328,7 @@ function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}connectedCallback(){super.connectedCallback(),this[
|
|
331
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}connectedCallback(){super.connectedCallback(),this[Cr]&&this.select?.[Sr](this)}disconnectedCallback(){super.disconnectedCallback(),this[Cr]&&this.select?.[wr](this)}willUpdate(t){if(!this[Cr])return;const e=this.select?.selectedOptions.get().some(t=>t.deref()===this)??!1;this.toggleAttribute("selected",e)}createRenderRoot(){return this}render(){return B``}},e([gr({context:br,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 _r extends Event{constructor(t,e){super("change",{bubbles:!0,composed:!1,cancelable:!1,...e}),this.value=t.value,this.selectedOptions=t.selectedOptions}}return t.SelectElement=class extends Se{static{kr=this}static{this.formAssociated=!0}static{this.ALLOWED_OPTION_ELEMENTS=[t.OptionElement]}static{this.styles=(()=>{const t=l`
|
|
332
332
|
${be.shadedElementStyles}
|
|
333
333
|
--tp-select-option-color: white;
|
|
334
334
|
--tp-select-selection-color: var(--tp-calc-element-color);
|
|
@@ -380,7 +380,7 @@ function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
380
380
|
${t}
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,r.styleSheet],e})()}#
|
|
383
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,r.styleSheet],e})()}#qt;get#Ft(){return this.shadowRoot?.querySelector("tp-popover")}#Gt;#Zt;#k;get value(){return this.#k.get()}set value(t){this.#Gt=t,yr(this.#Zt,this.#Jt,10,this)}#Kt;get placeholder(){return this.#Kt.get()}set placeholder(t){this.#Yt(this.#Kt,"placeholder",t)}#Qt;#Xt;#te;constructor(){super(),this.#qt=new Set,this.self=this,this.selectedOptions=pe([]),this.#Gt=null,this.#Zt=Symbol("tpselect:assignValueDebouncer"),this.#k=ue(()=>this.selectedOptions.get().map(t=>t.deref()?.value??"").filter(Boolean).join(",")),this.#Kt=pe("Select an option"),this.max=1,this.min=0,this.name=null,this.disabled=!1,this.required=!1,this.open=!1,this.#Xt="",this.#te=null,this.#Qt=this.attachInternals()}get internals(){return this.#Qt}get form(){return this.#Qt.form}get validity(){return this.#Qt.validity}get validationMessage(){return this.#Qt.validationMessage}get willValidate(){return this.#Qt.willValidate}checkValidity(){return this.#Qt.checkValidity()}reportValidity(){return this.#Qt.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.#Xt=this.value}disconnectedCallback(){super.disconnectedCallback()}render(){return B`
|
|
384
384
|
<div pseudo="button" part="button">
|
|
385
385
|
<slot name="button">
|
|
386
386
|
<tp-selected-content part="selected-content"></tp-selected-content>
|
|
@@ -392,14 +392,14 @@ function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
392
392
|
<tp-popover
|
|
393
393
|
position="start to start / bottom"
|
|
394
394
|
target="[pseudo=button]"
|
|
395
|
-
@click=${this.#
|
|
396
|
-
@toggle=${this.#
|
|
395
|
+
@click=${this.#ee}
|
|
396
|
+
@toggle=${this.#re}
|
|
397
397
|
part="popover">
|
|
398
398
|
<slot name="popover">
|
|
399
399
|
<slot></slot>
|
|
400
400
|
</slot>
|
|
401
401
|
</tp-popover>
|
|
402
|
-
`}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.#
|
|
402
|
+
`}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.#ne(),this.#se()}formResetCallback(){this.value=this.#Xt}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=""}#ne(){const t=""===this.value?[]:this.value.split(",");if(1===this.max)this.#Qt.setFormValue(t[0]??"");else{const e=new FormData,r=this.name??"";for(const n of t)e.append(r,n);this.#Qt.setFormValue(e)}this.required&&0===t.length?this.#Qt.setValidity({valueMissing:!0},"Please select an option."):this.#Qt.setValidity({})}#se(){const t=this.value;if(t===this.#te)return;const e=null===this.#te;if(this.#te=t,e)return;const r=this.selectedOptions.get().map(t=>t.deref()).filter(Boolean);this.dispatchEvent(new _r({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(),r=e.find(e=>e.deref()===t);r&&(e.length<=this.min||this.selectedOptions.set(e.filter(t=>t!==r)))}toggleOption(t){this.selectedOptions.get().find(e=>e.deref()===t)?this.deselectOption(t):this.selectOption(t)}togglePopover(){return this.#Ft.togglePopover()}hidePopover(){this.#Ft.hidePopover()}showPopover(){this.#Ft.showPopover()}[Sr](t){this.#qt.add(t),yr(this.#Zt,this.#Jt,10,this)}[wr](t){this.#qt.delete(t);const e=this.selectedOptions.get(),r=e.find(e=>e.deref()===t);r&&this.selectedOptions.set(e.filter(t=>t!==r))}#ee(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=>kr.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()}}#re(t){this.open="open"===t.newState}#Yt(t,e,r){const n=t.get();n!==r&&(t.set(r),this.requestUpdate(e,n))}#Jt(){const t=this.#Gt?.split(",").map(t=>t.trim())??[],e=Array.from(this.#qt);this.selectedOptions.set(t.map(t=>e.find(e=>e.value===t)).filter(Boolean).map(t=>new WeakRef(t)))}},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 ur(this,{context:t,initialValue:e})),e}};{e.constructor.addInitializer(e=>{n.set(e,new ur(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:br}),r("design:type",t.SelectElement)],t.SelectElement.prototype,"self",void 0),e([ut({type:String,reflect:!0,noAccessor:!0}),r("design:type",Object),r("design:paramtypes",[Object])],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:Number,reflect:!0,converter:{fromAttribute:t=>{if(null==t||""===t)return 0;const e=Number(String(t).trim());return Number.isFinite(e)&&e>=0?Math.floor(e):0},toAttribute:t=>String(t)}}),r("design:type",Number)],t.SelectElement.prototype,"min",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=kr=e([ht("tp-select"),r("design:paramtypes",[])],t.SelectElement),t.ButtonElement=class extends be{static{this.formAssociated=!0}static{this.styles=(()=>{const t=l`
|
|
403
403
|
@layer base {
|
|
404
404
|
tp-button {
|
|
405
405
|
${be.shadedElementStyles}
|
|
@@ -481,5 +481,5 @@ function gr({context:t,subscribe:e}){return(r,n)=>{"object"==typeof n?n.addIniti
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#
|
|
484
|
+
`;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,t.styleSheet],t})()}#Qt;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.#Qt.form;e&&("submit"===this.type?e.requestSubmit():"reset"===this.type&&e.reset())},this.#ie=t=>{this.disabled||" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.click())},this.#Qt=this.attachInternals(),this.#Qt.role="button"}get form(){return this.#Qt.form}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||this.setAttribute("tabindex",this.disabled?"-1":"0"),this.addEventListener("click",this.#w),this.addEventListener("keydown",this.#ie)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.#w),this.removeEventListener("keydown",this.#ie)}updated(t){super.updated?.(t),t.has("disabled")&&(this.setAttribute("tabindex",this.disabled?"-1":"0"),this.#Qt.ariaDisabled=this.disabled?"true":"false")}#w;#ie;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=_r,t.ThaDragEvent=Qe,t}({});
|
|
485
485
|
//# sourceMappingURL=elements.js.map
|