@penn-libraries/web 0.3.0-dev.2 → 0.3.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/{index-c02f277e.js → index-B6Rjt_WH.js} +339 -196
- package/dist/cjs/index-B6Rjt_WH.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -5
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/pennlibs-banner.cjs.entry.js +3 -5
- package/dist/cjs/pennlibs-banner.cjs.entry.js.map +1 -1
- package/dist/cjs/pennlibs-banner.entry.cjs.js.map +1 -0
- package/dist/cjs/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.cjs.js.map +1 -0
- package/dist/cjs/{pennlibs-chat_4.cjs.entry.js → pennlibs-chat_5.cjs.entry.js} +69 -50
- package/dist/cjs/pennlibs-chat_5.cjs.entry.js.map +1 -0
- package/dist/cjs/pennlibs-colors.cjs.entry.js +3 -6
- package/dist/cjs/pennlibs-colors.cjs.entry.js.map +1 -1
- package/dist/cjs/pennlibs-colors.entry.cjs.js.map +1 -0
- package/dist/cjs/web.cjs.js +8 -7
- package/dist/cjs/web.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/pennlibs-chat/pennlibs-chat.js.map +1 -1
- package/dist/collection/components/pennlibs-colors/pennlibs-colors.js +4 -4
- package/dist/collection/components/pennlibs-colors/pennlibs-colors.js.map +1 -1
- package/dist/collection/components/pennlibs-feedback/pennlibs-feedback.js.map +1 -1
- package/dist/collection/components/pennlibs-footer/pennlibs-footer.js +4 -5
- package/dist/collection/components/pennlibs-footer/pennlibs-footer.js.map +1 -1
- package/dist/collection/components/pennlibs-header/pennlibs-header.css +2 -114
- package/dist/collection/components/pennlibs-header/pennlibs-header.js +35 -27
- package/dist/collection/components/pennlibs-header/pennlibs-header.js.map +1 -1
- package/dist/collection/components/pennlibs-hero/pennlibs-hero.css +133 -0
- package/dist/collection/components/pennlibs-hero/pennlibs-hero.js +71 -0
- package/dist/collection/components/pennlibs-hero/pennlibs-hero.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/pennlibs-banner.js +2 -2
- package/dist/components/pennlibs-banner.js.map +1 -1
- package/dist/components/pennlibs-chat.js +2 -2
- package/dist/components/pennlibs-chat.js.map +1 -1
- package/dist/components/pennlibs-colors.js +2 -3
- package/dist/components/pennlibs-colors.js.map +1 -1
- package/dist/components/pennlibs-feedback.js +2 -2
- package/dist/components/pennlibs-feedback.js.map +1 -1
- package/dist/components/pennlibs-footer.js +2 -4
- package/dist/components/pennlibs-footer.js.map +1 -1
- package/dist/components/pennlibs-header.js +10 -41
- package/dist/components/pennlibs-header.js.map +1 -1
- package/dist/components/pennlibs-hero.d.ts +11 -0
- package/dist/components/pennlibs-hero.js +83 -0
- package/dist/components/pennlibs-hero.js.map +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +6 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/{web/p-085cc320.js → esm/index-BQRdy1TQ.js} +339 -176
- package/dist/esm/index-BQRdy1TQ.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +5 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/pennlibs-banner.entry.js +3 -3
- package/dist/esm/pennlibs-banner.entry.js.map +1 -1
- package/dist/esm/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.js.map +1 -0
- package/dist/esm/{pennlibs-chat_4.entry.js → pennlibs-chat_5.entry.js} +69 -49
- package/dist/esm/pennlibs-chat_5.entry.js.map +1 -0
- package/dist/esm/pennlibs-colors.entry.js +3 -4
- package/dist/esm/pennlibs-colors.entry.js.map +1 -1
- package/dist/esm/web.js +7 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/types/components/pennlibs-header/pennlibs-header.d.ts +4 -3
- package/dist/types/components/pennlibs-hero/pennlibs-hero.d.ts +13 -0
- package/dist/types/components.d.ts +21 -0
- package/dist/types/stencil-public-runtime.d.ts +9 -0
- package/dist/web/index.esm.js +2 -1
- package/dist/web/index.esm.js.map +1 -1
- package/dist/web/loader.esm.js.map +1 -0
- package/dist/web/{p-1910ca46.entry.js → p-2edaa432.entry.js} +4 -5
- package/dist/web/p-2edaa432.entry.js.map +1 -0
- package/dist/{esm/index-99779d4a.js → web/p-BQRdy1TQ.js} +339 -176
- package/dist/web/p-BQRdy1TQ.js.map +1 -0
- package/dist/web/p-DQuL1Twl.js +6 -0
- package/dist/web/p-DQuL1Twl.js.map +1 -0
- package/dist/web/{p-9cc59a0b.entry.js → p-a24d914e.entry.js} +69 -49
- package/dist/web/p-a24d914e.entry.js.map +1 -0
- package/dist/web/{p-9cf4cb70.entry.js → p-dac033ee.entry.js} +4 -4
- package/dist/web/p-dac033ee.entry.js.map +1 -0
- package/dist/web/pennlibs-banner.entry.esm.js.map +1 -0
- package/dist/web/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.esm.js.map +1 -0
- package/dist/web/pennlibs-colors.entry.esm.js.map +1 -0
- package/dist/web/web.css +1 -0
- package/dist/web/web.esm.js +7 -5
- package/dist/web/web.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-c02f277e.js.map +0 -1
- package/dist/cjs/pennlibs-chat_4.cjs.entry.js.map +0 -1
- package/dist/collection/components/pennlibs-header/container.js +0 -8
- package/dist/collection/components/pennlibs-header/container.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-99779d4a.js.map +0 -1
- package/dist/esm/pennlibs-chat_4.entry.js.map +0 -1
- package/dist/types/components/pennlibs-header/container.d.ts +0 -8
- package/dist/web/p-085cc320.js.map +0 -1
- package/dist/web/p-1910ca46.entry.js.map +0 -1
- package/dist/web/p-9cc59a0b.entry.js.map +0 -1
- package/dist/web/p-9cf4cb70.entry.js.map +0 -1
- package/dist/web/p-e1255160.js +0 -5
- package/dist/web/p-e1255160.js.map +0 -1
- package/loader/package.json +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface PennlibsHero extends Components.PennlibsHero, HTMLElement {}
|
|
4
|
+
export const PennlibsHero: {
|
|
5
|
+
prototype: PennlibsHero;
|
|
6
|
+
new (): PennlibsHero;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const pennlibsHeroCss = ":host{--hero-height:clamp(42vh, 32rem, 26rem);--hero-heading-font:var(--font-serif);--max-width:1080px;--color-typo:var(--color-fg-on-emphasis)}*,*:before,*:after{box-sizing:inherit}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.viewport-margins{width:100%;max-width:var(--max-width);margin:0 auto;padding:0 1em}.hero{position:relative;min-height:var(--hero-height);height:100%;background-size:cover;background-repeat:no-repeat;background-position:50% 33%;display:flex}.hero::before{content:\"\";display:flex;width:100%;height:100%;top:0;position:absolute;background:linear-gradient(360deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.05) 100%);z-index:0}.hero::after{content:\"\";display:flex;width:100%;height:100%;top:0;position:absolute;background:linear-gradient(180deg, rgba(1, 31, 91, 1) 0%, rgba(1, 31, 91, 0.9) 10%, rgba(1, 31, 91, 0.8) 20%, rgba(1, 31, 91, 0.1) 50%, rgba(1, 31, 91, 0.0) 100%);z-index:0}.hero__content{position:relative;display:flex;flex-direction:column;width:100%;z-index:1}.hero__heading-container{margin-top:auto;padding-top:3em;padding-bottom:3em}.hero__heading{text-shadow:1px 1px 2px var(--color-fg-default);line-height:1.1;font-size:2.75em;font-weight:bold;font-family:var(--hero-heading-font);text-wrap:pretty;max-width:30ch;margin:0;color:var(--color-typo)}@media (max-width: 920px){.hero__heading{font-size:2.5em}}.hero__sub-heading{font-size:1.15em;font-family:var(--font-family);font-weight:500;color:var(--color-typo);max-width:52ch;text-wrap:pretty;margin-top:1em;margin-bottom:0}.hero__sub-heading a{text-decoration:underline;text-underline-offset:var(--link-text-underline-offset);text-decoration-thickness:var(--link-text-decoration-thickness);color:var(--color-typo)}.hero__sub-heading a:hover{text-decoration-thickness:var(--link-hover-text-decoration-thickness)}.hero__sub-heading strong{font-weight:bold}@media (max-width: 620px){.hero__heading{font-size:2em}.hero__sub-heading{font-size:1em}}";
|
|
4
|
+
|
|
5
|
+
const getCurrentImageSource = (pictureElement) => {
|
|
6
|
+
const imgElement = pictureElement.querySelector('img');
|
|
7
|
+
return (imgElement === null || imgElement === void 0 ? void 0 : imgElement.currentSrc) || '';
|
|
8
|
+
};
|
|
9
|
+
const Hero = /*@__PURE__*/ proxyCustomElement(class Hero extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.heroPictureElement = null;
|
|
15
|
+
this.heroHeadingElement = null;
|
|
16
|
+
this.heroParagraphElement = null;
|
|
17
|
+
this.heroSrc = "";
|
|
18
|
+
this.lastSrc = "";
|
|
19
|
+
}
|
|
20
|
+
componentWillLoad() {
|
|
21
|
+
const heroPictureElement = this.hostElement.querySelector('picture[hero=art-direction]');
|
|
22
|
+
if (heroPictureElement) {
|
|
23
|
+
this.heroPictureElement = heroPictureElement;
|
|
24
|
+
this.startWatchingCurrentSrc(heroPictureElement);
|
|
25
|
+
}
|
|
26
|
+
const heroHeadingElement = this.hostElement.querySelector('h1[hero=heading]');
|
|
27
|
+
if (heroHeadingElement) {
|
|
28
|
+
this.heroHeadingElement = heroHeadingElement;
|
|
29
|
+
}
|
|
30
|
+
const heroParagraphElement = this.hostElement.querySelector('p[hero=sub-heading]');
|
|
31
|
+
if (heroParagraphElement) {
|
|
32
|
+
this.heroParagraphElement = heroParagraphElement;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
startWatchingCurrentSrc(pictureElement) {
|
|
36
|
+
const checkCurrentSrc = () => {
|
|
37
|
+
const currentSrc = getCurrentImageSource(pictureElement);
|
|
38
|
+
if (currentSrc !== this.lastSrc) {
|
|
39
|
+
this.lastSrc = currentSrc;
|
|
40
|
+
this.heroSrc = currentSrc;
|
|
41
|
+
}
|
|
42
|
+
this.animationFrameId = requestAnimationFrame(checkCurrentSrc);
|
|
43
|
+
};
|
|
44
|
+
this.animationFrameId = requestAnimationFrame(checkCurrentSrc);
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
if (this.animationFrameId) {
|
|
48
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return (h("div", { key: '87c59d996e17ad0de49957658053e61868f91369', class: "hero", style: { backgroundImage: `url(${this.heroSrc})` } }, h("div", { key: '68e8a1bde0b506c044e0a7d3d63cc5617b52c025', class: "hero__content" }, h("slot", { key: '9a5a94c334922dc17e3d19002f2480d93a1a9612', name: "start" }), h("div", { key: 'abb6ea5015c9810829cde3b8c6a391b2c36298f2', class: "hero__heading-container" }, this.heroHeadingElement && (h("div", { key: '81d5b79af5f5ac2e006ebc594d4d9b4ffa1dbb53', class: "viewport-margins" }, h("h1", { key: '1c6672b6228b8d3d2f2d0666644fc9cb199150a0', class: "hero__heading", innerHTML: this.heroHeadingElement.innerText }), this.heroParagraphElement && h("p", { key: '5ffbee19a06e6ecac28aa84549cc8d0bef112cd2', class: "hero__sub-heading", innerHTML: this.heroParagraphElement.innerHTML })))))));
|
|
53
|
+
}
|
|
54
|
+
static get assetsDirs() { return ["assets"]; }
|
|
55
|
+
get hostElement() { return this; }
|
|
56
|
+
static get style() { return pennlibsHeroCss; }
|
|
57
|
+
}, [1, "pennlibs-hero", {
|
|
58
|
+
"heroPictureElement": [32],
|
|
59
|
+
"heroHeadingElement": [32],
|
|
60
|
+
"heroParagraphElement": [32],
|
|
61
|
+
"heroSrc": [32]
|
|
62
|
+
}]);
|
|
63
|
+
function defineCustomElement$1() {
|
|
64
|
+
if (typeof customElements === "undefined") {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const components = ["pennlibs-hero"];
|
|
68
|
+
components.forEach(tagName => { switch (tagName) {
|
|
69
|
+
case "pennlibs-hero":
|
|
70
|
+
if (!customElements.get(tagName)) {
|
|
71
|
+
customElements.define(tagName, Hero);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const PennlibsHero = Hero;
|
|
78
|
+
const defineCustomElement = defineCustomElement$1;
|
|
79
|
+
|
|
80
|
+
export { PennlibsHero, defineCustomElement };
|
|
81
|
+
//# sourceMappingURL=pennlibs-hero.js.map
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=pennlibs-hero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pennlibs-hero.js","mappings":";;AAAA,MAAM,eAAe,GAAG,qiEAAqiE;;ACE7jE,MAAM,qBAAqB,GAAG,CAAC,cAAkC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B,CAAC,SAAS,EAAI,CAAA,CACzG,CACP,CACG,CACF,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/components/pennlibs-hero/pennlibs-hero.css?tag=pennlibs-hero&encapsulation=shadow","src/components/pennlibs-hero/pennlibs-hero.tsx"],"sourcesContent":[":host {\n --hero-height: clamp(42vh, 32rem, 26rem);\n --hero-heading-font: var(--font-serif);\n --max-width: 1080px;\n --color-typo: var(--color-fg-on-emphasis);\n}\n\n*, *:before, *:after {\n box-sizing: inherit;\n}\n\n.visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n.viewport-margins {\n width: 100%;\n max-width: var(--max-width);\n margin: 0 auto;\n padding: 0 1em;\n}\n\n/* Start of Selection */\n/* Hero section */\n.hero {\n position: relative;\n min-height: var(--hero-height);\n height: 100%;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: 50% 33%;\n display: flex;\n}\n/* End of Selection */\n\n.hero::before {\n content: \"\";\n display: flex;\n width: 100%;\n height: 100%;\n top: 0;\n position: absolute;\n background: linear-gradient(360deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.05) 100%);\n z-index: 0;\n}\n\n \n.hero::after {\n content: \"\";\n display: flex;\n width: 100%;\n height: 100%;\n top: 0;\n position: absolute;\n background: linear-gradient(180deg, rgba(1, 31, 91, 1) 0%, rgba(1, 31, 91, 0.9) 10%, rgba(1, 31, 91, 0.8) 20%, rgba(1, 31, 91, 0.1) 50%, rgba(1, 31, 91, 0.0) 100%);\n z-index: 0;\n}\n\n.hero__content {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n z-index: 1;\n}\n\n.hero__heading-container {\n margin-top: auto;\n padding-top: 3em;\n padding-bottom: 3em;\n}\n\n.hero__heading {\n text-shadow: 1px 1px 2px var(--color-fg-default);\n line-height: 1.1;\n font-size: 2.75em;\n font-weight: bold;\n font-family: var(--hero-heading-font);\n text-wrap: pretty;\n max-width: 30ch;\n margin: 0;\n color: var(--color-typo);\n}\n\n@media (max-width: 920px) {\n .hero__heading {\n font-size: 2.5em;\n }\n}\n\n.hero__sub-heading {\n font-size: 1.15em;\n font-family: var(--font-family);\n font-weight: 500;\n color: var(--color-typo);\n max-width: 52ch;\n text-wrap: pretty;\n margin-top: 1em;\n margin-bottom: 0;\n}\n\n.hero__sub-heading a {\n text-decoration: underline;\n text-underline-offset: var(--link-text-underline-offset);\n text-decoration-thickness: var(--link-text-decoration-thickness);\n color: var(--color-typo);\n}\n\n.hero__sub-heading a:hover {\n text-decoration-thickness: var(--link-hover-text-decoration-thickness);\n}\n\n.hero__sub-heading strong {\n font-weight: bold;\n}\n\n@media (max-width: 620px) {\n .hero__heading {\n font-size: 2em;\n }\n\n .hero__sub-heading {\n font-size: 1em;\n }\n}","import { h, Component, State, Element } from \"@stencil/core\";\n\nconst getCurrentImageSource = (pictureElement: HTMLPictureElement): string => {\n const imgElement = pictureElement.querySelector('img');\n return imgElement?.currentSrc || '';\n};\n\n@Component({\n tag: 'pennlibs-hero',\n styleUrl: 'pennlibs-hero.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class Hero {\n @Element() hostElement: HTMLElement;\n @State() heroPictureElement: null | HTMLPictureElement = null;\n @State() heroHeadingElement: null | HTMLHeadingElement = null;\n @State() heroParagraphElement: null | HTMLParagraphElement = null;\n @State() heroSrc: string = \"\";\n private lastSrc: string = \"\";\n private animationFrameId: number;\n\n componentWillLoad() {\n const heroPictureElement = this.hostElement.querySelector('picture[hero=art-direction]') as HTMLPictureElement;\n if (heroPictureElement) {\n this.heroPictureElement = heroPictureElement;\n this.startWatchingCurrentSrc(heroPictureElement);\n }\n\n const heroHeadingElement = this.hostElement.querySelector('h1[hero=heading]') as HTMLHeadingElement;\n if (heroHeadingElement) {\n this.heroHeadingElement = heroHeadingElement;\n }\n\n const heroParagraphElement = this.hostElement.querySelector('p[hero=sub-heading]') as HTMLParagraphElement;\n if (heroParagraphElement) {\n this.heroParagraphElement = heroParagraphElement;\n }\n }\n\n private startWatchingCurrentSrc(pictureElement: HTMLPictureElement) {\n const checkCurrentSrc = () => {\n const currentSrc = getCurrentImageSource(pictureElement);\n if (currentSrc !== this.lastSrc) {\n this.lastSrc = currentSrc;\n this.heroSrc = currentSrc;\n }\n this.animationFrameId = requestAnimationFrame(checkCurrentSrc);\n };\n \n this.animationFrameId = requestAnimationFrame(checkCurrentSrc);\n }\n\n disconnectedCallback() {\n if (this.animationFrameId) {\n cancelAnimationFrame(this.animationFrameId);\n }\n }\n\n render() {\n return (\n <div class=\"hero\" style={{ backgroundImage: `url(${this.heroSrc})` }}>\n <div class=\"hero__content\">\n <slot name=\"start\" />\n <div class=\"hero__heading-container\">\n {this.heroHeadingElement && (\n <div class=\"viewport-margins\">\n <h1 class=\"hero__heading\" innerHTML={this.heroHeadingElement.innerText} />\n {this.heroParagraphElement && <p class=\"hero__sub-heading\" innerHTML={this.heroParagraphElement.innerHTML} />}\n </div>\n )}\n </div>\n </div>\n </div>\n )\n }\n}"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-globals-DQuL1Twl.js","sources":["@stencil/core/internal/app-globals"],"sourcesContent":["export const globalScripts = () => {};\n"],"names":[],"mappings":"AAAY,MAAC,aAAa,GAAG,MAAM;;;;"}
|