@uvalib/web-components 0.0.0-stage → 1.0.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 +162 -0
- package/README.md +1164 -2
- package/bin/install-skill.mjs +139 -0
- package/dist/base/UvalibElement.d.ts +21 -0
- package/dist/base/UvalibElement.js +68 -0
- package/dist/base/UvalibElement.js.map +1 -0
- package/dist/base/analytics.d.ts +44 -0
- package/dist/base/analytics.js +59 -0
- package/dist/base/analytics.js.map +1 -0
- package/dist/base/color-scheme.d.ts +93 -0
- package/dist/base/color-scheme.js +267 -0
- package/dist/base/color-scheme.js.map +1 -0
- package/dist/base/define.d.ts +2 -0
- package/dist/base/define.js +6 -0
- package/dist/base/define.js.map +1 -0
- package/dist/base/heading-level.d.ts +12 -0
- package/dist/base/heading-level.js +52 -0
- package/dist/base/heading-level.js.map +1 -0
- package/dist/base/light-dom-styles.d.ts +18 -0
- package/dist/base/light-dom-styles.js +134 -0
- package/dist/base/light-dom-styles.js.map +1 -0
- package/dist/base.css +30 -0
- package/dist/base.d.ts +5 -0
- package/dist/base.js +5 -0
- package/dist/base.js.map +1 -0
- package/dist/components/bento-box/ArticlesSection.d.ts +19 -0
- package/dist/components/bento-box/ArticlesSection.js +22 -0
- package/dist/components/bento-box/ArticlesSection.js.map +1 -0
- package/dist/components/bento-box/BentoBox.d.ts +85 -0
- package/dist/components/bento-box/BentoBox.js +366 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -0
- package/dist/components/bento-box/BentoSection.d.ts +115 -0
- package/dist/components/bento-box/BentoSection.js +468 -0
- package/dist/components/bento-box/BentoSection.js.map +1 -0
- package/dist/components/bento-box/CatalogSection.d.ts +18 -0
- package/dist/components/bento-box/CatalogSection.js +19 -0
- package/dist/components/bento-box/CatalogSection.js.map +1 -0
- package/dist/components/bento-box/LibGuidesSection.d.ts +24 -0
- package/dist/components/bento-box/LibGuidesSection.js +73 -0
- package/dist/components/bento-box/LibGuidesSection.js.map +1 -0
- package/dist/components/bento-box/VirgoSection.d.ts +19 -0
- package/dist/components/bento-box/VirgoSection.js +58 -0
- package/dist/components/bento-box/VirgoSection.js.map +1 -0
- package/dist/components/bento-box/WebsiteSection.d.ts +25 -0
- package/dist/components/bento-box/WebsiteSection.js +40 -0
- package/dist/components/bento-box/WebsiteSection.js.map +1 -0
- package/dist/components/bento-box/bento-box.d.ts +1 -0
- package/dist/components/bento-box/bento-box.js +13 -0
- package/dist/components/bento-box/bento-box.js.map +1 -0
- package/dist/components/bento-box/bento-data.d.ts +147 -0
- package/dist/components/bento-box/bento-data.js +422 -0
- package/dist/components/bento-box/bento-data.js.map +1 -0
- package/dist/components/events-section/EventsSection.d.ts +91 -0
- package/dist/components/events-section/EventsSection.js +435 -0
- package/dist/components/events-section/EventsSection.js.map +1 -0
- package/dist/components/events-section/events-data.d.ts +90 -0
- package/dist/components/events-section/events-data.js +174 -0
- package/dist/components/events-section/events-data.js.map +1 -0
- package/dist/components/events-section/events-section.d.ts +1 -0
- package/dist/components/events-section/events-section.js +4 -0
- package/dist/components/events-section/events-section.js.map +1 -0
- package/dist/components/library-hours/hours-data.d.ts +104 -0
- package/dist/components/library-hours/hours-data.js +267 -0
- package/dist/components/library-hours/hours-data.js.map +1 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.d.ts +21 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js +59 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js.map +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.d.ts +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.js +5 -0
- package/dist/components/library-hours-setup/library-hours-setup.js.map +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +107 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +502 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.d.ts +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js +4 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js.map +1 -0
- package/dist/components/link.d.ts +2 -0
- package/dist/components/link.js +7 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalytics.d.ts +44 -0
- package/dist/components/site-analytics/SiteAnalytics.js +161 -0
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.d.ts +8 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js +22 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js.map +1 -0
- package/dist/components/site-analytics/site-analytics.d.ts +1 -0
- package/dist/components/site-analytics/site-analytics.js +4 -0
- package/dist/components/site-analytics/site-analytics.js.map +1 -0
- package/dist/components/site-footer/SiteFooter.d.ts +34 -0
- package/dist/components/site-footer/SiteFooter.js +275 -0
- package/dist/components/site-footer/SiteFooter.js.map +1 -0
- package/dist/components/site-footer/icons.d.ts +4 -0
- package/dist/components/site-footer/icons.js +7 -0
- package/dist/components/site-footer/icons.js.map +1 -0
- package/dist/components/site-footer/site-footer.d.ts +1 -0
- package/dist/components/site-footer/site-footer.js +4 -0
- package/dist/components/site-footer/site-footer.js.map +1 -0
- package/dist/components/site-header/SiteHeader.d.ts +154 -0
- package/dist/components/site-header/SiteHeader.js +845 -0
- package/dist/components/site-header/SiteHeader.js.map +1 -0
- package/dist/components/site-header/site-header.d.ts +1 -0
- package/dist/components/site-header/site-header.js +12 -0
- package/dist/components/site-header/site-header.js.map +1 -0
- package/dist/components/site-hours-section/SiteHoursSection.d.ts +63 -0
- package/dist/components/site-hours-section/SiteHoursSection.js +243 -0
- package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -0
- package/dist/components/site-hours-section/site-hours-section.d.ts +1 -0
- package/dist/components/site-hours-section/site-hours-section.js +4 -0
- package/dist/components/site-hours-section/site-hours-section.js.map +1 -0
- package/dist/components/site-main-nav/SiteMainNav.d.ts +136 -0
- package/dist/components/site-main-nav/SiteMainNav.js +678 -0
- package/dist/components/site-main-nav/SiteMainNav.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-data.d.ts +5 -0
- package/dist/components/site-main-nav/main-nav-data.js +90 -0
- package/dist/components/site-main-nav/main-nav-data.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-items.d.ts +49 -0
- package/dist/components/site-main-nav/main-nav-items.js +138 -0
- package/dist/components/site-main-nav/main-nav-items.js.map +1 -0
- package/dist/components/site-main-nav/site-main-nav.d.ts +1 -0
- package/dist/components/site-main-nav/site-main-nav.js +4 -0
- package/dist/components/site-main-nav/site-main-nav.js.map +1 -0
- package/dist/components/site-page/SitePage.d.ts +145 -0
- package/dist/components/site-page/SitePage.js +480 -0
- package/dist/components/site-page/SitePage.js.map +1 -0
- package/dist/components/site-page/alerts.d.ts +24 -0
- package/dist/components/site-page/alerts.js +78 -0
- package/dist/components/site-page/alerts.js.map +1 -0
- package/dist/components/site-page/site-page.d.ts +1 -0
- package/dist/components/site-page/site-page.js +7 -0
- package/dist/components/site-page/site-page.js.map +1 -0
- package/dist/components/site-style/SiteStyle.d.ts +37 -0
- package/dist/components/site-style/SiteStyle.js +76 -0
- package/dist/components/site-style/SiteStyle.js.map +1 -0
- package/dist/components/site-style/site-style.d.ts +1 -0
- package/dist/components/site-style/site-style.js +4 -0
- package/dist/components/site-style/site-style.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.d.ts +10 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js +11 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.d.ts +13 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js +25 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js.map +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.d.ts +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js +4 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js.map +1 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +46 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +339 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.d.ts +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js +4 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js.map +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +73 -0
- package/dist/components/uvalib-filter/UvalibFilter.js +279 -0
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.d.ts +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.js +4 -0
- package/dist/components/uvalib-filter/uvalib-filter.js.map +1 -0
- package/dist/custom-elements.json +15178 -0
- package/dist/data/fetch-json.d.ts +28 -0
- package/dist/data/fetch-json.js +43 -0
- package/dist/data/fetch-json.js.map +1 -0
- package/dist/data/new-york.d.ts +5 -0
- package/dist/data/new-york.js +23 -0
- package/dist/data/new-york.js.map +1 -0
- package/dist/data/sites.d.ts +12 -0
- package/dist/data/sites.js +89 -0
- package/dist/data/sites.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/accessible.d.ts +1 -0
- package/dist/styles/accessible.js +37 -0
- package/dist/styles/accessible.js.map +1 -0
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/base.js +41 -0
- package/dist/styles/base.js.map +1 -0
- package/dist/styles/color-scheme.d.ts +1 -0
- package/dist/styles/color-scheme.js +81 -0
- package/dist/styles/color-scheme.js.map +1 -0
- package/dist/styles/tokens.d.ts +1 -0
- package/dist/styles/tokens.js +85 -0
- package/dist/styles/tokens.js.map +1 -0
- package/dist/styles/w3-subset.d.ts +1 -0
- package/dist/styles/w3-subset.js +33 -0
- package/dist/styles/w3-subset.js.map +1 -0
- package/dist/tokens.css +152 -0
- package/dist-cdn/base.css +30 -0
- package/dist-cdn/bento-box.js +1023 -0
- package/dist-cdn/bento-box.js.map +1 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +174 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +1 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js +695 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +1 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js +40 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js.map +1 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js +55 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +1 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js +117 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js.map +1 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js +25 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js.map +1 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js +31 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js.map +1 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js +181 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +1 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js +346 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +1 -0
- package/dist-cdn/chunks/link-DbJSwj16.js +7 -0
- package/dist-cdn/chunks/link-DbJSwj16.js.map +1 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js +18 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js.map +1 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js +101 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js.map +1 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js +802 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +1 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js +605 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +1 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js +22 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js.map +1 -0
- package/dist-cdn/custom-elements.json +15178 -0
- package/dist-cdn/events-section.js +401 -0
- package/dist-cdn/events-section.js.map +1 -0
- package/dist-cdn/library-hours-setup.js +28 -0
- package/dist-cdn/library-hours-setup.js.map +1 -0
- package/dist-cdn/library-weekly-hours.js +1 -0
- package/dist-cdn/manifest.json +23 -0
- package/dist-cdn/site-analytics.js +6 -0
- package/dist-cdn/site-analytics.js.map +1 -0
- package/dist-cdn/site-footer.js +267 -0
- package/dist-cdn/site-footer.js.map +1 -0
- package/dist-cdn/site-header.js +1 -0
- package/dist-cdn/site-hours-section.js +145 -0
- package/dist-cdn/site-hours-section.js.map +1 -0
- package/dist-cdn/site-main-nav.js +1 -0
- package/dist-cdn/site-page.js +317 -0
- package/dist-cdn/site-page.js.map +1 -0
- package/dist-cdn/site-style.js +42 -0
- package/dist-cdn/site-style.js.map +1 -0
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +276 -0
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +631 -0
- package/dist-cdn/skills/uvalib-web-components/reference/migration.md +52 -0
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +147 -0
- package/dist-cdn/tokens.css +152 -0
- package/dist-cdn/uvalib-analytics.js +6 -0
- package/dist-cdn/uvalib-analytics.js.map +1 -0
- package/dist-cdn/uvalib-date-range.js +262 -0
- package/dist-cdn/uvalib-date-range.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +184 -0
- package/dist-cdn/uvalib-filter.js.map +1 -0
- package/package.json +152 -4
- package/skills/uvalib-web-components/SKILL.md +276 -0
- package/skills/uvalib-web-components/reference/components.md +631 -0
- package/skills/uvalib-web-components/reference/migration.md +52 -0
- package/skills/uvalib-web-components/reference/snippets.md +147 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Migrating to @uvalib/web-components
|
|
2
|
+
|
|
3
|
+
The five page-chrome elements (`site-page`, `site-header`, `site-footer`, `site-analytics`, `site-style`) keep their tag names and the attributes `root-link-domain`, `no-shadow-dom` and `no-style`, and the three library-hours elements (`site-hours-section`, `library-weekly-hours`, `library-hours-setup`) keep their tag names, attributes and markup, as do `events-section` and `bento-box` (with its `catalog-section`, `articles-section`, `libguides-section` and `website-section`) from `@uvalib/bento-box`. Only the URLs and package names change.
|
|
4
|
+
|
|
5
|
+
## CDN URLs
|
|
6
|
+
|
|
7
|
+
Base: `https://unpkg.internal.lib.virginia.edu/web-components/`. Pick the major alias `v1` (updates within the major) or an exact version `vX.Y.Z` (immutable). Never use `latest/` or `cdn-v*/` for new work.
|
|
8
|
+
|
|
9
|
+
| Old | New |
|
|
10
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `/web-components/latest/@uvalib/site-page/site-page.js` | `/web-components/v1/site-page.js` |
|
|
12
|
+
| `/web-components/latest/@uvalib/site-header/site-header.js` | `/web-components/v1/site-header.js` |
|
|
13
|
+
| `/web-components/latest/@uvalib/site-footer/site-footer.js` | `/web-components/v1/site-footer.js` |
|
|
14
|
+
| `/web-components/latest/@uvalib/site-analytics/site-analytics.js` | `/web-components/v1/site-analytics.js` |
|
|
15
|
+
| `/v0.0.12/uvalib-analytics.js` (or any `/vX.Y.Z/uvalib-analytics.js` outside `/web-components/`) | `/web-components/v1/uvalib-analytics.js` (same markup, `<uvalib-analytics matomoid="10">`; events are queued until Matomo loads and a page never counts twice) |
|
|
16
|
+
| `/web-components/latest/@uvalib/site-style/site-style.js` | `/web-components/v1/site-style.js` |
|
|
17
|
+
| `/web-components/cdn-vX.Y.Z/@uvalib/<pkg>/<file>.js` | `/web-components/v1/<tag>.js`, or `/web-components/v1.0.0/<tag>.js` to pin (the old cdn-v number does not map to a new version) |
|
|
18
|
+
| `/web-components/<latest or cdn-vX.Y.Z>/@uvalib/site-hours/<file>.js` | `/web-components/v1/<file>.js` for `site-hours-section`, `library-weekly-hours` and `library-hours-setup` (same markup); `library-daily-hours` is not migrated |
|
|
19
|
+
| `/web-components/<latest or cdn-vX.Y.Z>/@uvalib/bento-box/events-section.js`, or `unpkg.com/@uvalib/cdn-builds@1.0.2/build/events-section.js` | `/web-components/v1/events-section.js` (same markup; card headings follow the page's headings, and the inline `max-title-length` script can go) |
|
|
20
|
+
| `/web-components/<latest or cdn-vX.Y.Z>/@uvalib/bento-box/bento-box.js` | `/web-components/v1/bento-box.js` (same markup, `<bento-box no-style no-shadow-dom limit="3">`; it registers the four sections; `?query=` links keep working, new searches use `?q=`) |
|
|
21
|
+
| any other `/web-components/latest/@uvalib/<pkg>/<file>.js` | `/web-components/v1/<pkg>.js` when `<pkg>` is one of the five page-chrome tags; other packages (`bento-box`'s dead sections such as `people-section` or `mlb-section`, `site-menu-bar`, ...) are not migrated, leave their URLs alone |
|
|
22
|
+
|
|
23
|
+
Pattern: the new file is named after the element, `/web-components/v1/<tag>.js` (or an exact `vA.B.C`). For the page-chrome packages the tag is the package name (`@uvalib/site-page/site-page.js` becomes `v1/site-page.js`); for `@uvalib/site-hours` it is the file name (`@uvalib/site-hours/library-hours-setup.js` becomes `v1/library-hours-setup.js`; there is no `v1/site-hours.js`).
|
|
24
|
+
|
|
25
|
+
Notes:
|
|
26
|
+
|
|
27
|
+
- `site-page.js` also loads the header and footer, so separate script tags for `site-header` and `site-footer` are not needed.
|
|
28
|
+
- Shared stylesheets: `/web-components/v1/tokens.css` and `/web-components/v1/base.css`.
|
|
29
|
+
- 11ty sites using the `11ty-template` custom-elements plugin get the new URLs through the plugin; its `webComponentsVersion` option defaults to `"1"`.
|
|
30
|
+
|
|
31
|
+
## npm package names
|
|
32
|
+
|
|
33
|
+
| Old | New |
|
|
34
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| `@uvalib/site-page` | `@uvalib/web-components`, `import '@uvalib/web-components/site-page.js'` |
|
|
36
|
+
| `@uvalib/site-header` | `import '@uvalib/web-components/site-header.js'` |
|
|
37
|
+
| `@uvalib/site-footer` | `import '@uvalib/web-components/site-footer.js'` |
|
|
38
|
+
| `@uvalib/site-analytics` | `import '@uvalib/web-components/site-analytics.js'` |
|
|
39
|
+
| `@uvalib/uvalib-analytics` | `import '@uvalib/web-components/uvalib-analytics.js'`; `UvalibAnalyticsMixin` (`_analyticsEvent`, `_analyticsSearch`) from `@uvalib/web-components` |
|
|
40
|
+
| `@uvalib/site-style` | `import '@uvalib/web-components/site-style.js'` |
|
|
41
|
+
| `@uvalib/site-hours` | `import '@uvalib/web-components/site-hours-section.js'` (or `library-weekly-hours.js`, `library-hours-setup.js`) |
|
|
42
|
+
| `@uvalib/bento-box` (`events-section`) | `import '@uvalib/web-components/events-section.js'` |
|
|
43
|
+
| `@uvalib/bento-box` (`bento-box`) | `import '@uvalib/web-components/bento-box.js'` |
|
|
44
|
+
| `webSiteInfo` (site registry) | internal to `site-analytics`; not exported. Do not import it; pass `matomoid` to `<site-analytics>` if the URL-based lookup is not enough |
|
|
45
|
+
|
|
46
|
+
Importing `@uvalib/web-components` itself returns classes only and registers nothing; use the define entries above.
|
|
47
|
+
|
|
48
|
+
## Markup changes to make while migrating
|
|
49
|
+
|
|
50
|
+
- Delete any hand-written `<main>`, `role="main"`, skip link, header or footer: `<site-page>` renders them.
|
|
51
|
+
- `<site-style no-shadow-dom>` still works (it installs tokens and base styles); new pages do not need it.
|
|
52
|
+
- Look for `no-shadow-dom` that was added only as a workaround; keep it only if the host CSS should own the styling.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Page snippets
|
|
2
|
+
|
|
3
|
+
Complete pages, all loading from the CDN major alias `v1` (replace `v1` with `vX.Y.Z` to pin). Each is exercised by the repo's snippet test.
|
|
4
|
+
|
|
5
|
+
Host CSS owns the styling (`no-shadow-dom`):
|
|
6
|
+
|
|
7
|
+
```html snippet
|
|
8
|
+
<!doctype html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="utf-8" />
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
13
|
+
<title>Host-styled page</title>
|
|
14
|
+
<style>
|
|
15
|
+
/* Unlayered host CSS wins over the components' @layer uvalib styles. */
|
|
16
|
+
site-header a {
|
|
17
|
+
color: #232d4b;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
<link
|
|
21
|
+
rel="stylesheet"
|
|
22
|
+
href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css"
|
|
23
|
+
/>
|
|
24
|
+
<script
|
|
25
|
+
type="module"
|
|
26
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
|
|
27
|
+
></script>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<site-page no-shadow-dom>
|
|
31
|
+
<h1>Host-styled page</h1>
|
|
32
|
+
<p>The site stylesheet styles the header, footer and content.</p>
|
|
33
|
+
</site-page>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Existing page with a sidebar nav and its own `<main>`: delete the page's `<main>`, header and footer, and keep the sidebar and article as plain children:
|
|
39
|
+
|
|
40
|
+
```html snippet
|
|
41
|
+
<!doctype html>
|
|
42
|
+
<html lang="en">
|
|
43
|
+
<head>
|
|
44
|
+
<meta charset="utf-8" />
|
|
45
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
46
|
+
<title>Page with sidebar</title>
|
|
47
|
+
<link
|
|
48
|
+
rel="stylesheet"
|
|
49
|
+
href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css"
|
|
50
|
+
/>
|
|
51
|
+
<script
|
|
52
|
+
type="module"
|
|
53
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
|
|
54
|
+
></script>
|
|
55
|
+
</head>
|
|
56
|
+
<body>
|
|
57
|
+
<site-page>
|
|
58
|
+
<div class="layout">
|
|
59
|
+
<nav aria-label="Section">
|
|
60
|
+
<ul>
|
|
61
|
+
<li><a href="/a">Section A</a></li>
|
|
62
|
+
<li><a href="/b">Section B</a></li>
|
|
63
|
+
</ul>
|
|
64
|
+
</nav>
|
|
65
|
+
<article>
|
|
66
|
+
<h1>Page with sidebar</h1>
|
|
67
|
+
<p>Article content.</p>
|
|
68
|
+
</article>
|
|
69
|
+
</div>
|
|
70
|
+
</site-page>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Vendor or third-party site:
|
|
76
|
+
|
|
77
|
+
```html snippet
|
|
78
|
+
<!doctype html>
|
|
79
|
+
<html lang="en">
|
|
80
|
+
<head>
|
|
81
|
+
<meta charset="utf-8" />
|
|
82
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
83
|
+
<title>Vendor-hosted page</title>
|
|
84
|
+
<link
|
|
85
|
+
rel="stylesheet"
|
|
86
|
+
href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css"
|
|
87
|
+
/>
|
|
88
|
+
<script
|
|
89
|
+
type="module"
|
|
90
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
|
|
91
|
+
></script>
|
|
92
|
+
</head>
|
|
93
|
+
<body>
|
|
94
|
+
<site-page header-variant="vendor">
|
|
95
|
+
<h1>Vendor-hosted page</h1>
|
|
96
|
+
<p>Logo and Ask a Librarian only in the header.</p>
|
|
97
|
+
</site-page>
|
|
98
|
+
</body>
|
|
99
|
+
</html>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Analytics. `<site-analytics>` listens for `site-analytics-event`, `site-analytics-search` and `site-analytics-pageview` on `document` (and the original `uvalib-analytics-*` names). Events go through Matomo's `_paq` queue, so one fired before Matomo has loaded is kept; dispatch them normally from a user action such as a search submit. The Matomo property id is found from the page URL for registered library sites; otherwise add `matomoid="N"`, or use `<site-page matomo-id="N">` instead of the element. The snippet tests answer matomo.js with a stub, so nothing reaches real Matomo.
|
|
103
|
+
|
|
104
|
+
```html snippet
|
|
105
|
+
<!doctype html>
|
|
106
|
+
<html lang="en">
|
|
107
|
+
<head>
|
|
108
|
+
<meta charset="utf-8" />
|
|
109
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
110
|
+
<title>Search with analytics</title>
|
|
111
|
+
<link
|
|
112
|
+
rel="stylesheet"
|
|
113
|
+
href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css"
|
|
114
|
+
/>
|
|
115
|
+
<script
|
|
116
|
+
type="module"
|
|
117
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
|
|
118
|
+
></script>
|
|
119
|
+
<script
|
|
120
|
+
type="module"
|
|
121
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-analytics.js"
|
|
122
|
+
></script>
|
|
123
|
+
</head>
|
|
124
|
+
<body>
|
|
125
|
+
<site-page>
|
|
126
|
+
<site-analytics></site-analytics>
|
|
127
|
+
<h1>Search</h1>
|
|
128
|
+
<form id="search">
|
|
129
|
+
<input name="q" aria-label="Search" />
|
|
130
|
+
<button>Search</button>
|
|
131
|
+
</form>
|
|
132
|
+
<script type="module">
|
|
133
|
+
await customElements.whenDefined('site-analytics');
|
|
134
|
+
document.querySelector('#search').addEventListener('submit', (e) => {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
const q = new FormData(e.target).get('q');
|
|
137
|
+
document.dispatchEvent(
|
|
138
|
+
new CustomEvent('site-analytics-search', {
|
|
139
|
+
detail: { searchQuery: q, resultCount: 0 },
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
</script>
|
|
144
|
+
</site-page>
|
|
145
|
+
</body>
|
|
146
|
+
</html>
|
|
147
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
|
|
2
|
+
:root {
|
|
3
|
+
--uva-brand-blue-lightest: #87B9D9;
|
|
4
|
+
--uva-brand-blue-lighter: #3395D4;
|
|
5
|
+
--uva-brand-blue-light: #0370B7;
|
|
6
|
+
--uva-brand-blue-base: #232D4B;
|
|
7
|
+
--uva-brand-blue-300: #87B9D9;
|
|
8
|
+
--uva-brand-blue-200: #3395D4;
|
|
9
|
+
--uva-brand-blue-100: #0370B7;
|
|
10
|
+
--uva-brand-blue: #232D4B;
|
|
11
|
+
--uva-brand-orange-lightest: #FFEAD6;
|
|
12
|
+
--uva-brand-orange-lighter: #FFC999;
|
|
13
|
+
--uva-brand-orange-light: #FFB370;
|
|
14
|
+
--uva-brand-orange-base: #E57200;
|
|
15
|
+
--uva-brand-orange-dark: #B35900;
|
|
16
|
+
--uva-brand-orange-darker: #854200;
|
|
17
|
+
--uva-brand-orange-300: #FFEAD6;
|
|
18
|
+
--uva-brand-orange-200: #FFC999;
|
|
19
|
+
--uva-brand-orange-100: #FFB370;
|
|
20
|
+
--uva-brand-orange: #E57200;
|
|
21
|
+
--uva-brand-orange-A: #B35900;
|
|
22
|
+
--uva-brand-orange-B: #854200;
|
|
23
|
+
--uva-blue-alt-lightest: #BFE7F7;
|
|
24
|
+
--uva-blue-alt-lighter: #91D8F2;
|
|
25
|
+
--uva-blue-alt-light: #55C4EC;
|
|
26
|
+
--uva-blue-alt-base: #007BAC;
|
|
27
|
+
--uva-blue-alt-dark: #005679;
|
|
28
|
+
--uva-blue-alt-darkest: #141E3C;
|
|
29
|
+
--uva-blue-alt-400: #e6f2f7;
|
|
30
|
+
--uva-blue-alt-300: #BFE7F7;
|
|
31
|
+
--uva-blue-alt-200: #91D8F2;
|
|
32
|
+
--uva-blue-alt-100: #55C4EC;
|
|
33
|
+
--uva-blue-alt: #007BAC;
|
|
34
|
+
--uva-blue-alt-A: #005679;
|
|
35
|
+
--uva-blue-alt-B: #141E3C;
|
|
36
|
+
--uva-teal-lightest: #C8F2F4;
|
|
37
|
+
--uva-teal-light: #5BD7DE;
|
|
38
|
+
--uva-teal-base: #25CAD3;
|
|
39
|
+
--uva-teal-dark: #1DA1A8;
|
|
40
|
+
--uva-teal-darker: #16777C;
|
|
41
|
+
--uva-teal-200: #C8F2F4;
|
|
42
|
+
--uva-teal-100: #5BD7DE;
|
|
43
|
+
--uva-teal: #25CAD3;
|
|
44
|
+
--uva-teal-A: #1DA1A8;
|
|
45
|
+
--uva-teal-B: #16777C;
|
|
46
|
+
--uva-green-lightest: #DDEFDC;
|
|
47
|
+
--uva-green-lighter: #89CC74;
|
|
48
|
+
--uva-green-base: #62BB46;
|
|
49
|
+
--uva-green-dark: #4E9737;
|
|
50
|
+
--uva-green-200: #DDEFDC;
|
|
51
|
+
--uva-green-100: #89CC74;
|
|
52
|
+
--uva-green: #62BB46;
|
|
53
|
+
--uva-green-A: #4E9737;
|
|
54
|
+
--uva-red-lightest: #FBCFDA;
|
|
55
|
+
--uva-red-base: #EF3F6B;
|
|
56
|
+
--uva-red-dark: #DF1E43;
|
|
57
|
+
--uva-red-darker: #B30000;
|
|
58
|
+
--uva-red-100: #FBCFDA;
|
|
59
|
+
--uva-red: #EF3F6B;
|
|
60
|
+
--uva-red-A: #DF1E43;
|
|
61
|
+
--uva-red-B: #B30000;
|
|
62
|
+
--uva-yellow-lightest: #FEF6C8;
|
|
63
|
+
--uva-yellow-base: #ECC602;
|
|
64
|
+
--uva-yellow-dark: #B99C02;
|
|
65
|
+
--uva-yellow-100: #FEF6C8;
|
|
66
|
+
--uva-yellow: #ECC602;
|
|
67
|
+
--uva-yellow-A: #B99C02;
|
|
68
|
+
--uva-grey-lightest: #F1F1F1;
|
|
69
|
+
--uva-grey-light: #DADADA;
|
|
70
|
+
--uva-grey-base: #808080;
|
|
71
|
+
--uva-grey-dark: #4F4F4F;
|
|
72
|
+
--uva-grey-darkest: #2B2B2B;
|
|
73
|
+
--uva-grey-200: #F1F1F1;
|
|
74
|
+
--uva-grey-100: #DADADA;
|
|
75
|
+
--uva-grey-50: #ADADAD;
|
|
76
|
+
--uva-grey: #808080;
|
|
77
|
+
--uva-grey-A: #4F4F4F;
|
|
78
|
+
--uva-grey-B: #2B2B2B;
|
|
79
|
+
--uva-font-family: franklin-gothic-urw, Arial, Helvetica, sans-serif;
|
|
80
|
+
--uva-font-size-base: 17px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@supports (color: light-dark(#000, #fff)) {
|
|
85
|
+
:root[data-uva-color-scheme] {
|
|
86
|
+
--uva-color-surface: light-dark(#ffffff, #10172b);
|
|
87
|
+
--uva-color-surface-raised: light-dark(#ffffff, #232d4b);
|
|
88
|
+
--uva-color-surface-hover: light-dark(var(--uva-grey-100, #dadada), #2c3858);
|
|
89
|
+
--uva-color-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #e8e8e8);
|
|
90
|
+
--uva-color-text-muted: light-dark(#4b5563, #adadad);
|
|
91
|
+
--uva-color-link: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);
|
|
92
|
+
--uva-color-utility-link: light-dark(var(--uva-blue-alt-dark, #005679), #91d8f2);
|
|
93
|
+
--uva-color-focus: light-dark(var(--uva-brand-orange, #e57200), #ffb370);
|
|
94
|
+
--uva-color-current: light-dark(var(--uva-brand-orange, #e57200), #e57200);
|
|
95
|
+
--uva-color-accent-bg: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);
|
|
96
|
+
--uva-color-on-accent: light-dark(#ffffff, #10172b);
|
|
97
|
+
--uva-color-control-border: light-dark(var(--uva-grey, #808080), #7a84a0);
|
|
98
|
+
--uva-color-input-text: light-dark(#1f2937, #e8e8e8);
|
|
99
|
+
--uva-color-track: light-dark(#e5e7eb, #2c3858);
|
|
100
|
+
--uva-color-shadow: light-dark(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
|
|
101
|
+
--uva-color-pre-footer-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #005679);
|
|
102
|
+
--uva-color-pre-footer-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);
|
|
103
|
+
}
|
|
104
|
+
:root[data-uva-color-scheme='system'] {
|
|
105
|
+
color-scheme: light dark;
|
|
106
|
+
--uva-color-scheme: light dark;
|
|
107
|
+
}
|
|
108
|
+
:root[data-uva-color-scheme='light'] {
|
|
109
|
+
color-scheme: light;
|
|
110
|
+
--uva-color-scheme: light;
|
|
111
|
+
}
|
|
112
|
+
:root[data-uva-color-scheme='dark'] {
|
|
113
|
+
color-scheme: dark;
|
|
114
|
+
--uva-color-scheme: dark;
|
|
115
|
+
|
|
116
|
+
--uva-color-border: #7a84a0;
|
|
117
|
+
--uvalib-alerts-text: #e8e8e8;
|
|
118
|
+
--uvalib-alerts-header-bg: #0e4a57;
|
|
119
|
+
--uvalib-alerts-alert1-bg: #4a1622;
|
|
120
|
+
--uvalib-alerts-alert1-border: #ef3f6b;
|
|
121
|
+
--uvalib-alerts-alert2-bg: #3d3510;
|
|
122
|
+
--uvalib-alerts-alert2-border: #ecc602;
|
|
123
|
+
--uvalib-alerts-alert3-bg: #0d3247;
|
|
124
|
+
--uvalib-alerts-alert3-border: #55c4ec;
|
|
125
|
+
--uvalib-alerts-regional-bg: #0f3a3d;
|
|
126
|
+
--uvalib-alerts-regional-border: 0.2em solid #25cad3;
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
:root[data-uva-color-scheme='dark'] [slot='pre-footer'] a {
|
|
130
|
+
color: var(--uva-color-pre-footer-text, #ffffff);
|
|
131
|
+
}
|
|
132
|
+
@media (prefers-color-scheme: dark) {
|
|
133
|
+
:root[data-uva-color-scheme='system'] {
|
|
134
|
+
|
|
135
|
+
--uva-color-border: #7a84a0;
|
|
136
|
+
--uvalib-alerts-text: #e8e8e8;
|
|
137
|
+
--uvalib-alerts-header-bg: #0e4a57;
|
|
138
|
+
--uvalib-alerts-alert1-bg: #4a1622;
|
|
139
|
+
--uvalib-alerts-alert1-border: #ef3f6b;
|
|
140
|
+
--uvalib-alerts-alert2-bg: #3d3510;
|
|
141
|
+
--uvalib-alerts-alert2-border: #ecc602;
|
|
142
|
+
--uvalib-alerts-alert3-bg: #0d3247;
|
|
143
|
+
--uvalib-alerts-alert3-border: #55c4ec;
|
|
144
|
+
--uvalib-alerts-regional-bg: #0f3a3d;
|
|
145
|
+
--uvalib-alerts-regional-border: 0.2em solid #25cad3;
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
:root[data-uva-color-scheme='system'] [slot='pre-footer'] a {
|
|
149
|
+
color: var(--uva-color-pre-footer-text, #ffffff);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uvalib-analytics.js","names":["define","SiteAnalytics"],"sources":["../src/components/uvalib-analytics/UvalibAnalytics.ts","../src/components/uvalib-analytics/uvalib-analytics.ts"],"sourcesContent":["import { SiteAnalytics } from '../site-analytics/SiteAnalytics.js';\n\n/**\n * `<site-analytics>` under its original name, for markup such as Drupal's\n * `<uvalib-analytics matomoid=\"10\">`: the same element, attributes and events. A\n * constructor can be registered only once, hence the subclass.\n *\n * @tagname uvalib-analytics\n */\nexport class UvalibAnalytics extends SiteAnalytics {}\n","import { define } from '../../base/define.js';\nimport { UvalibAnalytics } from './UvalibAnalytics.js';\n\ndefine('uvalib-analytics', UvalibAnalytics);\n"],"mappings":";;;ACGAA,EAAO,oBAAoB,cDMUC,EAAc,CAAC,CCNV"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { a as e, f as t, l as n, m as r, n as i, o as a, t as o } from "./chunks/UvalibElement-BnI-eRRR.js";
|
|
2
|
+
// src/components/uvalib-date-range/UvalibDateRange.ts
|
|
3
|
+
var s = 0, c = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
4
|
+
function l(e) {
|
|
5
|
+
let t = typeof e == "string" ? c.exec(e) : null;
|
|
6
|
+
if (!t) return !1;
|
|
7
|
+
let [n, r, i] = [
|
|
8
|
+
Number(t[1]),
|
|
9
|
+
Number(t[2]),
|
|
10
|
+
Number(t[3])
|
|
11
|
+
], a = new Date(Date.UTC(n, r - 1, i));
|
|
12
|
+
return a.setUTCFullYear(n), a.getUTCFullYear() === n && a.getUTCMonth() === r - 1 && a.getUTCDate() === i;
|
|
13
|
+
}
|
|
14
|
+
var u = (e) => Number(e.slice(0, 4)), d = (e, t, n) => e < t ? t : e > n ? n : e, f = class extends o {
|
|
15
|
+
constructor(...e) {
|
|
16
|
+
super(...e), this.min = "", this.max = "", this.value = [], this.label = "Date range", this.uid = `uvalib-date-range-${++s}`, this.warned = !1;
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = t`
|
|
20
|
+
:host {
|
|
21
|
+
display: block;
|
|
22
|
+
font-family: var(--uva-font-family, inherit);
|
|
23
|
+
margin-bottom: 1.5rem;
|
|
24
|
+
}
|
|
25
|
+
fieldset {
|
|
26
|
+
border: none;
|
|
27
|
+
padding: 0;
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
legend {
|
|
31
|
+
font-weight: bold;
|
|
32
|
+
margin-bottom: 0.5rem;
|
|
33
|
+
color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
|
|
34
|
+
}
|
|
35
|
+
.date-range-container {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 0.75rem;
|
|
39
|
+
}
|
|
40
|
+
.slider-wrapper {
|
|
41
|
+
position: relative;
|
|
42
|
+
height: 24px;
|
|
43
|
+
margin: 0.5rem 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
.slider-track {
|
|
48
|
+
position: absolute;
|
|
49
|
+
height: 6px;
|
|
50
|
+
border-radius: 3px;
|
|
51
|
+
background-color: var(--uva-color-track, #e5e7eb);
|
|
52
|
+
left: 0;
|
|
53
|
+
right: 0;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
.slider-highlight {
|
|
57
|
+
position: absolute;
|
|
58
|
+
height: 6px;
|
|
59
|
+
border-radius: 3px;
|
|
60
|
+
background-color: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
|
|
61
|
+
z-index: 2;
|
|
62
|
+
}
|
|
63
|
+
/* Each input fills the 24px wrapper so it meets the minimum touch-target size; the track stays a 6px bar. */
|
|
64
|
+
input[type='range'] {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 24px;
|
|
68
|
+
background: none;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
-webkit-appearance: none;
|
|
71
|
+
-moz-appearance: none;
|
|
72
|
+
appearance: none;
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
z-index: 3;
|
|
76
|
+
}
|
|
77
|
+
input[type='range']:focus {
|
|
78
|
+
outline: none;
|
|
79
|
+
}
|
|
80
|
+
/* The end input is later in the DOM, so it is on top. When both thumbs sit on the same year
|
|
81
|
+
in the upper half, the start input goes on top so the pair can still be pulled apart. */
|
|
82
|
+
input[type='range'].on-top {
|
|
83
|
+
z-index: 4;
|
|
84
|
+
}
|
|
85
|
+
input[type='range']::-webkit-slider-thumb {
|
|
86
|
+
-webkit-appearance: none;
|
|
87
|
+
appearance: none;
|
|
88
|
+
height: 24px;
|
|
89
|
+
width: 24px;
|
|
90
|
+
border-radius: 50%;
|
|
91
|
+
background-color: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
|
|
92
|
+
border: 2px solid var(--uva-color-surface-raised, #ffffff);
|
|
93
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
pointer-events: auto;
|
|
96
|
+
transition:
|
|
97
|
+
transform 0.1s ease,
|
|
98
|
+
background-color 0.1s ease;
|
|
99
|
+
}
|
|
100
|
+
input[type='range']::-webkit-slider-thumb:hover {
|
|
101
|
+
transform: scale(1.1);
|
|
102
|
+
background-color: #ffc71a;
|
|
103
|
+
}
|
|
104
|
+
input[type='range']:focus-visible::-webkit-slider-thumb {
|
|
105
|
+
outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
|
|
106
|
+
outline-offset: 2px;
|
|
107
|
+
}
|
|
108
|
+
input[type='range']::-moz-range-thumb {
|
|
109
|
+
height: 20px;
|
|
110
|
+
width: 20px;
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
background-color: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
|
|
113
|
+
border: 2px solid var(--uva-color-surface-raised, #ffffff);
|
|
114
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
pointer-events: auto;
|
|
117
|
+
transition:
|
|
118
|
+
transform 0.1s ease,
|
|
119
|
+
background-color 0.1s ease;
|
|
120
|
+
}
|
|
121
|
+
input[type='range']::-moz-range-thumb:hover {
|
|
122
|
+
transform: scale(1.1);
|
|
123
|
+
background-color: #ffc71a;
|
|
124
|
+
}
|
|
125
|
+
input[type='range']:focus-visible::-moz-range-thumb {
|
|
126
|
+
outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
|
|
127
|
+
outline-offset: 2px;
|
|
128
|
+
}
|
|
129
|
+
.inputs-wrapper {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
align-items: stretch;
|
|
133
|
+
gap: 0.5rem;
|
|
134
|
+
}
|
|
135
|
+
.input-group {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: 0.25rem;
|
|
139
|
+
flex: 1;
|
|
140
|
+
}
|
|
141
|
+
.input-label {
|
|
142
|
+
font-size: 0.75rem;
|
|
143
|
+
color: var(--uva-color-text-muted, #4b5563);
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
}
|
|
146
|
+
.date-input {
|
|
147
|
+
padding: 0.375rem 0.5rem;
|
|
148
|
+
border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));
|
|
149
|
+
border-radius: 0.375rem;
|
|
150
|
+
font-size: 0.875rem;
|
|
151
|
+
color: var(--uva-color-input-text, #1f2937);
|
|
152
|
+
background-color: var(--uva-color-surface-raised, #ffffff);
|
|
153
|
+
width: 100%;
|
|
154
|
+
}
|
|
155
|
+
.date-input:focus-visible {
|
|
156
|
+
border-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
|
|
157
|
+
outline: 2px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
|
|
158
|
+
outline-offset: 1px;
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
}
|
|
162
|
+
get valid() {
|
|
163
|
+
return l(this.min) && l(this.max) && this.min <= this.max;
|
|
164
|
+
}
|
|
165
|
+
get range() {
|
|
166
|
+
let [e, t] = Array.isArray(this.value) ? this.value : [], n = l(e) ? d(e, this.min, this.max) : this.min, r = l(t) ? d(t, this.min, this.max) : this.max;
|
|
167
|
+
return n <= r ? [n, r] : [r, r];
|
|
168
|
+
}
|
|
169
|
+
willUpdate(e) {
|
|
170
|
+
!this.warned && (e.has("min") || e.has("max")) && !this.valid && (this.warned = !0, console.warn("<uvalib-date-range>: set \"min\" and \"max\" to ISO dates (YYYY-MM-DD) with min <= max; nothing is rendered until then."));
|
|
171
|
+
}
|
|
172
|
+
withYear(e, t, n) {
|
|
173
|
+
let r = String(t).padStart(4, "0"), i = `${r}-${e.slice(5)}`;
|
|
174
|
+
return l(i) ? i : `${r}-${n}`;
|
|
175
|
+
}
|
|
176
|
+
onStartYearInput(e) {
|
|
177
|
+
let t = e.target, [n, r] = this.range, i = Math.min(Number(t.value), u(r));
|
|
178
|
+
t.value = String(i), this.updateRange(d(this.withYear(n, i, "01-01"), this.min, r), r);
|
|
179
|
+
}
|
|
180
|
+
onEndYearInput(e) {
|
|
181
|
+
let t = e.target, [n, r] = this.range, i = Math.max(Number(t.value), u(n));
|
|
182
|
+
t.value = String(i), this.updateRange(n, d(this.withYear(r, i, "12-31"), n, this.max));
|
|
183
|
+
}
|
|
184
|
+
onDateInputChange(e, t) {
|
|
185
|
+
let n = e.target;
|
|
186
|
+
if (!l(n.value)) return;
|
|
187
|
+
let [r, i] = this.range;
|
|
188
|
+
t === 0 ? this.updateRange(d(n.value, this.min, i), i) : this.updateRange(r, d(n.value, r, this.max));
|
|
189
|
+
}
|
|
190
|
+
updateRange(e, t) {
|
|
191
|
+
this.value = [e, t], this.dispatchEvent(new CustomEvent("date-range-change", {
|
|
192
|
+
detail: { value: this.value },
|
|
193
|
+
bubbles: !0,
|
|
194
|
+
composed: !0
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
render() {
|
|
198
|
+
if (!this.valid) return a;
|
|
199
|
+
let e = u(this.min), t = u(this.max), [r, i] = this.range, o = u(r), s = u(i), c = t - e || 1, l = (o - e) / c * 100, d = (s - e) / c * 100, f = `${this.uid}-start`, p = `${this.uid}-end`;
|
|
200
|
+
return n`
|
|
201
|
+
<fieldset>
|
|
202
|
+
<legend>${this.label}</legend>
|
|
203
|
+
<div class="date-range-container">
|
|
204
|
+
<div class="slider-wrapper">
|
|
205
|
+
<div class="slider-track"></div>
|
|
206
|
+
<div
|
|
207
|
+
class="slider-highlight"
|
|
208
|
+
style="left: ${l}%; width: ${d - l}%;"
|
|
209
|
+
></div>
|
|
210
|
+
<input
|
|
211
|
+
type="range"
|
|
212
|
+
.min=${String(e)}
|
|
213
|
+
.max=${String(t)}
|
|
214
|
+
.value=${String(o)}
|
|
215
|
+
class=${o === s && o * 2 > e + t ? "on-top" : ""}
|
|
216
|
+
@input=${this.onStartYearInput}
|
|
217
|
+
aria-label="${this.label}: start year"
|
|
218
|
+
/>
|
|
219
|
+
<input
|
|
220
|
+
type="range"
|
|
221
|
+
.min=${String(e)}
|
|
222
|
+
.max=${String(t)}
|
|
223
|
+
.value=${String(s)}
|
|
224
|
+
@input=${this.onEndYearInput}
|
|
225
|
+
aria-label="${this.label}: end year"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="inputs-wrapper">
|
|
229
|
+
<div class="input-group">
|
|
230
|
+
<label class="input-label" for=${f}>From</label>
|
|
231
|
+
<input
|
|
232
|
+
type="date"
|
|
233
|
+
id=${f}
|
|
234
|
+
class="date-input"
|
|
235
|
+
.min=${this.min}
|
|
236
|
+
.max=${i}
|
|
237
|
+
.value=${r}
|
|
238
|
+
@change=${(e) => this.onDateInputChange(e, 0)}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
<div class="input-group">
|
|
242
|
+
<label class="input-label" for=${p}>To</label>
|
|
243
|
+
<input
|
|
244
|
+
type="date"
|
|
245
|
+
id=${p}
|
|
246
|
+
class="date-input"
|
|
247
|
+
.min=${r}
|
|
248
|
+
.max=${this.max}
|
|
249
|
+
.value=${i}
|
|
250
|
+
@change=${(e) => this.onDateInputChange(e, 1)}
|
|
251
|
+
/>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</fieldset>
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
// src/components/uvalib-date-range/uvalib-date-range.ts
|
|
260
|
+
i([e({ type: String })], f.prototype, "min", void 0), i([e({ type: String })], f.prototype, "max", void 0), i([e({ type: Array })], f.prototype, "value", void 0), i([e({ type: String })], f.prototype, "label", void 0), r("uvalib-date-range", f);
|
|
261
|
+
|
|
262
|
+
//# sourceMappingURL=uvalib-date-range.js.map
|