@nextrap/nte-nav 0.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## 0.1.0 (2025-07-15)
2
+
3
+ This was a version bump only for nte-nav to align it with other projects, there were no code changes.
4
+
5
+ ## 0.0.3 (2025-07-15)
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated nt-framework to 0.1.0
10
+ - Updated nte-offcanvas to 0.0.2
11
+ - Updated nte-burger to 0.0.2
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # nte-nav
2
+
3
+ A navigation element.
package/index.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";nte-nav.nav-row.start{--justify-content: flex-start}nte-nav.nav-row.end{--justify-content: flex-end}nte-nav.nav-row.center{--justify-content: center}nte-nav.nav-row.stretch{--justify-content: space-between}nte-nav.nav-row ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:row;align-items:center;position:relative;justify-content:var(--justify-content)}nte-nav.nav-row ul>li,nte-nav.nav-row ul li{position:relative;display:flex;align-items:center}nte-nav.nav-row ul>li>a,nte-nav.nav-row ul li>a{display:block;padding:.65em 1.1em;color:var(--text-color);text-decoration:none;transition:background var(--transition),color var(--transition);font-weight:500}nte-nav.nav-row ul>li>a.active,nte-nav.nav-row ul>li>a:active,nte-nav.nav-row ul li>a.active,nte-nav.nav-row ul li>a:active{background:var(--hover-color);color:var(--hover-text-color)}nte-nav.nav-row ul>li>a:hover,li:hover>nte-nav.nav-row ul>li>a,nte-nav.nav-row ul li>a:hover,li:hover>nte-nav.nav-row ul li>a{background:var(--hover-color);color:var(--hover-text-color)}nte-nav.nav-row ul>li>a:after,nte-nav.nav-row ul li>a:after{content:"";display:none;margin-left:.47em;margin-bottom:.08em;border:solid currentColor;border-width:0 2px 2px 0;padding:3px;transform:rotate(45deg) scale(.8);opacity:0;transition:opacity var(--transition),transform var(--transition)}nte-nav.nav-row ul>li:has(ul)>a:after,nte-nav.nav-row ul li:has(ul)>a:after{opacity:.55;display:inline-block}nte-nav.nav-row ul>li:hover>a:after,nte-nav.nav-row ul>li:focus-within>a:after,nte-nav.nav-row ul li:hover>a:after,nte-nav.nav-row ul li:focus-within>a:after{transform:rotate(-135deg) scale(.85)}nte-nav.nav-row ul>li>ul,nte-nav.nav-row ul li>ul{display:block;visibility:hidden;opacity:0;pointer-events:none;min-width:11rem;background:var(--submenu-bg);position:absolute;top:100%;left:0;margin-top:.3em;flex-direction:column;z-index:3;transition:opacity var(--transition),transform var(--transition),visibility var(--transition);transform:translateY(-.7em)}nte-nav.nav-row ul>li>ul:hover,nte-nav.nav-row ul>li>ul:focus-within,nte-nav.nav-row ul li>ul:hover,nte-nav.nav-row ul li>ul:focus-within{visibility:visible;opacity:1;pointer-events:all;transform:translateY(0)}nte-nav.nav-row ul>li>ul>li,nte-nav.nav-row ul li>ul>li{display:flex}nte-nav.nav-row ul>li>ul>li>a,nte-nav.nav-row ul li>ul>li>a{display:block;width:100%;color:var(--text-color);padding:.63em 1.3em;font-size:.99em;font-weight:400;transition:background var(--transition),color var(--transition)}nte-nav.nav-row ul>li>ul>li>a:hover,nte-nav.nav-row ul li>ul>li>a:hover{background:var(--hover-color);color:var(--hover-text-color)}nte-nav.nav-row ul>li:focus-within>ul,nte-nav.nav-row ul li:focus-within>ul{visibility:visible;opacity:1;pointer-events:all;transform:translateY(0)}.nav-offcanvas ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;width:100%;gap:.15rem;position:relative}.nav-offcanvas ul>li,.nav-offcanvas ul li{position:relative;display:block}.nav-offcanvas ul>li>a,.nav-offcanvas ul li>a{display:block;padding:.65em 1.1em;color:var(--text-color);text-decoration:none;transition:background var(--transition),color var(--transition);font-weight:500}.nav-offcanvas ul>li>a.active,.nav-offcanvas ul>li>a:active,.nav-offcanvas ul li>a.active,.nav-offcanvas ul li>a:active{background:var(--hover-color);color:var(--hover-text-color)}.nav-offcanvas ul>li>a:hover,li:hover>.nav-offcanvas ul>li>a,.nav-offcanvas ul li>a:hover,li:hover>.nav-offcanvas ul li>a{background:var(--hover-color);color:var(--hover-text-color)}.nav-offcanvas ul>li>a:after,.nav-offcanvas ul li>a:after{content:"";display:inline-block;margin-left:.47em;margin-bottom:.08em;border:solid currentColor;border-width:0 2px 2px 0;padding:3px;transform:rotate(45deg) scale(.8);opacity:0;transition:opacity var(--transition),transform var(--transition)}.nav-offcanvas ul>li:has(ul)>a:after,.nav-offcanvas ul li:has(ul)>a:after{opacity:.55}.nav-offcanvas ul>li:hover>a:after,.nav-offcanvas ul>li:focus-within>a:after,.nav-offcanvas ul li:hover>a:after,.nav-offcanvas ul li:focus-within>a:after{transform:rotate(135deg) scale(.85)}.nav-offcanvas ul>li:focus-within>ul,.nav-offcanvas ul li:focus-within>ul{display:flex}.nav-offcanvas ul>li>ul,.nav-offcanvas ul li>ul{list-style:none;margin:0;padding:0 0 0 .7em;display:none;flex-direction:column}li>.nav-offcanvas ul>li>ul,.nav-offcanvas ul>li>ul:focus-within,li>.nav-offcanvas ul li>ul,.nav-offcanvas ul li>ul:focus-within{display:flex}.nav-offcanvas ul>li>ul>li>a,.nav-offcanvas ul li>ul>li>a{padding:.55em 1.1em;font-size:.95em;font-weight:400;color:var(--text-color);transition:background var(--transition),color var(--transition)}.nav-offcanvas ul>li>ul>li>a:hover,.nav-offcanvas ul li>ul>li>a:hover{background:var(--hover-color);color:var(--hover-text-color)}nte-navbar.state-scrolled{--bg: rgba(var(--nt-white-rgb), 1)}nte-navbar.autoborder.state-scrolled::part(navbar){border-bottom:1px solid rgba(var(--nt-text-rgb),.1)}nte-navbar.autoshadow::part(navbar){transition:box-shadow .3s ease-in-out}nte-navbar.autoshadow.state-scrolled::part(navbar){box-shadow:0 2px 10px rgba(var(--nt-text-rgb),.1)}nte-navbar.autohide::part(navbar){transition:transform .3s ease-in-out}nte-navbar.autohide.state-pre-scrolled.state-scrolling-down::part(navbar){transform:translateY(-100%)}nte-navbar.autohide.state-pre-scrolled.state-scrolling-up::part(navbar){transform:translateY(0);position:fixed;top:0;left:0;opacity:1;width:100%}nte-navbar.autohide.state-scrolled::part(navbar){position:fixed;top:0;left:0;opacity:1;width:100%;transform:translateY(-100%)}nte-navbar.autohide.state-scrolled.state-scrolling-up::part(navbar){transform:translateY(0);position:fixed;top:0;left:0;opacity:1;width:100%}
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './lib/nte-nav';
2
+ export * from './lib/nte-navbar';
3
+ export * from './lib/nte-navbar-line';
package/index.js ADDED
@@ -0,0 +1,1211 @@
1
+ class xt {
2
+ /**
3
+ *
4
+ * @param delay Debounce delay in milliseconds
5
+ * @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
6
+ */
7
+ constructor(t, e = !1) {
8
+ this.delay = t, this.max_delay = e, this.timeout = null, this.startTimeWithMs = 0;
9
+ }
10
+ async wait() {
11
+ return this.startTimeWithMs === 0 && (this.startTimeWithMs = Date.now()), this.timeout && (this.max_delay === !1 || this.startTimeWithMs + this.max_delay > Date.now()) && clearTimeout(this.timeout), new Promise((t) => {
12
+ this.timeout = setTimeout(() => {
13
+ this.startTimeWithMs = 0, t(!0);
14
+ }, this.delay);
15
+ });
16
+ }
17
+ debounce(t) {
18
+ this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(() => {
19
+ t();
20
+ }, this.delay);
21
+ }
22
+ }
23
+ const C = {
24
+ xs: { name: "xs", minWidth: 0 },
25
+ sm: { name: "sm", minWidth: 576 },
26
+ md: { name: "md", minWidth: 768 },
27
+ lg: { name: "lg", minWidth: 992 },
28
+ xl: { name: "xl", minWidth: 1200 },
29
+ xxl: { name: "xxl", minWidth: 1400 }
30
+ };
31
+ let T = C.xs;
32
+ function K() {
33
+ const i = window.innerWidth;
34
+ let t = C.xs;
35
+ for (const e in C) {
36
+ const s = C[e];
37
+ i >= s.minWidth && (t = s);
38
+ }
39
+ return t;
40
+ }
41
+ function ot(i) {
42
+ if (typeof i == "string" && i.endsWith("px") && (i = parseInt(i.replace("px", ""))), typeof i == "string") {
43
+ if (i = C[i], !i)
44
+ throw new Error(
45
+ `Breakpoint ${i} not found. Defined breakpoints are: ${Object.keys(C).join(", ")}`
46
+ );
47
+ } else typeof i == "number" && (i = { name: "c", minWidth: i });
48
+ return window.innerWidth >= i.minWidth;
49
+ }
50
+ if (!window.__nextrap_current_breakpoint) {
51
+ window.__nextrap_current_breakpoint = K();
52
+ const i = new xt(200, 500);
53
+ window.addEventListener("resize", async () => {
54
+ if (await i.wait(), T !== K()) {
55
+ T = K(), window.__nextrap_current_breakpoint = T;
56
+ const t = new CustomEvent("breakpoint-changed", {
57
+ detail: { breakpoint: T }
58
+ });
59
+ console.log("Breakpoint changed", T), window.dispatchEvent(t);
60
+ }
61
+ });
62
+ }
63
+ class Et {
64
+ /**
65
+ * Checks recursively if the element is visible.
66
+ *
67
+ * @param el
68
+ */
69
+ static isVisible(t) {
70
+ const e = getComputedStyle(t);
71
+ if (e.display === "none" || e.visibility === "hidden") return !1;
72
+ if (t instanceof HTMLElement && (t.offsetWidth > 0 || t.offsetHeight > 0 || t.tagName === "IMG"))
73
+ return !0;
74
+ if (!t.children) return !1;
75
+ for (const s of t.children)
76
+ if (this.isVisible(s)) return !0;
77
+ return !1;
78
+ }
79
+ /**
80
+ * Usage:
81
+ *
82
+ * in firstupdated or connectedCallback of your element:
83
+ * ```ts
84
+ * override firstUpdated(_changedProperties: PropertyValues) {
85
+ * SlotTool.observeEmptySlots(this)
86
+ * }
87
+ * ```
88
+ *
89
+ * @param slot
90
+ */
91
+ static isEmptySlot(t) {
92
+ const e = t.assignedElements({ flatten: !0 });
93
+ return e.length === 0 ? !0 : e.every((s) => !this.isVisible(s));
94
+ }
95
+ static observeEmptySlots(t) {
96
+ const e = t.shadowRoot;
97
+ if (!e) {
98
+ console.warn("Element has no shadow root", t);
99
+ return;
100
+ }
101
+ e.querySelectorAll("slot").forEach((n) => {
102
+ this.isEmptySlot(n) ? n.setAttribute("empty", "") : n.removeAttribute("empty"), n.onslotchange = () => {
103
+ this.isEmptySlot(n) ? n.setAttribute("empty", "") : n.removeAttribute("empty");
104
+ };
105
+ });
106
+ }
107
+ }
108
+ /**
109
+ * @license
110
+ * Copyright 2019 Google LLC
111
+ * SPDX-License-Identifier: BSD-3-Clause
112
+ */
113
+ const z = globalThis, st = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, St = Symbol(), at = /* @__PURE__ */ new WeakMap();
114
+ let Ct = class {
115
+ constructor(t, e, s) {
116
+ if (this._$cssResult$ = !0, s !== St) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
117
+ this.cssText = t, this.t = e;
118
+ }
119
+ get styleSheet() {
120
+ let t = this.o;
121
+ const e = this.t;
122
+ if (st && t === void 0) {
123
+ const s = e !== void 0 && e.length === 1;
124
+ s && (t = at.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && at.set(e, t));
125
+ }
126
+ return t;
127
+ }
128
+ toString() {
129
+ return this.cssText;
130
+ }
131
+ };
132
+ const j = (i) => new Ct(typeof i == "string" ? i : i + "", void 0, St), jt = (i, t) => {
133
+ if (st) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
134
+ else for (const e of t) {
135
+ const s = document.createElement("style"), n = z.litNonce;
136
+ n !== void 0 && s.setAttribute("nonce", n), s.textContent = e.cssText, i.appendChild(s);
137
+ }
138
+ }, lt = st ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
139
+ let e = "";
140
+ for (const s of t.cssRules) e += s.cssText;
141
+ return j(e);
142
+ })(i) : i;
143
+ /**
144
+ * @license
145
+ * Copyright 2017 Google LLC
146
+ * SPDX-License-Identifier: BSD-3-Clause
147
+ */
148
+ const { is: Dt, defineProperty: It, getOwnPropertyDescriptor: Wt, getOwnPropertyNames: zt, getOwnPropertySymbols: Bt, getPrototypeOf: Gt } = Object, m = globalThis, ht = m.trustedTypes, Vt = ht ? ht.emptyScript : "", Z = m.reactiveElementPolyfillSupport, M = (i, t) => i, B = { toAttribute(i, t) {
149
+ switch (t) {
150
+ case Boolean:
151
+ i = i ? Vt : null;
152
+ break;
153
+ case Object:
154
+ case Array:
155
+ i = i == null ? i : JSON.stringify(i);
156
+ }
157
+ return i;
158
+ }, fromAttribute(i, t) {
159
+ let e = i;
160
+ switch (t) {
161
+ case Boolean:
162
+ e = i !== null;
163
+ break;
164
+ case Number:
165
+ e = i === null ? null : Number(i);
166
+ break;
167
+ case Object:
168
+ case Array:
169
+ try {
170
+ e = JSON.parse(i);
171
+ } catch {
172
+ e = null;
173
+ }
174
+ }
175
+ return e;
176
+ } }, it = (i, t) => !Dt(i, t), ct = { attribute: !0, type: String, converter: B, reflect: !1, useDefault: !1, hasChanged: it };
177
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
178
+ let b = class extends HTMLElement {
179
+ static addInitializer(t) {
180
+ this._$Ei(), (this.l ?? (this.l = [])).push(t);
181
+ }
182
+ static get observedAttributes() {
183
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
184
+ }
185
+ static createProperty(t, e = ct) {
186
+ if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
187
+ const s = Symbol(), n = this.getPropertyDescriptor(t, s, e);
188
+ n !== void 0 && It(this.prototype, t, n);
189
+ }
190
+ }
191
+ static getPropertyDescriptor(t, e, s) {
192
+ const { get: n, set: r } = Wt(this.prototype, t) ?? { get() {
193
+ return this[e];
194
+ }, set(o) {
195
+ this[e] = o;
196
+ } };
197
+ return { get: n, set(o) {
198
+ const l = n == null ? void 0 : n.call(this);
199
+ r == null || r.call(this, o), this.requestUpdate(t, l, s);
200
+ }, configurable: !0, enumerable: !0 };
201
+ }
202
+ static getPropertyOptions(t) {
203
+ return this.elementProperties.get(t) ?? ct;
204
+ }
205
+ static _$Ei() {
206
+ if (this.hasOwnProperty(M("elementProperties"))) return;
207
+ const t = Gt(this);
208
+ t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
209
+ }
210
+ static finalize() {
211
+ if (this.hasOwnProperty(M("finalized"))) return;
212
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(M("properties"))) {
213
+ const e = this.properties, s = [...zt(e), ...Bt(e)];
214
+ for (const n of s) this.createProperty(n, e[n]);
215
+ }
216
+ const t = this[Symbol.metadata];
217
+ if (t !== null) {
218
+ const e = litPropertyMetadata.get(t);
219
+ if (e !== void 0) for (const [s, n] of e) this.elementProperties.set(s, n);
220
+ }
221
+ this._$Eh = /* @__PURE__ */ new Map();
222
+ for (const [e, s] of this.elementProperties) {
223
+ const n = this._$Eu(e, s);
224
+ n !== void 0 && this._$Eh.set(n, e);
225
+ }
226
+ this.elementStyles = this.finalizeStyles(this.styles);
227
+ }
228
+ static finalizeStyles(t) {
229
+ const e = [];
230
+ if (Array.isArray(t)) {
231
+ const s = new Set(t.flat(1 / 0).reverse());
232
+ for (const n of s) e.unshift(lt(n));
233
+ } else t !== void 0 && e.push(lt(t));
234
+ return e;
235
+ }
236
+ static _$Eu(t, e) {
237
+ const s = e.attribute;
238
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
239
+ }
240
+ constructor() {
241
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
242
+ }
243
+ _$Ev() {
244
+ var t;
245
+ this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
246
+ }
247
+ addController(t) {
248
+ var e;
249
+ (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
250
+ }
251
+ removeController(t) {
252
+ var e;
253
+ (e = this._$EO) == null || e.delete(t);
254
+ }
255
+ _$E_() {
256
+ const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
257
+ for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
258
+ t.size > 0 && (this._$Ep = t);
259
+ }
260
+ createRenderRoot() {
261
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
262
+ return jt(t, this.constructor.elementStyles), t;
263
+ }
264
+ connectedCallback() {
265
+ var t;
266
+ this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
267
+ var s;
268
+ return (s = e.hostConnected) == null ? void 0 : s.call(e);
269
+ });
270
+ }
271
+ enableUpdating(t) {
272
+ }
273
+ disconnectedCallback() {
274
+ var t;
275
+ (t = this._$EO) == null || t.forEach((e) => {
276
+ var s;
277
+ return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
278
+ });
279
+ }
280
+ attributeChangedCallback(t, e, s) {
281
+ this._$AK(t, s);
282
+ }
283
+ _$ET(t, e) {
284
+ var r;
285
+ const s = this.constructor.elementProperties.get(t), n = this.constructor._$Eu(t, s);
286
+ if (n !== void 0 && s.reflect === !0) {
287
+ const o = (((r = s.converter) == null ? void 0 : r.toAttribute) !== void 0 ? s.converter : B).toAttribute(e, s.type);
288
+ this._$Em = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$Em = null;
289
+ }
290
+ }
291
+ _$AK(t, e) {
292
+ var r, o;
293
+ const s = this.constructor, n = s._$Eh.get(t);
294
+ if (n !== void 0 && this._$Em !== n) {
295
+ const l = s.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((r = l.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? l.converter : B;
296
+ this._$Em = n, this[n] = a.fromAttribute(e, l.type) ?? ((o = this._$Ej) == null ? void 0 : o.get(n)) ?? null, this._$Em = null;
297
+ }
298
+ }
299
+ requestUpdate(t, e, s) {
300
+ var n;
301
+ if (t !== void 0) {
302
+ const r = this.constructor, o = this[t];
303
+ if (s ?? (s = r.getPropertyOptions(t)), !((s.hasChanged ?? it)(o, e) || s.useDefault && s.reflect && o === ((n = this._$Ej) == null ? void 0 : n.get(t)) && !this.hasAttribute(r._$Eu(t, s)))) return;
304
+ this.C(t, e, s);
305
+ }
306
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
307
+ }
308
+ C(t, e, { useDefault: s, reflect: n, wrapped: r }, o) {
309
+ s && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), n === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
310
+ }
311
+ async _$EP() {
312
+ this.isUpdatePending = !0;
313
+ try {
314
+ await this._$ES;
315
+ } catch (e) {
316
+ Promise.reject(e);
317
+ }
318
+ const t = this.scheduleUpdate();
319
+ return t != null && await t, !this.isUpdatePending;
320
+ }
321
+ scheduleUpdate() {
322
+ return this.performUpdate();
323
+ }
324
+ performUpdate() {
325
+ var s;
326
+ if (!this.isUpdatePending) return;
327
+ if (!this.hasUpdated) {
328
+ if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
329
+ for (const [r, o] of this._$Ep) this[r] = o;
330
+ this._$Ep = void 0;
331
+ }
332
+ const n = this.constructor.elementProperties;
333
+ if (n.size > 0) for (const [r, o] of n) {
334
+ const { wrapped: l } = o, a = this[r];
335
+ l !== !0 || this._$AL.has(r) || a === void 0 || this.C(r, void 0, o, a);
336
+ }
337
+ }
338
+ let t = !1;
339
+ const e = this._$AL;
340
+ try {
341
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((n) => {
342
+ var r;
343
+ return (r = n.hostUpdate) == null ? void 0 : r.call(n);
344
+ }), this.update(e)) : this._$EM();
345
+ } catch (n) {
346
+ throw t = !1, this._$EM(), n;
347
+ }
348
+ t && this._$AE(e);
349
+ }
350
+ willUpdate(t) {
351
+ }
352
+ _$AE(t) {
353
+ var e;
354
+ (e = this._$EO) == null || e.forEach((s) => {
355
+ var n;
356
+ return (n = s.hostUpdated) == null ? void 0 : n.call(s);
357
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
358
+ }
359
+ _$EM() {
360
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
361
+ }
362
+ get updateComplete() {
363
+ return this.getUpdateComplete();
364
+ }
365
+ getUpdateComplete() {
366
+ return this._$ES;
367
+ }
368
+ shouldUpdate(t) {
369
+ return !0;
370
+ }
371
+ update(t) {
372
+ this._$Eq && (this._$Eq = this._$Eq.forEach((e) => this._$ET(e, this[e]))), this._$EM();
373
+ }
374
+ updated(t) {
375
+ }
376
+ firstUpdated(t) {
377
+ }
378
+ };
379
+ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[M("elementProperties")] = /* @__PURE__ */ new Map(), b[M("finalized")] = /* @__PURE__ */ new Map(), Z == null || Z({ ReactiveElement: b }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.1.0");
380
+ /**
381
+ * @license
382
+ * Copyright 2017 Google LLC
383
+ * SPDX-License-Identifier: BSD-3-Clause
384
+ */
385
+ const k = globalThis, G = k.trustedTypes, dt = G ? G.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Pt = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, Tt = "?" + v, qt = `<${Tt}>`, x = document, N = () => x.createComment(""), H = (i) => i === null || typeof i != "object" && typeof i != "function", nt = Array.isArray, Yt = (i) => nt(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", Q = `[
386
+ \f\r]`, O = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, pt = /-->/g, ut = />/g, g = RegExp(`>|${Q}(?:([^\\s"'>=/]+)(${Q}*=${Q}*(?:[^
387
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ft = /'/g, vt = /"/g, Ot = /^(?:script|style|textarea|title)$/i, Ft = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), L = Ft(1), E = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), mt = /* @__PURE__ */ new WeakMap(), w = x.createTreeWalker(x, 129);
388
+ function Mt(i, t) {
389
+ if (!nt(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
390
+ return dt !== void 0 ? dt.createHTML(t) : t;
391
+ }
392
+ const Jt = (i, t) => {
393
+ const e = i.length - 1, s = [];
394
+ let n, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = O;
395
+ for (let l = 0; l < e; l++) {
396
+ const a = i[l];
397
+ let d, h, c = -1, u = 0;
398
+ for (; u < a.length && (o.lastIndex = u, h = o.exec(a), h !== null); ) u = o.lastIndex, o === O ? h[1] === "!--" ? o = pt : h[1] !== void 0 ? o = ut : h[2] !== void 0 ? (Ot.test(h[2]) && (n = RegExp("</" + h[2], "g")), o = g) : h[3] !== void 0 && (o = g) : o === g ? h[0] === ">" ? (o = n ?? O, c = -1) : h[1] === void 0 ? c = -2 : (c = o.lastIndex - h[2].length, d = h[1], o = h[3] === void 0 ? g : h[3] === '"' ? vt : ft) : o === vt || o === ft ? o = g : o === pt || o === ut ? o = O : (o = g, n = void 0);
399
+ const f = o === g && i[l + 1].startsWith("/>") ? " " : "";
400
+ r += o === O ? a + qt : c >= 0 ? (s.push(d), a.slice(0, c) + Pt + a.slice(c) + v + f) : a + v + (c === -2 ? l : f);
401
+ }
402
+ return [Mt(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
403
+ };
404
+ class R {
405
+ constructor({ strings: t, _$litType$: e }, s) {
406
+ let n;
407
+ this.parts = [];
408
+ let r = 0, o = 0;
409
+ const l = t.length - 1, a = this.parts, [d, h] = Jt(t, e);
410
+ if (this.el = R.createElement(d, s), w.currentNode = this.el.content, e === 2 || e === 3) {
411
+ const c = this.el.content.firstChild;
412
+ c.replaceWith(...c.childNodes);
413
+ }
414
+ for (; (n = w.nextNode()) !== null && a.length < l; ) {
415
+ if (n.nodeType === 1) {
416
+ if (n.hasAttributes()) for (const c of n.getAttributeNames()) if (c.endsWith(Pt)) {
417
+ const u = h[o++], f = n.getAttribute(c).split(v), W = /([.?@])?(.*)/.exec(u);
418
+ a.push({ type: 1, index: r, name: W[2], strings: f, ctor: W[1] === "." ? Zt : W[1] === "?" ? Qt : W[1] === "@" ? Xt : Y }), n.removeAttribute(c);
419
+ } else c.startsWith(v) && (a.push({ type: 6, index: r }), n.removeAttribute(c));
420
+ if (Ot.test(n.tagName)) {
421
+ const c = n.textContent.split(v), u = c.length - 1;
422
+ if (u > 0) {
423
+ n.textContent = G ? G.emptyScript : "";
424
+ for (let f = 0; f < u; f++) n.append(c[f], N()), w.nextNode(), a.push({ type: 2, index: ++r });
425
+ n.append(c[u], N());
426
+ }
427
+ }
428
+ } else if (n.nodeType === 8) if (n.data === Tt) a.push({ type: 2, index: r });
429
+ else {
430
+ let c = -1;
431
+ for (; (c = n.data.indexOf(v, c + 1)) !== -1; ) a.push({ type: 7, index: r }), c += v.length - 1;
432
+ }
433
+ r++;
434
+ }
435
+ }
436
+ static createElement(t, e) {
437
+ const s = x.createElement("template");
438
+ return s.innerHTML = t, s;
439
+ }
440
+ }
441
+ function P(i, t, e = i, s) {
442
+ var o, l;
443
+ if (t === E) return t;
444
+ let n = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
445
+ const r = H(t) ? void 0 : t._$litDirective$;
446
+ return (n == null ? void 0 : n.constructor) !== r && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), r === void 0 ? n = void 0 : (n = new r(i), n._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = n : e._$Cl = n), n !== void 0 && (t = P(i, n._$AS(i, t.values), n, s)), t;
447
+ }
448
+ class Kt {
449
+ constructor(t, e) {
450
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
451
+ }
452
+ get parentNode() {
453
+ return this._$AM.parentNode;
454
+ }
455
+ get _$AU() {
456
+ return this._$AM._$AU;
457
+ }
458
+ u(t) {
459
+ const { el: { content: e }, parts: s } = this._$AD, n = ((t == null ? void 0 : t.creationScope) ?? x).importNode(e, !0);
460
+ w.currentNode = n;
461
+ let r = w.nextNode(), o = 0, l = 0, a = s[0];
462
+ for (; a !== void 0; ) {
463
+ if (o === a.index) {
464
+ let d;
465
+ a.type === 2 ? d = new D(r, r.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(r, a.name, a.strings, this, t) : a.type === 6 && (d = new te(r, this, t)), this._$AV.push(d), a = s[++l];
466
+ }
467
+ o !== (a == null ? void 0 : a.index) && (r = w.nextNode(), o++);
468
+ }
469
+ return w.currentNode = x, n;
470
+ }
471
+ p(t) {
472
+ let e = 0;
473
+ for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
474
+ }
475
+ }
476
+ class D {
477
+ get _$AU() {
478
+ var t;
479
+ return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
480
+ }
481
+ constructor(t, e, s, n) {
482
+ this.type = 2, this._$AH = p, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = n, this._$Cv = (n == null ? void 0 : n.isConnected) ?? !0;
483
+ }
484
+ get parentNode() {
485
+ let t = this._$AA.parentNode;
486
+ const e = this._$AM;
487
+ return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
488
+ }
489
+ get startNode() {
490
+ return this._$AA;
491
+ }
492
+ get endNode() {
493
+ return this._$AB;
494
+ }
495
+ _$AI(t, e = this) {
496
+ t = P(this, t, e), H(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Yt(t) ? this.k(t) : this._(t);
497
+ }
498
+ O(t) {
499
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
500
+ }
501
+ T(t) {
502
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
503
+ }
504
+ _(t) {
505
+ this._$AH !== p && H(this._$AH) ? this._$AA.nextSibling.data = t : this.T(x.createTextNode(t)), this._$AH = t;
506
+ }
507
+ $(t) {
508
+ var r;
509
+ const { values: e, _$litType$: s } = t, n = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = R.createElement(Mt(s.h, s.h[0]), this.options)), s);
510
+ if (((r = this._$AH) == null ? void 0 : r._$AD) === n) this._$AH.p(e);
511
+ else {
512
+ const o = new Kt(n, this), l = o.u(this.options);
513
+ o.p(e), this.T(l), this._$AH = o;
514
+ }
515
+ }
516
+ _$AC(t) {
517
+ let e = mt.get(t.strings);
518
+ return e === void 0 && mt.set(t.strings, e = new R(t)), e;
519
+ }
520
+ k(t) {
521
+ nt(this._$AH) || (this._$AH = [], this._$AR());
522
+ const e = this._$AH;
523
+ let s, n = 0;
524
+ for (const r of t) n === e.length ? e.push(s = new D(this.O(N()), this.O(N()), this, this.options)) : s = e[n], s._$AI(r), n++;
525
+ n < e.length && (this._$AR(s && s._$AB.nextSibling, n), e.length = n);
526
+ }
527
+ _$AR(t = this._$AA.nextSibling, e) {
528
+ var s;
529
+ for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
530
+ const n = t.nextSibling;
531
+ t.remove(), t = n;
532
+ }
533
+ }
534
+ setConnected(t) {
535
+ var e;
536
+ this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
537
+ }
538
+ }
539
+ class Y {
540
+ get tagName() {
541
+ return this.element.tagName;
542
+ }
543
+ get _$AU() {
544
+ return this._$AM._$AU;
545
+ }
546
+ constructor(t, e, s, n, r) {
547
+ this.type = 1, this._$AH = p, this._$AN = void 0, this.element = t, this.name = e, this._$AM = n, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = p;
548
+ }
549
+ _$AI(t, e = this, s, n) {
550
+ const r = this.strings;
551
+ let o = !1;
552
+ if (r === void 0) t = P(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
553
+ else {
554
+ const l = t;
555
+ let a, d;
556
+ for (t = r[0], a = 0; a < r.length - 1; a++) d = P(this, l[s + a], e, a), d === E && (d = this._$AH[a]), o || (o = !H(d) || d !== this._$AH[a]), d === p ? t = p : t !== p && (t += (d ?? "") + r[a + 1]), this._$AH[a] = d;
557
+ }
558
+ o && !n && this.j(t);
559
+ }
560
+ j(t) {
561
+ t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
562
+ }
563
+ }
564
+ class Zt extends Y {
565
+ constructor() {
566
+ super(...arguments), this.type = 3;
567
+ }
568
+ j(t) {
569
+ this.element[this.name] = t === p ? void 0 : t;
570
+ }
571
+ }
572
+ class Qt extends Y {
573
+ constructor() {
574
+ super(...arguments), this.type = 4;
575
+ }
576
+ j(t) {
577
+ this.element.toggleAttribute(this.name, !!t && t !== p);
578
+ }
579
+ }
580
+ class Xt extends Y {
581
+ constructor(t, e, s, n, r) {
582
+ super(t, e, s, n, r), this.type = 5;
583
+ }
584
+ _$AI(t, e = this) {
585
+ if ((t = P(this, t, e, 0) ?? p) === E) return;
586
+ const s = this._$AH, n = t === p && s !== p || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== p && (s === p || n);
587
+ n && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
588
+ }
589
+ handleEvent(t) {
590
+ var e;
591
+ typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
592
+ }
593
+ }
594
+ class te {
595
+ constructor(t, e, s) {
596
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
597
+ }
598
+ get _$AU() {
599
+ return this._$AM._$AU;
600
+ }
601
+ _$AI(t) {
602
+ P(this, t);
603
+ }
604
+ }
605
+ const X = k.litHtmlPolyfillSupport;
606
+ X == null || X(R, D), (k.litHtmlVersions ?? (k.litHtmlVersions = [])).push("3.3.0");
607
+ const ee = (i, t, e) => {
608
+ const s = (e == null ? void 0 : e.renderBefore) ?? t;
609
+ let n = s._$litPart$;
610
+ if (n === void 0) {
611
+ const r = (e == null ? void 0 : e.renderBefore) ?? null;
612
+ s._$litPart$ = n = new D(t.insertBefore(N(), r), r, void 0, e ?? {});
613
+ }
614
+ return n._$AI(i), n;
615
+ };
616
+ /**
617
+ * @license
618
+ * Copyright 2017 Google LLC
619
+ * SPDX-License-Identifier: BSD-3-Clause
620
+ */
621
+ const A = globalThis;
622
+ let $ = class extends b {
623
+ constructor() {
624
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
625
+ }
626
+ createRenderRoot() {
627
+ var e;
628
+ const t = super.createRenderRoot();
629
+ return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
630
+ }
631
+ update(t) {
632
+ const e = this.render();
633
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = ee(e, this.renderRoot, this.renderOptions);
634
+ }
635
+ connectedCallback() {
636
+ var t;
637
+ super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
638
+ }
639
+ disconnectedCallback() {
640
+ var t;
641
+ super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
642
+ }
643
+ render() {
644
+ return E;
645
+ }
646
+ };
647
+ var At;
648
+ $._$litElement$ = !0, $.finalized = !0, (At = A.litElementHydrateSupport) == null || At.call(A, { LitElement: $ });
649
+ const tt = A.litElementPolyfillSupport;
650
+ tt == null || tt({ LitElement: $ });
651
+ (A.litElementVersions ?? (A.litElementVersions = [])).push("4.2.0");
652
+ /**
653
+ * @license
654
+ * Copyright 2017 Google LLC
655
+ * SPDX-License-Identifier: BSD-3-Clause
656
+ */
657
+ const F = (i) => (t, e) => {
658
+ e !== void 0 ? e.addInitializer(() => {
659
+ customElements.define(i, t);
660
+ }) : customElements.define(i, t);
661
+ };
662
+ /**
663
+ * @license
664
+ * Copyright 2017 Google LLC
665
+ * SPDX-License-Identifier: BSD-3-Clause
666
+ */
667
+ const se = { attribute: !0, type: String, converter: B, reflect: !1, hasChanged: it }, ie = (i = se, t, e) => {
668
+ const { kind: s, metadata: n } = e;
669
+ let r = globalThis.litPropertyMetadata.get(n);
670
+ if (r === void 0 && globalThis.litPropertyMetadata.set(n, r = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), r.set(e.name, i), s === "accessor") {
671
+ const { name: o } = e;
672
+ return { set(l) {
673
+ const a = t.get.call(this);
674
+ t.set.call(this, l), this.requestUpdate(o, a, i);
675
+ }, init(l) {
676
+ return l !== void 0 && this.C(o, void 0, i, l), l;
677
+ } };
678
+ }
679
+ if (s === "setter") {
680
+ const { name: o } = e;
681
+ return function(l) {
682
+ const a = this[o];
683
+ t.call(this, l), this.requestUpdate(o, a, i);
684
+ };
685
+ }
686
+ throw Error("Unsupported decorator location: " + s);
687
+ };
688
+ function S(i) {
689
+ return (t, e) => typeof e == "object" ? ie(i, t, e) : ((s, n, r) => {
690
+ const o = n.hasOwnProperty(r);
691
+ return n.constructor.createProperty(r, s), o ? Object.getOwnPropertyDescriptor(n, r) : void 0;
692
+ })(i, t, e);
693
+ }
694
+ /**
695
+ * @license
696
+ * Copyright 2017 Google LLC
697
+ * SPDX-License-Identifier: BSD-3-Clause
698
+ */
699
+ function kt(i) {
700
+ return S({ ...i, state: !0, attribute: !1 });
701
+ }
702
+ function ne(i, t) {
703
+ const e = document.createElement("template");
704
+ return e.innerHTML = i.trim(), t.append(e.content.cloneNode(!0)), new Proxy({}, {
705
+ get(s, n) {
706
+ if (n === "fragment")
707
+ return t;
708
+ if (typeof n == "string") {
709
+ const r = t.getElementById(n);
710
+ if (!r)
711
+ throw new Error(`❌ Unknown id '${n}'.`);
712
+ return r;
713
+ }
714
+ }
715
+ });
716
+ }
717
+ const rt = class rt extends b {
718
+ constructor(t) {
719
+ super();
720
+ const e = this.createRenderRoot();
721
+ this.$ = ne(t, e);
722
+ }
723
+ connectedCallback() {
724
+ super.connectedCallback();
725
+ let t = this.css;
726
+ Array.isArray(t) || (t = [t]);
727
+ const e = t.map((s) => s instanceof Ct ? s.styleSheet : j(s).styleSheet);
728
+ this.shadowRoot.adoptedStyleSheets = e;
729
+ }
730
+ };
731
+ rt.DEFINITION = {
732
+ classes: [],
733
+ attributes: {}
734
+ };
735
+ let $t = rt;
736
+ var re = function(i, t, e, s) {
737
+ function n(r) {
738
+ return r instanceof e ? r : new e(function(o) {
739
+ o(r);
740
+ });
741
+ }
742
+ return new (e || (e = Promise))(function(r, o) {
743
+ function l(h) {
744
+ try {
745
+ d(s.next(h));
746
+ } catch (c) {
747
+ o(c);
748
+ }
749
+ }
750
+ function a(h) {
751
+ try {
752
+ d(s.throw(h));
753
+ } catch (c) {
754
+ o(c);
755
+ }
756
+ }
757
+ function d(h) {
758
+ h.done ? r(h.value) : n(h.value).then(l, a);
759
+ }
760
+ d((s = s.apply(i, t || [])).next());
761
+ });
762
+ };
763
+ function oe() {
764
+ return re(this, void 0, void 0, function* () {
765
+ return new Promise((i) => {
766
+ if (document.readyState === "complete" || document.readyState === "interactive")
767
+ return i("loaded");
768
+ document.addEventListener("DOMContentLoaded", () => i("DOMContentLoaded"));
769
+ });
770
+ });
771
+ }
772
+ var ae = function(i, t, e, s) {
773
+ function n(r) {
774
+ return r instanceof e ? r : new e(function(o) {
775
+ o(r);
776
+ });
777
+ }
778
+ return new (e || (e = Promise))(function(r, o) {
779
+ function l(h) {
780
+ try {
781
+ d(s.next(h));
782
+ } catch (c) {
783
+ o(c);
784
+ }
785
+ }
786
+ function a(h) {
787
+ try {
788
+ d(s.throw(h));
789
+ } catch (c) {
790
+ o(c);
791
+ }
792
+ }
793
+ function d(h) {
794
+ h.done ? r(h.value) : n(h.value).then(l, a);
795
+ }
796
+ d((s = s.apply(i, t || [])).next());
797
+ });
798
+ };
799
+ function _t(i) {
800
+ return ae(this, void 0, void 0, function* () {
801
+ return new Promise((t) => {
802
+ window.setTimeout(() => t(), i);
803
+ });
804
+ });
805
+ }
806
+ /**
807
+ * @license
808
+ * Copyright 2017 Google LLC
809
+ * SPDX-License-Identifier: BSD-3-Clause
810
+ */
811
+ const Ut = { ATTRIBUTE: 1, CHILD: 2 }, Nt = (i) => (...t) => ({ _$litDirective$: i, values: t });
812
+ class Ht {
813
+ constructor(t) {
814
+ }
815
+ get _$AU() {
816
+ return this._$AM._$AU;
817
+ }
818
+ _$AT(t, e, s) {
819
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
820
+ }
821
+ _$AS(t, e) {
822
+ return this.update(t, e);
823
+ }
824
+ update(t, e) {
825
+ return this.render(...e);
826
+ }
827
+ }
828
+ /**
829
+ * @license
830
+ * Copyright 2018 Google LLC
831
+ * SPDX-License-Identifier: BSD-3-Clause
832
+ */
833
+ const yt = Nt(class extends Ht {
834
+ constructor(i) {
835
+ var t;
836
+ if (super(i), i.type !== Ut.ATTRIBUTE || i.name !== "class" || ((t = i.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
837
+ }
838
+ render(i) {
839
+ return " " + Object.keys(i).filter((t) => i[t]).join(" ") + " ";
840
+ }
841
+ update(i, [t]) {
842
+ var s, n;
843
+ if (this.st === void 0) {
844
+ this.st = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter((r) => r !== "")));
845
+ for (const r in t) t[r] && !((s = this.nt) != null && s.has(r)) && this.st.add(r);
846
+ return this.render(t);
847
+ }
848
+ const e = i.element.classList;
849
+ for (const r of this.st) r in t || (e.remove(r), this.st.delete(r));
850
+ for (const r in t) {
851
+ const o = !!t[r];
852
+ o === this.st.has(r) || (n = this.nt) != null && n.has(r) || (o ? (e.add(r), this.st.add(r)) : (e.remove(r), this.st.delete(r)));
853
+ }
854
+ return E;
855
+ }
856
+ }), le = "*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit;color:inherit;background:none;border:none;outline:none}a{color:inherit;text-decoration:none}ul,ol{list-style:none}table{border-collapse:collapse;border-spacing:0}slot{display:contents}:host{--backdrop: rgba(var(--nt-dark-rgb), .5);--header-background: var(--nt-soft-primary);--background-color: var(--nt-white);--shadow-color: rgba(var(--nt-dark-rgb), .5);--padding: var(--nt-space);position:fixed;top:0;right:0;bottom:0;width:33%;min-width:300px;max-width:500px;z-index:9990;padding:0}:host[open]{display:block}#offcanvas{display:flex;flex-direction:column;width:100%;height:100%;overflow:scroll;background-color:var(--background-color);box-shadow:0 0 10px var(--shadow-color);transition:transform .2s ease-in-out;transform:translate(0)}#offcanvas.closed{transform:translate(100%)}#header{display:flex;width:100%;flex-direction:row;justify-content:space-between;align-items:center;background-color:var(--header-background);flex-grow:0;padding:var(--padding)}#header:has(>slot[empty]){display:none}#main{display:flex;width:100%;flex-grow:1;padding:var(--padding);min-height:200px;overflow:auto;height:100%}#footer{display:flex;width:100%;flex-direction:row;justify-content:space-between;align-items:center;margin-top:auto;flex-grow:0;padding:var(--padding)}#footer:has(>slot[empty]){display:none}#backdrop{opacity:1;transition:opacity .2s ease-in-out;position:fixed;top:0;left:0;width:100%;height:100%;background-color:var(--backdrop);z-index:-1;display:block}#backdrop.closed{opacity:0}";
857
+ var he = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, J = (i, t, e, s) => {
858
+ for (var n = s > 1 ? void 0 : s ? ce(t, e) : t, r = i.length - 1, o; r >= 0; r--)
859
+ (o = i[r]) && (n = (s ? o(t, e, n) : o(n)) || n);
860
+ return s && n && he(t, e, n), n;
861
+ };
862
+ let _ = class extends $ {
863
+ constructor() {
864
+ super(...arguments), this.backdrop = !0, this.opened = !1, this.closedClass = !0;
865
+ }
866
+ static get is() {
867
+ return "nte-offcanvas";
868
+ }
869
+ connectedCallback() {
870
+ super.connectedCallback();
871
+ }
872
+ open() {
873
+ this.opened = !0;
874
+ }
875
+ close() {
876
+ this.opened = !1;
877
+ }
878
+ toggle() {
879
+ this.opened = !this.opened;
880
+ }
881
+ async updated(i) {
882
+ i.has("opened") && (this.opened ? (this.style.display = "block", await _t(1), Et.observeEmptySlots(this), this.closedClass = !1) : (this.closedClass = !0, await _t(400), this.style.display = "none"));
883
+ }
884
+ render() {
885
+ return L`
886
+ <div
887
+ id="backdrop"
888
+ part="backdrop"
889
+ @click=${() => this.opened = !1}
890
+ class=${yt({ closed: this.closedClass })}
891
+ ></div>
892
+ <div
893
+ id="offcanvas"
894
+ part="offcanvas"
895
+ role="dialog"
896
+ aria-modal="true"
897
+ class=${yt({ closed: this.closedClass })}
898
+ ?backdrop="${this.backdrop}"
899
+ >
900
+ <div id="header">
901
+ <slot name="header"></slot>
902
+ </div>
903
+
904
+ <div id="main" part="main">
905
+ <slot></slot>
906
+ </div>
907
+
908
+ <div id="footer" part="footer">
909
+ <slot name="footer"></slot>
910
+ </div>
911
+ </div>
912
+ `;
913
+ }
914
+ };
915
+ _.styles = [j(le)];
916
+ J([
917
+ S({ type: Boolean, reflect: !0 })
918
+ ], _.prototype, "backdrop", 2);
919
+ J([
920
+ S({ type: Boolean, reflect: !0 })
921
+ ], _.prototype, "opened", 2);
922
+ J([
923
+ kt()
924
+ ], _.prototype, "closedClass", 2);
925
+ _ = J([
926
+ F(_.is)
927
+ ], _);
928
+ const de = ":host{--container-width: var(--nt-container-width);--text-color: var(--nt-text-color);--hover-color: var(--nt-primary);--hover-text-color: var(--nt-text-on-primary);--transition: .2s ease-in-out;--submenu-bg: var(--nt-light);--submenu-text-color: var(--nt-text);--justify-content: center;--sidemenu-bg: var(--nt-soft-primary);--justify-sidebar-burger: flex-end}";
929
+ var pe = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, I = (i, t, e, s) => {
930
+ for (var n = s > 1 ? void 0 : s ? ue(t, e) : t, r = i.length - 1, o; r >= 0; r--)
931
+ (o = i[r]) && (n = (s ? o(t, e, n) : o(n)) || n);
932
+ return s && n && pe(t, e, n), n;
933
+ };
934
+ let y = class extends $ {
935
+ constructor() {
936
+ super(), this.mode = "auto", this.text = "Menu", this.breakpoint = "99999px", this._sidebar = !1, this.offcanvas = new _(), this.offcanvas.classList.add("nav-offcanvas"), this.offcanvas.innerHTML = '<div slot="header"><nte-burger state="open"></nte-burger></div>', this.offcanvas.querySelector("nte-burger").onclick = () => {
937
+ this.offcanvas.close();
938
+ }, document.body.appendChild(this.offcanvas);
939
+ }
940
+ render() {
941
+ const i = L`
942
+ <div class="nt-nav-links" id="main" part="main">
943
+ <slot id="main-slot"></slot>
944
+ </div>
945
+ `;
946
+ return L` <nav>
947
+ <slot
948
+ ?hidden=${!this._sidebar}
949
+ name="burger"
950
+ open
951
+ aria-haspopup="true"
952
+ id="burger"
953
+ class="burger"
954
+ @click=${() => this.offcanvas.open()}
955
+ >
956
+ <!-- fallback icon -->
957
+ <div style="display:flex; align-items: center; justify-content: center;">
958
+ <div id="text"><slot name="menu-text"></slot></div>
959
+ <nte-burger id="open-burger"></nte-burger>
960
+ </div>
961
+ </slot>
962
+ ${i}
963
+ </nav>`;
964
+ }
965
+ updated(i) {
966
+ var t;
967
+ if (super.updated(i), this._sidebar) {
968
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("#main-slot");
969
+ this.offcanvas.append(...e.assignedElements());
970
+ }
971
+ }
972
+ firstUpdated(i) {
973
+ super.firstUpdated(i);
974
+ const t = getComputedStyle(this);
975
+ for (const e of t)
976
+ console.debug(`Copying style ${e} with value ${t.getPropertyValue(e)}`), e.startsWith("--") && this.offcanvas.style.setProperty(e, t.getPropertyValue(e));
977
+ }
978
+ switchMode(i) {
979
+ this.classList.remove("nav-row", "nav-column"), this.classList.add(`nav-${i}`);
980
+ }
981
+ connectedCallback() {
982
+ super.connectedCallback(), this.switchMode("column"), this._sidebar = !0, this.breakpoint !== "" && (ot(this.breakpoint) && (this.switchMode("row"), this._sidebar = !1), window.addEventListener("breakpoint-changed", (i) => {
983
+ ot(this.breakpoint) ? (this.switchMode("row"), this._sidebar = !1) : (this.switchMode("column"), this._sidebar = !0);
984
+ }));
985
+ }
986
+ };
987
+ y.DEFINITION = {
988
+ classes: ["align-left", "align-right", "align-center"],
989
+ attributes: {}
990
+ };
991
+ y.styles = [j(de)];
992
+ I([
993
+ S({ type: String, reflect: !0 })
994
+ ], y.prototype, "mode", 2);
995
+ I([
996
+ S({ type: String, reflect: !0 })
997
+ ], y.prototype, "text", 2);
998
+ I([
999
+ S({ type: String, reflect: !0 })
1000
+ ], y.prototype, "breakpoint", 2);
1001
+ I([
1002
+ kt()
1003
+ ], y.prototype, "_sidebar", 2);
1004
+ y = I([
1005
+ F("nte-nav")
1006
+ ], y);
1007
+ /**
1008
+ * @license
1009
+ * Copyright 2020 Google LLC
1010
+ * SPDX-License-Identifier: BSD-3-Clause
1011
+ */
1012
+ const fe = (i) => i.strings === void 0;
1013
+ /**
1014
+ * @license
1015
+ * Copyright 2017 Google LLC
1016
+ * SPDX-License-Identifier: BSD-3-Clause
1017
+ */
1018
+ const U = (i, t) => {
1019
+ var s;
1020
+ const e = i._$AN;
1021
+ if (e === void 0) return !1;
1022
+ for (const n of e) (s = n._$AO) == null || s.call(n, t, !1), U(n, t);
1023
+ return !0;
1024
+ }, V = (i) => {
1025
+ let t, e;
1026
+ do {
1027
+ if ((t = i._$AM) === void 0) break;
1028
+ e = t._$AN, e.delete(i), i = t;
1029
+ } while ((e == null ? void 0 : e.size) === 0);
1030
+ }, Lt = (i) => {
1031
+ for (let t; t = i._$AM; i = t) {
1032
+ let e = t._$AN;
1033
+ if (e === void 0) t._$AN = e = /* @__PURE__ */ new Set();
1034
+ else if (e.has(i)) break;
1035
+ e.add(i), $e(t);
1036
+ }
1037
+ };
1038
+ function ve(i) {
1039
+ this._$AN !== void 0 ? (V(this), this._$AM = i, Lt(this)) : this._$AM = i;
1040
+ }
1041
+ function me(i, t = !1, e = 0) {
1042
+ const s = this._$AH, n = this._$AN;
1043
+ if (n !== void 0 && n.size !== 0) if (t) if (Array.isArray(s)) for (let r = e; r < s.length; r++) U(s[r], !1), V(s[r]);
1044
+ else s != null && (U(s, !1), V(s));
1045
+ else U(this, i);
1046
+ }
1047
+ const $e = (i) => {
1048
+ i.type == Ut.CHILD && (i._$AP ?? (i._$AP = me), i._$AQ ?? (i._$AQ = ve));
1049
+ };
1050
+ class _e extends Ht {
1051
+ constructor() {
1052
+ super(...arguments), this._$AN = void 0;
1053
+ }
1054
+ _$AT(t, e, s) {
1055
+ super._$AT(t, e, s), Lt(this), this.isConnected = t._$AU;
1056
+ }
1057
+ _$AO(t, e = !0) {
1058
+ var s, n;
1059
+ t !== this.isConnected && (this.isConnected = t, t ? (s = this.reconnected) == null || s.call(this) : (n = this.disconnected) == null || n.call(this)), e && (U(this, t), V(this));
1060
+ }
1061
+ setValue(t) {
1062
+ if (fe(this._$Ct)) this._$Ct._$AI(t, this);
1063
+ else {
1064
+ const e = [...this._$Ct._$AH];
1065
+ e[this._$Ci] = t, this._$Ct._$AI(e, this, 0);
1066
+ }
1067
+ }
1068
+ disconnected() {
1069
+ }
1070
+ reconnected() {
1071
+ }
1072
+ }
1073
+ /**
1074
+ * @license
1075
+ * Copyright 2020 Google LLC
1076
+ * SPDX-License-Identifier: BSD-3-Clause
1077
+ */
1078
+ const gt = () => new ye();
1079
+ class ye {
1080
+ }
1081
+ const et = /* @__PURE__ */ new WeakMap(), bt = Nt(class extends _e {
1082
+ render(i) {
1083
+ return p;
1084
+ }
1085
+ update(i, [t]) {
1086
+ var s;
1087
+ const e = t !== this.G;
1088
+ return e && this.G !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.G = t, this.ht = (s = i.options) == null ? void 0 : s.host, this.rt(this.ct = i.element)), p;
1089
+ }
1090
+ rt(i) {
1091
+ if (this.isConnected || (i = void 0), typeof this.G == "function") {
1092
+ const t = this.ht ?? globalThis;
1093
+ let e = et.get(t);
1094
+ e === void 0 && (e = /* @__PURE__ */ new WeakMap(), et.set(t, e)), e.get(this.G) !== void 0 && this.G.call(this.ht, void 0), e.set(this.G, i), i !== void 0 && this.G.call(this.ht, i);
1095
+ } else this.G.value = i;
1096
+ }
1097
+ get lt() {
1098
+ var i, t;
1099
+ return typeof this.G == "function" ? (i = et.get(this.ht ?? globalThis)) == null ? void 0 : i.get(this.G) : (t = this.G) == null ? void 0 : t.value;
1100
+ }
1101
+ disconnected() {
1102
+ this.lt === this.ct && this.rt(void 0);
1103
+ }
1104
+ reconnected() {
1105
+ this.rt(this.ct);
1106
+ }
1107
+ }), ge = "*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%;width:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit;color:inherit;background:none;border:none;outline:none}a{color:inherit;text-decoration:none}ul,ol{list-style:none}table{border-collapse:collapse;border-spacing:0}slot{display:contents}:host{--bg: transparent;--spacer-bg: transparent;--container-width: var(--nt-container-width, 100%);--brand-height: 80px;--padding: .5rem;margin:0}#wrapper{position:relative;width:100%}#navbar{position:absolute;top:0;width:100%;height:auto;background-color:var(--bg);z-index:1000;padding:var(--padding)}#container{width:var(--container-width);margin:0 auto;display:flex}#container #brand{width:auto;align-items:start;display:flex;height:100%;justify-items:center}#container #brand:has(slot[empty]){display:none}#container #brand slot::slotted(img){height:var(--brand-height);width:auto}#container #navbars{display:flex;flex-grow:1;justify-content:end;align-items:center;gap:1rem}";
1108
+ var be = Object.defineProperty, we = Object.getOwnPropertyDescriptor, Rt = (i, t, e, s) => {
1109
+ for (var n = s > 1 ? void 0 : s ? we(t, e) : t, r = i.length - 1, o; r >= 0; r--)
1110
+ (o = i[r]) && (n = (s ? o(t, e, n) : o(n)) || n);
1111
+ return s && n && be(t, e, n), n;
1112
+ };
1113
+ let q = class extends $ {
1114
+ constructor() {
1115
+ super(), this.navbarRef = gt(), this.spacerRef = gt(), this.scrollThreshold = 0, this._lastScrollY = window.scrollY, this._debouncer = new xt(100, 300), document.addEventListener(
1116
+ "scroll",
1117
+ async () => {
1118
+ this.updateScrollState();
1119
+ },
1120
+ { passive: !0 }
1121
+ );
1122
+ }
1123
+ static get is() {
1124
+ return "nte-navbar";
1125
+ }
1126
+ updateScrollState() {
1127
+ const i = window.scrollY;
1128
+ if (i < 2) {
1129
+ this.classList.add("state-scrolled-top"), this.classList.remove("state-pre-scrolled");
1130
+ return;
1131
+ } else
1132
+ this.classList.remove("state-scrolled-top"), this.classList.remove("state-scrolling-up");
1133
+ i < this._lastScrollY ? (this.classList.add("state-scrolling-up"), this.classList.remove("state-scrolling-down")) : (this.classList.remove("state-scrolling-up"), this.classList.add("state-scrolling-down")), i > this.scrollThreshold ? (this.classList.add("state-scrolled"), this.classList.remove("state-pre-scrolled")) : (this.classList.add("state-pre-scrolled"), this.classList.remove("state-scrolled")), this._lastScrollY = i;
1134
+ }
1135
+ async connectedCallback() {
1136
+ this.updateScrollState(), await oe(), super.connectedCallback();
1137
+ }
1138
+ // Adjust the spacer height on every render
1139
+ updated(i) {
1140
+ super.updated(i);
1141
+ const t = this.navbarRef.value, e = this.spacerRef.value;
1142
+ t && e && (e.style.height = `${t.offsetHeight}px`);
1143
+ }
1144
+ firstUpdated(i) {
1145
+ Et.observeEmptySlots(this);
1146
+ }
1147
+ render() {
1148
+ return L`
1149
+ <div id="wrapper" part="wrapper">
1150
+ <div id="spacer" part="spacer" ${bt(this.spacerRef)}></div>
1151
+ <div id="navbar" part="navbar" ${bt(this.navbarRef)}>
1152
+ <div id="container" part="container">
1153
+ <div id="brand" part="brand">
1154
+ <slot name="brand"></slot>
1155
+ </div>
1156
+ <div id="navbars">
1157
+ <slot></slot>
1158
+ </div>
1159
+ </div>
1160
+ </div>
1161
+ </div>
1162
+ `;
1163
+ }
1164
+ };
1165
+ q.styles = [j(ge)];
1166
+ Rt([
1167
+ S({ type: Number, attribute: "scroll-threshold", reflect: !0 })
1168
+ ], q.prototype, "scrollThreshold", 2);
1169
+ q = Rt([
1170
+ F("nte-navbar")
1171
+ ], q);
1172
+ var Ae = Object.getOwnPropertyDescriptor, xe = (i, t, e, s) => {
1173
+ for (var n = s > 1 ? void 0 : s ? Ae(t, e) : t, r = i.length - 1, o; r >= 0; r--)
1174
+ (o = i[r]) && (n = o(n) || n);
1175
+ return n;
1176
+ };
1177
+ let wt = class extends $ {
1178
+ static get is() {
1179
+ return "nte-navbar-line";
1180
+ }
1181
+ createRenderRoot() {
1182
+ return this.attachShadow({ mode: "open" });
1183
+ }
1184
+ connectedCallback() {
1185
+ super.connectedCallback();
1186
+ }
1187
+ render() {
1188
+ return L`
1189
+ <div id="main">
1190
+ <div id="topbar" part="topbar">
1191
+ <div id="container-top" part="container-top">
1192
+ <slot name="top"></slot>
1193
+ </div>
1194
+ </div>
1195
+
1196
+ <div id="navbar" part="navbar">
1197
+ <div id="container" part="container">
1198
+ <slot></slot>
1199
+ </div>
1200
+ </div>
1201
+ </div>
1202
+ `;
1203
+ }
1204
+ };
1205
+ wt = xe([
1206
+ F("nte-navbar-line")
1207
+ ], wt);
1208
+ export {
1209
+ y as NteNav,
1210
+ q as NteNavbar
1211
+ };
@@ -0,0 +1,25 @@
1
+ import { NtElementDefinition } from '../../../../nextrap-base/nt-framework/src/index.ts';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ /**
4
+ * <nte-nav>
5
+ * <span slot="brand">Brand</span>
6
+ * <a slot="links" href="/">Home</a>
7
+ * ...
8
+ * [optionally:] <nte-burger slot="burger"></nte-burger>
9
+ * </nte-nav>
10
+ */
11
+ export declare class NteNav extends LitElement {
12
+ static DEFINITION: NtElementDefinition;
13
+ static styles: import('lit').CSSResult[];
14
+ mode: 'row' | 'column' | 'auto';
15
+ text: string;
16
+ breakpoint: string | number;
17
+ private offcanvas;
18
+ private _sidebar;
19
+ constructor();
20
+ render(): import('lit-html').TemplateResult<1>;
21
+ protected updated(_changedProperties: PropertyValues): void;
22
+ protected firstUpdated(_changedProperties: PropertyValues): void;
23
+ switchMode(mode: 'row' | 'column'): void;
24
+ connectedCallback(): void;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ export declare class NteNavbar extends LitElement {
3
+ static get is(): string;
4
+ static styles: import('lit').CSSResult[];
5
+ private navbarRef;
6
+ private spacerRef;
7
+ scrollThreshold: number;
8
+ private _lastScrollY;
9
+ private _debouncer;
10
+ constructor();
11
+ private updateScrollState;
12
+ connectedCallback(): Promise<void>;
13
+ updated(_changedProperties: PropertyValues): void;
14
+ firstUpdated(_changedProperties: PropertyValues): void;
15
+ render(): import('lit-html').TemplateResult<1>;
16
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@nextrap/nte-nav",
3
+ "version": "0.0.2",
4
+ "main": "./index.js",
5
+ "dependencies": {
6
+ "@nextrap/nt-framework": "^0.0.1",
7
+ "@nextrap/nte-burger": "^0.0.1",
8
+ "@nextrap/nte-offcanvas": "^0.0.1",
9
+ "@nextrap/style-reset": "^0.0.1"
10
+ },
11
+ "devDependencies": {
12
+ "@nextrap/style-base": "^0.0.1"
13
+ },
14
+ "type": "module",
15
+ "exports": {
16
+ "./nav": "./src/lib/nte-nav.ts"
17
+ },
18
+ "types": "./index.d.ts"
19
+ }