@uvalib/web-components 1.8.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +486 -60
- package/dist/base/clipboard.d.ts +9 -0
- package/dist/base/clipboard.js +30 -0
- package/dist/base/clipboard.js.map +1 -0
- package/dist/base.css +188 -3
- package/dist/components/site-page/SitePage.js +2 -1
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/site-style/SiteStyle.js +2 -1
- package/dist/components/site-style/SiteStyle.js.map +1 -1
- package/dist/components/uvalib-citation/UvalibCitation.d.ts +124 -0
- package/dist/components/uvalib-citation/UvalibCitation.js +545 -0
- package/dist/components/uvalib-citation/UvalibCitation.js.map +1 -0
- package/dist/components/uvalib-citation/uvalib-citation.d.ts +1 -0
- package/dist/components/uvalib-citation/uvalib-citation.js +4 -0
- package/dist/components/uvalib-citation/uvalib-citation.js.map +1 -0
- package/dist/components/uvalib-dialog/UvalibDialog.d.ts +167 -0
- package/dist/components/uvalib-dialog/UvalibDialog.js +688 -0
- package/dist/components/uvalib-dialog/UvalibDialog.js.map +1 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.d.ts +1 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.js +4 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.js.map +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +92 -9
- package/dist/components/uvalib-filter/UvalibFilter.js +748 -60
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -1
- package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -4
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/custom-elements.json +5881 -3592
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/base.js +41 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +4 -0
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.js +4 -0
- package/dist/styles/controls.js.map +1 -1
- package/dist/styles/field-text.d.ts +1 -0
- package/dist/styles/field-text.js +21 -0
- package/dist/styles/field-text.js.map +1 -0
- package/dist/styles/font-fallback.d.ts +7 -0
- package/dist/styles/font-fallback.js +15 -0
- package/dist/styles/font-fallback.js.map +1 -1
- package/dist/styles/hidden.js +13 -1
- package/dist/styles/hidden.js.map +1 -1
- package/dist/styles/table.d.ts +1 -0
- package/dist/styles/table.js +164 -0
- package/dist/styles/table.js.map +1 -0
- package/dist/tokens.css +4 -0
- package/dist-cdn/base.css +188 -3
- package/dist-cdn/chunks/{base-DfLI8lpa.js → base-CHMHBPeI.js} +58 -7
- package/dist-cdn/chunks/base-CHMHBPeI.js.map +1 -0
- package/dist-cdn/chunks/clipboard-CNG7Y_5X.js +18 -0
- package/dist-cdn/chunks/clipboard-CNG7Y_5X.js.map +1 -0
- package/dist-cdn/chunks/if-defined-COiQb-gl.js +6 -0
- package/dist-cdn/chunks/if-defined-COiQb-gl.js.map +1 -0
- package/dist-cdn/chunks/{site-header-CEmNtmk5.js → site-header-B78a_ldi.js} +27 -22
- package/dist-cdn/chunks/site-header-B78a_ldi.js.map +1 -0
- package/dist-cdn/chunks/{site-main-nav-CAwKq_x5.js → site-main-nav-CmMq2t8t.js} +52 -51
- package/dist-cdn/chunks/site-main-nav-CmMq2t8t.js.map +1 -0
- package/dist-cdn/custom-elements.json +5881 -3592
- package/dist-cdn/manifest.json +4 -2
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +48 -48
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +7 -7
- package/dist-cdn/site-style.js.map +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +8 -5
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +135 -8
- package/dist-cdn/tokens.css +4 -0
- package/dist-cdn/uvalib-citation.js +382 -0
- package/dist-cdn/uvalib-citation.js.map +1 -0
- package/dist-cdn/uvalib-dialog.js +419 -0
- package/dist-cdn/uvalib-dialog.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +603 -69
- package/dist-cdn/uvalib-filter.js.map +1 -1
- package/dist-cdn/uvalib-metadata.js +49 -49
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/package.json +9 -1
- package/skills/uvalib-web-components/SKILL.md +8 -5
- package/skills/uvalib-web-components/reference/components.md +135 -8
- package/dist-cdn/chunks/base-DfLI8lpa.js.map +0 -1
- package/dist-cdn/chunks/site-header-CEmNtmk5.js.map +0 -1
- package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +0 -1
package/dist-cdn/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.9.0",
|
|
3
3
|
"elements": {
|
|
4
4
|
"site-page": "site-page.js",
|
|
5
5
|
"site-header": "site-header.js",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"uvalib-image-regions": "uvalib-image-regions.js",
|
|
35
35
|
"uvalib-map": "uvalib-map.js",
|
|
36
36
|
"uvalib-filter-drawer": "uvalib-filter-drawer.js",
|
|
37
|
-
"uvalib-back-to-top": "uvalib-back-to-top.js"
|
|
37
|
+
"uvalib-back-to-top": "uvalib-back-to-top.js",
|
|
38
|
+
"uvalib-dialog": "uvalib-dialog.js",
|
|
39
|
+
"uvalib-citation": "uvalib-citation.js"
|
|
38
40
|
},
|
|
39
41
|
"styles": [
|
|
40
42
|
"tokens.css",
|
package/dist-cdn/site-header.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./chunks/site-header-
|
|
1
|
+
import "./chunks/site-header-B78a_ldi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./chunks/site-main-nav-
|
|
1
|
+
import "./chunks/site-main-nav-CmMq2t8t.js";
|
package/dist-cdn/site-page.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { a as e, f as t, i as n, l as r, m as i, n as a, o, r as s, t as c } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { a as
|
|
7
|
-
import { r as
|
|
8
|
-
import { a as
|
|
2
|
+
import { t as l } from "./chunks/if-defined-COiQb-gl.js";
|
|
3
|
+
import { a as u, i as d, n as f, r as p, t as m } from "./chunks/base-CHMHBPeI.js";
|
|
4
|
+
import { t as h } from "./chunks/accessible-DJv7YOtS.js";
|
|
5
|
+
import { t as g } from "./chunks/site-header-B78a_ldi.js";
|
|
6
|
+
import { a as _ } from "./chunks/analytics-DTTihuBD.js";
|
|
7
|
+
import { r as v } from "./chunks/analytics-state-Ce8DKe4F.js";
|
|
8
|
+
import { a as y, i as b, r as x, t as S } from "./chunks/alerts-C5vkeb-f.js";
|
|
9
9
|
// src/components/site-page/SitePage.ts
|
|
10
|
-
var
|
|
10
|
+
var C = "site-alerts", w = "Library alerts", T = (e) => e instanceof Element ? e.getAttribute("slot") : null, E = class extends c {
|
|
11
11
|
constructor(...e) {
|
|
12
|
-
super(...e), this.rootLinkDomain = "https://www.library.virginia.edu", this.headerVariant = "full", this.noGlobalStyles = !1, this.noFooter = !1, this.printChrome = !1, this.noMainNav = !1, this.alertsEnv = "production", this.noAlerts = !1, this.colorSchemeSwitch = !1, this.scheme = new
|
|
13
|
-
this.hasBreadcrumbs = [...this.children].some((e) =>
|
|
12
|
+
super(...e), this.rootLinkDomain = "https://www.library.virginia.edu", this.headerVariant = "full", this.noGlobalStyles = !1, this.noFooter = !1, this.printChrome = !1, this.noMainNav = !1, this.alertsEnv = "production", this.noAlerts = !1, this.colorSchemeSwitch = !1, this.scheme = new g(this, () => this.colorSchemeSwitch, () => this.noStyle, !1), this.chrome = /* @__PURE__ */ new WeakSet(), this.globalsInstalled = !1, this.alertsUrl = S, this.alertsUiRequested = !1, this.listShown = !1, this.hasBreadcrumbs = !1, this.syncHasBreadcrumbs = () => {
|
|
13
|
+
this.hasBreadcrumbs = [...this.children].some((e) => T(e) === "breadcrumbs");
|
|
14
14
|
}, this.syncPrintSource = () => {
|
|
15
15
|
let e = this.renderRoot.querySelector(this.lightDom ? ":scope > main" : "main");
|
|
16
16
|
if (!e) return;
|
|
@@ -22,7 +22,7 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
22
22
|
this.hostColorScheme = !1;
|
|
23
23
|
}
|
|
24
24
|
static {
|
|
25
|
-
this.styles = [
|
|
25
|
+
this.styles = [h, t`
|
|
26
26
|
:host {
|
|
27
27
|
display: block;
|
|
28
28
|
}
|
|
@@ -131,20 +131,20 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
131
131
|
super.disconnectedCallback(), this.observer?.disconnect(), this.breadcrumbsObserver?.disconnect(), this.ownerDocument.defaultView?.removeEventListener("beforeprint", this.syncPrintSource);
|
|
132
132
|
}
|
|
133
133
|
installGlobalStyles(e) {
|
|
134
|
-
if (s("uvalib-tokens", [
|
|
134
|
+
if (s("uvalib-tokens", [p], {
|
|
135
135
|
root: e,
|
|
136
136
|
scope: !1
|
|
137
137
|
}), s("uvalib-global", [
|
|
138
|
-
u,
|
|
139
138
|
d,
|
|
140
|
-
|
|
139
|
+
f,
|
|
140
|
+
h
|
|
141
141
|
], {
|
|
142
142
|
root: e,
|
|
143
143
|
scope: !1,
|
|
144
144
|
layer: !1
|
|
145
|
-
}), !e.head.querySelector("link[href=\"https://use.typekit.net/oym8nvz.css\"]")) {
|
|
145
|
+
}), u(e), !e.head.querySelector("link[href=\"https://use.typekit.net/oym8nvz.css\"]")) {
|
|
146
146
|
let t = e.createElement("link");
|
|
147
|
-
t.rel = "stylesheet", t.href =
|
|
147
|
+
t.rel = "stylesheet", t.href = m, e.head.append(t);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
onListChange(e) {
|
|
@@ -153,21 +153,21 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
153
153
|
this.listShown = typeof t == "number" && t > 0;
|
|
154
154
|
}
|
|
155
155
|
willUpdate(e) {
|
|
156
|
-
e.has("colorSchemeSwitch") && this.scheme.sync(), e.has("noAlerts") && this.noAlerts && (this.listShown = !1), e.has("alertsEnv") && this.alertsEnv && !
|
|
156
|
+
e.has("colorSchemeSwitch") && this.scheme.sync(), e.has("noAlerts") && this.noAlerts && (this.listShown = !1), e.has("alertsEnv") && this.alertsEnv && !b(this.alertsEnv) && console.warn(`${this.localName}: unknown alerts-env "${this.alertsEnv}"; using production. Valid values: production, staging.`);
|
|
157
157
|
try {
|
|
158
|
-
this.alertsUrl =
|
|
158
|
+
this.alertsUrl = x(this.alertsEnv, this.alertsSrc, this.ownerDocument.baseURI);
|
|
159
159
|
} catch {
|
|
160
|
-
e.has("alertsSrc") && console.warn(`${this.localName}: alerts-src "${this.alertsSrc}" is not a URL; ignoring it.`), this.alertsUrl =
|
|
160
|
+
e.has("alertsSrc") && console.warn(`${this.localName}: alerts-src "${this.alertsSrc}" is not a URL; ignoring it.`), this.alertsUrl = x(this.alertsEnv, null, this.ownerDocument.baseURI);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
updated() {
|
|
164
|
-
this.lightDom && this.syncLightAlerts(), this.syncPrintSource(), this.noAlerts || (
|
|
164
|
+
this.lightDom && this.syncLightAlerts(), this.syncPrintSource(), this.noAlerts || (y(this.ownerDocument, this.alertsUrl), this.defineAlerts()), this.syncAnalytics();
|
|
165
165
|
}
|
|
166
166
|
loadAlertsUi() {
|
|
167
167
|
return import("./site-alerts.js");
|
|
168
168
|
}
|
|
169
169
|
defineAlerts() {
|
|
170
|
-
this.alertsUiRequested || customElements.get(
|
|
170
|
+
this.alertsUiRequested || customElements.get(C) || (this.alertsUiRequested = !0, this.loadAlertsUi().catch((e) => console.error(`${this.localName}: failed to load site-alerts`, e)));
|
|
171
171
|
}
|
|
172
172
|
loadAnalytics() {
|
|
173
173
|
return import("./site-analytics.js");
|
|
@@ -182,7 +182,7 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
182
182
|
if (this.ownerDocument.querySelector("site-analytics, uvalib-analytics")) return;
|
|
183
183
|
let e = this.analytics = this.ownerDocument.createElement("site-analytics");
|
|
184
184
|
if (this.chrome.add(e), !customElements.get("site-analytics")) {
|
|
185
|
-
let t =
|
|
185
|
+
let t = v(this.ownerDocument);
|
|
186
186
|
this.loadAnalytics().then(() => customElements.whenDefined("site-analytics")).then(() => e.updateComplete).then(() => t.flush(), (e) => {
|
|
187
187
|
t.drop(), console.error(`${this.localName}: failed to load site-analytics`, e);
|
|
188
188
|
});
|
|
@@ -206,14 +206,14 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
206
206
|
}
|
|
207
207
|
if (!this.lightAlerts) {
|
|
208
208
|
let e = this.ownerDocument, t = (t) => {
|
|
209
|
-
let n = e.createElement(
|
|
209
|
+
let n = e.createElement(C);
|
|
210
210
|
return n.setAttribute("show", t), n.setAttribute("no-shadow-dom", ""), this.chrome.add(n), n;
|
|
211
211
|
}, n = t("header");
|
|
212
212
|
n.slot = "alerts";
|
|
213
213
|
let r = t("list");
|
|
214
214
|
r.addEventListener("site-alerts-change", (e) => this.onListChange(e));
|
|
215
215
|
let i = e.createElement("section");
|
|
216
|
-
i.className = "alerts-list", i.setAttribute("aria-label",
|
|
216
|
+
i.className = "alerts-list", i.setAttribute("aria-label", w), i.append(r), this.chrome.add(i), this.lightAlerts = {
|
|
217
217
|
top: n,
|
|
218
218
|
band: i,
|
|
219
219
|
list: r,
|
|
@@ -250,11 +250,11 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
250
250
|
}
|
|
251
251
|
reslot(e) {
|
|
252
252
|
let t = this.querySelector(":scope > main"), n = this.querySelector(":scope > site-header");
|
|
253
|
-
t && n && !this.chrome.has(e) && (e.parentNode === t &&
|
|
253
|
+
t && n && !this.chrome.has(e) && (e.parentNode === t && T(e) === "breadcrumbs" ? this.placeBreadcrumbs(e, n) : e.parentNode === this && T(e) !== "breadcrumbs" && t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING && t.append(e));
|
|
254
254
|
}
|
|
255
255
|
placeBreadcrumbs(e, t) {
|
|
256
256
|
let n = t;
|
|
257
|
-
for (let t = n.nextSibling; t && (t === this.lightAlerts?.band ||
|
|
257
|
+
for (let t = n.nextSibling; t && (t === this.lightAlerts?.band || T(t) === "breadcrumbs"); t = n.nextSibling) {
|
|
258
258
|
if (t === e) return;
|
|
259
259
|
n = t;
|
|
260
260
|
}
|
|
@@ -264,12 +264,12 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
264
264
|
let t = this.querySelector(":scope > main"), n = this.querySelector(":scope > site-header"), r = this.querySelector(":scope > site-footer");
|
|
265
265
|
if (t && n && r) for (let i of [...e]) {
|
|
266
266
|
if (i.parentNode !== this || this.chrome.has(i) || i.nodeType === Node.TEXT_NODE && !i.textContent?.trim()) continue;
|
|
267
|
-
let e =
|
|
267
|
+
let e = T(i);
|
|
268
268
|
e === "breadcrumbs" ? this.placeBreadcrumbs(i, n) : (e === "pre-footer" ? r : e === "site-links" || e === "main-nav" ? n : t).append(i);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
onSkip(e) {
|
|
272
|
-
e.preventDefault(), this.lightDom &&
|
|
272
|
+
e.preventDefault(), this.lightDom && _(this, ["site-header", "skip-link"]), this.renderRoot.querySelector("main")?.focus();
|
|
273
273
|
}
|
|
274
274
|
render() {
|
|
275
275
|
let e = this.lightDom, t = r`<a
|
|
@@ -285,7 +285,7 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
285
285
|
?no-style=${this.noStyle}
|
|
286
286
|
></site-alerts>`, a = r`<section
|
|
287
287
|
class="alerts-list"
|
|
288
|
-
aria-label=${
|
|
288
|
+
aria-label=${w}
|
|
289
289
|
?hidden=${!this.listShown}
|
|
290
290
|
>
|
|
291
291
|
<site-alerts
|
|
@@ -340,62 +340,62 @@ var S = "site-alerts", C = "Library alerts", w = (e) => e instanceof Element ? e
|
|
|
340
340
|
a([e({
|
|
341
341
|
type: String,
|
|
342
342
|
attribute: "root-link-domain"
|
|
343
|
-
})],
|
|
343
|
+
})], E.prototype, "rootLinkDomain", void 0), a([e({
|
|
344
344
|
type: String,
|
|
345
345
|
attribute: "header-variant"
|
|
346
|
-
})],
|
|
346
|
+
})], E.prototype, "headerVariant", void 0), a([e({
|
|
347
347
|
type: Boolean,
|
|
348
348
|
attribute: "no-global-styles"
|
|
349
|
-
})],
|
|
349
|
+
})], E.prototype, "noGlobalStyles", void 0), a([e({
|
|
350
350
|
type: Boolean,
|
|
351
351
|
attribute: "no-footer",
|
|
352
352
|
reflect: !0
|
|
353
|
-
})],
|
|
353
|
+
})], E.prototype, "noFooter", void 0), a([e({
|
|
354
354
|
type: Boolean,
|
|
355
355
|
attribute: "print-chrome",
|
|
356
356
|
reflect: !0
|
|
357
|
-
})],
|
|
357
|
+
})], E.prototype, "printChrome", void 0), a([e({
|
|
358
358
|
type: String,
|
|
359
359
|
attribute: "site-links-label"
|
|
360
|
-
})],
|
|
360
|
+
})], E.prototype, "siteLinksLabel", void 0), a([e({
|
|
361
361
|
type: String,
|
|
362
362
|
attribute: "site-name"
|
|
363
|
-
})],
|
|
363
|
+
})], E.prototype, "siteName", void 0), a([e({
|
|
364
364
|
type: String,
|
|
365
365
|
attribute: "site-name-href"
|
|
366
|
-
})],
|
|
366
|
+
})], E.prototype, "siteNameHref", void 0), a([e({
|
|
367
367
|
type: Boolean,
|
|
368
368
|
attribute: "no-main-nav"
|
|
369
|
-
})],
|
|
369
|
+
})], E.prototype, "noMainNav", void 0), a([e({
|
|
370
370
|
type: String,
|
|
371
371
|
attribute: "main-nav-label"
|
|
372
|
-
})],
|
|
372
|
+
})], E.prototype, "mainNavLabel", void 0), a([e({
|
|
373
373
|
type: String,
|
|
374
374
|
attribute: "main-nav-src"
|
|
375
|
-
})],
|
|
375
|
+
})], E.prototype, "mainNavSrc", void 0), a([e({
|
|
376
376
|
type: String,
|
|
377
377
|
attribute: "main-nav-current"
|
|
378
|
-
})],
|
|
378
|
+
})], E.prototype, "mainNavCurrent", void 0), a([e({
|
|
379
379
|
type: String,
|
|
380
380
|
attribute: "alerts-env"
|
|
381
|
-
})],
|
|
381
|
+
})], E.prototype, "alertsEnv", void 0), a([e({
|
|
382
382
|
type: String,
|
|
383
383
|
attribute: "alerts-src"
|
|
384
|
-
})],
|
|
384
|
+
})], E.prototype, "alertsSrc", void 0), a([e({
|
|
385
385
|
type: Boolean,
|
|
386
386
|
attribute: "no-alerts"
|
|
387
|
-
})],
|
|
387
|
+
})], E.prototype, "noAlerts", void 0), a([e({
|
|
388
388
|
type: Boolean,
|
|
389
389
|
attribute: "color-scheme-switch"
|
|
390
|
-
})],
|
|
390
|
+
})], E.prototype, "colorSchemeSwitch", void 0), a([e({
|
|
391
391
|
type: Number,
|
|
392
392
|
attribute: "matomo-id"
|
|
393
|
-
})],
|
|
393
|
+
})], E.prototype, "matomoId", void 0), a([e({
|
|
394
394
|
type: String,
|
|
395
395
|
attribute: "matomo-url"
|
|
396
|
-
})],
|
|
396
|
+
})], E.prototype, "matomoUrl", void 0), a([e({
|
|
397
397
|
type: String,
|
|
398
398
|
attribute: "matomo-downloads"
|
|
399
|
-
})],
|
|
399
|
+
})], E.prototype, "matomoDownloads", void 0), a([n()], E.prototype, "listShown", void 0), a([n()], E.prototype, "hasBreadcrumbs", void 0), import("./site-footer.js").catch((e) => console.error("site-page: failed to load site-footer", e)), i("site-page", E);
|
|
400
400
|
|
|
401
401
|
//# sourceMappingURL=site-page.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-page.js","names":["ifDefined","nothing","_decorate","property","state","n","i","r","b","define","__decorate","installLightDomStyles","UvalibElement","o","fontFallback","base","tokens","TYPEKIT_URL","accessible","ColorSchemeController","trackEvent","bufferAnalytics","loadAlerts","isAlertsEnv","alertsBase","ALERTS_PRODUCTION_SRC","ALERTS_UI","ALERTS_LIST_LABEL","slotOf","SitePage","_args","c","main","doc","name","value","link","count","changed","err","id","a","buffer","header","make","show","top","list","band","regional","content","records","el","ref","next","footer","nodes","slot","light","skip","alerts","alert","A"],"sources":["../src/components/site-page/SitePage.ts","../src/components/site-page/site-page.ts"],"sourcesContent":["import { html, css, nothing, type PropertyValues } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, state } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { fontFallback } from '../../styles/font-fallback.js';\nimport { tokens } from '../../styles/tokens.js';\nimport { base, TYPEKIT_URL } from '../../styles/base.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { ColorSchemeController } from '../../base/color-scheme.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { bufferAnalytics } from '../../base/analytics-state.js';\nimport {\n ALERTS_PRODUCTION_SRC,\n alertsBase,\n isAlertsEnv,\n loadAlerts,\n} from '../site-alerts/alerts.js';\n\nexport { ALERTS_PRODUCTION_SRC, ALERTS_STAGING_SRC } from '../site-alerts/alerts.js';\nexport type { AlertsEnv } from '../site-alerts/alerts.js';\n\n/** The `<site-alerts>` elements' `show` values: header banner, alert list, regional alerts. */\ntype AlertShow = 'header' | 'list' | 'regional';\nconst ALERTS_UI = 'site-alerts';\n/** Accessible name of the list band region. */\nconst ALERTS_LIST_LABEL = 'Library alerts';\n\nconst slotOf = (n: Node): string | null => (n instanceof Element ? n.getAttribute('slot') : null);\n\n/**\n * Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles.\n * Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`.\n *\n * The header shows the UVA Library main navigation by default (`no-main-nav` turns it off;\n * `header-variant=\"vendor\"` never shows it).\n *\n * Shows live UVA Library alerts by default with `<site-alerts>` (its code loads only then),\n * placed as Virgo places them: a full-bleed `<site-alerts show=\"header\">` banner at the top\n * of the header landmark (after the skip link), a full-bleed band between the header and\n * `<main>` holding `<site-alerts show=\"list\">` (a `<section aria-label=\"Library alerts\">`\n * region, hidden while the list has nothing to show), and `<site-alerts show=\"regional\">` as\n * the first child of `<main>`, inside its padding. Their data comes from one headless\n * `<uvalib-alerts>`, loaded once per document, with a module script, from the alerts CDN\n * (`alerts-env`, or `alerts-src`); if it fails to load, one console warning is logged and\n * the page works as before. `no-alerts` renders no alert elements and loads nothing.\n *\n * A `slot=\"breadcrumbs\"` child (a `<uvalib-breadcrumbs>`) is placed where library.virginia.edu\n * puts the trail: after the header and the alert list band, before `<main>` and outside it (so\n * the skip link lands past it), with the same gutters as `<main>`.\n *\n * Printing leaves out the chrome: the skip link, header (with the main navigation and the\n * header alert), alert list band, regional alerts, breadcrumbs, pre-footer and footer are not\n * printed, `<main>` loses its gutters, and the content prints black on white (a dark scheme\n * prints light), its links underlined. A short line above the content says where the page\n * came from (\"UVA Library — <site name or page title>\" and the page's URL). `print-chrome`\n * prints the page as it is shown instead. With `no-style` none of this applies.\n *\n * @tagname site-page\n * @slot - Main page content, rendered inside the single `<main>`.\n * @slot breadcrumbs - Optional breadcrumb trail (a `<uvalib-breadcrumbs>`), shown between the header (and alert list band) and `<main>`. In light mode it is moved there, never into `<main>`.\n * @slot pre-footer - Optional content shown in a band above the footer.\n * @slot site-links - Optional `<a href>` elements, forwarded to `<site-header>`, that replace the library utility links in the header (inline nav and Menu popover). Ignored with `header-variant=\"vendor\"`.\n * @slot main-nav - Optional `<nav>` forwarded to `<site-header>`, whose list replaces the UVA Library main navigation's links (see `<site-main-nav>`). Ignored with `no-main-nav` and `header-variant=\"vendor\"`.\n * @csspart main - The `<main>` landmark.\n * @csspart header - The `<header>` element inside `<site-header>` (shadow mode; exported through `exportparts`).\n * @csspart footer - The `<footer>` element inside `<site-footer>` (shadow mode; exported through `exportparts`).\n * @cssprop [--uva-brand-blue=#232d4b] - Skip link background.\n * @cssprop [--uva-brand-orange=#e57200] - Focus ring colour (focus-visible outline).\n * @cssprop [--uva-font-family=franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif] - Page font family (global styles).\n * @cssprop [--uva-font-size-base=17px] - Page base font size (global styles).\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Page text colour (global styles).\n * @cssprop --uva-color-surface - Dark-mode role token: page background (global styles; else none).\n * @cssprop --uva-color-text - Dark-mode role token: page text (global styles; else `--uva-grey-darkest`).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: skip-link background (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: skip-link text (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class SitePage extends UvalibElement {\n /** The page's content keeps the page's own colour scheme. */\n protected static override hostColorScheme = false;\n @property({ type: String, attribute: 'root-link-domain' }) rootLinkDomain =\n 'https://www.library.virginia.edu';\n @property({ type: String, attribute: 'header-variant' }) headerVariant: 'full' | 'vendor' =\n 'full';\n @property({ type: Boolean, attribute: 'no-global-styles' }) noGlobalStyles = false;\n /**\n * Hide the footer (and any pre-footer band), for tools and app-like pages where the site\n * footer does not belong. The footer is kept hidden rather than removed, so toggling the\n * attribute keeps pre-footer content.\n */\n @property({ type: Boolean, attribute: 'no-footer', reflect: true }) noFooter = false;\n /**\n * Print the header, alerts, breadcrumbs and footer too. By default printing leaves them out\n * and prints only `<main>`, black on white.\n */\n @property({ type: Boolean, attribute: 'print-chrome', reflect: true }) printChrome = false;\n /** Accessible name of the header navigation when site links are given (default \"Site\"). */\n @property({ type: String, attribute: 'site-links-label' }) siteLinksLabel?: string;\n /** The sub-site's name, forwarded to `<site-header site-name>`: shown after the logo as a link to the site's home. */\n @property({ type: String, attribute: 'site-name' }) siteName?: string;\n /** Where the site name links, forwarded to `<site-header site-name-href>` (default `/`). */\n @property({ type: String, attribute: 'site-name-href' }) siteNameHref?: string;\n /** Hide the UVA Library main navigation in the header. */\n @property({ type: Boolean, attribute: 'no-main-nav' }) noMainNav = false;\n /** Accessible name of the header's main navigation (default \"Main\"). */\n @property({ type: String, attribute: 'main-nav-label' }) mainNavLabel?: string;\n /** URL of JSON main navigation items, forwarded to `<site-header main-nav-src>`. */\n @property({ type: String, attribute: 'main-nav-src' }) mainNavSrc?: string;\n /**\n * The URL whose main-navigation link is marked current, forwarded to `<site-header\n * main-nav-current>`. Default: the page location, followed through same-document\n * navigations; set it when a single-page app's route is not its URL.\n */\n @property({ type: String, attribute: 'main-nav-current' }) mainNavCurrent?: string;\n /**\n * Alerts environment: `production` (default) or `staging`. Any other value logs one\n * console warning and uses production. Ignored when `alerts-src` is set.\n */\n @property({ type: String, attribute: 'alerts-env' }) alertsEnv = 'production';\n /**\n * Alerts base URL (holding `config.json`, `alerts.json` and `v1/uvalib-alerts.js`); overrides\n * `alerts-env`. For a custom domain, local development and tests.\n */\n @property({ type: String, attribute: 'alerts-src' }) alertsSrc?: string;\n /** Render no alert elements and load no alerts script. */\n @property({ type: Boolean, attribute: 'no-alerts' }) noAlerts = false;\n /**\n * Opt in to dark mode, forwarded to `<site-header color-scheme-switch>`: the page follows\n * the OS preference, and a Light / Dark / System control in the header lets the visitor\n * override it (remembered per site). Off by default: the page is always light. The page's\n * own content must support it (see the README's \"Dark mode\").\n */\n @property({ type: Boolean, attribute: 'color-scheme-switch' }) colorSchemeSwitch = false;\n /**\n * Opt in to Matomo analytics: the site's Matomo id. The page then adds one\n * `<site-analytics>` for it (loading its code only then), which records the page view and\n * what the library's components report (see the README's \"Analytics\"). Off by default. With\n * an analytics element or a Matomo snippet already on the page nothing is counted twice.\n */\n @property({ type: Number, attribute: 'matomo-id' }) matomoId?: number;\n /** The Matomo server for `matomo-id`, ending in `/` (default: the library's). */\n @property({ type: String, attribute: 'matomo-url' }) matomoUrl?: string;\n /**\n * `event`: the `<site-analytics downloads=\"event\">` option for `matomo-id`, counting\n * downloads as `['download', '<extension>']` events without their URLs.\n */\n @property({ type: String, attribute: 'matomo-downloads' }) matomoDownloads?: string;\n\n /**\n * Sets the stored scheme on <html> as soon as the page connects, before the header renders,\n * so pages without the inline snippet flash as little as possible; without the switch it\n * removes a stray attribute. It renders nothing itself.\n */\n private readonly scheme = new ColorSchemeController(\n this,\n () => this.colorSchemeSwitch,\n () => this.noStyle,\n false,\n );\n\n static styles = [\n accessible,\n css`\n :host {\n display: block;\n }\n site-header,\n site-footer,\n main {\n display: block;\n width: 100%;\n }\n site-footer[hidden] {\n display: none;\n }\n /* Virgo's alert list: a full-bleed band flush under the header, above main's padding. */\n .alerts-list {\n display: block;\n width: 100%;\n margin: 0;\n padding: 0;\n }\n .alerts-list[hidden] {\n display: none;\n }\n .alerts-list > site-alerts {\n display: block;\n }\n /* The breadcrumb trail lines up with main's content (same max width and side padding). */\n ::slotted([slot='breadcrumbs']) {\n display: block;\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 16px 40px 0;\n }\n /* An empty or hidden trail takes no space. */\n ::slotted([slot='breadcrumbs']:is([hidden], [data-empty])) {\n display: none;\n }\n /* Light mode (this stylesheet is rewritten to \\`site-page > …\\` there). */\n :host > [slot='breadcrumbs']:is([hidden], [data-empty]) {\n display: none;\n }\n :host > [slot='breadcrumbs'] {\n display: block;\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 16px 40px 0;\n }\n /* Old layout: .main-container-inner (max 1600px, centred) > .w3-row-padding 8px\n > .w3-col 8px > .d8-fade 24px = 40px each side; 12px margin + 24px padding below. */\n main {\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 36px 40px;\n }\n @media screen and (min-width: 993px) {\n main {\n padding-top: 24px; /* old: .breadcrumb-found dropped its 12px top margin */\n }\n }\n /* Print (issue #20): only <main>, black on white, unless print-chrome. In shadow mode\n the breadcrumbs slot is hidden, which hides what is assigned to it; in light mode\n (rewritten to site-page …) the trail is a direct child. The pre-footer is in the\n footer. The base styles underline the content's links and print a dark scheme light. */\n @media print {\n :host(:not([print-chrome])) {\n color: #000;\n background: #fff;\n }\n :host(:not([print-chrome])) :is(site-header, site-footer, .alerts-list, .skip-link),\n :host(:not([print-chrome])) main > site-alerts,\n :host(:not([print-chrome])) slot[name='breadcrumbs'],\n :host(:not([print-chrome])) > [slot='breadcrumbs'] {\n display: none;\n }\n :host(:not([print-chrome])) main {\n max-width: none;\n padding: 0;\n }\n /* Where the page came from: a line above the content, from --uvalib-print-source\n (set on <main>: \"UVA Library — <site name or title> <URL>\"). Print only, so never\n read out on screen. */\n :host(:not([print-chrome])) main::before {\n content: var(--uvalib-print-source, none);\n display: block;\n margin: 0 0 1rem;\n padding: 0 0 0.25rem;\n border-bottom: 1px solid #000;\n color: #000;\n font-size: 0.875rem;\n overflow-wrap: anywhere;\n }\n }\n `,\n ];\n\n /** Light mode: nodes this element rendered itself (incl. Lit markers), never routed. */\n private chrome = new WeakSet<Node>();\n private observer?: MutationObserver;\n private globalsInstalled = false;\n /** The alerts base URL in use, from `alerts-src` or `alerts-env`. */\n private alertsUrl = ALERTS_PRODUCTION_SRC;\n /** Light mode: the alert elements this element created, and the list band. */\n private lightAlerts?: {\n top: HTMLElement;\n band: HTMLElement;\n list: HTMLElement;\n regional: HTMLElement;\n };\n /** The `<site-analytics>` this element added for `matomo-id`. */\n private analytics?: HTMLElement;\n /** Whether this element asked for `<site-alerts>`' code. */\n private alertsUiRequested = false;\n /** Whether the list alerts have anything to show, from their last update event. */\n @state() private listShown = false;\n /**\n * Shadow mode: whether a `slot=\"breadcrumbs\"` child exists, so the slot is rendered only\n * then and the page without breadcrumbs renders exactly what it did before them.\n */\n @state() private hasBreadcrumbs = false;\n private breadcrumbsObserver?: MutationObserver;\n\n private syncHasBreadcrumbs = (): void => {\n this.hasBreadcrumbs = [...this.children].some((c) => slotOf(c) === 'breadcrumbs');\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.lightDom) {\n this.syncHasBreadcrumbs();\n this.breadcrumbsObserver ??= new MutationObserver(this.syncHasBreadcrumbs);\n this.breadcrumbsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n this.ownerDocument.defaultView?.addEventListener('beforeprint', this.syncPrintSource);\n if (!this.noGlobalStyles && !this.globalsInstalled) {\n this.globalsInstalled = true;\n this.installGlobalStyles(this.ownerDocument);\n }\n // Reconnect after a disconnect; the first connect starts routing in update().\n if (this.lightDom && this.hasUpdated) {\n this.route(this.childNodes);\n this.observe();\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.breadcrumbsObserver?.disconnect();\n this.ownerDocument.defaultView?.removeEventListener('beforeprint', this.syncPrintSource);\n }\n\n /**\n * The printed \"where from\" line, as a CSS string on <main> (`--uvalib-print-source`), read\n * by the print styles. Set on each update and again just before printing, so a single-page\n * app prints its current title and URL.\n */\n private syncPrintSource = (): void => {\n const main = this.renderRoot.querySelector<HTMLElement>(\n this.lightDom ? ':scope > main' : 'main',\n );\n if (!main) return;\n const doc = this.ownerDocument;\n const name = (this.siteName || doc.title || '').trim();\n const text = `UVA Library${name ? ` — ${name}` : ''} ${doc.defaultView?.location.href ?? ''}`;\n const value = `\"${text\n .trim()\n .replace(/[\\\\\"]/g, '\\\\$&')\n .replace(/[\\n\\r\\f]/g, ' ')}\"`;\n if (main.style.getPropertyValue('--uvalib-print-source') !== value)\n main.style.setProperty('--uvalib-print-source', value);\n };\n\n private installGlobalStyles(doc: Document): void {\n // Tokens stay layered so a host's own `:root { --uva-*: … }` wins; base and accessibility\n // rules are unlayered so they beat host resets.\n installLightDomStyles('uvalib-tokens', [tokens], { root: doc, scope: false });\n installLightDomStyles('uvalib-global', [fontFallback, base, accessible], {\n root: doc,\n scope: false,\n layer: false,\n });\n if (!doc.head.querySelector(`link[href=\"${TYPEKIT_URL}\"]`)) {\n const link = doc.createElement('link');\n link.rel = 'stylesheet';\n link.href = TYPEKIT_URL;\n doc.head.append(link);\n }\n }\n\n /** The list element's `site-alerts-change`: show the band only while it lists alerts. */\n private onListChange(e: Event): void {\n if (e.target !== e.currentTarget) return;\n const count = (e as CustomEvent<{ count?: unknown }>).detail?.count;\n this.listShown = typeof count === 'number' && count > 0;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('colorSchemeSwitch')) this.scheme.sync();\n if (changed.has('noAlerts') && this.noAlerts) this.listShown = false;\n if (changed.has('alertsEnv') && this.alertsEnv && !isAlertsEnv(this.alertsEnv)) {\n console.warn(\n `${this.localName}: unknown alerts-env \"${this.alertsEnv}\"; using production. Valid values: production, staging.`,\n );\n }\n try {\n this.alertsUrl = alertsBase(this.alertsEnv, this.alertsSrc, this.ownerDocument.baseURI);\n } catch {\n if (changed.has('alertsSrc')) {\n console.warn(\n `${this.localName}: alerts-src \"${this.alertsSrc}\" is not a URL; ignoring it.`,\n );\n }\n this.alertsUrl = alertsBase(this.alertsEnv, null, this.ownerDocument.baseURI);\n }\n }\n\n protected override updated(): void {\n if (this.lightDom) this.syncLightAlerts();\n this.syncPrintSource();\n if (!this.noAlerts) {\n // The alerts script starts loading at once, alongside <site-alerts>' own code.\n loadAlerts(this.ownerDocument, this.alertsUrl);\n this.defineAlerts();\n }\n this.syncAnalytics();\n }\n\n /** Loads `<site-alerts>` (and registers it) on first use of the alerts. */\n protected loadAlertsUi(): Promise<unknown> {\n return import('../site-alerts/site-alerts.js');\n }\n\n private defineAlerts(): void {\n if (this.alertsUiRequested || customElements.get(ALERTS_UI)) return;\n this.alertsUiRequested = true;\n this.loadAlertsUi().catch((err) =>\n console.error(`${this.localName}: failed to load site-alerts`, err),\n );\n }\n\n /** Loads `<site-analytics>` (and registers it) on first use of `matomo-id`. */\n protected loadAnalytics(): Promise<unknown> {\n return import('../site-analytics/site-analytics.js');\n }\n\n /**\n * `matomo-id`: one `<site-analytics>`, at the very start of the render root, before Lit's\n * markers, so no render ever clears it and (being chrome) light DOM routing never moves it.\n * The element's own one-tracker guard keeps a second element or snippet from double-counting.\n */\n private syncAnalytics(): void {\n const id = Number(this.matomoId);\n if (!(id > 0)) {\n this.analytics?.remove();\n this.analytics = undefined;\n return;\n }\n if (!this.analytics) {\n // An analytics element the page has already (say the old v0.0.12 <uvalib-analytics>,\n // which does not share the one-tracker guard) records the page: don't add a second.\n if (this.ownerDocument.querySelector('site-analytics, uvalib-analytics')) return;\n const a = (this.analytics = this.ownerDocument.createElement('site-analytics'));\n this.chrome.add(a);\n if (!customElements.get('site-analytics')) {\n // Until the code arrives nothing forwards: keep what the components report meanwhile\n // (a bento search can settle first) and hand it over once the element is running.\n const buffer = bufferAnalytics(this.ownerDocument);\n this.loadAnalytics()\n .then(() => customElements.whenDefined('site-analytics'))\n .then(() => (a as HTMLElement & { updateComplete?: Promise<unknown> }).updateComplete)\n .then(\n () => buffer.flush(),\n (err) => {\n buffer.drop();\n console.error(`${this.localName}: failed to load site-analytics`, err);\n },\n );\n }\n }\n const a = this.analytics;\n if (a.getAttribute('matomoid') !== String(id)) a.setAttribute('matomoid', String(id));\n if (this.matomoUrl) a.setAttribute('matomourl', this.matomoUrl);\n else a.removeAttribute('matomourl');\n if (this.matomoDownloads) a.setAttribute('downloads', this.matomoDownloads);\n else a.removeAttribute('downloads');\n if (a.parentNode !== this.renderRoot) this.renderRoot.prepend(a);\n }\n\n /**\n * Light mode keeps <main> free of Lit parts, so the alert elements are managed here: the\n * header one is handed to <site-header> as a `slot=\"alerts\"` child (it moves it into its\n * <header>), the list band goes right after <site-header>, and regional stays the first\n * child of <main>. The band and the elements are chrome, so route() never moves them.\n */\n private syncLightAlerts(): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n if (!main || !header) return;\n if (this.noAlerts) {\n const a = this.lightAlerts;\n for (const n of a ? [a.top, a.band, a.regional] : []) n.remove();\n this.lightAlerts = undefined;\n return;\n }\n if (!this.lightAlerts) {\n const doc = this.ownerDocument;\n const make = (show: AlertShow) => {\n const a = doc.createElement(ALERTS_UI);\n a.setAttribute('show', show);\n a.setAttribute('no-shadow-dom', '');\n this.chrome.add(a);\n return a;\n };\n const top = make('header');\n top.slot = 'alerts';\n const list = make('list');\n list.addEventListener('site-alerts-change', (e) => this.onListChange(e));\n const band = doc.createElement('section');\n band.className = 'alerts-list';\n band.setAttribute('aria-label', ALERTS_LIST_LABEL);\n band.append(list);\n this.chrome.add(band);\n this.lightAlerts = { top, band, list, regional: make('regional') };\n }\n const { top, band, list, regional } = this.lightAlerts;\n for (const a of [top, list, regional]) {\n if (a.getAttribute('alerts-src') !== this.alertsUrl)\n a.setAttribute('alerts-src', this.alertsUrl);\n a.toggleAttribute('no-style', this.noStyle);\n }\n band.hidden = !this.listShown;\n if (!header.contains(top)) header.append(top);\n // Directly after <site-header>, before any Lit marker, so no part ever clears it.\n if (header.nextSibling !== band) header.after(band);\n if (main.firstChild !== regional) main.prepend(regional);\n }\n\n protected override update(changed: PropertyValues): void {\n if (this.hasUpdated || !this.lightDom) {\n super.update(changed);\n return;\n }\n const content = [...this.childNodes];\n super.update(changed); // first render appends the chrome after the content\n for (const n of this.childNodes) if (!content.includes(n)) this.chrome.add(n);\n this.route(content);\n this.observe();\n }\n\n private observe(): void {\n this.observer ??= new MutationObserver((records) => {\n for (const r of records) {\n if (r.type === 'attributes') this.reslot(r.target as Element);\n else if (r.target === this) this.route(r.addedNodes);\n }\n });\n // One call: observing the same node again would replace these options. Children added to\n // the page are routed; a content node given slot=\"breadcrumbs\" later (or losing it) moves\n // out of (or back into) <main>.\n this.observer.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n /** Light mode: a top-level content node's `slot` changed to or from `breadcrumbs`. */\n private reslot(el: Element): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n if (!main || !header || this.chrome.has(el)) return;\n if (el.parentNode === main && slotOf(el) === 'breadcrumbs') this.placeBreadcrumbs(el, header);\n else if (\n el.parentNode === this &&\n slotOf(el) !== 'breadcrumbs' &&\n main.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING\n )\n main.append(el);\n }\n\n /**\n * Light mode: a `slot=\"breadcrumbs\"` node goes after the header, the alert list band and any\n * breadcrumbs already there, before Lit's markers (so no render clears it) and `<main>`.\n */\n private placeBreadcrumbs(n: Node, header: Element): void {\n let ref: Node = header;\n for (let next = ref.nextSibling; next; next = ref.nextSibling) {\n if (next !== this.lightAlerts?.band && slotOf(next) !== 'breadcrumbs') break;\n if (next === n) return; // already in place\n ref = next;\n }\n (ref as ChildNode).after(n);\n }\n\n /**\n * Light mode has no slots: move content into `<main>`, pre-footer nodes to the footer,\n * site links and main-nav markup to the header and breadcrumbs before `<main>`.\n */\n private route(nodes: Iterable<Node>): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n const footer = this.querySelector(':scope > site-footer');\n if (!main || !header || !footer) return;\n for (const n of [...nodes]) {\n if (n.parentNode !== this || this.chrome.has(n)) continue;\n if (n.nodeType === Node.TEXT_NODE && !n.textContent?.trim()) continue;\n // The header and footer adopt their own slotted children, even before they upgrade.\n const slot = slotOf(n);\n if (slot === 'breadcrumbs') {\n this.placeBreadcrumbs(n, header);\n continue;\n }\n const to =\n slot === 'pre-footer'\n ? footer\n : slot === 'site-links' || slot === 'main-nav'\n ? header\n : main;\n to.append(n);\n }\n }\n\n private onSkip(e: Event): void {\n e.preventDefault();\n // Shadow mode: the link is in <site-header>'s skip-link slot, and the header reports it.\n if (this.lightDom) trackEvent(this, ['site-header', 'skip-link']);\n this.renderRoot.querySelector<HTMLElement>('main')?.focus();\n }\n\n protected override render() {\n const light = this.lightDom;\n // Light mode keeps <main> and <site-footer> free of Lit parts so moved content is never cleared.\n const skip = html`<a\n class=\"skip-link\"\n href=\"#main-content\"\n slot=${ifDefined(light ? undefined : 'skip-link')}\n @click=${this.onSkip}\n >Skip to main content</a\n >`;\n // Shadow mode: the link is slotted into <site-header>'s <header> landmark, because axe\n // looks the #main-content target up on the document and cannot see it in this shadow root,\n // so it would flag a skip link that sits outside every landmark (\"region\").\n // Light mode: the link stays the first child, where the target resolves.\n const alerts = !this.noAlerts && !light;\n const alert = (show: AlertShow) =>\n html`<site-alerts\n slot=${ifDefined(show === 'header' ? 'alerts' : undefined)}\n show=${show}\n alerts-src=${this.alertsUrl}\n ?no-style=${this.noStyle}\n ></site-alerts>`;\n // Shadow mode's list band; light mode builds the same in syncLightAlerts().\n const band = html`<section\n class=\"alerts-list\"\n aria-label=${ALERTS_LIST_LABEL}\n ?hidden=${!this.listShown}\n >\n <site-alerts\n show=\"list\"\n alerts-src=${this.alertsUrl}\n ?no-style=${this.noStyle}\n @site-alerts-change=${this.onListChange}\n ></site-alerts>\n </section>`;\n return html`\n ${light ? skip : nothing}\n <site-header\n exportparts=\"header\"\n ?no-shadow-dom=${light}\n ?no-style=${this.noStyle}\n variant=${this.headerVariant}\n root-link-domain=${this.rootLinkDomain}\n site-links-label=${ifDefined(this.siteLinksLabel)}\n site-name=${ifDefined(this.siteName)}\n site-name-href=${ifDefined(this.siteNameHref)}\n ?no-main-nav=${this.noMainNav}\n main-nav-label=${ifDefined(this.mainNavLabel)}\n main-nav-src=${ifDefined(this.mainNavSrc)}\n main-nav-current=${ifDefined(this.mainNavCurrent)}\n ?color-scheme-switch=${this.colorSchemeSwitch}\n >${\n light\n ? nothing\n : html`${skip}${alerts ? alert('header') : nothing}<slot\n name=\"site-links\"\n slot=\"site-links\"\n ></slot\n ><slot name=\"main-nav\" slot=\"main-nav\"></slot>`\n }</site-header\n >\n ${alerts ? band : nothing}\n ${!light && this.hasBreadcrumbs ? html`<slot name=\"breadcrumbs\"></slot>` : nothing}\n ${\n light\n ? html`<main id=\"main-content\" tabindex=\"-1\" part=\"main\"></main>`\n : html`<main id=\"main-content\" tabindex=\"-1\" part=\"main\">\n ${alerts ? alert('regional') : nothing}<slot></slot>\n </main>`\n }\n ${\n light\n ? html`<site-footer\n no-shadow-dom\n ?hidden=${this.noFooter}\n ?no-style=${this.noStyle}\n root-link-domain=${this.rootLinkDomain}\n ></site-footer>`\n : html`<site-footer\n exportparts=\"footer\"\n ?hidden=${this.noFooter}\n ?no-style=${this.noStyle}\n root-link-domain=${this.rootLinkDomain}\n ><slot name=\"pre-footer\" slot=\"pre-footer\"></slot\n ></site-footer>`\n }\n `;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SitePage } from './SitePage.js';\nimport '../site-header/site-header.js';\n// The footer sits at the bottom of the page, so it loads asynchronously.\nimport('../site-footer/site-footer.js').catch((err) =>\n console.error('site-page: failed to load site-footer', err),\n);\n\ndefine('site-page', SitePage);\n"],"mappings":";;;;;;;;;AAwBA,IAAM0B,IAAY,eAEZC,IAAoB,kBAEpBC,KAAU,MAA4BvB,aAAa,UAAUA,EAAE,aAAa,MAAM,IAAI,MAkD/EwB,IAAb,cAA8BjB,EAAc;;EAyPJ,A,aArPpC,KAAA,iBAAA,oCAEA,KAAA,gBAAA,QAC2E,KAAA,iBAAA,IAME,KAAA,WAAA,IAKM,KAAA,cAAA,IAQlB,KAAA,YAAA,IAeF,KAAA,YAAA,cAOD,KAAA,WAAA,IAOmB,KAAA,oBAAA,IAqBzD,KAAA,SAAA,IAAIO,EAC5B,YACM,KAAK,yBACL,KAAK,SACX,EACF,GAuGiB,KAAA,yBAAA,IAAI,QAAc,GAER,KAAA,mBAAA,IAEP,KAAA,YAAAM,GAWQ,KAAA,oBAAA,IAEC,KAAA,YAAA,IAKK,KAAA,iBAAA,IAGO,KAAA,2BAAA;GACvC,KAAK,iBAAiB,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,MAAM,MAAMG,EAAOG,CAAC,MAAM,aAAa;EAClF,GAsCsC,KAAA,wBAAA;GACpC,IAAMC,IAAO,KAAK,WAAW,cAC3B,KAAK,WAAW,kBA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AAM;CAAS,WAAW;AAAsB,CAAC,CAAA,GAAA0B,EAAA,WAAA,qBAAA,KAAA,CAAA,GAO5D3B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAA0B,EAAA,WAAA,YAAA,KAAA,CAAA,GAEjD3B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAA0B,EAAA,WAAA,aAAA,KAAA,CAAA,GAKlD3B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAmB,CAAC,CAAA,GAAA0B,EAAA,WAAA,mBAAA,KAAA,CAAA,GAoIxD3B,EAAA,CAAAE,EAAM,CAAA,GAAAyB,EAAA,WAAA,aAAA,KAAA,CAAA,GAKN3B,EAAA,CAAAE,EAAM,CAAA,GAAAyB,EAAA,WAAA,kBAAA,KAAA,CAAA,GCxRT,OAAO,mBAAgC,CAAC,OAAO,MAC7C,QAAQ,MAAM,yCAAyCU,CAAG,CAC5D,GAEA9B,EAAO,aAAaoB,CAAQ"}
|
|
1
|
+
{"version":3,"file":"site-page.js","names":["ifDefined","nothing","_decorate","property","state","n","i","r","b","define","__decorate","installLightDomStyles","UvalibElement","o","loadFontFallback","fontFallback","base","tokens","TYPEKIT_URL","accessible","ColorSchemeController","trackEvent","bufferAnalytics","loadAlerts","isAlertsEnv","alertsBase","ALERTS_PRODUCTION_SRC","ALERTS_UI","ALERTS_LIST_LABEL","slotOf","SitePage","_args","c","main","doc","name","value","link","count","changed","err","id","a","buffer","header","make","show","top","list","band","regional","content","records","el","ref","next","footer","nodes","slot","light","skip","alerts","alert","A"],"sources":["../src/components/site-page/SitePage.ts","../src/components/site-page/site-page.ts"],"sourcesContent":["import { html, css, nothing, type PropertyValues } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { property, state } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { fontFallback, loadFontFallback } from '../../styles/font-fallback.js';\nimport { tokens } from '../../styles/tokens.js';\nimport { base, TYPEKIT_URL } from '../../styles/base.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { ColorSchemeController } from '../../base/color-scheme.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { bufferAnalytics } from '../../base/analytics-state.js';\nimport {\n ALERTS_PRODUCTION_SRC,\n alertsBase,\n isAlertsEnv,\n loadAlerts,\n} from '../site-alerts/alerts.js';\n\nexport { ALERTS_PRODUCTION_SRC, ALERTS_STAGING_SRC } from '../site-alerts/alerts.js';\nexport type { AlertsEnv } from '../site-alerts/alerts.js';\n\n/** The `<site-alerts>` elements' `show` values: header banner, alert list, regional alerts. */\ntype AlertShow = 'header' | 'list' | 'regional';\nconst ALERTS_UI = 'site-alerts';\n/** Accessible name of the list band region. */\nconst ALERTS_LIST_LABEL = 'Library alerts';\n\nconst slotOf = (n: Node): string | null => (n instanceof Element ? n.getAttribute('slot') : null);\n\n/**\n * Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles.\n * Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`.\n *\n * The header shows the UVA Library main navigation by default (`no-main-nav` turns it off;\n * `header-variant=\"vendor\"` never shows it).\n *\n * Shows live UVA Library alerts by default with `<site-alerts>` (its code loads only then),\n * placed as Virgo places them: a full-bleed `<site-alerts show=\"header\">` banner at the top\n * of the header landmark (after the skip link), a full-bleed band between the header and\n * `<main>` holding `<site-alerts show=\"list\">` (a `<section aria-label=\"Library alerts\">`\n * region, hidden while the list has nothing to show), and `<site-alerts show=\"regional\">` as\n * the first child of `<main>`, inside its padding. Their data comes from one headless\n * `<uvalib-alerts>`, loaded once per document, with a module script, from the alerts CDN\n * (`alerts-env`, or `alerts-src`); if it fails to load, one console warning is logged and\n * the page works as before. `no-alerts` renders no alert elements and loads nothing.\n *\n * A `slot=\"breadcrumbs\"` child (a `<uvalib-breadcrumbs>`) is placed where library.virginia.edu\n * puts the trail: after the header and the alert list band, before `<main>` and outside it (so\n * the skip link lands past it), with the same gutters as `<main>`.\n *\n * Printing leaves out the chrome: the skip link, header (with the main navigation and the\n * header alert), alert list band, regional alerts, breadcrumbs, pre-footer and footer are not\n * printed, `<main>` loses its gutters, and the content prints black on white (a dark scheme\n * prints light), its links underlined. A short line above the content says where the page\n * came from (\"UVA Library — <site name or page title>\" and the page's URL). `print-chrome`\n * prints the page as it is shown instead. With `no-style` none of this applies.\n *\n * @tagname site-page\n * @slot - Main page content, rendered inside the single `<main>`.\n * @slot breadcrumbs - Optional breadcrumb trail (a `<uvalib-breadcrumbs>`), shown between the header (and alert list band) and `<main>`. In light mode it is moved there, never into `<main>`.\n * @slot pre-footer - Optional content shown in a band above the footer.\n * @slot site-links - Optional `<a href>` elements, forwarded to `<site-header>`, that replace the library utility links in the header (inline nav and Menu popover). Ignored with `header-variant=\"vendor\"`.\n * @slot main-nav - Optional `<nav>` forwarded to `<site-header>`, whose list replaces the UVA Library main navigation's links (see `<site-main-nav>`). Ignored with `no-main-nav` and `header-variant=\"vendor\"`.\n * @csspart main - The `<main>` landmark.\n * @csspart header - The `<header>` element inside `<site-header>` (shadow mode; exported through `exportparts`).\n * @csspart footer - The `<footer>` element inside `<site-footer>` (shadow mode; exported through `exportparts`).\n * @cssprop [--uva-brand-blue=#232d4b] - Skip link background.\n * @cssprop [--uva-brand-orange=#e57200] - Focus ring colour (focus-visible outline).\n * @cssprop [--uva-font-family=franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif] - Page font family (global styles).\n * @cssprop [--uva-font-size-base=17px] - Page base font size (global styles).\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Page text colour (global styles).\n * @cssprop --uva-color-surface - Dark-mode role token: page background (global styles; else none).\n * @cssprop --uva-color-text - Dark-mode role token: page text (global styles; else `--uva-grey-darkest`).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: skip-link background (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: skip-link text (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class SitePage extends UvalibElement {\n /** The page's content keeps the page's own colour scheme. */\n protected static override hostColorScheme = false;\n @property({ type: String, attribute: 'root-link-domain' }) rootLinkDomain =\n 'https://www.library.virginia.edu';\n @property({ type: String, attribute: 'header-variant' }) headerVariant: 'full' | 'vendor' =\n 'full';\n @property({ type: Boolean, attribute: 'no-global-styles' }) noGlobalStyles = false;\n /**\n * Hide the footer (and any pre-footer band), for tools and app-like pages where the site\n * footer does not belong. The footer is kept hidden rather than removed, so toggling the\n * attribute keeps pre-footer content.\n */\n @property({ type: Boolean, attribute: 'no-footer', reflect: true }) noFooter = false;\n /**\n * Print the header, alerts, breadcrumbs and footer too. By default printing leaves them out\n * and prints only `<main>`, black on white.\n */\n @property({ type: Boolean, attribute: 'print-chrome', reflect: true }) printChrome = false;\n /** Accessible name of the header navigation when site links are given (default \"Site\"). */\n @property({ type: String, attribute: 'site-links-label' }) siteLinksLabel?: string;\n /** The sub-site's name, forwarded to `<site-header site-name>`: shown after the logo as a link to the site's home. */\n @property({ type: String, attribute: 'site-name' }) siteName?: string;\n /** Where the site name links, forwarded to `<site-header site-name-href>` (default `/`). */\n @property({ type: String, attribute: 'site-name-href' }) siteNameHref?: string;\n /** Hide the UVA Library main navigation in the header. */\n @property({ type: Boolean, attribute: 'no-main-nav' }) noMainNav = false;\n /** Accessible name of the header's main navigation (default \"Main\"). */\n @property({ type: String, attribute: 'main-nav-label' }) mainNavLabel?: string;\n /** URL of JSON main navigation items, forwarded to `<site-header main-nav-src>`. */\n @property({ type: String, attribute: 'main-nav-src' }) mainNavSrc?: string;\n /**\n * The URL whose main-navigation link is marked current, forwarded to `<site-header\n * main-nav-current>`. Default: the page location, followed through same-document\n * navigations; set it when a single-page app's route is not its URL.\n */\n @property({ type: String, attribute: 'main-nav-current' }) mainNavCurrent?: string;\n /**\n * Alerts environment: `production` (default) or `staging`. Any other value logs one\n * console warning and uses production. Ignored when `alerts-src` is set.\n */\n @property({ type: String, attribute: 'alerts-env' }) alertsEnv = 'production';\n /**\n * Alerts base URL (holding `config.json`, `alerts.json` and `v1/uvalib-alerts.js`); overrides\n * `alerts-env`. For a custom domain, local development and tests.\n */\n @property({ type: String, attribute: 'alerts-src' }) alertsSrc?: string;\n /** Render no alert elements and load no alerts script. */\n @property({ type: Boolean, attribute: 'no-alerts' }) noAlerts = false;\n /**\n * Opt in to dark mode, forwarded to `<site-header color-scheme-switch>`: the page follows\n * the OS preference, and a Light / Dark / System control in the header lets the visitor\n * override it (remembered per site). Off by default: the page is always light. The page's\n * own content must support it (see the README's \"Dark mode\").\n */\n @property({ type: Boolean, attribute: 'color-scheme-switch' }) colorSchemeSwitch = false;\n /**\n * Opt in to Matomo analytics: the site's Matomo id. The page then adds one\n * `<site-analytics>` for it (loading its code only then), which records the page view and\n * what the library's components report (see the README's \"Analytics\"). Off by default. With\n * an analytics element or a Matomo snippet already on the page nothing is counted twice.\n */\n @property({ type: Number, attribute: 'matomo-id' }) matomoId?: number;\n /** The Matomo server for `matomo-id`, ending in `/` (default: the library's). */\n @property({ type: String, attribute: 'matomo-url' }) matomoUrl?: string;\n /**\n * `event`: the `<site-analytics downloads=\"event\">` option for `matomo-id`, counting\n * downloads as `['download', '<extension>']` events without their URLs.\n */\n @property({ type: String, attribute: 'matomo-downloads' }) matomoDownloads?: string;\n\n /**\n * Sets the stored scheme on <html> as soon as the page connects, before the header renders,\n * so pages without the inline snippet flash as little as possible; without the switch it\n * removes a stray attribute. It renders nothing itself.\n */\n private readonly scheme = new ColorSchemeController(\n this,\n () => this.colorSchemeSwitch,\n () => this.noStyle,\n false,\n );\n\n static styles = [\n accessible,\n css`\n :host {\n display: block;\n }\n site-header,\n site-footer,\n main {\n display: block;\n width: 100%;\n }\n site-footer[hidden] {\n display: none;\n }\n /* Virgo's alert list: a full-bleed band flush under the header, above main's padding. */\n .alerts-list {\n display: block;\n width: 100%;\n margin: 0;\n padding: 0;\n }\n .alerts-list[hidden] {\n display: none;\n }\n .alerts-list > site-alerts {\n display: block;\n }\n /* The breadcrumb trail lines up with main's content (same max width and side padding). */\n ::slotted([slot='breadcrumbs']) {\n display: block;\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 16px 40px 0;\n }\n /* An empty or hidden trail takes no space. */\n ::slotted([slot='breadcrumbs']:is([hidden], [data-empty])) {\n display: none;\n }\n /* Light mode (this stylesheet is rewritten to \\`site-page > …\\` there). */\n :host > [slot='breadcrumbs']:is([hidden], [data-empty]) {\n display: none;\n }\n :host > [slot='breadcrumbs'] {\n display: block;\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 16px 40px 0;\n }\n /* Old layout: .main-container-inner (max 1600px, centred) > .w3-row-padding 8px\n > .w3-col 8px > .d8-fade 24px = 40px each side; 12px margin + 24px padding below. */\n main {\n box-sizing: border-box;\n max-width: 1600px;\n margin: 0 auto;\n padding: 36px 40px;\n }\n @media screen and (min-width: 993px) {\n main {\n padding-top: 24px; /* old: .breadcrumb-found dropped its 12px top margin */\n }\n }\n /* Print (issue #20): only <main>, black on white, unless print-chrome. In shadow mode\n the breadcrumbs slot is hidden, which hides what is assigned to it; in light mode\n (rewritten to site-page …) the trail is a direct child. The pre-footer is in the\n footer. The base styles underline the content's links and print a dark scheme light. */\n @media print {\n :host(:not([print-chrome])) {\n color: #000;\n background: #fff;\n }\n :host(:not([print-chrome])) :is(site-header, site-footer, .alerts-list, .skip-link),\n :host(:not([print-chrome])) main > site-alerts,\n :host(:not([print-chrome])) slot[name='breadcrumbs'],\n :host(:not([print-chrome])) > [slot='breadcrumbs'] {\n display: none;\n }\n :host(:not([print-chrome])) main {\n max-width: none;\n padding: 0;\n }\n /* Where the page came from: a line above the content, from --uvalib-print-source\n (set on <main>: \"UVA Library — <site name or title> <URL>\"). Print only, so never\n read out on screen. */\n :host(:not([print-chrome])) main::before {\n content: var(--uvalib-print-source, none);\n display: block;\n margin: 0 0 1rem;\n padding: 0 0 0.25rem;\n border-bottom: 1px solid #000;\n color: #000;\n font-size: 0.875rem;\n overflow-wrap: anywhere;\n }\n }\n `,\n ];\n\n /** Light mode: nodes this element rendered itself (incl. Lit markers), never routed. */\n private chrome = new WeakSet<Node>();\n private observer?: MutationObserver;\n private globalsInstalled = false;\n /** The alerts base URL in use, from `alerts-src` or `alerts-env`. */\n private alertsUrl = ALERTS_PRODUCTION_SRC;\n /** Light mode: the alert elements this element created, and the list band. */\n private lightAlerts?: {\n top: HTMLElement;\n band: HTMLElement;\n list: HTMLElement;\n regional: HTMLElement;\n };\n /** The `<site-analytics>` this element added for `matomo-id`. */\n private analytics?: HTMLElement;\n /** Whether this element asked for `<site-alerts>`' code. */\n private alertsUiRequested = false;\n /** Whether the list alerts have anything to show, from their last update event. */\n @state() private listShown = false;\n /**\n * Shadow mode: whether a `slot=\"breadcrumbs\"` child exists, so the slot is rendered only\n * then and the page without breadcrumbs renders exactly what it did before them.\n */\n @state() private hasBreadcrumbs = false;\n private breadcrumbsObserver?: MutationObserver;\n\n private syncHasBreadcrumbs = (): void => {\n this.hasBreadcrumbs = [...this.children].some((c) => slotOf(c) === 'breadcrumbs');\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.lightDom) {\n this.syncHasBreadcrumbs();\n this.breadcrumbsObserver ??= new MutationObserver(this.syncHasBreadcrumbs);\n this.breadcrumbsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n this.ownerDocument.defaultView?.addEventListener('beforeprint', this.syncPrintSource);\n if (!this.noGlobalStyles && !this.globalsInstalled) {\n this.globalsInstalled = true;\n this.installGlobalStyles(this.ownerDocument);\n }\n // Reconnect after a disconnect; the first connect starts routing in update().\n if (this.lightDom && this.hasUpdated) {\n this.route(this.childNodes);\n this.observe();\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.breadcrumbsObserver?.disconnect();\n this.ownerDocument.defaultView?.removeEventListener('beforeprint', this.syncPrintSource);\n }\n\n /**\n * The printed \"where from\" line, as a CSS string on <main> (`--uvalib-print-source`), read\n * by the print styles. Set on each update and again just before printing, so a single-page\n * app prints its current title and URL.\n */\n private syncPrintSource = (): void => {\n const main = this.renderRoot.querySelector<HTMLElement>(\n this.lightDom ? ':scope > main' : 'main',\n );\n if (!main) return;\n const doc = this.ownerDocument;\n const name = (this.siteName || doc.title || '').trim();\n const text = `UVA Library${name ? ` — ${name}` : ''} ${doc.defaultView?.location.href ?? ''}`;\n const value = `\"${text\n .trim()\n .replace(/[\\\\\"]/g, '\\\\$&')\n .replace(/[\\n\\r\\f]/g, ' ')}\"`;\n if (main.style.getPropertyValue('--uvalib-print-source') !== value)\n main.style.setProperty('--uvalib-print-source', value);\n };\n\n private installGlobalStyles(doc: Document): void {\n // Tokens stay layered so a host's own `:root { --uva-*: … }` wins; base and accessibility\n // rules are unlayered so they beat host resets.\n installLightDomStyles('uvalib-tokens', [tokens], { root: doc, scope: false });\n installLightDomStyles('uvalib-global', [fontFallback, base, accessible], {\n root: doc,\n scope: false,\n layer: false,\n });\n loadFontFallback(doc);\n if (!doc.head.querySelector(`link[href=\"${TYPEKIT_URL}\"]`)) {\n const link = doc.createElement('link');\n link.rel = 'stylesheet';\n link.href = TYPEKIT_URL;\n doc.head.append(link);\n }\n }\n\n /** The list element's `site-alerts-change`: show the band only while it lists alerts. */\n private onListChange(e: Event): void {\n if (e.target !== e.currentTarget) return;\n const count = (e as CustomEvent<{ count?: unknown }>).detail?.count;\n this.listShown = typeof count === 'number' && count > 0;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('colorSchemeSwitch')) this.scheme.sync();\n if (changed.has('noAlerts') && this.noAlerts) this.listShown = false;\n if (changed.has('alertsEnv') && this.alertsEnv && !isAlertsEnv(this.alertsEnv)) {\n console.warn(\n `${this.localName}: unknown alerts-env \"${this.alertsEnv}\"; using production. Valid values: production, staging.`,\n );\n }\n try {\n this.alertsUrl = alertsBase(this.alertsEnv, this.alertsSrc, this.ownerDocument.baseURI);\n } catch {\n if (changed.has('alertsSrc')) {\n console.warn(\n `${this.localName}: alerts-src \"${this.alertsSrc}\" is not a URL; ignoring it.`,\n );\n }\n this.alertsUrl = alertsBase(this.alertsEnv, null, this.ownerDocument.baseURI);\n }\n }\n\n protected override updated(): void {\n if (this.lightDom) this.syncLightAlerts();\n this.syncPrintSource();\n if (!this.noAlerts) {\n // The alerts script starts loading at once, alongside <site-alerts>' own code.\n loadAlerts(this.ownerDocument, this.alertsUrl);\n this.defineAlerts();\n }\n this.syncAnalytics();\n }\n\n /** Loads `<site-alerts>` (and registers it) on first use of the alerts. */\n protected loadAlertsUi(): Promise<unknown> {\n return import('../site-alerts/site-alerts.js');\n }\n\n private defineAlerts(): void {\n if (this.alertsUiRequested || customElements.get(ALERTS_UI)) return;\n this.alertsUiRequested = true;\n this.loadAlertsUi().catch((err) =>\n console.error(`${this.localName}: failed to load site-alerts`, err),\n );\n }\n\n /** Loads `<site-analytics>` (and registers it) on first use of `matomo-id`. */\n protected loadAnalytics(): Promise<unknown> {\n return import('../site-analytics/site-analytics.js');\n }\n\n /**\n * `matomo-id`: one `<site-analytics>`, at the very start of the render root, before Lit's\n * markers, so no render ever clears it and (being chrome) light DOM routing never moves it.\n * The element's own one-tracker guard keeps a second element or snippet from double-counting.\n */\n private syncAnalytics(): void {\n const id = Number(this.matomoId);\n if (!(id > 0)) {\n this.analytics?.remove();\n this.analytics = undefined;\n return;\n }\n if (!this.analytics) {\n // An analytics element the page has already (say the old v0.0.12 <uvalib-analytics>,\n // which does not share the one-tracker guard) records the page: don't add a second.\n if (this.ownerDocument.querySelector('site-analytics, uvalib-analytics')) return;\n const a = (this.analytics = this.ownerDocument.createElement('site-analytics'));\n this.chrome.add(a);\n if (!customElements.get('site-analytics')) {\n // Until the code arrives nothing forwards: keep what the components report meanwhile\n // (a bento search can settle first) and hand it over once the element is running.\n const buffer = bufferAnalytics(this.ownerDocument);\n this.loadAnalytics()\n .then(() => customElements.whenDefined('site-analytics'))\n .then(() => (a as HTMLElement & { updateComplete?: Promise<unknown> }).updateComplete)\n .then(\n () => buffer.flush(),\n (err) => {\n buffer.drop();\n console.error(`${this.localName}: failed to load site-analytics`, err);\n },\n );\n }\n }\n const a = this.analytics;\n if (a.getAttribute('matomoid') !== String(id)) a.setAttribute('matomoid', String(id));\n if (this.matomoUrl) a.setAttribute('matomourl', this.matomoUrl);\n else a.removeAttribute('matomourl');\n if (this.matomoDownloads) a.setAttribute('downloads', this.matomoDownloads);\n else a.removeAttribute('downloads');\n if (a.parentNode !== this.renderRoot) this.renderRoot.prepend(a);\n }\n\n /**\n * Light mode keeps <main> free of Lit parts, so the alert elements are managed here: the\n * header one is handed to <site-header> as a `slot=\"alerts\"` child (it moves it into its\n * <header>), the list band goes right after <site-header>, and regional stays the first\n * child of <main>. The band and the elements are chrome, so route() never moves them.\n */\n private syncLightAlerts(): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n if (!main || !header) return;\n if (this.noAlerts) {\n const a = this.lightAlerts;\n for (const n of a ? [a.top, a.band, a.regional] : []) n.remove();\n this.lightAlerts = undefined;\n return;\n }\n if (!this.lightAlerts) {\n const doc = this.ownerDocument;\n const make = (show: AlertShow) => {\n const a = doc.createElement(ALERTS_UI);\n a.setAttribute('show', show);\n a.setAttribute('no-shadow-dom', '');\n this.chrome.add(a);\n return a;\n };\n const top = make('header');\n top.slot = 'alerts';\n const list = make('list');\n list.addEventListener('site-alerts-change', (e) => this.onListChange(e));\n const band = doc.createElement('section');\n band.className = 'alerts-list';\n band.setAttribute('aria-label', ALERTS_LIST_LABEL);\n band.append(list);\n this.chrome.add(band);\n this.lightAlerts = { top, band, list, regional: make('regional') };\n }\n const { top, band, list, regional } = this.lightAlerts;\n for (const a of [top, list, regional]) {\n if (a.getAttribute('alerts-src') !== this.alertsUrl)\n a.setAttribute('alerts-src', this.alertsUrl);\n a.toggleAttribute('no-style', this.noStyle);\n }\n band.hidden = !this.listShown;\n if (!header.contains(top)) header.append(top);\n // Directly after <site-header>, before any Lit marker, so no part ever clears it.\n if (header.nextSibling !== band) header.after(band);\n if (main.firstChild !== regional) main.prepend(regional);\n }\n\n protected override update(changed: PropertyValues): void {\n if (this.hasUpdated || !this.lightDom) {\n super.update(changed);\n return;\n }\n const content = [...this.childNodes];\n super.update(changed); // first render appends the chrome after the content\n for (const n of this.childNodes) if (!content.includes(n)) this.chrome.add(n);\n this.route(content);\n this.observe();\n }\n\n private observe(): void {\n this.observer ??= new MutationObserver((records) => {\n for (const r of records) {\n if (r.type === 'attributes') this.reslot(r.target as Element);\n else if (r.target === this) this.route(r.addedNodes);\n }\n });\n // One call: observing the same node again would replace these options. Children added to\n // the page are routed; a content node given slot=\"breadcrumbs\" later (or losing it) moves\n // out of (or back into) <main>.\n this.observer.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n /** Light mode: a top-level content node's `slot` changed to or from `breadcrumbs`. */\n private reslot(el: Element): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n if (!main || !header || this.chrome.has(el)) return;\n if (el.parentNode === main && slotOf(el) === 'breadcrumbs') this.placeBreadcrumbs(el, header);\n else if (\n el.parentNode === this &&\n slotOf(el) !== 'breadcrumbs' &&\n main.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING\n )\n main.append(el);\n }\n\n /**\n * Light mode: a `slot=\"breadcrumbs\"` node goes after the header, the alert list band and any\n * breadcrumbs already there, before Lit's markers (so no render clears it) and `<main>`.\n */\n private placeBreadcrumbs(n: Node, header: Element): void {\n let ref: Node = header;\n for (let next = ref.nextSibling; next; next = ref.nextSibling) {\n if (next !== this.lightAlerts?.band && slotOf(next) !== 'breadcrumbs') break;\n if (next === n) return; // already in place\n ref = next;\n }\n (ref as ChildNode).after(n);\n }\n\n /**\n * Light mode has no slots: move content into `<main>`, pre-footer nodes to the footer,\n * site links and main-nav markup to the header and breadcrumbs before `<main>`.\n */\n private route(nodes: Iterable<Node>): void {\n const main = this.querySelector(':scope > main');\n const header = this.querySelector(':scope > site-header');\n const footer = this.querySelector(':scope > site-footer');\n if (!main || !header || !footer) return;\n for (const n of [...nodes]) {\n if (n.parentNode !== this || this.chrome.has(n)) continue;\n if (n.nodeType === Node.TEXT_NODE && !n.textContent?.trim()) continue;\n // The header and footer adopt their own slotted children, even before they upgrade.\n const slot = slotOf(n);\n if (slot === 'breadcrumbs') {\n this.placeBreadcrumbs(n, header);\n continue;\n }\n const to =\n slot === 'pre-footer'\n ? footer\n : slot === 'site-links' || slot === 'main-nav'\n ? header\n : main;\n to.append(n);\n }\n }\n\n private onSkip(e: Event): void {\n e.preventDefault();\n // Shadow mode: the link is in <site-header>'s skip-link slot, and the header reports it.\n if (this.lightDom) trackEvent(this, ['site-header', 'skip-link']);\n this.renderRoot.querySelector<HTMLElement>('main')?.focus();\n }\n\n protected override render() {\n const light = this.lightDom;\n // Light mode keeps <main> and <site-footer> free of Lit parts so moved content is never cleared.\n const skip = html`<a\n class=\"skip-link\"\n href=\"#main-content\"\n slot=${ifDefined(light ? undefined : 'skip-link')}\n @click=${this.onSkip}\n >Skip to main content</a\n >`;\n // Shadow mode: the link is slotted into <site-header>'s <header> landmark, because axe\n // looks the #main-content target up on the document and cannot see it in this shadow root,\n // so it would flag a skip link that sits outside every landmark (\"region\").\n // Light mode: the link stays the first child, where the target resolves.\n const alerts = !this.noAlerts && !light;\n const alert = (show: AlertShow) =>\n html`<site-alerts\n slot=${ifDefined(show === 'header' ? 'alerts' : undefined)}\n show=${show}\n alerts-src=${this.alertsUrl}\n ?no-style=${this.noStyle}\n ></site-alerts>`;\n // Shadow mode's list band; light mode builds the same in syncLightAlerts().\n const band = html`<section\n class=\"alerts-list\"\n aria-label=${ALERTS_LIST_LABEL}\n ?hidden=${!this.listShown}\n >\n <site-alerts\n show=\"list\"\n alerts-src=${this.alertsUrl}\n ?no-style=${this.noStyle}\n @site-alerts-change=${this.onListChange}\n ></site-alerts>\n </section>`;\n return html`\n ${light ? skip : nothing}\n <site-header\n exportparts=\"header\"\n ?no-shadow-dom=${light}\n ?no-style=${this.noStyle}\n variant=${this.headerVariant}\n root-link-domain=${this.rootLinkDomain}\n site-links-label=${ifDefined(this.siteLinksLabel)}\n site-name=${ifDefined(this.siteName)}\n site-name-href=${ifDefined(this.siteNameHref)}\n ?no-main-nav=${this.noMainNav}\n main-nav-label=${ifDefined(this.mainNavLabel)}\n main-nav-src=${ifDefined(this.mainNavSrc)}\n main-nav-current=${ifDefined(this.mainNavCurrent)}\n ?color-scheme-switch=${this.colorSchemeSwitch}\n >${\n light\n ? nothing\n : html`${skip}${alerts ? alert('header') : nothing}<slot\n name=\"site-links\"\n slot=\"site-links\"\n ></slot\n ><slot name=\"main-nav\" slot=\"main-nav\"></slot>`\n }</site-header\n >\n ${alerts ? band : nothing}\n ${!light && this.hasBreadcrumbs ? html`<slot name=\"breadcrumbs\"></slot>` : nothing}\n ${\n light\n ? html`<main id=\"main-content\" tabindex=\"-1\" part=\"main\"></main>`\n : html`<main id=\"main-content\" tabindex=\"-1\" part=\"main\">\n ${alerts ? alert('regional') : nothing}<slot></slot>\n </main>`\n }\n ${\n light\n ? html`<site-footer\n no-shadow-dom\n ?hidden=${this.noFooter}\n ?no-style=${this.noStyle}\n root-link-domain=${this.rootLinkDomain}\n ></site-footer>`\n : html`<site-footer\n exportparts=\"footer\"\n ?hidden=${this.noFooter}\n ?no-style=${this.noStyle}\n root-link-domain=${this.rootLinkDomain}\n ><slot name=\"pre-footer\" slot=\"pre-footer\"></slot\n ></site-footer>`\n }\n `;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SitePage } from './SitePage.js';\nimport '../site-header/site-header.js';\n// The footer sits at the bottom of the page, so it loads asynchronously.\nimport('../site-footer/site-footer.js').catch((err)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B,EAAA,CAAAE,EAAM,CAAA,GAAA0B,EAAA,WAAA,aAAA,KAAA,CAAA,GAKN5B,EAAA,CAAAE,EAAM,CAAA,GAAA0B,EAAA,WAAA,kBAAA,KAAA,CAAA,GCxRT,OAAO,mBAAgC,CAAC,OAAO,MAC7C,QAAQ,MAAM,yCAAyCU,CAAG,CAC5D,GAEA/B,EAAO,aAAaqB,CAAQ"}
|
package/dist-cdn/site-style.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e, l as t, m as n, n as r, o as i, r as a, t as o } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as s, i as c, n as l, r as u } from "./chunks/base-CHMHBPeI.js";
|
|
3
3
|
// src/components/site-style/SiteStyle.ts
|
|
4
|
-
var
|
|
4
|
+
var d = class extends o {
|
|
5
5
|
constructor(...e) {
|
|
6
6
|
super(...e), this.imports = {}, this.importedStyles = "";
|
|
7
7
|
}
|
|
@@ -9,17 +9,17 @@ var u = class extends o {
|
|
|
9
9
|
this.hostColorScheme = !1;
|
|
10
10
|
}
|
|
11
11
|
static {
|
|
12
|
-
this.styles = [
|
|
12
|
+
this.styles = [u, l];
|
|
13
13
|
}
|
|
14
14
|
installLightStyles() {
|
|
15
|
-
a("uvalib-tokens", [
|
|
15
|
+
a("uvalib-tokens", [u], {
|
|
16
16
|
root: this.ownerDocument,
|
|
17
17
|
scope: !1
|
|
18
|
-
}), a("uvalib-site-style", [
|
|
18
|
+
}), a("uvalib-site-style", [c, l], {
|
|
19
19
|
root: this.ownerDocument,
|
|
20
20
|
scope: !1,
|
|
21
21
|
layer: !1
|
|
22
|
-
});
|
|
22
|
+
}), s(this.ownerDocument);
|
|
23
23
|
}
|
|
24
24
|
firstUpdated() {
|
|
25
25
|
this.imports && !this.noStyle && Object.keys(this.imports).forEach((e) => {
|
|
@@ -37,6 +37,6 @@ var u = class extends o {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
// src/components/site-style/site-style.ts
|
|
40
|
-
r([e({ type: Object })],
|
|
40
|
+
r([e({ type: Object })], d.prototype, "imports", void 0), r([e({ type: String })], d.prototype, "importedStyles", void 0), n("site-style", d);
|
|
41
41
|
|
|
42
42
|
//# sourceMappingURL=site-style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-style.js","names":["nothing","_decorate","property","n","b","define","__decorate","A","installLightDomStyles","UvalibElement","fontFallback","base","tokens","SiteStyle","_args","imp","key","css"],"sources":["../src/components/site-style/SiteStyle.ts","../src/components/site-style/site-style.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { fontFallback } from '../../styles/font-fallback.js';\nimport { tokens } from '../../styles/tokens.js';\nimport { base } from '../../styles/base.js';\n\n/**\n * Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base page\n * styles on the document. Shadow mode only styles inside its own shadow root, so the\n * `:root` and `html, body` rules of those sheets match nothing there and the slotted content\n * is not restyled; it inherits whatever inherited tokens and fonts the page already provides.\n *\n * @tagname site-style\n * @slot - Content rendered in shadow mode; it is not restyled by this element. In light mode there is no shadow root and the children stay in place.\n * @cssprop [--uva-font-family=franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif] - Font family.\n * @cssprop [--uva-font-size-base=17px] - Base font size.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Text colour.\n * @cssprop --uva-color-text - Dark-mode role token: text colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-surface - Dark-mode role token: page background (else none).\n */\nexport class SiteStyle extends UvalibElement {\n /** The wrapped content keeps the page's own colour scheme. */\n protected static override hostColorScheme = false;\n static styles = [tokens, base];\n\n /** Map of tag name to a module URL whose default export is a stylesheet; ported as is. */\n @property({ type: Object }) imports: { [key: string]: string } = {};\n\n /**\n * Accumulated text of the stylesheets loaded through `imports`. Carried over from the old\n * component for compatibility; it is not rendered anywhere.\n */\n @property({ type: String }) importedStyles = '';\n\n /**\n * Page-level styles: unscoped; the base rules are unlayered (so they beat host resets), the tokens layered, under their own dedupe key, always on the owner\n * document (not the root node) because `:root` tokens inherit into shadow roots.\n */\n protected override installLightStyles(): void {\n // Tokens layered (host `:root` overrides win), base unlayered (beats host resets).\n installLightDomStyles('uvalib-tokens', [tokens], { root: this.ownerDocument, scope: false });\n installLightDomStyles('uvalib-site-style', [fontFallback, base], {\n root: this.ownerDocument,\n scope: false,\n layer: false,\n });\n }\n\n protected override firstUpdated(): void {\n if (this.imports && !this.noStyle) {\n Object.keys(this.imports).forEach((key) => {\n const imp = this.imports[key];\n if (imp) {\n import(/* @vite-ignore */ imp).then((css: { default: { toString(): string } }) => {\n this.importedStyles += css.default.toString().replace(/:host/, key.toLowerCase());\n });\n }\n });\n }\n }\n\n protected override render() {\n return this.lightDom ? nothing : html`<slot></slot>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SiteStyle } from './SiteStyle.js';\n\ndefine('site-style', SiteStyle);\n"],"mappings":";;;AAsBA,
|
|
1
|
+
{"version":3,"file":"site-style.js","names":["nothing","_decorate","property","n","b","define","__decorate","A","installLightDomStyles","UvalibElement","loadFontFallback","fontFallback","base","tokens","SiteStyle","_args","imp","key","css"],"sources":["../src/components/site-style/SiteStyle.ts","../src/components/site-style/site-style.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { fontFallback, loadFontFallback } from '../../styles/font-fallback.js';\nimport { tokens } from '../../styles/tokens.js';\nimport { base } from '../../styles/base.js';\n\n/**\n * Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base page\n * styles on the document. Shadow mode only styles inside its own shadow root, so the\n * `:root` and `html, body` rules of those sheets match nothing there and the slotted content\n * is not restyled; it inherits whatever inherited tokens and fonts the page already provides.\n *\n * @tagname site-style\n * @slot - Content rendered in shadow mode; it is not restyled by this element. In light mode there is no shadow root and the children stay in place.\n * @cssprop [--uva-font-family=franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif] - Font family.\n * @cssprop [--uva-font-size-base=17px] - Base font size.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Text colour.\n * @cssprop --uva-color-text - Dark-mode role token: text colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-surface - Dark-mode role token: page background (else none).\n */\nexport class SiteStyle extends UvalibElement {\n /** The wrapped content keeps the page's own colour scheme. */\n protected static override hostColorScheme = false;\n static styles = [tokens, base];\n\n /** Map of tag name to a module URL whose default export is a stylesheet; ported as is. */\n @property({ type: Object }) imports: { [key: string]: string } = {};\n\n /**\n * Accumulated text of the stylesheets loaded through `imports`. Carried over from the old\n * component for compatibility; it is not rendered anywhere.\n */\n @property({ type: String }) importedStyles = '';\n\n /**\n * Page-level styles: unscoped; the base rules are unlayered (so they beat host resets), the tokens layered, under their own dedupe key, always on the owner\n * document (not the root node) because `:root` tokens inherit into shadow roots.\n */\n protected override installLightStyles(): void {\n // Tokens layered (host `:root` overrides win), base unlayered (beats host resets).\n installLightDomStyles('uvalib-tokens', [tokens], { root: this.ownerDocument, scope: false });\n installLightDomStyles('uvalib-site-style', [fontFallback, base], {\n root: this.ownerDocument,\n scope: false,\n layer: false,\n });\n loadFontFallback(this.ownerDocument);\n }\n\n protected override firstUpdated(): void {\n if (this.imports && !this.noStyle) {\n Object.keys(this.imports).forEach((key) => {\n const imp = this.imports[key];\n if (imp) {\n import(/* @vite-ignore */ imp).then((css: { default: { toString(): string } }) => {\n this.importedStyles += css.default.toString().replace(/:host/, key.toLowerCase());\n });\n }\n });\n }\n }\n\n protected override render() {\n return this.lightDom ? nothing : html`<slot></slot>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SiteStyle } from './SiteStyle.js';\n\ndefine('site-style', SiteStyle);\n"],"mappings":";;;AAsBA,IAAac,IAAb,cAA+BL,EAAc;;EAYE,A,aANoB,KAAA,UAAA,CAAC,GAMrB,KAAA,iBAAA;;;EAVD,KAAA,kBAAA;;;EAC5B,KAAA,SAAA,CAACI,GAAQD,CAAI;;CAe7B,qBAA8C;EAQ5C,AANAJ,EAAsB,iBAAiB,CAACK,CAAM,GAAG;GAAE,MAAM,KAAK;GAAe,OAAO;EAAM,CAAC,GAC3FL,EAAsB,qBAAqB,CAACG,GAAcC,CAAI,GAAG;GAC/D,MAAM,KAAK;GACX,OAAO;GACP,OAAO;EACT,CAAC,GACDF,EAAiB,KAAK,aAAa;CACrC;CAEA,eAAwC;EACtC,AAAI,KAAK,WAAW,CAAC,KAAK,WACxB,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,SAAS,MAAQ;GACzC,IAAMM,IAAM,KAAK,QAAQC;GACzB,AAAID,KACF;;IAA0BA;CAAI,CAAC,MAAM,MAA6C;IAChF,KAAK,kBAAkBE,EAAI,QAAQ,SAAS,CAAC,CAAC,QAAQ,SAASD,EAAI,YAAY,CAAC;GAClF,CAAC;EAEL,CAAC;CAEL;CAEA,SAA4B;EAC1B,OAAO,KAAK,WAAWjB,IAAU,CAAI;CACvC;AACF;;AAvCGC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAY,EAAA,WAAA,WAAA,KAAA,CAAA,GAMzBb,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAY,EAAA,WAAA,kBAAA,KAAA,CAAA,GC/B5BT,EAAO,cAAcS,CAAS"}
|