@nysds/nys-globalheader 1.11.2 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nys-globalheader.js
CHANGED
|
@@ -1,621 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Part of the New York State Design System
|
|
9
|
-
* Repository: https://github.com/its-hcd/nysds
|
|
10
|
-
* License: MIT
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2019 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
const _ = globalThis, E = _.ShadowRoot && (_.ShadyCSS === void 0 || _.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, O = Symbol(), M = /* @__PURE__ */ new WeakMap();
|
|
18
|
-
let T = class {
|
|
19
|
-
constructor(e, t, n) {
|
|
20
|
-
if (this._$cssResult$ = !0, n !== O) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
21
|
-
this.cssText = e, this.t = t;
|
|
22
|
-
}
|
|
23
|
-
get styleSheet() {
|
|
24
|
-
let e = this.o;
|
|
25
|
-
const t = this.t;
|
|
26
|
-
if (E && e === void 0) {
|
|
27
|
-
const n = t !== void 0 && t.length === 1;
|
|
28
|
-
n && (e = M.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && M.set(t, e));
|
|
29
|
-
}
|
|
30
|
-
return e;
|
|
31
|
-
}
|
|
32
|
-
toString() {
|
|
33
|
-
return this.cssText;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const j = (a) => new T(typeof a == "string" ? a : a + "", void 0, O), q = (a, e) => {
|
|
37
|
-
if (E) a.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
|
|
38
|
-
else for (const t of e) {
|
|
39
|
-
const n = document.createElement("style"), s = _.litNonce;
|
|
40
|
-
s !== void 0 && n.setAttribute("nonce", s), n.textContent = t.cssText, a.appendChild(n);
|
|
41
|
-
}
|
|
42
|
-
}, P = E ? (a) => a : (a) => a instanceof CSSStyleSheet ? ((e) => {
|
|
43
|
-
let t = "";
|
|
44
|
-
for (const n of e.cssRules) t += n.cssText;
|
|
45
|
-
return j(t);
|
|
46
|
-
})(a) : a;
|
|
47
|
-
/**
|
|
48
|
-
* @license
|
|
49
|
-
* Copyright 2017 Google LLC
|
|
50
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/
|
|
52
|
-
const { is: D, defineProperty: H, getOwnPropertyDescriptor: W, getOwnPropertyNames: B, getOwnPropertySymbols: G, getPrototypeOf: J } = Object, m = globalThis, C = m.trustedTypes, K = C ? C.emptyScript : "", F = m.reactiveElementPolyfillSupport, g = (a, e) => a, f = { toAttribute(a, e) {
|
|
53
|
-
switch (e) {
|
|
54
|
-
case Boolean:
|
|
55
|
-
a = a ? K : null;
|
|
56
|
-
break;
|
|
57
|
-
case Object:
|
|
58
|
-
case Array:
|
|
59
|
-
a = a == null ? a : JSON.stringify(a);
|
|
60
|
-
}
|
|
61
|
-
return a;
|
|
62
|
-
}, fromAttribute(a, e) {
|
|
63
|
-
let t = a;
|
|
64
|
-
switch (e) {
|
|
65
|
-
case Boolean:
|
|
66
|
-
t = a !== null;
|
|
67
|
-
break;
|
|
68
|
-
case Number:
|
|
69
|
-
t = a === null ? null : Number(a);
|
|
70
|
-
break;
|
|
71
|
-
case Object:
|
|
72
|
-
case Array:
|
|
73
|
-
try {
|
|
74
|
-
t = JSON.parse(a);
|
|
75
|
-
} catch {
|
|
76
|
-
t = null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return t;
|
|
80
|
-
} }, S = (a, e) => !D(a, e), A = { attribute: !0, type: String, converter: f, reflect: !1, useDefault: !1, hasChanged: S };
|
|
81
|
-
Symbol.metadata ??= Symbol("metadata"), m.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
82
|
-
class p extends HTMLElement {
|
|
83
|
-
static addInitializer(e) {
|
|
84
|
-
this._$Ei(), (this.l ??= []).push(e);
|
|
85
|
-
}
|
|
86
|
-
static get observedAttributes() {
|
|
87
|
-
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
88
|
-
}
|
|
89
|
-
static createProperty(e, t = A) {
|
|
90
|
-
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
91
|
-
const n = Symbol(), s = this.getPropertyDescriptor(e, n, t);
|
|
92
|
-
s !== void 0 && H(this.prototype, e, s);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
static getPropertyDescriptor(e, t, n) {
|
|
96
|
-
const { get: s, set: o } = W(this.prototype, e) ?? { get() {
|
|
97
|
-
return this[t];
|
|
98
|
-
}, set(i) {
|
|
99
|
-
this[t] = i;
|
|
100
|
-
} };
|
|
101
|
-
return { get: s, set(i) {
|
|
102
|
-
const r = s?.call(this);
|
|
103
|
-
o?.call(this, i), this.requestUpdate(e, r, n);
|
|
104
|
-
}, configurable: !0, enumerable: !0 };
|
|
105
|
-
}
|
|
106
|
-
static getPropertyOptions(e) {
|
|
107
|
-
return this.elementProperties.get(e) ?? A;
|
|
108
|
-
}
|
|
109
|
-
static _$Ei() {
|
|
110
|
-
if (this.hasOwnProperty(g("elementProperties"))) return;
|
|
111
|
-
const e = J(this);
|
|
112
|
-
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
113
|
-
}
|
|
114
|
-
static finalize() {
|
|
115
|
-
if (this.hasOwnProperty(g("finalized"))) return;
|
|
116
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(g("properties"))) {
|
|
117
|
-
const t = this.properties, n = [...B(t), ...G(t)];
|
|
118
|
-
for (const s of n) this.createProperty(s, t[s]);
|
|
119
|
-
}
|
|
120
|
-
const e = this[Symbol.metadata];
|
|
121
|
-
if (e !== null) {
|
|
122
|
-
const t = litPropertyMetadata.get(e);
|
|
123
|
-
if (t !== void 0) for (const [n, s] of t) this.elementProperties.set(n, s);
|
|
124
|
-
}
|
|
125
|
-
this._$Eh = /* @__PURE__ */ new Map();
|
|
126
|
-
for (const [t, n] of this.elementProperties) {
|
|
127
|
-
const s = this._$Eu(t, n);
|
|
128
|
-
s !== void 0 && this._$Eh.set(s, t);
|
|
129
|
-
}
|
|
130
|
-
this.elementStyles = this.finalizeStyles(this.styles);
|
|
131
|
-
}
|
|
132
|
-
static finalizeStyles(e) {
|
|
133
|
-
const t = [];
|
|
134
|
-
if (Array.isArray(e)) {
|
|
135
|
-
const n = new Set(e.flat(1 / 0).reverse());
|
|
136
|
-
for (const s of n) t.unshift(P(s));
|
|
137
|
-
} else e !== void 0 && t.push(P(e));
|
|
138
|
-
return t;
|
|
139
|
-
}
|
|
140
|
-
static _$Eu(e, t) {
|
|
141
|
-
const n = t.attribute;
|
|
142
|
-
return n === !1 ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
143
|
-
}
|
|
144
|
-
constructor() {
|
|
145
|
-
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
146
|
-
}
|
|
147
|
-
_$Ev() {
|
|
148
|
-
this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
|
|
149
|
-
}
|
|
150
|
-
addController(e) {
|
|
151
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
152
|
-
}
|
|
153
|
-
removeController(e) {
|
|
154
|
-
this._$EO?.delete(e);
|
|
155
|
-
}
|
|
156
|
-
_$E_() {
|
|
157
|
-
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
158
|
-
for (const n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
159
|
-
e.size > 0 && (this._$Ep = e);
|
|
160
|
-
}
|
|
161
|
-
createRenderRoot() {
|
|
162
|
-
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
163
|
-
return q(e, this.constructor.elementStyles), e;
|
|
164
|
-
}
|
|
165
|
-
connectedCallback() {
|
|
166
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
|
|
167
|
-
}
|
|
168
|
-
enableUpdating(e) {
|
|
169
|
-
}
|
|
170
|
-
disconnectedCallback() {
|
|
171
|
-
this._$EO?.forEach(((e) => e.hostDisconnected?.()));
|
|
172
|
-
}
|
|
173
|
-
attributeChangedCallback(e, t, n) {
|
|
174
|
-
this._$AK(e, n);
|
|
175
|
-
}
|
|
176
|
-
_$ET(e, t) {
|
|
177
|
-
const n = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, n);
|
|
178
|
-
if (s !== void 0 && n.reflect === !0) {
|
|
179
|
-
const o = (n.converter?.toAttribute !== void 0 ? n.converter : f).toAttribute(t, n.type);
|
|
180
|
-
this._$Em = e, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
_$AK(e, t) {
|
|
184
|
-
const n = this.constructor, s = n._$Eh.get(e);
|
|
185
|
-
if (s !== void 0 && this._$Em !== s) {
|
|
186
|
-
const o = n.getPropertyOptions(s), i = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : f;
|
|
187
|
-
this._$Em = s;
|
|
188
|
-
const r = i.fromAttribute(t, o.type);
|
|
189
|
-
this[s] = r ?? this._$Ej?.get(s) ?? r, this._$Em = null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
requestUpdate(e, t, n) {
|
|
193
|
-
if (e !== void 0) {
|
|
194
|
-
const s = this.constructor, o = this[e];
|
|
195
|
-
if (n ??= s.getPropertyOptions(e), !((n.hasChanged ?? S)(o, t) || n.useDefault && n.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(s._$Eu(e, n)))) return;
|
|
196
|
-
this.C(e, t, n);
|
|
197
|
-
}
|
|
198
|
-
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
199
|
-
}
|
|
200
|
-
C(e, t, { useDefault: n, reflect: s, wrapped: o }, i) {
|
|
201
|
-
n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, i ?? t ?? this[e]), o !== !0 || i !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), s === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
202
|
-
}
|
|
203
|
-
async _$EP() {
|
|
204
|
-
this.isUpdatePending = !0;
|
|
205
|
-
try {
|
|
206
|
-
await this._$ES;
|
|
207
|
-
} catch (t) {
|
|
208
|
-
Promise.reject(t);
|
|
209
|
-
}
|
|
210
|
-
const e = this.scheduleUpdate();
|
|
211
|
-
return e != null && await e, !this.isUpdatePending;
|
|
212
|
-
}
|
|
213
|
-
scheduleUpdate() {
|
|
214
|
-
return this.performUpdate();
|
|
215
|
-
}
|
|
216
|
-
performUpdate() {
|
|
217
|
-
if (!this.isUpdatePending) return;
|
|
218
|
-
if (!this.hasUpdated) {
|
|
219
|
-
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
220
|
-
for (const [s, o] of this._$Ep) this[s] = o;
|
|
221
|
-
this._$Ep = void 0;
|
|
222
|
-
}
|
|
223
|
-
const n = this.constructor.elementProperties;
|
|
224
|
-
if (n.size > 0) for (const [s, o] of n) {
|
|
225
|
-
const { wrapped: i } = o, r = this[s];
|
|
226
|
-
i !== !0 || this._$AL.has(s) || r === void 0 || this.C(s, void 0, o, r);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
let e = !1;
|
|
230
|
-
const t = this._$AL;
|
|
231
|
-
try {
|
|
232
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((n) => n.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
233
|
-
} catch (n) {
|
|
234
|
-
throw e = !1, this._$EM(), n;
|
|
235
|
-
}
|
|
236
|
-
e && this._$AE(t);
|
|
237
|
-
}
|
|
238
|
-
willUpdate(e) {
|
|
239
|
-
}
|
|
240
|
-
_$AE(e) {
|
|
241
|
-
this._$EO?.forEach(((t) => t.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
242
|
-
}
|
|
243
|
-
_$EM() {
|
|
244
|
-
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
245
|
-
}
|
|
246
|
-
get updateComplete() {
|
|
247
|
-
return this.getUpdateComplete();
|
|
248
|
-
}
|
|
249
|
-
getUpdateComplete() {
|
|
250
|
-
return this._$ES;
|
|
251
|
-
}
|
|
252
|
-
shouldUpdate(e) {
|
|
253
|
-
return !0;
|
|
254
|
-
}
|
|
255
|
-
update(e) {
|
|
256
|
-
this._$Eq &&= this._$Eq.forEach(((t) => this._$ET(t, this[t]))), this._$EM();
|
|
257
|
-
}
|
|
258
|
-
updated(e) {
|
|
259
|
-
}
|
|
260
|
-
firstUpdated(e) {
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
p.elementStyles = [], p.shadowRootOptions = { mode: "open" }, p[g("elementProperties")] = /* @__PURE__ */ new Map(), p[g("finalized")] = /* @__PURE__ */ new Map(), F?.({ ReactiveElement: p }), (m.reactiveElementVersions ??= []).push("2.1.1");
|
|
264
|
-
/**
|
|
265
|
-
* @license
|
|
266
|
-
* Copyright 2017 Google LLC
|
|
267
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
268
|
-
*/
|
|
269
|
-
const I = { attribute: !0, type: String, converter: f, reflect: !1, hasChanged: S }, Q = (a = I, e, t) => {
|
|
270
|
-
const { kind: n, metadata: s } = t;
|
|
271
|
-
let o = globalThis.litPropertyMetadata.get(s);
|
|
272
|
-
if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), n === "setter" && ((a = Object.create(a)).wrapped = !0), o.set(t.name, a), n === "accessor") {
|
|
273
|
-
const { name: i } = t;
|
|
274
|
-
return { set(r) {
|
|
275
|
-
const c = e.get.call(this);
|
|
276
|
-
e.set.call(this, r), this.requestUpdate(i, c, a);
|
|
277
|
-
}, init(r) {
|
|
278
|
-
return r !== void 0 && this.C(i, void 0, a, r), r;
|
|
279
|
-
} };
|
|
280
|
-
}
|
|
281
|
-
if (n === "setter") {
|
|
282
|
-
const { name: i } = t;
|
|
283
|
-
return function(r) {
|
|
284
|
-
const c = this[i];
|
|
285
|
-
e.call(this, r), this.requestUpdate(i, c, a);
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
throw Error("Unsupported decorator location: " + n);
|
|
289
|
-
};
|
|
290
|
-
function v(a) {
|
|
291
|
-
return (e, t) => typeof t == "object" ? Q(a, e, t) : ((n, s, o) => {
|
|
292
|
-
const i = s.hasOwnProperty(o);
|
|
293
|
-
return s.constructor.createProperty(o, n), i ? Object.getOwnPropertyDescriptor(s, o) : void 0;
|
|
294
|
-
})(a, e, t);
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* @license
|
|
298
|
-
* Copyright 2017 Google LLC
|
|
299
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
300
|
-
*/
|
|
301
|
-
function N(a) {
|
|
302
|
-
return v({ ...a, state: !0, attribute: !1 });
|
|
303
|
-
}
|
|
304
|
-
const V = L`
|
|
305
|
-
:host {
|
|
306
|
-
/* Global Header Styles */
|
|
307
|
-
--_nys-globalheader-color: var(
|
|
308
|
-
--nys-color-text-reverse,
|
|
309
|
-
var(--nys-color-white, #ffffff)
|
|
310
|
-
);
|
|
311
|
-
--_nys-globalheader-link-color: var(
|
|
312
|
-
--nys-color-link-reverse-neutral,
|
|
313
|
-
var(--nys-color-white, #fff)
|
|
314
|
-
);
|
|
315
|
-
--_nys-globalheader-background-color: var(
|
|
316
|
-
--nys-color-theme,
|
|
317
|
-
var(--nys-color-state-blue-700, #154973)
|
|
318
|
-
);
|
|
319
|
-
--_nys-globalheader-gap: var(--nys-space-300, 24px);
|
|
320
|
-
--_nys-globalheader-padding: var(--nys-space-250, 20px);
|
|
321
|
-
--_nys-globalheader-font-family--menu: var(
|
|
322
|
-
--nys-font-family-ui,
|
|
323
|
-
var(
|
|
324
|
-
--nys-font-family-sans,
|
|
325
|
-
"Proxima Nova",
|
|
326
|
-
"Helvetica Neue",
|
|
327
|
-
"Helvetica",
|
|
328
|
-
"Arial",
|
|
329
|
-
sans-serif
|
|
330
|
-
)
|
|
331
|
-
);
|
|
332
|
-
--_nys-globalheader-line-height: normal;
|
|
333
|
-
--_nys-globalheader-letter-spacing: normal;
|
|
334
|
-
--_nys-globalheader-font-weight: var(--nys-font-weight-semibold, 600);
|
|
335
|
-
--_nys-globalheader-max-width: var(--nys-max-content-width, 1280px);
|
|
336
|
-
|
|
337
|
-
/* Agency and App Name Styling */
|
|
338
|
-
--_nys-globalheader-gap--text: var(--nys-space-100, 8px);
|
|
339
|
-
--_nys-globalheader-font-size--heading: var(
|
|
340
|
-
--nys-font-size-agency-xl,
|
|
341
|
-
var(--nys-font-size-2xl, 22px)
|
|
342
|
-
);
|
|
343
|
-
--_nys-globalheader-font-size--subheading: var(
|
|
344
|
-
--nys-font-size-agency-md,
|
|
345
|
-
var(--nys-font-size-md, 16px)
|
|
346
|
-
);
|
|
347
|
-
--_nys-globalheader-font-family--headings: var(
|
|
348
|
-
--nys-font-family-agency,
|
|
349
|
-
"D Sari",
|
|
350
|
-
Arial,
|
|
351
|
-
sans-serif
|
|
352
|
-
);
|
|
353
|
-
|
|
354
|
-
/* Menu Content Styling */
|
|
355
|
-
--_nys-globalheader-line-height--menu: var(
|
|
356
|
-
--nys-font-lineheight-ui-md,
|
|
357
|
-
24px
|
|
358
|
-
);
|
|
359
|
-
--_nys-globalheader-letter-spacing--menu: var(
|
|
360
|
-
--nys-font-letterspacing-ui-md,
|
|
361
|
-
var(--nys-font-letterspacing-400, 0.044px)
|
|
362
|
-
);
|
|
363
|
-
--_nys-globalheader-text-decoration-thickness--menu: var(
|
|
364
|
-
--nys-size-2px,
|
|
365
|
-
2px
|
|
366
|
-
);
|
|
367
|
-
--_nys-globalheader-link-padding: var(--nys-space-300, 24px)
|
|
368
|
-
var(--nys-space-200, 16px);
|
|
369
|
-
|
|
370
|
-
/* Mobile Menu */
|
|
371
|
-
--_nys-globalheader-font-size--menu-btn: var(--nys-type-size-ui-xs, 12px);
|
|
372
|
-
--_nys-globalheader-line-height--menu-btn: var(
|
|
373
|
-
--nys-font-lineheight-ui-xs,
|
|
374
|
-
20px
|
|
375
|
-
);
|
|
376
|
-
--_nys-globalheader-letter-spacing--menu-btn: var(
|
|
377
|
-
--nys-font-letterspacing-ui-xs,
|
|
378
|
-
0.057px
|
|
379
|
-
);
|
|
380
|
-
--_nys-globalheader-border-color--menu: var(--nys-color-theme-mid, #457aa5);
|
|
381
|
-
--_nys-globalheader-background-color--menu--hover: var(
|
|
382
|
-
--nys-color-theme-strong,
|
|
383
|
-
#0e324f
|
|
384
|
-
);
|
|
385
|
-
--_nys-globalheader-background-color--menu--active: var(
|
|
386
|
-
--nys-color-theme-stronger,
|
|
387
|
-
#081b2b
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/* Slotted content (menu links) basic resets */
|
|
392
|
-
ul {
|
|
393
|
-
list-style-type: none;
|
|
394
|
-
padding: 0;
|
|
395
|
-
margin: 0;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
li {
|
|
399
|
-
display: block;
|
|
400
|
-
margin: 0;
|
|
401
|
-
padding: 0;
|
|
402
|
-
box-sizing: border-box;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
a {
|
|
406
|
-
color: var(--_nys-globalheader-color);
|
|
407
|
-
text-decoration: none;
|
|
408
|
-
font-family: var(--_nys-globalheader-font-family--menu);
|
|
409
|
-
font-style: normal;
|
|
410
|
-
font-weight: 400;
|
|
411
|
-
line-height: var(--_nys-globalheader-line-height--menu);
|
|
412
|
-
letter-spacing: var(--_nys-globalheader-letter-spacing--menu);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.nys-globalheader {
|
|
416
|
-
display: flex;
|
|
417
|
-
justify-content: center;
|
|
418
|
-
padding: var(--_nys-globalheader-padding);
|
|
419
|
-
background-color: var(--_nys-globalheader-background-color);
|
|
420
|
-
color: var(--_nys-globalheader-color);
|
|
421
|
-
width: 100%;
|
|
422
|
-
min-height: 76px;
|
|
423
|
-
box-sizing: border-box;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/* Main container */
|
|
427
|
-
.nys-globalheader__main-container {
|
|
428
|
-
display: flex;
|
|
429
|
-
gap: var(--_nys-globalheader-gap);
|
|
430
|
-
max-width: var(--_nys-globalheader-max-width);
|
|
431
|
-
width: 100%;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/* Left-hand side Agency and App names */
|
|
435
|
-
.nys-globalheader__name-container {
|
|
436
|
-
display: flex;
|
|
437
|
-
flex-direction: column;
|
|
438
|
-
justify-content: center;
|
|
439
|
-
align-items: flex-start;
|
|
440
|
-
gap: var(--_nys-globalheader-gap--text);
|
|
441
|
-
}
|
|
442
|
-
.nys-globalheader__name {
|
|
443
|
-
margin: 0;
|
|
444
|
-
color: var(--_nys-globalheader-color);
|
|
445
|
-
font-family: var(--_nys-globalheader-font-family--headings);
|
|
446
|
-
font-size: var(--_nys-globalheader-font-size--heading);
|
|
447
|
-
font-style: normal;
|
|
448
|
-
font-weight: var(--_nys-globalheader-font-weight);
|
|
449
|
-
line-height: var(--_nys-globalheader-line-height);
|
|
450
|
-
letter-spacing: var(--_nys-globalheader-letter-spacing);
|
|
451
|
-
overflow-wrap: break-word; /* note: we use this bc text-wrap: wrap; is not a standard CSS property (yet). */
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
.nys-globalheader__agencyName {
|
|
455
|
-
font-size: var(--_nys-globalheader-font-size--subheading);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/* Set the font size for the agency to be the main font if appName is not defined */
|
|
459
|
-
.nys-globalheader__agencyName.main {
|
|
460
|
-
font-size: var(--_nys-globalheader-font-size--heading);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/* Slotted content */
|
|
464
|
-
.nys-globalheader__content {
|
|
465
|
-
display: none;
|
|
466
|
-
font-family: var(--_nys-globalheader-font-family--menu);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
.nys-globalheader__content ul {
|
|
470
|
-
display: flex;
|
|
471
|
-
flex-direction: column;
|
|
472
|
-
align-items: center;
|
|
473
|
-
flex-wrap: wrap;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
.nys-globalheader__content ul a:hover {
|
|
477
|
-
text-decoration: underline;
|
|
478
|
-
text-decoration-style: solid;
|
|
479
|
-
text-decoration-skip-ink: auto;
|
|
480
|
-
text-decoration-thickness: 7%;
|
|
481
|
-
text-underline-offset: auto;
|
|
482
|
-
text-underline-position: from-font;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
.nys-globalheader__content ul a:active {
|
|
486
|
-
text-decoration-thickness: var(
|
|
487
|
-
--_nys-globalheader-text-decoration-thickness--menu
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
/* Active Links */
|
|
492
|
-
.nys-globalheader__content li.active a,
|
|
493
|
-
.nys-globalheader__content-mobile li.active a {
|
|
494
|
-
font-weight: 700;
|
|
495
|
-
}
|
|
496
|
-
.nys-globalheader__content li.active {
|
|
497
|
-
border-bottom: 8px solid var(--nys-color-theme-weak, #cddde9);
|
|
498
|
-
}
|
|
499
|
-
.nys-globalheader__content li.active a {
|
|
500
|
-
margin-bottom: calc(-1 * var(--nys-space-100, 8px));
|
|
501
|
-
}
|
|
502
|
-
.nys-globalheader__content-mobile li.active a {
|
|
503
|
-
border-left: 8px solid var(--nys-color-theme-weak, #cddde9);
|
|
504
|
-
border-bottom: 1px solid var(--_nys-globalheader-border-color--menu);
|
|
505
|
-
}
|
|
506
|
-
.nys-globalheader__content ul li.active a:hover {
|
|
507
|
-
text-decoration: none;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/* Mobile Menu */
|
|
511
|
-
.nys-globalheader__content-mobile {
|
|
512
|
-
position: absolute;
|
|
513
|
-
z-index: 10;
|
|
514
|
-
display: flex;
|
|
515
|
-
flex-direction: column;
|
|
516
|
-
justify-content: center;
|
|
517
|
-
background-color: var(--_nys-globalheader-background-color);
|
|
518
|
-
width: fit-content;
|
|
519
|
-
}
|
|
520
|
-
.nys-globalheader__content-mobile.close {
|
|
521
|
-
display: none;
|
|
522
|
-
}
|
|
523
|
-
.nys-globalheader__content-mobile ul {
|
|
524
|
-
display: flex;
|
|
525
|
-
flex-direction: column;
|
|
526
|
-
}
|
|
527
|
-
.nys-globalheader__content-mobile ul li:first-child a {
|
|
528
|
-
border-top: 1px solid var(--_nys-globalheader-color);
|
|
529
|
-
}
|
|
530
|
-
.nys-globalheader__content-mobile ul li a {
|
|
531
|
-
display: flex;
|
|
532
|
-
padding: 24px;
|
|
533
|
-
align-items: center;
|
|
534
|
-
gap: 8px;
|
|
535
|
-
align-self: stretch;
|
|
536
|
-
border-bottom: 1px solid var(--_nys-globalheader-border-color--menu);
|
|
537
|
-
background-color: var(--_nys-globalheader-background-color);
|
|
538
|
-
}
|
|
539
|
-
.nys-globalheader__content-mobile ul li a:hover {
|
|
540
|
-
background-color: var(--_nys-globalheader-background-color--menu--hover);
|
|
541
|
-
}
|
|
542
|
-
.nys-globalheader__content-mobile ul li a:active {
|
|
543
|
-
background-color: var(--_nys-globalheader-background-color--menu--active);
|
|
544
|
-
}
|
|
545
|
-
.nys-globalheader__name-container-link {
|
|
546
|
-
display: flex;
|
|
547
|
-
flex-direction: column;
|
|
548
|
-
justify-content: center;
|
|
549
|
-
}
|
|
550
|
-
/* Mobile Menu (OPEN/CLOSE Button Container) */
|
|
551
|
-
.nys-globalheader__button-container {
|
|
552
|
-
display: flex;
|
|
553
|
-
justify-content: center;
|
|
554
|
-
align-items: center;
|
|
555
|
-
}
|
|
556
|
-
.nys-globalheader__mobile-menu-button {
|
|
557
|
-
display: flex;
|
|
558
|
-
flex-direction: column;
|
|
559
|
-
justify-content: center;
|
|
560
|
-
align-items: center;
|
|
561
|
-
gap: 3px;
|
|
562
|
-
width: 50px;
|
|
563
|
-
height: 50px;
|
|
564
|
-
background-color: var(--_nys-globalheader-background-color);
|
|
565
|
-
border: none;
|
|
566
|
-
cursor: pointer;
|
|
567
|
-
display: flex;
|
|
568
|
-
justify-content: center;
|
|
569
|
-
align-items: center;
|
|
570
|
-
padding: 0;
|
|
571
|
-
color: var(--_nys-globalheader-color);
|
|
572
|
-
}
|
|
573
|
-
.nys-globalheader__mobile-menu-button-text {
|
|
574
|
-
font-size: var(--_nys-globalheader-font-size--menu-btn);
|
|
575
|
-
line-height: var(--_nys-globalheader-line-height--menu-btn);
|
|
576
|
-
letter-spacing: var(--_nys-globalheader-letter-spacing--menu-btn);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/* Breakpoints using NYSDS Guidelines (Menu Links) */
|
|
580
|
-
/* https://www.figma.com/design/U2QpuSUXRTxbgG64Fzi9bu?node-id=1170-340 */
|
|
581
|
-
@media (min-width: 1024px) {
|
|
582
|
-
/* Desktop (MD - Above 1024px) */
|
|
583
|
-
.nys-globalheader__content {
|
|
584
|
-
display: flex;
|
|
585
|
-
}
|
|
586
|
-
.nys-globalheader__content ul {
|
|
587
|
-
flex-direction: row;
|
|
588
|
-
}
|
|
589
|
-
.nys-globalheader__content-mobile,
|
|
590
|
-
.nys-globalheader__button-container {
|
|
591
|
-
display: none;
|
|
592
|
-
}
|
|
593
|
-
li {
|
|
594
|
-
display: flex;
|
|
595
|
-
align-items: center;
|
|
596
|
-
padding: var(--_nys-globalheader-link-padding);
|
|
597
|
-
}
|
|
598
|
-
:host {
|
|
599
|
-
--_nys-globalheader-gap: var(--nys-space-500, 40px);
|
|
600
|
-
--_nys-globalheader-padding: var(--nys-space-50, 4px)
|
|
601
|
-
var(--nys-size-400, 32px) 0;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
@media (min-width: 1280px) {
|
|
606
|
-
/* Large Desktop (LG - Above 1280px) */
|
|
607
|
-
:host {
|
|
608
|
-
--_nys-globalheader-padding: var(--nys-space-50, 4px)
|
|
609
|
-
var(--nys-space-800, 64px) 0;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
`;
|
|
613
|
-
var X = Object.defineProperty, y = (a, e, t, n) => {
|
|
614
|
-
for (var s = void 0, o = a.length - 1, i; o >= 0; o--)
|
|
615
|
-
(i = a[o]) && (s = i(e, t, s) || s);
|
|
616
|
-
return s && X(e, t, s), s;
|
|
1
|
+
import { LitElement as w, unsafeCSS as N, html as o } from "lit";
|
|
2
|
+
import { property as _, state as v } from "lit/decorators.js";
|
|
3
|
+
const M = ':host{--_nys-globalheader-color: var( --nys-color-text-reverse, var(--nys-color-white, #ffffff) );--_nys-globalheader-link-color: var( --nys-color-link-reverse-neutral, var(--nys-color-white, #fff) );--_nys-globalheader-background-color: var( --nys-color-theme, var(--nys-color-state-blue-700, #154973) );--_nys-globalheader-gap: var(--nys-space-300, 24px);--_nys-globalheader-padding: var(--nys-space-250, 20px);--_nys-globalheader-font-family--menu: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-globalheader-line-height: normal;--_nys-globalheader-letter-spacing: normal;--_nys-globalheader-font-weight: var(--nys-font-weight-semibold, 600);--_nys-globalheader-max-width: var(--nys-max-content-width, 1280px);--_nys-globalheader-gap--text: var(--nys-space-100, 8px);--_nys-globalheader-font-size--heading: var( --nys-font-size-agency-xl, var(--nys-font-size-2xl, 22px) );--_nys-globalheader-font-size--subheading: var( --nys-font-size-agency-md, var(--nys-font-size-md, 16px) );--_nys-globalheader-font-family--headings: var( --nys-font-family-agency, "D Sari", Arial, sans-serif );--_nys-globalheader-line-height--menu: var( --nys-font-lineheight-ui-md, 24px );--_nys-globalheader-letter-spacing--menu: var( --nys-font-letterspacing-ui-md, var(--nys-font-letterspacing-400, .044px) );--_nys-globalheader-text-decoration-thickness--menu: var( --nys-size-2px, 2px );--_nys-globalheader-link-padding: var(--nys-space-300, 24px) var(--nys-space-200, 16px);--_nys-globalheader-font-size--menu-btn: var(--nys-type-size-ui-xs, 12px);--_nys-globalheader-line-height--menu-btn: var( --nys-font-lineheight-ui-xs, 20px );--_nys-globalheader-letter-spacing--menu-btn: var( --nys-font-letterspacing-ui-xs, .057px );--_nys-globalheader-border-color--menu: var(--nys-color-theme-mid, #457aa5);--_nys-globalheader-background-color--menu--hover: var( --nys-color-theme-strong, #0e324f );--_nys-globalheader-background-color--menu--active: var( --nys-color-theme-stronger, #081b2b )}ul{list-style-type:none;padding:0;margin:0}li{display:block;margin:0;padding:0;box-sizing:border-box}a{color:var(--_nys-globalheader-color);text-decoration:none;font-family:var(--_nys-globalheader-font-family--menu);font-style:normal;font-weight:400;line-height:var(--_nys-globalheader-line-height--menu);letter-spacing:var(--_nys-globalheader-letter-spacing--menu)}.nys-globalheader{display:flex;justify-content:center;padding:var(--_nys-globalheader-padding);background-color:var(--_nys-globalheader-background-color);color:var(--_nys-globalheader-color);width:100%;min-height:76px;box-sizing:border-box}.nys-globalheader__main-container{display:flex;gap:var(--_nys-globalheader-gap);max-width:var(--_nys-globalheader-max-width);width:100%}.nys-globalheader__name-container{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:var(--_nys-globalheader-gap--text)}.nys-globalheader__name{margin:0;color:var(--_nys-globalheader-color);font-family:var(--_nys-globalheader-font-family--headings);font-size:var(--_nys-globalheader-font-size--heading);font-style:normal;font-weight:var(--_nys-globalheader-font-weight);line-height:var(--_nys-globalheader-line-height);letter-spacing:var(--_nys-globalheader-letter-spacing);overflow-wrap:break-word}.nys-globalheader__agencyName{font-size:var(--_nys-globalheader-font-size--subheading)}.nys-globalheader__agencyName.main{font-size:var(--_nys-globalheader-font-size--heading)}.nys-globalheader__content{display:none;font-family:var(--_nys-globalheader-font-family--menu)}.nys-globalheader__content ul{display:flex;flex-direction:column;align-items:center;flex-wrap:wrap}.nys-globalheader__content ul a:hover{text-decoration:underline;text-decoration-style:solid;text-decoration-skip-ink:auto;text-decoration-thickness:7%;text-underline-offset:auto;text-underline-position:from-font}.nys-globalheader__content ul a:active{text-decoration-thickness:var(--_nys-globalheader-text-decoration-thickness--menu)}.nys-globalheader__content li.active a,.nys-globalheader__content-mobile li.active a{font-weight:700}.nys-globalheader__content li.active{border-bottom:8px solid var(--nys-color-theme-weak, #cddde9)}.nys-globalheader__content li.active a{margin-bottom:calc(-1 * var(--nys-space-100, 8px))}.nys-globalheader__content-mobile li.active a{border-left:8px solid var(--nys-color-theme-weak, #cddde9);border-bottom:1px solid var(--_nys-globalheader-border-color--menu)}.nys-globalheader__content ul li.active a:hover{text-decoration:none}.nys-globalheader__content-mobile{position:absolute;z-index:10;display:flex;flex-direction:column;justify-content:center;background-color:var(--_nys-globalheader-background-color);width:fit-content}.nys-globalheader__content-mobile.close{display:none}.nys-globalheader__content-mobile ul{display:flex;flex-direction:column}.nys-globalheader__content-mobile ul li:first-child a{border-top:1px solid var(--_nys-globalheader-color)}.nys-globalheader__content-mobile ul li a{display:flex;padding:24px;align-items:center;gap:8px;align-self:stretch;border-bottom:1px solid var(--_nys-globalheader-border-color--menu);background-color:var(--_nys-globalheader-background-color)}.nys-globalheader__content-mobile ul li a:hover{background-color:var(--_nys-globalheader-background-color--menu--hover)}.nys-globalheader__content-mobile ul li a:active{background-color:var(--_nys-globalheader-background-color--menu--active)}.nys-globalheader__name-container-link{display:flex;flex-direction:column;justify-content:center}.nys-globalheader__button-container{display:flex;justify-content:center;align-items:center}.nys-globalheader__mobile-menu-button{flex-direction:column;gap:3px;width:50px;height:50px;background-color:var(--_nys-globalheader-background-color);border:none;cursor:pointer;display:flex;justify-content:center;align-items:center;padding:0;color:var(--_nys-globalheader-color)}.nys-globalheader__mobile-menu-button-text{font-size:var(--_nys-globalheader-font-size--menu-btn);line-height:var(--_nys-globalheader-line-height--menu-btn);letter-spacing:var(--_nys-globalheader-letter-spacing--menu-btn)}@media(min-width:1024px){.nys-globalheader__content{display:flex}.nys-globalheader__content ul{flex-direction:row}.nys-globalheader__content-mobile,.nys-globalheader__button-container{display:none}li{display:flex;align-items:center;padding:var(--_nys-globalheader-link-padding)}:host{--_nys-globalheader-gap: var(--nys-space-500, 40px);--_nys-globalheader-padding: var(--nys-space-50, 4px) var(--nys-size-400, 32px) 0}}@media(min-width:1280px){:host{--_nys-globalheader-padding: var(--nys-space-50, 4px) var(--nys-space-800, 64px) 0}}';
|
|
4
|
+
var z = Object.defineProperty, c = (p, e, t, r) => {
|
|
5
|
+
for (var n = void 0, a = p.length - 1, l; a >= 0; a--)
|
|
6
|
+
(l = p[a]) && (n = l(e, t, n) || n);
|
|
7
|
+
return n && z(e, t, n), n;
|
|
617
8
|
};
|
|
618
|
-
const
|
|
9
|
+
const m = class m extends w {
|
|
619
10
|
constructor() {
|
|
620
11
|
super(...arguments), this.appName = "", this.agencyName = "", this.homepageLink = "", this.slotHasContent = !0, this.isMobileMenuOpen = !1;
|
|
621
12
|
}
|
|
@@ -628,36 +19,36 @@ const w = class w extends R {
|
|
|
628
19
|
async _handleSlotChange() {
|
|
629
20
|
const e = this.shadowRoot?.querySelector("slot");
|
|
630
21
|
if (!e) return;
|
|
631
|
-
const t = e?.assignedNodes({ flatten: !0 }).filter((
|
|
22
|
+
const t = e?.assignedNodes({ flatten: !0 }).filter((a) => a.nodeType === Node.ELEMENT_NODE);
|
|
632
23
|
await Promise.resolve(), this.slotHasContent = t.length > 0;
|
|
633
|
-
const
|
|
24
|
+
const r = this.shadowRoot?.querySelector(
|
|
634
25
|
".nys-globalheader__content"
|
|
635
|
-
),
|
|
26
|
+
), n = this.shadowRoot?.querySelector(
|
|
636
27
|
".nys-globalheader__content-mobile"
|
|
637
28
|
);
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
const
|
|
29
|
+
if (r && n) {
|
|
30
|
+
r.innerHTML = "", n.innerHTML = "";
|
|
31
|
+
const a = this._normalizePath(
|
|
641
32
|
window.location.pathname + window.location.hash
|
|
642
33
|
);
|
|
643
|
-
t.forEach((
|
|
644
|
-
if (
|
|
645
|
-
const
|
|
646
|
-
["script", "iframe", "object", "embed, img"].forEach((
|
|
647
|
-
|
|
34
|
+
t.forEach((l) => {
|
|
35
|
+
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
36
|
+
const i = l.cloneNode(!0), f = l.cloneNode(!0);
|
|
37
|
+
["script", "iframe", "object", "embed, img"].forEach((y) => {
|
|
38
|
+
i.querySelectorAll(y).forEach((h) => h.remove());
|
|
648
39
|
});
|
|
649
|
-
const
|
|
650
|
-
const
|
|
651
|
-
let
|
|
40
|
+
const u = (y) => {
|
|
41
|
+
const h = Array.from(y.querySelectorAll("a"));
|
|
42
|
+
let g = {
|
|
652
43
|
li: null,
|
|
653
44
|
length: 0
|
|
654
45
|
};
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
d && (d === "/" &&
|
|
46
|
+
h.forEach((b) => {
|
|
47
|
+
const x = b.getAttribute("href"), d = this._normalizePath(x);
|
|
48
|
+
d && (d === "/" && a === "/" ? g = { li: b.closest("li"), length: 1 } : a?.startsWith(d) && d.length > g.length && (g = { li: b.closest("li"), length: d.length }), h.forEach((k) => k.closest("li")?.classList.remove("active")), g.li?.classList.add("active"));
|
|
658
49
|
});
|
|
659
50
|
};
|
|
660
|
-
|
|
51
|
+
u(i), u(f), r.appendChild(i), n.appendChild(f), l.remove();
|
|
661
52
|
}
|
|
662
53
|
});
|
|
663
54
|
}
|
|
@@ -679,20 +70,20 @@ const w = class w extends R {
|
|
|
679
70
|
this.shadowRoot?.querySelectorAll(
|
|
680
71
|
".nys-globalheader__content, .nys-globalheader__content-mobile"
|
|
681
72
|
)?.forEach((t) => {
|
|
682
|
-
t?.addEventListener("click", (
|
|
683
|
-
const
|
|
684
|
-
if (!
|
|
685
|
-
t.querySelectorAll("li.active").forEach((
|
|
686
|
-
const
|
|
687
|
-
|
|
73
|
+
t?.addEventListener("click", (r) => {
|
|
74
|
+
const a = r.target.closest("a");
|
|
75
|
+
if (!a) return;
|
|
76
|
+
t.querySelectorAll("li.active").forEach((i) => i.classList.remove("active"));
|
|
77
|
+
const l = a.closest("li");
|
|
78
|
+
l && l.classList.add("active");
|
|
688
79
|
});
|
|
689
80
|
});
|
|
690
81
|
}
|
|
691
82
|
render() {
|
|
692
|
-
return
|
|
83
|
+
return o`
|
|
693
84
|
<header class="nys-globalheader">
|
|
694
85
|
<div class="nys-globalheader__main-container">
|
|
695
|
-
${this.slotHasContent ?
|
|
86
|
+
${this.slotHasContent ? o` <div class="nys-globalheader__button-container">
|
|
696
87
|
<button
|
|
697
88
|
class="nys-globalheader__mobile-menu-button"
|
|
698
89
|
@click="${this._toggleMobileMenu}"
|
|
@@ -707,37 +98,37 @@ const w = class w extends R {
|
|
|
707
98
|
>
|
|
708
99
|
</button>
|
|
709
100
|
</div>` : ""}
|
|
710
|
-
${this.homepageLink?.trim() ?
|
|
101
|
+
${this.homepageLink?.trim() ? o`<a
|
|
711
102
|
class="nys-globalheader__name-container-link"
|
|
712
103
|
href=${this.homepageLink?.trim()}
|
|
713
104
|
>
|
|
714
105
|
<div class="nys-globalheader__name-container">
|
|
715
|
-
${this.appName?.trim().length > 0 ?
|
|
106
|
+
${this.appName?.trim().length > 0 ? o`<div
|
|
716
107
|
class="nys-globalheader__appName nys-globalheader__name"
|
|
717
108
|
>
|
|
718
109
|
${this.appName}
|
|
719
110
|
</div> ` : ""}
|
|
720
|
-
${this.agencyName?.trim().length > 0 ?
|
|
111
|
+
${this.agencyName?.trim().length > 0 ? o`<div
|
|
721
112
|
class="nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim().length > 0 ? "" : "main"}"
|
|
722
113
|
>
|
|
723
114
|
${this.agencyName}
|
|
724
115
|
</div> ` : ""}
|
|
725
116
|
</div>
|
|
726
|
-
</a>` :
|
|
117
|
+
</a>` : o`
|
|
727
118
|
<div class="nys-globalheader__name-container">
|
|
728
|
-
${this.appName?.trim().length > 0 ?
|
|
119
|
+
${this.appName?.trim().length > 0 ? o`<div
|
|
729
120
|
class="nys-globalheader__appName nys-globalheader__name"
|
|
730
121
|
>
|
|
731
122
|
${this.appName}
|
|
732
123
|
</div> ` : ""}
|
|
733
|
-
${this.agencyName?.trim().length > 0 ?
|
|
124
|
+
${this.agencyName?.trim().length > 0 ? o`<div
|
|
734
125
|
class="nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim().length > 0 ? "" : "main"}"
|
|
735
126
|
>
|
|
736
127
|
${this.agencyName}
|
|
737
128
|
</div> ` : ""}
|
|
738
129
|
</div>
|
|
739
130
|
`}
|
|
740
|
-
${this.slotHasContent ?
|
|
131
|
+
${this.slotHasContent ? o`<div class="nys-globalheader__content">
|
|
741
132
|
<slot
|
|
742
133
|
style="display: hidden"
|
|
743
134
|
@slotchange="${this._handleSlotChange}"
|
|
@@ -751,25 +142,25 @@ const w = class w extends R {
|
|
|
751
142
|
`;
|
|
752
143
|
}
|
|
753
144
|
};
|
|
754
|
-
|
|
755
|
-
let
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
],
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
],
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
],
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
],
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
],
|
|
771
|
-
customElements.get("nys-globalheader") || customElements.define("nys-globalheader",
|
|
145
|
+
m.styles = N(M);
|
|
146
|
+
let s = m;
|
|
147
|
+
c([
|
|
148
|
+
_({ type: String })
|
|
149
|
+
], s.prototype, "appName");
|
|
150
|
+
c([
|
|
151
|
+
_({ type: String })
|
|
152
|
+
], s.prototype, "agencyName");
|
|
153
|
+
c([
|
|
154
|
+
_({ type: String })
|
|
155
|
+
], s.prototype, "homepageLink");
|
|
156
|
+
c([
|
|
157
|
+
v()
|
|
158
|
+
], s.prototype, "slotHasContent");
|
|
159
|
+
c([
|
|
160
|
+
v()
|
|
161
|
+
], s.prototype, "isMobileMenuOpen");
|
|
162
|
+
customElements.get("nys-globalheader") || customElements.define("nys-globalheader", s);
|
|
772
163
|
export {
|
|
773
|
-
|
|
164
|
+
s as NysGlobalHeader
|
|
774
165
|
};
|
|
775
166
|
//# sourceMappingURL=nys-globalheader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nys-globalheader.js","sources":["../../../node_modules/@lit/reactive-element/css-tag.js","../../../node_modules/@lit/reactive-element/reactive-element.js","../../../node_modules/@lit/reactive-element/decorators/property.js","../../../node_modules/@lit/reactive-element/decorators/state.js","../src/nys-globalheader.styles.ts","../src/nys-globalheader.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[o+1]),t[0]);return new n(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement(\"style\"),n=t.litNonce;void 0!==n&&o.setAttribute(\"nonce\",n),o.textContent=e.cssText,s.appendChild(o)}},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{n as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as s}from\"./css-tag.js\";export{CSSResult,css,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:\"\",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol(\"metadata\"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d(\"elementProperties\")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d(\"properties\"))){const t=this.properties,s=[...r(t),...o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(t(s))}else void 0!==s&&i.push(t(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:\"open\"},y[d(\"elementProperties\")]=new Map,y[d(\"finalized\")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push(\"2.1.1\");export{y as ReactiveElement,s as adoptStyles,u as defaultConverter,t as getCompatibleStyle,f as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","import{defaultConverter as t,notEqual as e}from\"../reactive-element.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o={attribute:!0,type:String,converter:t,reflect:!1,hasChanged:e},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),\"setter\"===n&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),\"accessor\"===n){const{name:o}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if(\"setter\"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t)}}throw Error(\"Unsupported decorator location: \"+n)};function n(t){return(e,o)=>\"object\"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}export{n as property,r as standardProperty};\n//# sourceMappingURL=property.js.map\n","import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n","import { css } from \"lit\";\n\nexport default css`\n :host {\n /* Global Header Styles */\n --_nys-globalheader-color: var(\n --nys-color-text-reverse,\n var(--nys-color-white, #ffffff)\n );\n --_nys-globalheader-link-color: var(\n --nys-color-link-reverse-neutral,\n var(--nys-color-white, #fff)\n );\n --_nys-globalheader-background-color: var(\n --nys-color-theme,\n var(--nys-color-state-blue-700, #154973)\n );\n --_nys-globalheader-gap: var(--nys-space-300, 24px);\n --_nys-globalheader-padding: var(--nys-space-250, 20px);\n --_nys-globalheader-font-family--menu: var(\n --nys-font-family-ui,\n var(\n --nys-font-family-sans,\n \"Proxima Nova\",\n \"Helvetica Neue\",\n \"Helvetica\",\n \"Arial\",\n sans-serif\n )\n );\n --_nys-globalheader-line-height: normal;\n --_nys-globalheader-letter-spacing: normal;\n --_nys-globalheader-font-weight: var(--nys-font-weight-semibold, 600);\n --_nys-globalheader-max-width: var(--nys-max-content-width, 1280px);\n\n /* Agency and App Name Styling */\n --_nys-globalheader-gap--text: var(--nys-space-100, 8px);\n --_nys-globalheader-font-size--heading: var(\n --nys-font-size-agency-xl,\n var(--nys-font-size-2xl, 22px)\n );\n --_nys-globalheader-font-size--subheading: var(\n --nys-font-size-agency-md,\n var(--nys-font-size-md, 16px)\n );\n --_nys-globalheader-font-family--headings: var(\n --nys-font-family-agency,\n \"D Sari\",\n Arial,\n sans-serif\n );\n\n /* Menu Content Styling */\n --_nys-globalheader-line-height--menu: var(\n --nys-font-lineheight-ui-md,\n 24px\n );\n --_nys-globalheader-letter-spacing--menu: var(\n --nys-font-letterspacing-ui-md,\n var(--nys-font-letterspacing-400, 0.044px)\n );\n --_nys-globalheader-text-decoration-thickness--menu: var(\n --nys-size-2px,\n 2px\n );\n --_nys-globalheader-link-padding: var(--nys-space-300, 24px)\n var(--nys-space-200, 16px);\n\n /* Mobile Menu */\n --_nys-globalheader-font-size--menu-btn: var(--nys-type-size-ui-xs, 12px);\n --_nys-globalheader-line-height--menu-btn: var(\n --nys-font-lineheight-ui-xs,\n 20px\n );\n --_nys-globalheader-letter-spacing--menu-btn: var(\n --nys-font-letterspacing-ui-xs,\n 0.057px\n );\n --_nys-globalheader-border-color--menu: var(--nys-color-theme-mid, #457aa5);\n --_nys-globalheader-background-color--menu--hover: var(\n --nys-color-theme-strong,\n #0e324f\n );\n --_nys-globalheader-background-color--menu--active: var(\n --nys-color-theme-stronger,\n #081b2b\n );\n }\n\n /* Slotted content (menu links) basic resets */\n ul {\n list-style-type: none;\n padding: 0;\n margin: 0;\n }\n\n li {\n display: block;\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n a {\n color: var(--_nys-globalheader-color);\n text-decoration: none;\n font-family: var(--_nys-globalheader-font-family--menu);\n font-style: normal;\n font-weight: 400;\n line-height: var(--_nys-globalheader-line-height--menu);\n letter-spacing: var(--_nys-globalheader-letter-spacing--menu);\n }\n\n .nys-globalheader {\n display: flex;\n justify-content: center;\n padding: var(--_nys-globalheader-padding);\n background-color: var(--_nys-globalheader-background-color);\n color: var(--_nys-globalheader-color);\n width: 100%;\n min-height: 76px;\n box-sizing: border-box;\n }\n\n /* Main container */\n .nys-globalheader__main-container {\n display: flex;\n gap: var(--_nys-globalheader-gap);\n max-width: var(--_nys-globalheader-max-width);\n width: 100%;\n }\n\n /* Left-hand side Agency and App names */\n .nys-globalheader__name-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: var(--_nys-globalheader-gap--text);\n }\n .nys-globalheader__name {\n margin: 0;\n color: var(--_nys-globalheader-color);\n font-family: var(--_nys-globalheader-font-family--headings);\n font-size: var(--_nys-globalheader-font-size--heading);\n font-style: normal;\n font-weight: var(--_nys-globalheader-font-weight);\n line-height: var(--_nys-globalheader-line-height);\n letter-spacing: var(--_nys-globalheader-letter-spacing);\n overflow-wrap: break-word; /* note: we use this bc text-wrap: wrap; is not a standard CSS property (yet). */\n }\n\n .nys-globalheader__agencyName {\n font-size: var(--_nys-globalheader-font-size--subheading);\n }\n\n /* Set the font size for the agency to be the main font if appName is not defined */\n .nys-globalheader__agencyName.main {\n font-size: var(--_nys-globalheader-font-size--heading);\n }\n\n /* Slotted content */\n .nys-globalheader__content {\n display: none;\n font-family: var(--_nys-globalheader-font-family--menu);\n }\n\n .nys-globalheader__content ul {\n display: flex;\n flex-direction: column;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .nys-globalheader__content ul a:hover {\n text-decoration: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: auto;\n text-decoration-thickness: 7%;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .nys-globalheader__content ul a:active {\n text-decoration-thickness: var(\n --_nys-globalheader-text-decoration-thickness--menu\n );\n }\n\n /* Active Links */\n .nys-globalheader__content li.active a,\n .nys-globalheader__content-mobile li.active a {\n font-weight: 700;\n }\n .nys-globalheader__content li.active {\n border-bottom: 8px solid var(--nys-color-theme-weak, #cddde9);\n }\n .nys-globalheader__content li.active a {\n margin-bottom: calc(-1 * var(--nys-space-100, 8px));\n }\n .nys-globalheader__content-mobile li.active a {\n border-left: 8px solid var(--nys-color-theme-weak, #cddde9);\n border-bottom: 1px solid var(--_nys-globalheader-border-color--menu);\n }\n .nys-globalheader__content ul li.active a:hover {\n text-decoration: none;\n }\n\n /* Mobile Menu */\n .nys-globalheader__content-mobile {\n position: absolute;\n z-index: 10;\n display: flex;\n flex-direction: column;\n justify-content: center;\n background-color: var(--_nys-globalheader-background-color);\n width: fit-content;\n }\n .nys-globalheader__content-mobile.close {\n display: none;\n }\n .nys-globalheader__content-mobile ul {\n display: flex;\n flex-direction: column;\n }\n .nys-globalheader__content-mobile ul li:first-child a {\n border-top: 1px solid var(--_nys-globalheader-color);\n }\n .nys-globalheader__content-mobile ul li a {\n display: flex;\n padding: 24px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n border-bottom: 1px solid var(--_nys-globalheader-border-color--menu);\n background-color: var(--_nys-globalheader-background-color);\n }\n .nys-globalheader__content-mobile ul li a:hover {\n background-color: var(--_nys-globalheader-background-color--menu--hover);\n }\n .nys-globalheader__content-mobile ul li a:active {\n background-color: var(--_nys-globalheader-background-color--menu--active);\n }\n .nys-globalheader__name-container-link {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n /* Mobile Menu (OPEN/CLOSE Button Container) */\n .nys-globalheader__button-container {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .nys-globalheader__mobile-menu-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 3px;\n width: 50px;\n height: 50px;\n background-color: var(--_nys-globalheader-background-color);\n border: none;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0;\n color: var(--_nys-globalheader-color);\n }\n .nys-globalheader__mobile-menu-button-text {\n font-size: var(--_nys-globalheader-font-size--menu-btn);\n line-height: var(--_nys-globalheader-line-height--menu-btn);\n letter-spacing: var(--_nys-globalheader-letter-spacing--menu-btn);\n }\n\n /* Breakpoints using NYSDS Guidelines (Menu Links) */\n /* https://www.figma.com/design/U2QpuSUXRTxbgG64Fzi9bu?node-id=1170-340 */\n @media (min-width: 1024px) {\n /* Desktop (MD - Above 1024px) */\n .nys-globalheader__content {\n display: flex;\n }\n .nys-globalheader__content ul {\n flex-direction: row;\n }\n .nys-globalheader__content-mobile,\n .nys-globalheader__button-container {\n display: none;\n }\n li {\n display: flex;\n align-items: center;\n padding: var(--_nys-globalheader-link-padding);\n }\n :host {\n --_nys-globalheader-gap: var(--nys-space-500, 40px);\n --_nys-globalheader-padding: var(--nys-space-50, 4px)\n var(--nys-size-400, 32px) 0;\n }\n }\n\n @media (min-width: 1280px) {\n /* Large Desktop (LG - Above 1280px) */\n :host {\n --_nys-globalheader-padding: var(--nys-space-50, 4px)\n var(--nys-space-800, 64px) 0;\n }\n }\n`;\n","import { LitElement, html } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport styles from \"./nys-globalheader.styles\";\n\nexport class NysGlobalHeader extends LitElement {\n static styles = styles;\n\n /********************** Properties **********************/\n @property({ type: String }) appName = \"\";\n @property({ type: String }) agencyName = \"\";\n @property({ type: String }) homepageLink = \"\";\n @state() private slotHasContent = true;\n @state() private isMobileMenuOpen = false;\n\n /**************** Lifecycle Methods ****************/\n\n firstUpdated() {\n // Check for slot content after rendering\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>(\"slot\");\n slot?.addEventListener(\"slotchange\", () => this._handleSlotChange());\n this._handleSlotChange(); // run once at startup\n\n this._listenLinkClicks();\n }\n\n /******************** Functions ********************/\n // Gets called when the slot content changes and directly appends the slotted elements into the shadow DOM\n private async _handleSlotChange() {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>(\"slot\");\n if (!slot) return;\n\n const assignedNodes = slot\n ?.assignedNodes({ flatten: true })\n .filter((node) => node.nodeType === Node.ELEMENT_NODE) as Element[]; // Filter to elements only\n\n await Promise.resolve(); // Wait for current update cycle to complete before modifying reactive state (solves the lit issue \"scheduled an update\")\n\n // Update slotHasContent for styling content\n this.slotHasContent = assignedNodes.length > 0;\n\n // Get the container to append the slotted elements\n const container = this.shadowRoot?.querySelector(\n \".nys-globalheader__content\",\n );\n const containerMobile = this.shadowRoot?.querySelector(\n \".nys-globalheader__content-mobile\",\n );\n\n if (container && containerMobile) {\n // Clear existing children in the container\n container.innerHTML = \"\";\n containerMobile.innerHTML = \"\";\n\n const currentUrl = this._normalizePath(\n window.location.pathname + window.location.hash,\n );\n\n // Clone and append slotted elements into the shadow DOM container\n assignedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const cleanNode = node.cloneNode(true) as HTMLElement;\n const cleanNodeMobile = node.cloneNode(true) as HTMLElement;\n\n // Remove <script>, <iframe>, <object>, and any potentially dangerous elements XSS\n const dangerousTags = [\"script\", \"iframe\", \"object\", \"embed, img\"];\n dangerousTags.forEach((tag) => {\n (cleanNode as Element)\n .querySelectorAll(tag)\n .forEach((element) => element.remove());\n });\n\n /**\n * Get all user slotted ahref links and for each link, determine the best matching link via the pattern of\n * prioritize the link with the longest match.\n * @param node\n */\n const highlightActiveLink = (node: HTMLElement) => {\n const links = Array.from(node.querySelectorAll(\"a\"));\n\n // Because we can only have one active link at all times, we\n let bestMatch: { li: HTMLElement | null; length: number } = {\n li: null,\n length: 0,\n };\n\n links.forEach((a) => {\n const hrefAttr = a.getAttribute(\"href\");\n const linkPath = this._normalizePath(hrefAttr);\n\n if (!linkPath) return;\n\n // Exact homepage match\n if (linkPath === \"/\" && currentUrl === \"/\") {\n bestMatch = { li: a.closest(\"li\"), length: 1 };\n } else if (\n currentUrl?.startsWith(linkPath) &&\n linkPath.length > bestMatch.length\n ) {\n bestMatch = { li: a.closest(\"li\"), length: linkPath.length };\n }\n\n // Clear old actives\n links.forEach((a) => a.closest(\"li\")?.classList.remove(\"active\"));\n\n // Set the best matched link to active\n bestMatch.li?.classList.add(\"active\");\n });\n };\n\n highlightActiveLink(cleanNode);\n highlightActiveLink(cleanNodeMobile);\n\n container.appendChild(cleanNode);\n containerMobile.appendChild(cleanNodeMobile);\n node.remove(); // Remove from light DOM to avoid duplication\n }\n });\n }\n }\n\n // Normalize paths so that links like \"name\", \"/name/\", and \"/\" match window.location.pathname.\n // This ensures consistent active-link behavior regardless of how hrefs are written.\n private _normalizePath(path: string | null) {\n if (!path) return;\n\n // Checks path always starts with \"/\"\n if (!path.startsWith(\"/\")) {\n path = \"/\" + path;\n }\n\n // Strip trailing slash except for root \"/\"\n if (path.length > 1 && path.endsWith(\"/\")) {\n path = path.slice(0, -1);\n }\n\n return path.toLowerCase();\n }\n\n private _toggleMobileMenu() {\n this.isMobileMenuOpen = !this.isMobileMenuOpen;\n }\n\n /**\n * Handles client-side navigation when links are clicked (no full page refresh).\n */\n // Ensures only the clicked link's <li> is marked active in both desktop and mobile menus.\n private _listenLinkClicks() {\n const containers = this.shadowRoot?.querySelectorAll(\n \".nys-globalheader__content, .nys-globalheader__content-mobile\",\n );\n\n containers?.forEach((container) => {\n container?.addEventListener(\"click\", (event) => {\n const target = event.target as HTMLElement;\n const a = target.closest(\"a\");\n\n if (!a) return;\n\n // Clear all existing active <li>\n container\n .querySelectorAll(\"li.active\")\n .forEach((li) => li.classList.remove(\"active\"));\n\n // Set active on the clicked link's <li>\n const li = a.closest(\"li\");\n if (li) li.classList.add(\"active\");\n });\n });\n }\n\n render() {\n return html`\n <header class=\"nys-globalheader\">\n <div class=\"nys-globalheader__main-container\">\n ${this.slotHasContent\n ? html` <div class=\"nys-globalheader__button-container\">\n <button\n class=\"nys-globalheader__mobile-menu-button\"\n @click=\"${this._toggleMobileMenu}\"\n >\n <nys-icon\n name=\"${this.isMobileMenuOpen ? \"close\" : \"menu\"}\"\n size=\"32\"\n label=\"${this.isMobileMenuOpen ? \"close\" : \"menu\"} icon\"\n ></nys-icon>\n <span class=\"nys-globalheader__mobile-menu-button-text\"\n >${this.isMobileMenuOpen ? \"CLOSE\" : \"MENU\"}</span\n >\n </button>\n </div>`\n : \"\"}\n ${!this.homepageLink?.trim()\n ? html`\n <div class=\"nys-globalheader__name-container\">\n ${this.appName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__appName nys-globalheader__name\"\n >\n ${this.appName}\n </div> `\n : \"\"}\n ${this.agencyName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim()\n .length > 0\n ? \"\"\n : \"main\"}\"\n >\n ${this.agencyName}\n </div> `\n : \"\"}\n </div>\n `\n : html`<a\n class=\"nys-globalheader__name-container-link\"\n href=${this.homepageLink?.trim()}\n >\n <div class=\"nys-globalheader__name-container\">\n ${this.appName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__appName nys-globalheader__name\"\n >\n ${this.appName}\n </div> `\n : \"\"}\n ${this.agencyName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim()\n .length > 0\n ? \"\"\n : \"main\"}\"\n >\n ${this.agencyName}\n </div> `\n : \"\"}\n </div>\n </a>`}\n ${this.slotHasContent\n ? html`<div class=\"nys-globalheader__content\">\n <slot\n style=\"display: hidden\"\n @slotchange=\"${this._handleSlotChange}\"\n ></slot>\n </div>`\n : \"\"}\n </div>\n </header>\n <div\n class=\"nys-globalheader__content-mobile ${this.isMobileMenuOpen\n ? \"\"\n : \"close\"}\"\n ></div>\n `;\n }\n}\n\nif (!customElements.get(\"nys-globalheader\")) {\n customElements.define(\"nys-globalheader\", NysGlobalHeader);\n}\n"],"names":["t","e","s","o","n$2","r","n","S","c","i","h","a","l","p","d","u","f","b","y","styles","css","_NysGlobalHeader","LitElement","slot","assignedNodes","node","container","containerMobile","currentUrl","cleanNode","cleanNodeMobile","tag","element","highlightActiveLink","links","bestMatch","hrefAttr","linkPath","path","event","li","html","NysGlobalHeader","__decorateClass","property","state"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,M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AK,SAAS,KAAA,EAAO,SAAS,IAC5BA;AAAA;AAAA;AAAA,0BAGI,KAAK,OAAO;AAAA,iCAEhB,EAAE;AAAA,oBACJ,KAAK,YAAY,KAAA,EAAO,SAAS,IAC/BA;AAAA,qFAC+D,KAAK,SAAS,KAAA,EACxE,SAAS,IACR,KACA,MAAM;AAAA;AAAA,0BAER,KAAK,UAAU;AAAA,iCAEnB,EAAE;AAAA;AAAA,eA0BL;AAAA,YACP,KAAK,iBACHA;AAAA;AAAA;AAAA,iCAGmB,KAAK,iBAAiB;AAAA;AAAA,wBAGzC,EAAE;AAAA;AAAA;AAAA;AAAA,kDAIkC,KAAK,mBAC3C,KACA,OAAO;AAAA;AAAA;AAAA,EAGjB;AACF;AAzPEpB,EAAO,SAASF;AADX,IAAMuB,IAANrB;AAIuBsB,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAJfF,EAIiB,WAAA,SAAA;AACAC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GALfF,EAKiB,WAAA,YAAA;AACAC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GANfF,EAMiB,WAAA,cAAA;AACXC,EAAA;AAAA,EAAhBE,EAAA;AAAM,GAPIH,EAOM,WAAA,gBAAA;AACAC,EAAA;AAAA,EAAhBE,EAAA;AAAM,GARIH,EAQM,WAAA,kBAAA;AAoPd,eAAe,IAAI,kBAAkB,KACxC,eAAe,OAAO,oBAAoBA,CAAe;","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"nys-globalheader.js","sources":["../src/nys-globalheader.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-globalheader.scss?inline\";\n\nexport class NysGlobalHeader extends LitElement {\n static styles = unsafeCSS(styles);\n\n /********************** Properties **********************/\n @property({ type: String }) appName = \"\";\n @property({ type: String }) agencyName = \"\";\n @property({ type: String }) homepageLink = \"\";\n @state() private slotHasContent = true;\n @state() private isMobileMenuOpen = false;\n\n /**************** Lifecycle Methods ****************/\n\n firstUpdated() {\n // Check for slot content after rendering\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>(\"slot\");\n slot?.addEventListener(\"slotchange\", () => this._handleSlotChange());\n this._handleSlotChange(); // run once at startup\n\n this._listenLinkClicks();\n }\n\n /******************** Functions ********************/\n // Gets called when the slot content changes and directly appends the slotted elements into the shadow DOM\n private async _handleSlotChange() {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>(\"slot\");\n if (!slot) return;\n\n const assignedNodes = slot\n ?.assignedNodes({ flatten: true })\n .filter((node) => node.nodeType === Node.ELEMENT_NODE) as Element[]; // Filter to elements only\n\n await Promise.resolve(); // Wait for current update cycle to complete before modifying reactive state (solves the lit issue \"scheduled an update\")\n\n // Update slotHasContent for styling content\n this.slotHasContent = assignedNodes.length > 0;\n\n // Get the container to append the slotted elements\n const container = this.shadowRoot?.querySelector(\n \".nys-globalheader__content\",\n );\n const containerMobile = this.shadowRoot?.querySelector(\n \".nys-globalheader__content-mobile\",\n );\n\n if (container && containerMobile) {\n // Clear existing children in the container\n container.innerHTML = \"\";\n containerMobile.innerHTML = \"\";\n\n const currentUrl = this._normalizePath(\n window.location.pathname + window.location.hash,\n );\n\n // Clone and append slotted elements into the shadow DOM container\n assignedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const cleanNode = node.cloneNode(true) as HTMLElement;\n const cleanNodeMobile = node.cloneNode(true) as HTMLElement;\n\n // Remove <script>, <iframe>, <object>, and any potentially dangerous elements XSS\n const dangerousTags = [\"script\", \"iframe\", \"object\", \"embed, img\"];\n dangerousTags.forEach((tag) => {\n (cleanNode as Element)\n .querySelectorAll(tag)\n .forEach((element) => element.remove());\n });\n\n /**\n * Get all user slotted ahref links and for each link, determine the best matching link via the pattern of\n * prioritize the link with the longest match.\n * @param node\n */\n const highlightActiveLink = (node: HTMLElement) => {\n const links = Array.from(node.querySelectorAll(\"a\"));\n\n // Because we can only have one active link at all times, we\n let bestMatch: { li: HTMLElement | null; length: number } = {\n li: null,\n length: 0,\n };\n\n links.forEach((a) => {\n const hrefAttr = a.getAttribute(\"href\");\n const linkPath = this._normalizePath(hrefAttr);\n\n if (!linkPath) return;\n\n // Exact homepage match\n if (linkPath === \"/\" && currentUrl === \"/\") {\n bestMatch = { li: a.closest(\"li\"), length: 1 };\n } else if (\n currentUrl?.startsWith(linkPath) &&\n linkPath.length > bestMatch.length\n ) {\n bestMatch = { li: a.closest(\"li\"), length: linkPath.length };\n }\n\n // Clear old actives\n links.forEach((a) => a.closest(\"li\")?.classList.remove(\"active\"));\n\n // Set the best matched link to active\n bestMatch.li?.classList.add(\"active\");\n });\n };\n\n highlightActiveLink(cleanNode);\n highlightActiveLink(cleanNodeMobile);\n\n container.appendChild(cleanNode);\n containerMobile.appendChild(cleanNodeMobile);\n node.remove(); // Remove from light DOM to avoid duplication\n }\n });\n }\n }\n\n // Normalize paths so that links like \"name\", \"/name/\", and \"/\" match window.location.pathname.\n // This ensures consistent active-link behavior regardless of how hrefs are written.\n private _normalizePath(path: string | null) {\n if (!path) return;\n\n // Checks path always starts with \"/\"\n if (!path.startsWith(\"/\")) {\n path = \"/\" + path;\n }\n\n // Strip trailing slash except for root \"/\"\n if (path.length > 1 && path.endsWith(\"/\")) {\n path = path.slice(0, -1);\n }\n\n return path.toLowerCase();\n }\n\n private _toggleMobileMenu() {\n this.isMobileMenuOpen = !this.isMobileMenuOpen;\n }\n\n /**\n * Handles client-side navigation when links are clicked (no full page refresh).\n */\n // Ensures only the clicked link's <li> is marked active in both desktop and mobile menus.\n private _listenLinkClicks() {\n const containers = this.shadowRoot?.querySelectorAll(\n \".nys-globalheader__content, .nys-globalheader__content-mobile\",\n );\n\n containers?.forEach((container) => {\n container?.addEventListener(\"click\", (event) => {\n const target = event.target as HTMLElement;\n const a = target.closest(\"a\");\n\n if (!a) return;\n\n // Clear all existing active <li>\n container\n .querySelectorAll(\"li.active\")\n .forEach((li) => li.classList.remove(\"active\"));\n\n // Set active on the clicked link's <li>\n const li = a.closest(\"li\");\n if (li) li.classList.add(\"active\");\n });\n });\n }\n\n render() {\n return html`\n <header class=\"nys-globalheader\">\n <div class=\"nys-globalheader__main-container\">\n ${this.slotHasContent\n ? html` <div class=\"nys-globalheader__button-container\">\n <button\n class=\"nys-globalheader__mobile-menu-button\"\n @click=\"${this._toggleMobileMenu}\"\n >\n <nys-icon\n name=\"${this.isMobileMenuOpen ? \"close\" : \"menu\"}\"\n size=\"32\"\n label=\"${this.isMobileMenuOpen ? \"close\" : \"menu\"} icon\"\n ></nys-icon>\n <span class=\"nys-globalheader__mobile-menu-button-text\"\n >${this.isMobileMenuOpen ? \"CLOSE\" : \"MENU\"}</span\n >\n </button>\n </div>`\n : \"\"}\n ${!this.homepageLink?.trim()\n ? html`\n <div class=\"nys-globalheader__name-container\">\n ${this.appName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__appName nys-globalheader__name\"\n >\n ${this.appName}\n </div> `\n : \"\"}\n ${this.agencyName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim()\n .length > 0\n ? \"\"\n : \"main\"}\"\n >\n ${this.agencyName}\n </div> `\n : \"\"}\n </div>\n `\n : html`<a\n class=\"nys-globalheader__name-container-link\"\n href=${this.homepageLink?.trim()}\n >\n <div class=\"nys-globalheader__name-container\">\n ${this.appName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__appName nys-globalheader__name\"\n >\n ${this.appName}\n </div> `\n : \"\"}\n ${this.agencyName?.trim().length > 0\n ? html`<div\n class=\"nys-globalheader__agencyName nys-globalheader__name ${this.appName?.trim()\n .length > 0\n ? \"\"\n : \"main\"}\"\n >\n ${this.agencyName}\n </div> `\n : \"\"}\n </div>\n </a>`}\n ${this.slotHasContent\n ? html`<div class=\"nys-globalheader__content\">\n <slot\n style=\"display: hidden\"\n @slotchange=\"${this._handleSlotChange}\"\n ></slot>\n </div>`\n : \"\"}\n </div>\n </header>\n <div\n class=\"nys-globalheader__content-mobile ${this.isMobileMenuOpen\n ? \"\"\n : \"close\"}\"\n ></div>\n `;\n }\n}\n\nif (!customElements.get(\"nys-globalheader\")) {\n customElements.define(\"nys-globalheader\", NysGlobalHeader);\n}\n"],"names":["_NysGlobalHeader","LitElement","slot","assignedNodes","node","container","containerMobile","currentUrl","cleanNode","cleanNodeMobile","tag","element","highlightActiveLink","links","bestMatch","a","hrefAttr","linkPath","path","event","li","html","unsafeCSS","styles","NysGlobalHeader","__decorateClass","property","state"],"mappings":";;;;;;;;AAKO,MAAMA,IAAN,MAAMA,UAAwBC,EAAW;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA,GAIuB,KAAA,UAAU,IACV,KAAA,aAAa,IACb,KAAA,eAAe,IAClC,KAAQ,iBAAiB,IACzB,KAAQ,mBAAmB;AAAA,EAAA;AAAA;AAAA,EAIpC,eAAe;AAGb,IADa,KAAK,YAAY,cAA+B,MAAM,GAC7D,iBAAiB,cAAc,MAAM,KAAK,mBAAmB,GACnE,KAAK,kBAAA,GAEL,KAAK,kBAAA;AAAA,EACP;AAAA;AAAA;AAAA,EAIA,MAAc,oBAAoB;AAChC,UAAMC,IAAO,KAAK,YAAY,cAA+B,MAAM;AACnE,QAAI,CAACA,EAAM;AAEX,UAAMC,IAAgBD,GAClB,cAAc,EAAE,SAAS,GAAA,CAAM,EAChC,OAAO,CAACE,MAASA,EAAK,aAAa,KAAK,YAAY;AAEvD,UAAM,QAAQ,QAAA,GAGd,KAAK,iBAAiBD,EAAc,SAAS;AAG7C,UAAME,IAAY,KAAK,YAAY;AAAA,MACjC;AAAA,IAAA,GAEIC,IAAkB,KAAK,YAAY;AAAA,MACvC;AAAA,IAAA;AAGF,QAAID,KAAaC,GAAiB;AAEhC,MAAAD,EAAU,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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/nys-globalheader",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.4",
|
|
4
4
|
"description": "The Globalheader component from the NYS Design System.",
|
|
5
5
|
"module": "dist/nys-globalheader.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"lit-analyze": "lit-analyzer '**/*.ts'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nysds/nys-icon": "^1.11.
|
|
26
|
+
"@nysds/nys-icon": "^1.11.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"lit": "^3.
|
|
30
|
-
"typescript": "^5.
|
|
31
|
-
"vite": "^7.1.
|
|
29
|
+
"lit": "^3.3.1",
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"vite": "^7.1.12"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
|
34
34
|
"new-york-state",
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./nys-globalheader";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
export declare class NysGlobalHeader extends LitElement {
|
|
3
|
-
static styles: import("lit").CSSResult;
|
|
4
|
-
/********************** Properties **********************/
|
|
5
|
-
appName: string;
|
|
6
|
-
agencyName: string;
|
|
7
|
-
homepageLink: string;
|
|
8
|
-
private slotHasContent;
|
|
9
|
-
private isMobileMenuOpen;
|
|
10
|
-
/**************** Lifecycle Methods ****************/
|
|
11
|
-
firstUpdated(): void;
|
|
12
|
-
/******************** Functions ********************/
|
|
13
|
-
private _handleSlotChange;
|
|
14
|
-
private _normalizePath;
|
|
15
|
-
private _toggleMobileMenu;
|
|
16
|
-
/**
|
|
17
|
-
* Handles client-side navigation when links are clicked (no full page refresh).
|
|
18
|
-
*/
|
|
19
|
-
private _listenLinkClicks;
|
|
20
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|