@universityofmaryland/web-elements-library 1.5.0-beta.0 → 1.5.1
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/README.md +1 -1
- package/dist/composite/banner/promo.d.ts.map +1 -1
- package/dist/composite/banner/promo.js +6 -3
- package/dist/composite/banner/promo.js.map +1 -1
- package/dist/composite/banner/promo.mjs +6 -3
- package/dist/composite/banner/promo.mjs.map +1 -1
- package/dist/composite/footer/elements/main-section/index.js.map +1 -1
- package/dist/composite/footer/elements/main-section/index.mjs.map +1 -1
- package/dist/composite/navigation/header.d.ts.map +1 -1
- package/dist/composite/navigation/header.js +4 -1
- package/dist/composite/navigation/header.js.map +1 -1
- package/dist/composite/navigation/header.mjs +4 -1
- package/dist/composite/navigation/header.mjs.map +1 -1
- package/dist/composite/quote/elements/icon.d.ts +3 -2
- package/dist/composite/quote/elements/icon.d.ts.map +1 -1
- package/dist/composite/quote/elements/icon.js +23 -16
- package/dist/composite/quote/elements/icon.js.map +1 -1
- package/dist/composite/quote/elements/icon.mjs +23 -16
- package/dist/composite/quote/elements/icon.mjs.map +1 -1
- package/dist/composite/quote/elements/image.d.ts.map +1 -1
- package/dist/composite/quote/elements/image.js +6 -6
- package/dist/composite/quote/elements/image.js.map +1 -1
- package/dist/composite/quote/elements/image.mjs +6 -6
- package/dist/composite/quote/elements/image.mjs.map +1 -1
- package/dist/composite/quote/elements/index.d.ts +1 -0
- package/dist/composite/quote/elements/index.d.ts.map +1 -1
- package/dist/composite/quote/elements/index.js +2 -0
- package/dist/composite/quote/elements/index.js.map +1 -1
- package/dist/composite/quote/elements/index.mjs +2 -0
- package/dist/composite/quote/elements/index.mjs.map +1 -1
- package/dist/composite/quote/elements/quote.d.ts +13 -0
- package/dist/composite/quote/elements/quote.d.ts.map +1 -0
- package/dist/composite/quote/elements/quote.js +114 -0
- package/dist/composite/quote/elements/quote.js.map +1 -0
- package/dist/composite/quote/elements/quote.mjs +97 -0
- package/dist/composite/quote/elements/quote.mjs.map +1 -0
- package/dist/composite/quote/elements/text.d.ts +1 -1
- package/dist/composite/quote/elements/text.d.ts.map +1 -1
- package/dist/composite/quote/elements/text.js +103 -172
- package/dist/composite/quote/elements/text.js.map +1 -1
- package/dist/composite/quote/elements/text.mjs +103 -172
- package/dist/composite/quote/elements/text.mjs.map +1 -1
- package/dist/composite/quote/featured.d.ts +3 -0
- package/dist/composite/quote/featured.d.ts.map +1 -1
- package/dist/composite/quote/featured.js +14 -7
- package/dist/composite/quote/featured.js.map +1 -1
- package/dist/composite/quote/featured.mjs +14 -7
- package/dist/composite/quote/featured.mjs.map +1 -1
- package/dist/composite/quote/helper/animation.d.ts.map +1 -1
- package/dist/composite/quote/helper/animation.js +67 -36
- package/dist/composite/quote/helper/animation.js.map +1 -1
- package/dist/composite/quote/helper/animation.mjs +67 -36
- package/dist/composite/quote/helper/animation.mjs.map +1 -1
- package/dist/composite/quote/inline.d.ts +3 -0
- package/dist/composite/quote/inline.d.ts.map +1 -1
- package/dist/composite/quote/inline.js +15 -7
- package/dist/composite/quote/inline.js.map +1 -1
- package/dist/composite/quote/inline.mjs +15 -7
- package/dist/composite/quote/inline.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.mjs","sources":["../../../../source/composite/quote/elements/text.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport * as typography from '@universityofmaryland/web-styles-library/typography';\nimport { ElementModel } from 'model';\nimport { default as elementIcon } from './icon';\nimport { default as elementAction } from './action';\nimport { SMALL } from '../_constants';\nimport { type QuoteTextProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\nexport default (props: QuoteTextProps) => {\n const {\n isThemeDark,\n isThemeMaryland,\n isSizeLarge = false,\n isTypeFeatured = false,\n image,\n quote,\n attribution,\n attributionSubText,\n action,\n includesAnimation,\n } = props;\n\n const createQuoteText = (\n quote: HTMLElement,\n quoteChildren: ElementVisual[],\n ) => {\n let quoteTextElement: HTMLElement = quote;\n const wordsList = splitWords(quote);\n\n if (includesAnimation) {\n quoteTextElement = document.createElement('div');\n\n wordsList.map((word) => {\n quoteTextElement.appendChild(word);\n });\n }\n\n const quoteElement = ElementModel.create({\n element: quoteTextElement,\n className: 'quote-container-quote',\n children: quoteChildren,\n elementStyles: {\n element: {\n position: 'relative',\n fontWeight: '700',\n color: token.color.black,\n ...typography.sans.larger,\n\n ...(isSizeLarge && { ...typography.sans.extraLarge }),\n\n ...((isThemeDark || isThemeMaryland) && {\n color: token.color.white,\n }),\n\n [`&::before`]: {\n content: '\"\"',\n position: 'absolute',\n left: `-${token.spacing.md}`,\n top: '7px',\n height: 'calc(100% - 14px)',\n width: '2px',\n display: 'block',\n backgroundColor: token.color.red,\n ...(isThemeMaryland && { backgroundColor: token.color.gold }),\n\n ...(image &&\n !isTypeFeatured && {\n display: 'none',\n }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n left: `-${token.spacing.md}`,\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n ...(!isTypeFeatured && {\n display: 'block',\n }),\n },\n },\n\n ['& *']: {\n color: 'currentColor',\n ...typography.sans.larger,\n ...(isSizeLarge && { ...typography.sans.extraLarge }),\n },\n },\n },\n });\n\n return quoteElement;\n };\n\n const getQuoteTextContainerChildren = (props: QuoteTextProps) => {\n const wrapperChildren: ElementVisual[] = [];\n\n if (quote) {\n const quoteChildren: ElementVisual[] = [];\n const iconSpan = elementIcon(props);\n\n if (!image) {\n quoteChildren.push(iconSpan);\n }\n\n const quoteElement = createQuoteText(quote, quoteChildren);\n\n wrapperChildren.push(quoteElement);\n }\n\n if (attribution) {\n const attributionElement = ElementModel.create({\n element: attribution,\n className: 'quote-container-attribution',\n elementStyles: {\n element: {\n marginTop: token.spacing.sm,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n [`& *`]: {\n color: 'currentColor',\n ...typography.sans.medium,\n },\n },\n },\n });\n\n wrapperChildren.push(attributionElement);\n }\n\n if (attributionSubText) {\n const attributionSubTextElement = ElementModel.create({\n element: attributionSubText,\n className: 'quote-container-text-attribution-sub-text',\n elementStyles: {\n element: {\n color: token.color.gray.dark,\n fontStyle: 'italic',\n ...typography.sans.small,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...((isThemeDark || isThemeMaryland) && {\n color: token.color.white,\n }),\n },\n },\n });\n\n wrapperChildren.push(attributionSubTextElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n ...props,\n action,\n });\n\n wrapperChildren.push(actionElement);\n }\n\n return wrapperChildren;\n };\n\n const splitWords = (quote: HTMLElement) => {\n const text = quote.textContent ?? '';\n const words = text.trim().split(/\\s+/);\n\n const wordElements = words.map((word, index) => {\n const wordElement = document.createElement('div');\n wordElement.classList.add('quote-text-split-word');\n\n Object.assign(wordElement.style, {\n display: 'inline-block',\n whiteSpace: 'pre-wrap',\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n });\n\n wordElement.textContent = word + (index < words.length - 1 ? ' ' : '');\n\n return wordElement;\n });\n\n return wordElements;\n };\n\n const CreateQuoteTextContainer = (props: QuoteTextProps) => {\n const wrapperChildren = getQuoteTextContainerChildren(props);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-text-container-wrapper',\n children: wrapperChildren,\n });\n\n return ElementModel.createDiv({\n className: 'quote-text-container',\n children: [wrapper],\n elementStyles: {\n element: {\n width: '100%',\n ...typography.sans.medium,\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n paddingTop: token.spacing.lg,\n paddingLeft: token.spacing.md,\n\n ...(!isTypeFeatured && {\n ...(isSizeLarge && { paddingTop: token.spacing['2xl'] }),\n }),\n },\n\n [`@container (min-width: ${SMALL}px)`]: {\n paddingLeft: token.spacing['4xl'],\n\n ...(!isTypeFeatured && {\n ...(image && { paddingLeft: '0' }),\n }),\n },\n\n [`& *`]: {\n ...typography.sans.medium,\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n ...(isThemeMaryland && {\n color: token.color.white,\n }),\n },\n },\n },\n });\n };\n\n return CreateQuoteTextContainer(props);\n};\n"],"names":["quote","ElementModel.create","props","ElementModel.createDiv"],"mappings":";;;;;;AASA,MAAA,cAAe,CAAC,UAA0B;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEJ,QAAM,kBAAkB,CACtBA,QACA,kBACG;AACH,QAAI,mBAAgCA;AACpC,UAAM,YAAY,WAAWA,MAAK;AAElC,QAAI,mBAAmB;AACrB,yBAAmB,SAAS,cAAc,KAAK;AAE/C,gBAAU,IAAI,CAAC,SAAS;AACtB,yBAAiB,YAAY,IAAI;AAAA,MACnC,CAAC;AAAA,IACH;AAEA,UAAM,eAAeC,OAAoB;AAAA,MACvC,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,MACV,eAAe;AAAA,QACb,SAAS;AAAA,UACP,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,OAAO,MAAM,MAAM;AAAA,UACnB,GAAG,WAAW,KAAK;AAAA,UAEnB,GAAI,eAAe,EAAE,GAAG,WAAW,KAAK,WAAA;AAAA,UAExC,IAAK,eAAe,oBAAoB;AAAA,YACtC,OAAO,MAAM,MAAM;AAAA,UAAA;AAAA,UAGrB,CAAC,WAAW,GAAG;AAAA,YACb,SAAS;AAAA,YACT,UAAU;AAAA,YACV,MAAM,IAAI,MAAM,QAAQ,EAAE;AAAA,YAC1B,KAAK;AAAA,YACL,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,SAAS;AAAA,YACT,iBAAiB,MAAM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AAK;AAE3D,UAAM,UAAUC,UAAuB;AAAA,MACrC,WAAW;AAAA,MACX,UAAU;AAAA,IAAA,CACX;AAED,WAAOA,UAAuB;AAAA,MAC5B,WAAW;AAAA,MACX,UAAU,CAAC,OAAO;AAAA,MAClB,eAAe;AAAA,QACb,SAAS;AAAA,UACP,OAAO;AAAA,UACP,GAAG,WAAW,KAAK;AAAA,UAEnB,CAAC,0BAA0B,QAAQ,CAAC,KAAK,GAAG;AAAA,YAC1C,YAAY,MAAM,QAAQ;AAAA,YAC1B,aAAa,MAAM,QAAQ;AAAA,YAE3B,GAAI,CAAC,kBAAkB;AAAA,cACrB,GAAI,eAAe,EAAE,YAAY,MAAM,QAAQ,KAAK,EAAA;AAAA,YAAE;AAAA,UACxD;AAAA,UAGF,CAAC,0BAA0B,KAAK,KAAK,GAAG;AAAA,YACtC,aAAa,MAAM,QAAQ,KAAK;AAAA,YAEhC,GAAI,CAAC,kBAAkB;AAAA,cACrB,GAAI,SAAS,EAAE,aAAa,IAAA;AAAA,YAAI;AAAA,UAClC;AAAA,UAGF,CAAC,KAAK,GAAG;AAAA,YACP,GAAG,WAAW,KAAK;AAAA,YAEnB,GAAI,eAAe;AAAA,cACjB,OAAO,MAAM,MAAM;AAAA,YAAA;AAAA,YAGrB,GAAI,mBAAmB;AAAA,cACrB,OAAO,MAAM,MAAM;AAAA,YAAA;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CACD;AAAA,EACH;AAEA,SAAO,yBAAyB,KAAK;AACvC;"}
|
|
1
|
+
{"version":3,"file":"text.mjs","sources":["../../../../source/composite/quote/elements/text.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport * as typography from '@universityofmaryland/web-styles-library/typography';\nimport { ElementModel } from 'model';\nimport { default as elementAction } from './action';\nimport { default as elementQuote } from './quote';\nimport { SMALL } from '../_constants';\nimport { type QuoteTextProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface ChildrenProps\n extends Pick<\n QuoteTextProps,\n | 'quote'\n | 'image'\n | 'attribution'\n | 'attributionSubText'\n | 'action'\n | 'isThemeDark'\n | 'isSizeLarge'\n | 'isTypeFeatured'\n | 'includesAnimation'\n > {\n shouldHaveWhiteText?: boolean;\n hasImage: boolean;\n}\n\nconst createChildren = (props: ChildrenProps) => {\n const {\n action,\n attribution,\n attributionSubText,\n hasImage,\n includesAnimation,\n isThemeDark,\n quote,\n shouldHaveWhiteText,\n } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n if (quote) {\n wrapperChildren.push(\n elementQuote({ ...props, shouldHaveWhiteText, quote, hasImage }),\n );\n }\n\n if (attribution) {\n const attributionElement = ElementModel.create({\n element: attribution,\n className: 'quote-container-attribution',\n elementStyles: {\n element: {\n marginTop: token.spacing.sm,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(isThemeDark && {\n color: token.color.white,\n }),\n\n [`& *`]: {\n color: 'currentColor',\n ...typography.sans.medium,\n },\n },\n },\n });\n\n wrapperChildren.push(attributionElement);\n }\n\n if (attributionSubText) {\n const attributionSubTextElement = ElementModel.create({\n element: attributionSubText,\n className: 'quote-container-text-attribution-sub-text',\n elementStyles: {\n element: {\n color: token.color.gray.dark,\n fontStyle: 'italic',\n ...typography.sans.small,\n\n ...(includesAnimation && {\n opacity: '0',\n transform: 'translateY(20px)',\n transition: 'opacity 1s ease, transform 0.5s ease',\n }),\n\n ...(shouldHaveWhiteText && {\n color: token.color.white,\n }),\n },\n },\n });\n\n wrapperChildren.push(attributionSubTextElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n ...props,\n action,\n });\n\n wrapperChildren.push(actionElement);\n }\n\n return wrapperChildren;\n};\n\nexport default (\n props: Pick<\n QuoteTextProps,\n | 'isThemeDark'\n | 'isThemeMaryland'\n | 'isSizeLarge'\n | 'isTypeFeatured'\n | 'image'\n | 'quote'\n | 'attribution'\n | 'attributionSubText'\n | 'action'\n | 'includesAnimation'\n >,\n) => {\n const {\n image,\n isSizeLarge = false,\n isThemeDark,\n isThemeMaryland,\n isTypeFeatured = false,\n } = props;\n const shouldHaveWhiteText = isThemeDark || isThemeMaryland;\n const isSizeLargeAndNotFeatured = isSizeLarge && !isTypeFeatured;\n const hasImage = image != null;\n const isHasImageAndNotFeatured = hasImage && !isTypeFeatured;\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-text-container-wrapper',\n children: [\n ...createChildren({\n ...props,\n shouldHaveWhiteText,\n hasImage,\n }),\n ],\n });\n\n return ElementModel.createDiv({\n className: 'quote-text-container',\n children: [wrapper],\n elementStyles: {\n element: {\n width: '100%',\n ...typography.sans.medium,\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n paddingLeft: token.spacing.md,\n\n ...(!hasImage && {\n paddingTop: token.spacing.lg,\n }),\n\n ...(isSizeLargeAndNotFeatured && {\n paddingTop: token.spacing['2xl'],\n }),\n },\n\n [`@container (min-width: ${SMALL}px)`]: {\n paddingLeft: token.spacing['4xl'],\n\n ...(isHasImageAndNotFeatured && { paddingLeft: '0' }),\n },\n\n [`& *`]: {\n ...typography.sans.medium,\n\n ...(shouldHaveWhiteText && {\n color: token.color.white,\n }),\n },\n },\n },\n });\n};\n"],"names":["ElementModel.create","ElementModel.createDiv"],"mappings":";;;;;;AA0BA,MAAM,iBAAiB,CAAC,UAAyB;AAC/C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,kBAAmC,CAAA;AAEzC,MAAI,OAAO;AACT,oBAAgB;AAAA,MACd,aAAa,EAAE,GAAG,OAAO,qBAAqB,OAAO,UAAU;AAAA,IAAA;AAAA,EAEnE;AAEA,MAAI,aAAa;AACf,UAAM,qBAAqBA,OAAoB;AAAA,MAC7C,SAAS;AAAA,MACT,WAAW;AAAA,MACX,eAAe;AAAA,Q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AAW;AAAA,IACX,UAAU;AAAA,MACR,GAAG,eAAe;AAAA,QAChB,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,EACH,CACD;AAED,SAAOA,UAAuB;AAAA,IAC5B,WAAW;AAAA,IACX,UAAU,CAAC,OAAO;AAAA,IAClB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,OAAO;AAAA,QACP,GAAG,WAAW,KAAK;AAAA,QAEnB,CAAC,0BAA0B,QAAQ,CAAC,KAAK,GAAG;AAAA,UAC1C,aAAa,MAAM,QAAQ;AAAA,UAE3B,GAAI,CAAC,YAAY;AAAA,YACf,YAAY,MAAM,QAAQ;AAAA,UAAA;AAAA,UAG5B,GAAI,6BAA6B;AAAA,YAC/B,YAAY,MAAM,QAAQ,KAAK;AAAA,UAAA;AAAA,QACjC;AAAA,QAGF,CAAC,0BAA0B,KAAK,KAAK,GAAG;AAAA,UACtC,aAAa,MAAM,QAAQ,KAAK;AAAA,UAEhC,GAAI,4BAA4B,EAAE,aAAa,IAAA;AAAA,QAAI;AAAA,QAGrD,CAAC,KAAK,GAAG;AAAA,UACP,GAAG,WAAW,KAAK;AAAA,UAEnB,GAAI,uBAAuB;AAAA,YACzB,OAAO,MAAM,MAAM;AAAA,UAAA;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CACD;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featured.d.ts","sourceRoot":"","sources":["../../../source/composite/quote/featured.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;yBAsInC,OAAO,kBAAkB
|
|
1
|
+
{"version":3,"file":"featured.d.ts","sourceRoot":"","sources":["../../../source/composite/quote/featured.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;yBAsInC,OAAO,kBAAkB;;;;;;;;AAAzC,wBAwGE"}
|
|
@@ -5,9 +5,9 @@ const index = require("../../model/elements/index.js");
|
|
|
5
5
|
const inline = require("./inline.js");
|
|
6
6
|
const image = require("./elements/image.js");
|
|
7
7
|
require("@universityofmaryland/web-styles-library/typography");
|
|
8
|
+
const action = require("./elements/action.js");
|
|
8
9
|
require("@universityofmaryland/web-icons-library/brand");
|
|
9
10
|
const _constants = require("./_constants.js");
|
|
10
|
-
const action = require("./elements/action.js");
|
|
11
11
|
const animation = require("./helper/animation.js");
|
|
12
12
|
function _interopNamespaceDefault(e) {
|
|
13
13
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -136,7 +136,7 @@ const createTextureContainer = ({
|
|
|
136
136
|
const featured = (props) => {
|
|
137
137
|
const { isThemeDark, isThemeMaryland, image: image2, isTransparent } = props;
|
|
138
138
|
const wrapperChildren = [];
|
|
139
|
-
const inlineQuote = inline(props);
|
|
139
|
+
const inlineQuote = inline({ ...props, isTypeFeatured: true });
|
|
140
140
|
const textContainer = index.createDiv({
|
|
141
141
|
className: "quote-featured-text",
|
|
142
142
|
children: [inlineQuote],
|
|
@@ -207,11 +207,18 @@ const featured = (props) => {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
const loadAnimation = () => {
|
|
211
|
+
animation.quoteAnimation({
|
|
212
|
+
...props,
|
|
213
|
+
quoteElement: container
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
...container,
|
|
218
|
+
events: {
|
|
219
|
+
loadAnimation
|
|
220
|
+
}
|
|
221
|
+
};
|
|
215
222
|
};
|
|
216
223
|
module.exports = featured;
|
|
217
224
|
//# sourceMappingURL=featured.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featured.js","sources":["../../../source/composite/quote/featured.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport { imageFromSvg } from '@universityofmaryland/web-utilities-library/media';\nimport { ElementModel } from 'model';\nimport InlineQuote from './inline';\nimport { image as elementImage, action as elementAction } from './elements';\nimport { quoteAnimation } from './helper/animation';\nimport { MEDIUM, SMALL } from './_constants';\nimport { type QuoteFeaturedProps } from './_types';\nimport { type ElementVisual } from '../../_types';\n\nconst BACKGROUND_TEXTURE_LIGHT = `<svg id=\"quote_background_light\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 850.5 532.1\"><path d=\"M.3,0h332.7L.3,326.6V0Z\" fill=\"#757575\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/><path d=\"M517.9,532.1h332.7L308.6,0H0v23.6l517.9,508.5Z\" fill=\"#000\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/></svg>`;\nconst BACKGROUND_TEXTURE_DARK = `<svg id=\"quote_background_dark\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 614.86 300.65\"><defs><style>.cls-1{opacity:.25;}.cls-1,.cls-2{fill:#757575;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:.1;}</style></defs><path class=\"cls-2\" d=\"m.27,0h332.67L27.46,299.93H.27V0Z\"/><path class=\"cls-1\" d=\"m0,0h308.65l306.21,300.65h-332.67L0,23.59V0Z\"/></svg>`;\n\nconst createImageContainer = (props: QuoteFeaturedProps) => {\n const { image, action } = props;\n\n const getContainerChildren = () => {\n const containerChildren: ElementVisual[] = [];\n\n if (image) {\n const imageElement = elementImage({\n ...props,\n isTypeFeatured: true,\n image,\n });\n containerChildren.push(imageElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n isTypeFeatured: true,\n action,\n });\n containerChildren.push(actionElement);\n }\n\n return containerChildren;\n };\n\n const createImageContainerElement = () => {\n return ElementModel.createDiv({\n className: 'quote-featured-image',\n children: containerChildren,\n elementStyles: {\n element: {\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n marginTop: `-${token.spacing.lg}`,\n\n ['&[align-center=true]']: {\n marginTop: '0',\n justifyContent: 'center',\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n padding: `0 ${token.spacing.lg}`,\n },\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${\n MEDIUM - 1\n }px)`]: {\n margin: '0 auto',\n marginTop: `-${token.spacing['8xl']}`,\n maxWidth: '300px',\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n paddingLeft: token.spacing['6xl'],\n width: `calc(300px + ${token.spacing['6xl']})`,\n },\n },\n },\n });\n };\n\n const containerChildren = getContainerChildren();\n const container = createImageContainerElement();\n\n if (window.innerWidth >= MEDIUM && image instanceof HTMLImageElement) {\n image.addEventListener('load', () => {\n const parent = container;\n\n if (!parent) return;\n\n const aspectRatio = image.offsetHeight / parent.element.offsetHeight;\n\n if (aspectRatio < 0.5) {\n container.element.setAttribute('align-center', 'true');\n }\n });\n }\n\n return container;\n};\n\nconst createTextureContainer = ({\n isThemeDark,\n isThemeMaryland,\n}: QuoteFeaturedProps) => {\n const isDarkText = isThemeDark || isThemeMaryland;\n const backgroundTexture = imageFromSvg({\n SVG: isDarkText ? BACKGROUND_TEXTURE_DARK : BACKGROUND_TEXTURE_LIGHT,\n });\n\n const backgroundTextureElement = ElementModel.create({\n element: backgroundTexture,\n className: 'quote-background-texture',\n });\n const container = ElementModel.createDiv({\n className: 'quote-featured-texture',\n children: [backgroundTextureElement],\n elementStyles: {\n element: {\n overflow: 'hidden',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n\n [`& > img`]: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '70%',\n height: '120%',\n objectFit: 'cover',\n },\n\n [`@container (max-width: ${MEDIUM - 1}px)`]: {\n display: 'none',\n },\n },\n },\n });\n\n return container;\n};\n\nexport default (props: QuoteFeaturedProps) => {\n const { isThemeDark, isThemeMaryland, image, isTransparent } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n const inlineQuote = InlineQuote(props);\n\n const textContainer = ElementModel.createDiv({\n className: 'quote-featured-text',\n children: [inlineQuote],\n elementStyles: {\n element: {\n padding: token.spacing.lg,\n position: 'relative',\n width: '100%',\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n padding: `${token.spacing['2xl']}`,\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n padding: `${token.spacing['4xl']}`,\n },\n },\n },\n });\n\n if (!isTransparent) {\n wrapperChildren.push(createTextureContainer(props));\n }\n\n if (image) {\n wrapperChildren.push(createImageContainer(props));\n }\n\n wrapperChildren.push(textContainer);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-featured-container-wrapper',\n children: wrapperChildren,\n elementStyles: {\n element: {\n backgroundColor: token.color.gray.lightest,\n position: 'relative',\n ...(isThemeDark && { backgroundColor: token.color.black }),\n ...(isThemeMaryland && { backgroundColor: token.color.red }),\n ...(isTransparent && { backgroundColor: 'transparent' }),\n\n ...(image && {\n display: 'flex',\n flexDirection: 'column',\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n display: 'flex',\n flexDirection: 'row',\n },\n }),\n },\n },\n });\n\n const spacer = ElementModel.createDiv({\n className: 'quote-featured-container-spacer',\n children: [wrapper],\n elementStyles: {\n element: {\n paddingTop: token.spacing.lg,\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${MEDIUM - 1}px)`]:\n {\n ...(image && {\n paddingTop: token.spacing['8xl'],\n }),\n },\n },\n },\n });\n\n const container = ElementModel.createDiv({\n className: 'quote-featured-container',\n children: [spacer],\n elementStyles: {\n element: {\n containerType: 'inline-size',\n },\n },\n });\n\n quoteAnimation({\n ...props,\n quoteElement: container,\n });\n\n return container;\n};\n"],"names":["image","action","containerChildren","elementImage","elementAction","ElementModel.createDiv","token","SMALL","MEDIUM","imageFromSvg","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AAAA,UAEf,CAAC,0BAA0BQ,iBAAM,KAAK,GAAG;AAAA,YACvC,SAAS;AAAA,YACT,eAAe;AAAA,UAAA;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CACD;AAED,QAAM,SAASH,MAAAA,UAAuB;AAAA,IACpC,WAAW;AAAA,IACX,UAAU,CAAC,OAAO;AAAA,IAClB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,YAAYC,iBAAM,QAAQ;AAAA,QAE1B,GAAI,iBAAiB,EAAE,SAAS,IAAA;AAAA,QAEhC,CAAC,0BAA0BC,gBAAK,uBAAuBC,WAAAA,SAAS,CAAC,KAAK,GACpE;AAAA,UACE,GAAIR,UAAS;AAAA,YACX,YAAYM,iBAAM,QAAQ,KAAK;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,IACJ;AAAA,EACF,CACD;AAED,QAAM,YAAYD,MAAAA,UAAuB;AAAA,IACvC,WAAW;AAAA,IACX,UAAU,CAAC,MAAM;AAAA,IACjB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,eAAe;AAAA,MAAA;AAAA,IACjB;AAAA,EACF,CACD;AAEDO,2BAAe;AAAA,IACb,GAAG;AAAA,IACH,cAAc;AAAA,EAAA,CACf;AAED,SAAO;AACT;;"}
|
|
1
|
+
{"version":3,"file":"featured.js","sources":["../../../source/composite/quote/featured.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport { imageFromSvg } from '@universityofmaryland/web-utilities-library/media';\nimport { ElementModel } from 'model';\nimport InlineQuote from './inline';\nimport { image as elementImage, action as elementAction } from './elements';\nimport { quoteAnimation } from './helper/animation';\nimport { MEDIUM, SMALL } from './_constants';\nimport { type QuoteFeaturedProps } from './_types';\nimport { type ElementVisual } from '../../_types';\n\nconst BACKGROUND_TEXTURE_LIGHT = `<svg id=\"quote_background_light\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 850.5 532.1\"><path d=\"M.3,0h332.7L.3,326.6V0Z\" fill=\"#757575\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/><path d=\"M517.9,532.1h332.7L308.6,0H0v23.6l517.9,508.5Z\" fill=\"#000\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/></svg>`;\nconst BACKGROUND_TEXTURE_DARK = `<svg id=\"quote_background_dark\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 614.86 300.65\"><defs><style>.cls-1{opacity:.25;}.cls-1,.cls-2{fill:#757575;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:.1;}</style></defs><path class=\"cls-2\" d=\"m.27,0h332.67L27.46,299.93H.27V0Z\"/><path class=\"cls-1\" d=\"m0,0h308.65l306.21,300.65h-332.67L0,23.59V0Z\"/></svg>`;\n\nconst createImageContainer = (props: QuoteFeaturedProps) => {\n const { image, action } = props;\n\n const getContainerChildren = () => {\n const containerChildren: ElementVisual[] = [];\n\n if (image) {\n const imageElement = elementImage({\n ...props,\n isTypeFeatured: true,\n image,\n });\n containerChildren.push(imageElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n isTypeFeatured: true,\n action,\n });\n containerChildren.push(actionElement);\n }\n\n return containerChildren;\n };\n\n const createImageContainerElement = () => {\n return ElementModel.createDiv({\n className: 'quote-featured-image',\n children: containerChildren,\n elementStyles: {\n element: {\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n marginTop: `-${token.spacing.lg}`,\n\n ['&[align-center=true]']: {\n marginTop: '0',\n justifyContent: 'center',\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n padding: `0 ${token.spacing.lg}`,\n },\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${\n MEDIUM - 1\n }px)`]: {\n margin: '0 auto',\n marginTop: `-${token.spacing['8xl']}`,\n maxWidth: '300px',\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n paddingLeft: token.spacing['6xl'],\n width: `calc(300px + ${token.spacing['6xl']})`,\n },\n },\n },\n });\n };\n\n const containerChildren = getContainerChildren();\n const container = createImageContainerElement();\n\n if (window.innerWidth >= MEDIUM && image instanceof HTMLImageElement) {\n image.addEventListener('load', () => {\n const parent = container;\n\n if (!parent) return;\n\n const aspectRatio = image.offsetHeight / parent.element.offsetHeight;\n\n if (aspectRatio < 0.5) {\n container.element.setAttribute('align-center', 'true');\n }\n });\n }\n\n return container;\n};\n\nconst createTextureContainer = ({\n isThemeDark,\n isThemeMaryland,\n}: QuoteFeaturedProps) => {\n const isDarkText = isThemeDark || isThemeMaryland;\n const backgroundTexture = imageFromSvg({\n SVG: isDarkText ? BACKGROUND_TEXTURE_DARK : BACKGROUND_TEXTURE_LIGHT,\n });\n\n const backgroundTextureElement = ElementModel.create({\n element: backgroundTexture,\n className: 'quote-background-texture',\n });\n const container = ElementModel.createDiv({\n className: 'quote-featured-texture',\n children: [backgroundTextureElement],\n elementStyles: {\n element: {\n overflow: 'hidden',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n\n [`& > img`]: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '70%',\n height: '120%',\n objectFit: 'cover',\n },\n\n [`@container (max-width: ${MEDIUM - 1}px)`]: {\n display: 'none',\n },\n },\n },\n });\n\n return container;\n};\n\nexport default (props: QuoteFeaturedProps) => {\n const { isThemeDark, isThemeMaryland, image, isTransparent } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n const inlineQuote = InlineQuote({ ...props, isTypeFeatured: true });\n\n const textContainer = ElementModel.createDiv({\n className: 'quote-featured-text',\n children: [inlineQuote],\n elementStyles: {\n element: {\n padding: token.spacing.lg,\n position: 'relative',\n width: '100%',\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n padding: `${token.spacing['2xl']}`,\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n padding: `${token.spacing['4xl']}`,\n },\n },\n },\n });\n\n if (!isTransparent) {\n wrapperChildren.push(createTextureContainer(props));\n }\n\n if (image) {\n wrapperChildren.push(createImageContainer(props));\n }\n\n wrapperChildren.push(textContainer);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-featured-container-wrapper',\n children: wrapperChildren,\n elementStyles: {\n element: {\n backgroundColor: token.color.gray.lightest,\n position: 'relative',\n ...(isThemeDark && { backgroundColor: token.color.black }),\n ...(isThemeMaryland && { backgroundColor: token.color.red }),\n ...(isTransparent && { backgroundColor: 'transparent' }),\n\n ...(image && {\n display: 'flex',\n flexDirection: 'column',\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n display: 'flex',\n flexDirection: 'row',\n },\n }),\n },\n },\n });\n\n const spacer = ElementModel.createDiv({\n className: 'quote-featured-container-spacer',\n children: [wrapper],\n elementStyles: {\n element: {\n paddingTop: token.spacing.lg,\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${MEDIUM - 1}px)`]:\n {\n ...(image && {\n paddingTop: token.spacing['8xl'],\n }),\n },\n },\n },\n });\n\n const container = ElementModel.createDiv({\n className: 'quote-featured-container',\n children: [spacer],\n elementStyles: {\n element: {\n containerType: 'inline-size',\n },\n },\n });\n\n const loadAnimation = () => {\n quoteAnimation({\n ...props,\n quoteElement: container,\n });\n };\n\n return {\n ...container,\n events: {\n loadAnimation,\n },\n };\n};\n"],"names":["image","action","containerChildren","elementImage","elementAction","ElementModel.createDiv","token","SMALL","MEDIUM","imageFromSvg","ElementModel.create","InlineQuote","quoteAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAEhC,MAAM,uBAAuB,CAAC,UAA8B;AAC1D,QAAM,EAAA,OAAEA,iBAAOC,SAAA,IAAW;AAE1B,QAAM,uBAAuB,MAAM;AACjC,UAAMC,qBAAqC,CAAA;AAE3C,QAAIF,SAAO;AACT,YA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MACb,SAAS;AAAA,QACP,YAAYC,iBAAM,QAAQ;AAAA,QAE1B,GAAI,iBAAiB,EAAE,SAAS,IAAA;AAAA,QAEhC,CAAC,0BAA0BC,gBAAK,uBAAuBC,WAAAA,SAAS,CAAC,KAAK,GACpE;AAAA,UACE,GAAIR,UAAS;AAAA,YACX,YAAYM,iBAAM,QAAQ,KAAK;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,IACJ;AAAA,EACF,CACD;AAED,QAAM,YAAYD,MAAAA,UAAuB;AAAA,IACvC,WAAW;AAAA,IACX,UAAU,CAAC,MAAM;AAAA,IACjB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,eAAe;AAAA,MAAA;AAAA,IACjB;AAAA,EACF,CACD;AAED,QAAM,gBAAgB,MAAM;AAC1BO,6BAAe;AAAA,MACb,GAAG;AAAA,MACH,cAAc;AAAA,IAAA,CACf;AAAA,EACH;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
|
@@ -4,9 +4,9 @@ import { createDiv, create } from "../../model/elements/index.mjs";
|
|
|
4
4
|
import InlineQuote from "./inline.mjs";
|
|
5
5
|
import elementImage from "./elements/image.mjs";
|
|
6
6
|
import "@universityofmaryland/web-styles-library/typography";
|
|
7
|
+
import elementAction from "./elements/action.mjs";
|
|
7
8
|
import "@universityofmaryland/web-icons-library/brand";
|
|
8
9
|
import { MEDIUM, SMALL } from "./_constants.mjs";
|
|
9
|
-
import elementAction from "./elements/action.mjs";
|
|
10
10
|
import { quoteAnimation } from "./helper/animation.mjs";
|
|
11
11
|
const BACKGROUND_TEXTURE_LIGHT = `<svg id="quote_background_light" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 850.5 532.1"><path d="M.3,0h332.7L.3,326.6V0Z" fill="#757575" fill-rule="evenodd" isolation="isolate" opacity=".04" stroke-width="0"/><path d="M517.9,532.1h332.7L308.6,0H0v23.6l517.9,508.5Z" fill="#000" fill-rule="evenodd" isolation="isolate" opacity=".04" stroke-width="0"/></svg>`;
|
|
12
12
|
const BACKGROUND_TEXTURE_DARK = `<svg id="quote_background_dark" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 614.86 300.65"><defs><style>.cls-1{opacity:.25;}.cls-1,.cls-2{fill:#757575;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:.1;}</style></defs><path class="cls-2" d="m.27,0h332.67L27.46,299.93H.27V0Z"/><path class="cls-1" d="m0,0h308.65l306.21,300.65h-332.67L0,23.59V0Z"/></svg>`;
|
|
@@ -118,7 +118,7 @@ const createTextureContainer = ({
|
|
|
118
118
|
const featured = (props) => {
|
|
119
119
|
const { isThemeDark, isThemeMaryland, image, isTransparent } = props;
|
|
120
120
|
const wrapperChildren = [];
|
|
121
|
-
const inlineQuote = InlineQuote(props);
|
|
121
|
+
const inlineQuote = InlineQuote({ ...props, isTypeFeatured: true });
|
|
122
122
|
const textContainer = createDiv({
|
|
123
123
|
className: "quote-featured-text",
|
|
124
124
|
children: [inlineQuote],
|
|
@@ -189,11 +189,18 @@ const featured = (props) => {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
const loadAnimation = () => {
|
|
193
|
+
quoteAnimation({
|
|
194
|
+
...props,
|
|
195
|
+
quoteElement: container
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
...container,
|
|
200
|
+
events: {
|
|
201
|
+
loadAnimation
|
|
202
|
+
}
|
|
203
|
+
};
|
|
197
204
|
};
|
|
198
205
|
export {
|
|
199
206
|
featured as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featured.mjs","sources":["../../../source/composite/quote/featured.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport { imageFromSvg } from '@universityofmaryland/web-utilities-library/media';\nimport { ElementModel } from 'model';\nimport InlineQuote from './inline';\nimport { image as elementImage, action as elementAction } from './elements';\nimport { quoteAnimation } from './helper/animation';\nimport { MEDIUM, SMALL } from './_constants';\nimport { type QuoteFeaturedProps } from './_types';\nimport { type ElementVisual } from '../../_types';\n\nconst BACKGROUND_TEXTURE_LIGHT = `<svg id=\"quote_background_light\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 850.5 532.1\"><path d=\"M.3,0h332.7L.3,326.6V0Z\" fill=\"#757575\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/><path d=\"M517.9,532.1h332.7L308.6,0H0v23.6l517.9,508.5Z\" fill=\"#000\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/></svg>`;\nconst BACKGROUND_TEXTURE_DARK = `<svg id=\"quote_background_dark\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 614.86 300.65\"><defs><style>.cls-1{opacity:.25;}.cls-1,.cls-2{fill:#757575;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:.1;}</style></defs><path class=\"cls-2\" d=\"m.27,0h332.67L27.46,299.93H.27V0Z\"/><path class=\"cls-1\" d=\"m0,0h308.65l306.21,300.65h-332.67L0,23.59V0Z\"/></svg>`;\n\nconst createImageContainer = (props: QuoteFeaturedProps) => {\n const { image, action } = props;\n\n const getContainerChildren = () => {\n const containerChildren: ElementVisual[] = [];\n\n if (image) {\n const imageElement = elementImage({\n ...props,\n isTypeFeatured: true,\n image,\n });\n containerChildren.push(imageElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n isTypeFeatured: true,\n action,\n });\n containerChildren.push(actionElement);\n }\n\n return containerChildren;\n };\n\n const createImageContainerElement = () => {\n return ElementModel.createDiv({\n className: 'quote-featured-image',\n children: containerChildren,\n elementStyles: {\n element: {\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n marginTop: `-${token.spacing.lg}`,\n\n ['&[align-center=true]']: {\n marginTop: '0',\n justifyContent: 'center',\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n padding: `0 ${token.spacing.lg}`,\n },\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${\n MEDIUM - 1\n }px)`]: {\n margin: '0 auto',\n marginTop: `-${token.spacing['8xl']}`,\n maxWidth: '300px',\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n paddingLeft: token.spacing['6xl'],\n width: `calc(300px + ${token.spacing['6xl']})`,\n },\n },\n },\n });\n };\n\n const containerChildren = getContainerChildren();\n const container = createImageContainerElement();\n\n if (window.innerWidth >= MEDIUM && image instanceof HTMLImageElement) {\n image.addEventListener('load', () => {\n const parent = container;\n\n if (!parent) return;\n\n const aspectRatio = image.offsetHeight / parent.element.offsetHeight;\n\n if (aspectRatio < 0.5) {\n container.element.setAttribute('align-center', 'true');\n }\n });\n }\n\n return container;\n};\n\nconst createTextureContainer = ({\n isThemeDark,\n isThemeMaryland,\n}: QuoteFeaturedProps) => {\n const isDarkText = isThemeDark || isThemeMaryland;\n const backgroundTexture = imageFromSvg({\n SVG: isDarkText ? BACKGROUND_TEXTURE_DARK : BACKGROUND_TEXTURE_LIGHT,\n });\n\n const backgroundTextureElement = ElementModel.create({\n element: backgroundTexture,\n className: 'quote-background-texture',\n });\n const container = ElementModel.createDiv({\n className: 'quote-featured-texture',\n children: [backgroundTextureElement],\n elementStyles: {\n element: {\n overflow: 'hidden',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n\n [`& > img`]: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '70%',\n height: '120%',\n objectFit: 'cover',\n },\n\n [`@container (max-width: ${MEDIUM - 1}px)`]: {\n display: 'none',\n },\n },\n },\n });\n\n return container;\n};\n\nexport default (props: QuoteFeaturedProps) => {\n const { isThemeDark, isThemeMaryland, image, isTransparent } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n const inlineQuote = InlineQuote(props);\n\n const textContainer = ElementModel.createDiv({\n className: 'quote-featured-text',\n children: [inlineQuote],\n elementStyles: {\n element: {\n padding: token.spacing.lg,\n position: 'relative',\n width: '100%',\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n padding: `${token.spacing['2xl']}`,\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n padding: `${token.spacing['4xl']}`,\n },\n },\n },\n });\n\n if (!isTransparent) {\n wrapperChildren.push(createTextureContainer(props));\n }\n\n if (image) {\n wrapperChildren.push(createImageContainer(props));\n }\n\n wrapperChildren.push(textContainer);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-featured-container-wrapper',\n children: wrapperChildren,\n elementStyles: {\n element: {\n backgroundColor: token.color.gray.lightest,\n position: 'relative',\n ...(isThemeDark && { backgroundColor: token.color.black }),\n ...(isThemeMaryland && { backgroundColor: token.color.red }),\n ...(isTransparent && { backgroundColor: 'transparent' }),\n\n ...(image && {\n display: 'flex',\n flexDirection: 'column',\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n display: 'flex',\n flexDirection: 'row',\n },\n }),\n },\n },\n });\n\n const spacer = ElementModel.createDiv({\n className: 'quote-featured-container-spacer',\n children: [wrapper],\n elementStyles: {\n element: {\n paddingTop: token.spacing.lg,\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${MEDIUM - 1}px)`]:\n {\n ...(image && {\n paddingTop: token.spacing['8xl'],\n }),\n },\n },\n },\n });\n\n const container = ElementModel.createDiv({\n className: 'quote-featured-container',\n children: [spacer],\n elementStyles: {\n element: {\n containerType: 'inline-size',\n },\n },\n });\n\n quoteAnimation({\n ...props,\n quoteElement: container,\n });\n\n return container;\n};\n"],"names":["containerChildren","ElementModel.createDiv","ElementModel.create"],"mappings":";;;;;;;;;;AAUA,MAAM,2BAA2B;AACjC,MAA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AS;AAAA,QACP,YAAY,MAAM,QAAQ;AAAA,QAE1B,GAAI,iBAAiB,EAAE,SAAS,IAAA;AAAA,QAEhC,CAAC,0BAA0B,KAAK,uBAAuB,SAAS,CAAC,KAAK,GACpE;AAAA,UACE,GAAI,SAAS;AAAA,YACX,YAAY,MAAM,QAAQ,KAAK;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,IACJ;AAAA,EACF,CACD;AAED,QAAM,YAAYA,UAAuB;AAAA,IACvC,WAAW;AAAA,IACX,UAAU,CAAC,MAAM;AAAA,IACjB,eAAe;AAAA,MACb,SAAS;AAAA,QACP,eAAe;AAAA,MAAA;AAAA,IACjB;AAAA,EACF,CACD;AAED,iBAAe;AAAA,IACb,GAAG;AAAA,IACH,cAAc;AAAA,EAAA,CACf;AAED,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"featured.mjs","sources":["../../../source/composite/quote/featured.ts"],"sourcesContent":["import * as token from '@universityofmaryland/web-styles-library/token';\nimport { imageFromSvg } from '@universityofmaryland/web-utilities-library/media';\nimport { ElementModel } from 'model';\nimport InlineQuote from './inline';\nimport { image as elementImage, action as elementAction } from './elements';\nimport { quoteAnimation } from './helper/animation';\nimport { MEDIUM, SMALL } from './_constants';\nimport { type QuoteFeaturedProps } from './_types';\nimport { type ElementVisual } from '../../_types';\n\nconst BACKGROUND_TEXTURE_LIGHT = `<svg id=\"quote_background_light\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 850.5 532.1\"><path d=\"M.3,0h332.7L.3,326.6V0Z\" fill=\"#757575\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/><path d=\"M517.9,532.1h332.7L308.6,0H0v23.6l517.9,508.5Z\" fill=\"#000\" fill-rule=\"evenodd\" isolation=\"isolate\" opacity=\".04\" stroke-width=\"0\"/></svg>`;\nconst BACKGROUND_TEXTURE_DARK = `<svg id=\"quote_background_dark\" aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 614.86 300.65\"><defs><style>.cls-1{opacity:.25;}.cls-1,.cls-2{fill:#757575;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:.1;}</style></defs><path class=\"cls-2\" d=\"m.27,0h332.67L27.46,299.93H.27V0Z\"/><path class=\"cls-1\" d=\"m0,0h308.65l306.21,300.65h-332.67L0,23.59V0Z\"/></svg>`;\n\nconst createImageContainer = (props: QuoteFeaturedProps) => {\n const { image, action } = props;\n\n const getContainerChildren = () => {\n const containerChildren: ElementVisual[] = [];\n\n if (image) {\n const imageElement = elementImage({\n ...props,\n isTypeFeatured: true,\n image,\n });\n containerChildren.push(imageElement);\n }\n\n if (action) {\n const actionElement = elementAction({\n isTypeFeatured: true,\n action,\n });\n containerChildren.push(actionElement);\n }\n\n return containerChildren;\n };\n\n const createImageContainerElement = () => {\n return ElementModel.createDiv({\n className: 'quote-featured-image',\n children: containerChildren,\n elementStyles: {\n element: {\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n marginTop: `-${token.spacing.lg}`,\n\n ['&[align-center=true]']: {\n marginTop: '0',\n justifyContent: 'center',\n },\n\n [`@container (max-width: ${SMALL - 1}px)`]: {\n padding: `0 ${token.spacing.lg}`,\n },\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${\n MEDIUM - 1\n }px)`]: {\n margin: '0 auto',\n marginTop: `-${token.spacing['8xl']}`,\n maxWidth: '300px',\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n paddingLeft: token.spacing['6xl'],\n width: `calc(300px + ${token.spacing['6xl']})`,\n },\n },\n },\n });\n };\n\n const containerChildren = getContainerChildren();\n const container = createImageContainerElement();\n\n if (window.innerWidth >= MEDIUM && image instanceof HTMLImageElement) {\n image.addEventListener('load', () => {\n const parent = container;\n\n if (!parent) return;\n\n const aspectRatio = image.offsetHeight / parent.element.offsetHeight;\n\n if (aspectRatio < 0.5) {\n container.element.setAttribute('align-center', 'true');\n }\n });\n }\n\n return container;\n};\n\nconst createTextureContainer = ({\n isThemeDark,\n isThemeMaryland,\n}: QuoteFeaturedProps) => {\n const isDarkText = isThemeDark || isThemeMaryland;\n const backgroundTexture = imageFromSvg({\n SVG: isDarkText ? BACKGROUND_TEXTURE_DARK : BACKGROUND_TEXTURE_LIGHT,\n });\n\n const backgroundTextureElement = ElementModel.create({\n element: backgroundTexture,\n className: 'quote-background-texture',\n });\n const container = ElementModel.createDiv({\n className: 'quote-featured-texture',\n children: [backgroundTextureElement],\n elementStyles: {\n element: {\n overflow: 'hidden',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n\n [`& > img`]: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '70%',\n height: '120%',\n objectFit: 'cover',\n },\n\n [`@container (max-width: ${MEDIUM - 1}px)`]: {\n display: 'none',\n },\n },\n },\n });\n\n return container;\n};\n\nexport default (props: QuoteFeaturedProps) => {\n const { isThemeDark, isThemeMaryland, image, isTransparent } = props;\n const wrapperChildren: ElementVisual[] = [];\n\n const inlineQuote = InlineQuote({ ...props, isTypeFeatured: true });\n\n const textContainer = ElementModel.createDiv({\n className: 'quote-featured-text',\n children: [inlineQuote],\n elementStyles: {\n element: {\n padding: token.spacing.lg,\n position: 'relative',\n width: '100%',\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px)`]: {\n padding: `${token.spacing['2xl']}`,\n },\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n padding: `${token.spacing['4xl']}`,\n },\n },\n },\n });\n\n if (!isTransparent) {\n wrapperChildren.push(createTextureContainer(props));\n }\n\n if (image) {\n wrapperChildren.push(createImageContainer(props));\n }\n\n wrapperChildren.push(textContainer);\n\n const wrapper = ElementModel.createDiv({\n className: 'quote-featured-container-wrapper',\n children: wrapperChildren,\n elementStyles: {\n element: {\n backgroundColor: token.color.gray.lightest,\n position: 'relative',\n ...(isThemeDark && { backgroundColor: token.color.black }),\n ...(isThemeMaryland && { backgroundColor: token.color.red }),\n ...(isTransparent && { backgroundColor: 'transparent' }),\n\n ...(image && {\n display: 'flex',\n flexDirection: 'column',\n\n [`@container (min-width: ${MEDIUM}px)`]: {\n display: 'flex',\n flexDirection: 'row',\n },\n }),\n },\n },\n });\n\n const spacer = ElementModel.createDiv({\n className: 'quote-featured-container-spacer',\n children: [wrapper],\n elementStyles: {\n element: {\n paddingTop: token.spacing.lg,\n\n ...(isTransparent && { padding: '0' }),\n\n [`@container (min-width: ${SMALL}px) and (max-width: ${MEDIUM - 1}px)`]:\n {\n ...(image && {\n paddingTop: token.spacing['8xl'],\n }),\n },\n },\n },\n });\n\n const container = ElementModel.createDiv({\n className: 'quote-featured-container',\n children: [spacer],\n elementStyles: {\n element: {\n containerType: 'inline-size',\n },\n },\n });\n\n const loadAnimation = () => {\n quoteAnimation({\n ...props,\n quoteElement: container,\n });\n };\n\n return {\n ...container,\n events: {\n loadAnimation,\n },\n };\n};\n"],"names":["containerChildren","ElementModel.createDiv","ElementModel.create"],"mappings":";;;;;;;;;;AAUA,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAEhC,MAAM,uBAAuB,CAAC,UAA8B;AAC1D,QAAM,EAAE,OAAO,OAAA,IAAW;AAE1B,QAAM,uBAAuB,MAAM;AACjC,UAAMA,qBAAqC,CAAA;AAE3C,QAAI,OAAO;AACT,YAAM,eAAe,aAAa;AAAA,QAChC,GAAG;AAAA,QACH,gBAAgB;AAAA,QAChB;AAAA,MAAA,CACD;AACDA,yBAAkB,KAAK,YAAY;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,YAAM,gBAAgB,cAAc;AAAA,QAClC,gBAAgB;AAAA,QAChB;AAAA,MAAA,CACD;AACDA,yBAAkB,KAAK,aAAa;AAAA,IACtC;AAEA,WAAOA;AAAAA,EACT;AAEA,QAAM,8BAA8B,MAAM;AACxC,WAAOC,UAAuB;AAAA,MAC5B,WAAW;AAAA,MACX,UAAU;AAAA,MACV,e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AAA,CACf;AAAA,EACH;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../source/composite/quote/helper/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,mBACR,SAAQ,iBAAiB,EACvB,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,mBAAmB,GAAG,OAAO,CAAC;IAC/D,YAAY,EAAE,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,GAAI,oEAM5B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../source/composite/quote/helper/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,mBACR,SAAQ,iBAAiB,EACvB,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,mBAAmB,GAAG,OAAO,CAAC;IAC/D,YAAY,EAAE,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,GAAI,oEAM5B,mBAAmB,SAgHrB,CAAC"}
|
|
@@ -7,6 +7,7 @@ const quoteAnimation = ({
|
|
|
7
7
|
quote,
|
|
8
8
|
quoteElement
|
|
9
9
|
}) => {
|
|
10
|
+
if (!includesAnimation || !quote) return;
|
|
10
11
|
const quoteTextElement = quoteElement.element.querySelector(
|
|
11
12
|
".quote-container-quote"
|
|
12
13
|
);
|
|
@@ -19,45 +20,69 @@ const quoteAnimation = ({
|
|
|
19
20
|
const actionsElement = quoteElement.element.querySelector(
|
|
20
21
|
".quote-container-actions"
|
|
21
22
|
);
|
|
23
|
+
const animateAction = !isTypeFeatured || isTypeFeatured && !image;
|
|
24
|
+
const applyFinalState = () => {
|
|
25
|
+
const wordsList = Array.from(
|
|
26
|
+
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
27
|
+
);
|
|
28
|
+
wordsList.forEach((word) => {
|
|
29
|
+
word.style.transition = "none";
|
|
30
|
+
word.style.opacity = "1";
|
|
31
|
+
word.style.transform = "translateY(0)";
|
|
32
|
+
});
|
|
33
|
+
if (attributionElement) {
|
|
34
|
+
attributionElement.style.transition = "none";
|
|
35
|
+
attributionElement.style.opacity = "1";
|
|
36
|
+
attributionElement.style.transform = "translateY(0)";
|
|
37
|
+
}
|
|
38
|
+
if (attributionSubTextElement) {
|
|
39
|
+
attributionSubTextElement.style.transition = "none";
|
|
40
|
+
attributionSubTextElement.style.opacity = "1";
|
|
41
|
+
attributionSubTextElement.style.transform = "translateY(0)";
|
|
42
|
+
}
|
|
43
|
+
if (actionsElement && animateAction) {
|
|
44
|
+
actionsElement.style.transition = "none";
|
|
45
|
+
actionsElement.style.opacity = "1";
|
|
46
|
+
actionsElement.style.transform = "translateY(0)";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const runAnimation = () => {
|
|
50
|
+
const wordsList = Array.from(
|
|
51
|
+
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
52
|
+
);
|
|
53
|
+
let quoteAnimationLength = 50;
|
|
54
|
+
wordsList.forEach((word, i) => {
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
word.style.opacity = "1";
|
|
57
|
+
word.style.transform = "translateY(0)";
|
|
58
|
+
}, i * 50);
|
|
59
|
+
quoteAnimationLength += 50;
|
|
60
|
+
});
|
|
61
|
+
if (attributionElement) {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
attributionElement.style.opacity = "1";
|
|
64
|
+
attributionElement.style.transform = "translateY(0)";
|
|
65
|
+
}, quoteAnimationLength);
|
|
66
|
+
}
|
|
67
|
+
if (attributionSubTextElement) {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
attributionSubTextElement.style.opacity = "1";
|
|
70
|
+
attributionSubTextElement.style.transform = "translateY(0)";
|
|
71
|
+
}, quoteAnimationLength);
|
|
72
|
+
}
|
|
73
|
+
if (actionsElement && animateAction) {
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
actionsElement.style.opacity = "1";
|
|
76
|
+
actionsElement.style.transform = "translateY(0)";
|
|
77
|
+
}, quoteAnimationLength);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
22
80
|
const observer = new IntersectionObserver(
|
|
23
81
|
(entries) => {
|
|
24
82
|
entries.forEach((entry) => {
|
|
25
83
|
if (entry.isIntersecting) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
const wordsList = Array.from(
|
|
30
|
-
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
31
|
-
);
|
|
32
|
-
const animateAction = !isTypeFeatured || isTypeFeatured && !image;
|
|
33
|
-
let quoteAnimationLength = 50;
|
|
34
|
-
wordsList.forEach((word, i) => {
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
word.style.opacity = "1";
|
|
37
|
-
word.style.transform = "translateY(0)";
|
|
38
|
-
}, i * 50);
|
|
39
|
-
quoteAnimationLength += 50;
|
|
40
|
-
});
|
|
41
|
-
if (attributionElement) {
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
if (attributionElement) {
|
|
44
|
-
attributionElement.style.opacity = "1";
|
|
45
|
-
attributionElement.style.transform = "translateY(0)";
|
|
46
|
-
}
|
|
47
|
-
}, quoteAnimationLength);
|
|
48
|
-
}
|
|
49
|
-
if (attributionSubTextElement) {
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
attributionSubTextElement.style.opacity = "1";
|
|
52
|
-
attributionSubTextElement.style.transform = "translateY(0)";
|
|
53
|
-
}, quoteAnimationLength);
|
|
54
|
-
}
|
|
55
|
-
if (actionsElement && animateAction) {
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
actionsElement.style.opacity = "1";
|
|
58
|
-
actionsElement.style.transform = "translateY(0)";
|
|
59
|
-
}, quoteAnimationLength);
|
|
60
|
-
}
|
|
84
|
+
runAnimation();
|
|
85
|
+
observer.unobserve(entry.target);
|
|
61
86
|
}
|
|
62
87
|
});
|
|
63
88
|
},
|
|
@@ -66,7 +91,13 @@ const quoteAnimation = ({
|
|
|
66
91
|
threshold: 0
|
|
67
92
|
}
|
|
68
93
|
);
|
|
69
|
-
|
|
94
|
+
const rect = quoteTextElement.getBoundingClientRect();
|
|
95
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
96
|
+
const triggerPoint = windowHeight - 120;
|
|
97
|
+
const isAlreadyPast = rect.top < triggerPoint;
|
|
98
|
+
if (isAlreadyPast) {
|
|
99
|
+
applyFinalState();
|
|
100
|
+
} else {
|
|
70
101
|
observer.observe(quoteTextElement);
|
|
71
102
|
}
|
|
72
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.js","sources":["../../../../source/composite/quote/helper/animation.ts"],"sourcesContent":["import { type QuoteBaseProps, type QuoteVariantProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface QuoteAnimationProps\n extends QuoteVariantProps,\n Pick<QuoteBaseProps, 'quote' | 'includesAnimation' | 'image'> {\n quoteElement: ElementVisual;\n}\n\nexport const quoteAnimation = ({\n image,\n includesAnimation,\n isTypeFeatured = false,\n quote,\n quoteElement,\n}: QuoteAnimationProps) => {\n const quoteTextElement = quoteElement.element.querySelector(\n '.quote-container-quote',\n ) as HTMLElement;\n const attributionElement = quoteElement.element.querySelector(\n '.quote-container-attribution',\n ) as HTMLElement;\n const attributionSubTextElement = quoteElement.element.querySelector(\n '.quote-container-text-attribution-sub-text',\n ) as HTMLElement;\n const actionsElement = quoteElement.element.querySelector(\n '.quote-container-actions',\n ) as HTMLElement;\n\n const
|
|
1
|
+
{"version":3,"file":"animation.js","sources":["../../../../source/composite/quote/helper/animation.ts"],"sourcesContent":["import { type QuoteBaseProps, type QuoteVariantProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface QuoteAnimationProps\n extends QuoteVariantProps,\n Pick<QuoteBaseProps, 'quote' | 'includesAnimation' | 'image'> {\n quoteElement: ElementVisual;\n}\n\nexport const quoteAnimation = ({\n image,\n includesAnimation,\n isTypeFeatured = false,\n quote,\n quoteElement,\n}: QuoteAnimationProps) => {\n if (!includesAnimation || !quote) return;\n\n const quoteTextElement = quoteElement.element.querySelector(\n '.quote-container-quote',\n ) as HTMLElement;\n const attributionElement = quoteElement.element.querySelector(\n '.quote-container-attribution',\n ) as HTMLElement;\n const attributionSubTextElement = quoteElement.element.querySelector(\n '.quote-container-text-attribution-sub-text',\n ) as HTMLElement;\n const actionsElement = quoteElement.element.querySelector(\n '.quote-container-actions',\n ) as HTMLElement;\n\n const animateAction = !isTypeFeatured || (isTypeFeatured && !image);\n\n const applyFinalState = () => {\n const wordsList = Array.from(\n quoteTextElement.querySelectorAll('.quote-text-split-word'),\n ) as HTMLElement[];\n\n wordsList.forEach((word) => {\n word.style.transition = 'none';\n word.style.opacity = '1';\n word.style.transform = 'translateY(0)';\n });\n\n if (attributionElement) {\n attributionElement.style.transition = 'none';\n attributionElement.style.opacity = '1';\n attributionElement.style.transform = 'translateY(0)';\n }\n\n if (attributionSubTextElement) {\n attributionSubTextElement.style.transition = 'none';\n attributionSubTextElement.style.opacity = '1';\n attributionSubTextElement.style.transform = 'translateY(0)';\n }\n\n if (actionsElement && animateAction) {\n actionsElement.style.transition = 'none';\n actionsElement.style.opacity = '1';\n actionsElement.style.transform = 'translateY(0)';\n }\n };\n\n const runAnimation = () => {\n const wordsList = Array.from(\n quoteTextElement.querySelectorAll('.quote-text-split-word'),\n ) as HTMLElement[];\n\n let quoteAnimationLength = 50;\n\n wordsList.forEach((word, i) => {\n setTimeout(() => {\n word.style.opacity = '1';\n word.style.transform = 'translateY(0)';\n }, i * 50);\n\n quoteAnimationLength += 50;\n });\n\n if (attributionElement) {\n setTimeout(() => {\n attributionElement.style.opacity = '1';\n attributionElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n\n if (attributionSubTextElement) {\n setTimeout(() => {\n attributionSubTextElement.style.opacity = '1';\n attributionSubTextElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n\n if (actionsElement && animateAction) {\n setTimeout(() => {\n actionsElement.style.opacity = '1';\n actionsElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n };\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n runAnimation();\n observer.unobserve(entry.target);\n }\n });\n },\n {\n rootMargin: '0px 0px -120px 0px',\n threshold: 0,\n },\n );\n\n const rect = quoteTextElement.getBoundingClientRect();\n const windowHeight =\n window.innerHeight || document.documentElement.clientHeight;\n const triggerPoint = windowHeight - 120;\n const isAlreadyPast = rect.top < triggerPoint;\n\n if (isAlreadyPast) {\n applyFinalState();\n } else {\n observer.observe(quoteTextElement);\n }\n};\n"],"names":[],"mappings":";;AASO,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,qBAAqB,CAAC,MAAO;AAElC,QAAM,mBAAmB,aAAa,QAAQ;AAAA,IAC5C;AAAA,EAAA;AAEF,QAAM,qBAAqB,aAAa,QAAQ;AAAA,IAC9C;AAAA,EAAA;AAEF,QAAM,4BAA4B,aAAa,QAAQ;AAAA,IACrD;AAAA,EAAA;AAEF,QAAM,iBAAiB,aAAa,QAAQ;AAAA,IAC1C;AAAA,EAAA;AAGF,QAAM,gBAAgB,CAAC,kBAAmB,kBAAkB,CAAC;AAE7D,QAAM,kBAAkB,MAAM;AAC5B,UAAM,YAAY,MAAM;AAAA,MACtB,iB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AAAA,IACnB,CAAC,YAAY;AACX,cAAQ,QAAQ,CAAC,UAAU;AACzB,YAAI,MAAM,gBAAgB;AACxB,uBAAA;AACA,mBAAS,UAAU,MAAM,MAAM;AAAA,QACjC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,WAAW;AAAA,IAAA;AAAA,EACb;AAGF,QAAM,OAAO,iBAAiB,sBAAA;AAC9B,QAAM,eACJ,OAAO,eAAe,SAAS,gBAAgB;AACjD,QAAM,eAAe,eAAe;AACpC,QAAM,gBAAgB,KAAK,MAAM;AAEjC,MAAI,eAAe;AACjB,oBAAA;AAAA,EACF,OAAO;AACL,aAAS,QAAQ,gBAAgB;AAAA,EACnC;AACF;;"}
|
|
@@ -5,6 +5,7 @@ const quoteAnimation = ({
|
|
|
5
5
|
quote,
|
|
6
6
|
quoteElement
|
|
7
7
|
}) => {
|
|
8
|
+
if (!includesAnimation || !quote) return;
|
|
8
9
|
const quoteTextElement = quoteElement.element.querySelector(
|
|
9
10
|
".quote-container-quote"
|
|
10
11
|
);
|
|
@@ -17,45 +18,69 @@ const quoteAnimation = ({
|
|
|
17
18
|
const actionsElement = quoteElement.element.querySelector(
|
|
18
19
|
".quote-container-actions"
|
|
19
20
|
);
|
|
21
|
+
const animateAction = !isTypeFeatured || isTypeFeatured && !image;
|
|
22
|
+
const applyFinalState = () => {
|
|
23
|
+
const wordsList = Array.from(
|
|
24
|
+
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
25
|
+
);
|
|
26
|
+
wordsList.forEach((word) => {
|
|
27
|
+
word.style.transition = "none";
|
|
28
|
+
word.style.opacity = "1";
|
|
29
|
+
word.style.transform = "translateY(0)";
|
|
30
|
+
});
|
|
31
|
+
if (attributionElement) {
|
|
32
|
+
attributionElement.style.transition = "none";
|
|
33
|
+
attributionElement.style.opacity = "1";
|
|
34
|
+
attributionElement.style.transform = "translateY(0)";
|
|
35
|
+
}
|
|
36
|
+
if (attributionSubTextElement) {
|
|
37
|
+
attributionSubTextElement.style.transition = "none";
|
|
38
|
+
attributionSubTextElement.style.opacity = "1";
|
|
39
|
+
attributionSubTextElement.style.transform = "translateY(0)";
|
|
40
|
+
}
|
|
41
|
+
if (actionsElement && animateAction) {
|
|
42
|
+
actionsElement.style.transition = "none";
|
|
43
|
+
actionsElement.style.opacity = "1";
|
|
44
|
+
actionsElement.style.transform = "translateY(0)";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const runAnimation = () => {
|
|
48
|
+
const wordsList = Array.from(
|
|
49
|
+
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
50
|
+
);
|
|
51
|
+
let quoteAnimationLength = 50;
|
|
52
|
+
wordsList.forEach((word, i) => {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
word.style.opacity = "1";
|
|
55
|
+
word.style.transform = "translateY(0)";
|
|
56
|
+
}, i * 50);
|
|
57
|
+
quoteAnimationLength += 50;
|
|
58
|
+
});
|
|
59
|
+
if (attributionElement) {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
attributionElement.style.opacity = "1";
|
|
62
|
+
attributionElement.style.transform = "translateY(0)";
|
|
63
|
+
}, quoteAnimationLength);
|
|
64
|
+
}
|
|
65
|
+
if (attributionSubTextElement) {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
attributionSubTextElement.style.opacity = "1";
|
|
68
|
+
attributionSubTextElement.style.transform = "translateY(0)";
|
|
69
|
+
}, quoteAnimationLength);
|
|
70
|
+
}
|
|
71
|
+
if (actionsElement && animateAction) {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
actionsElement.style.opacity = "1";
|
|
74
|
+
actionsElement.style.transform = "translateY(0)";
|
|
75
|
+
}, quoteAnimationLength);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
20
78
|
const observer = new IntersectionObserver(
|
|
21
79
|
(entries) => {
|
|
22
80
|
entries.forEach((entry) => {
|
|
23
81
|
if (entry.isIntersecting) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const wordsList = Array.from(
|
|
28
|
-
quoteTextElement.querySelectorAll(".quote-text-split-word")
|
|
29
|
-
);
|
|
30
|
-
const animateAction = !isTypeFeatured || isTypeFeatured && !image;
|
|
31
|
-
let quoteAnimationLength = 50;
|
|
32
|
-
wordsList.forEach((word, i) => {
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
word.style.opacity = "1";
|
|
35
|
-
word.style.transform = "translateY(0)";
|
|
36
|
-
}, i * 50);
|
|
37
|
-
quoteAnimationLength += 50;
|
|
38
|
-
});
|
|
39
|
-
if (attributionElement) {
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
if (attributionElement) {
|
|
42
|
-
attributionElement.style.opacity = "1";
|
|
43
|
-
attributionElement.style.transform = "translateY(0)";
|
|
44
|
-
}
|
|
45
|
-
}, quoteAnimationLength);
|
|
46
|
-
}
|
|
47
|
-
if (attributionSubTextElement) {
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
attributionSubTextElement.style.opacity = "1";
|
|
50
|
-
attributionSubTextElement.style.transform = "translateY(0)";
|
|
51
|
-
}, quoteAnimationLength);
|
|
52
|
-
}
|
|
53
|
-
if (actionsElement && animateAction) {
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
actionsElement.style.opacity = "1";
|
|
56
|
-
actionsElement.style.transform = "translateY(0)";
|
|
57
|
-
}, quoteAnimationLength);
|
|
58
|
-
}
|
|
82
|
+
runAnimation();
|
|
83
|
+
observer.unobserve(entry.target);
|
|
59
84
|
}
|
|
60
85
|
});
|
|
61
86
|
},
|
|
@@ -64,7 +89,13 @@ const quoteAnimation = ({
|
|
|
64
89
|
threshold: 0
|
|
65
90
|
}
|
|
66
91
|
);
|
|
67
|
-
|
|
92
|
+
const rect = quoteTextElement.getBoundingClientRect();
|
|
93
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
94
|
+
const triggerPoint = windowHeight - 120;
|
|
95
|
+
const isAlreadyPast = rect.top < triggerPoint;
|
|
96
|
+
if (isAlreadyPast) {
|
|
97
|
+
applyFinalState();
|
|
98
|
+
} else {
|
|
68
99
|
observer.observe(quoteTextElement);
|
|
69
100
|
}
|
|
70
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.mjs","sources":["../../../../source/composite/quote/helper/animation.ts"],"sourcesContent":["import { type QuoteBaseProps, type QuoteVariantProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface QuoteAnimationProps\n extends QuoteVariantProps,\n Pick<QuoteBaseProps, 'quote' | 'includesAnimation' | 'image'> {\n quoteElement: ElementVisual;\n}\n\nexport const quoteAnimation = ({\n image,\n includesAnimation,\n isTypeFeatured = false,\n quote,\n quoteElement,\n}: QuoteAnimationProps) => {\n const quoteTextElement = quoteElement.element.querySelector(\n '.quote-container-quote',\n ) as HTMLElement;\n const attributionElement = quoteElement.element.querySelector(\n '.quote-container-attribution',\n ) as HTMLElement;\n const attributionSubTextElement = quoteElement.element.querySelector(\n '.quote-container-text-attribution-sub-text',\n ) as HTMLElement;\n const actionsElement = quoteElement.element.querySelector(\n '.quote-container-actions',\n ) as HTMLElement;\n\n const
|
|
1
|
+
{"version":3,"file":"animation.mjs","sources":["../../../../source/composite/quote/helper/animation.ts"],"sourcesContent":["import { type QuoteBaseProps, type QuoteVariantProps } from '../_types';\nimport { type ElementVisual } from '../../../_types';\n\ninterface QuoteAnimationProps\n extends QuoteVariantProps,\n Pick<QuoteBaseProps, 'quote' | 'includesAnimation' | 'image'> {\n quoteElement: ElementVisual;\n}\n\nexport const quoteAnimation = ({\n image,\n includesAnimation,\n isTypeFeatured = false,\n quote,\n quoteElement,\n}: QuoteAnimationProps) => {\n if (!includesAnimation || !quote) return;\n\n const quoteTextElement = quoteElement.element.querySelector(\n '.quote-container-quote',\n ) as HTMLElement;\n const attributionElement = quoteElement.element.querySelector(\n '.quote-container-attribution',\n ) as HTMLElement;\n const attributionSubTextElement = quoteElement.element.querySelector(\n '.quote-container-text-attribution-sub-text',\n ) as HTMLElement;\n const actionsElement = quoteElement.element.querySelector(\n '.quote-container-actions',\n ) as HTMLElement;\n\n const animateAction = !isTypeFeatured || (isTypeFeatured && !image);\n\n const applyFinalState = () => {\n const wordsList = Array.from(\n quoteTextElement.querySelectorAll('.quote-text-split-word'),\n ) as HTMLElement[];\n\n wordsList.forEach((word) => {\n word.style.transition = 'none';\n word.style.opacity = '1';\n word.style.transform = 'translateY(0)';\n });\n\n if (attributionElement) {\n attributionElement.style.transition = 'none';\n attributionElement.style.opacity = '1';\n attributionElement.style.transform = 'translateY(0)';\n }\n\n if (attributionSubTextElement) {\n attributionSubTextElement.style.transition = 'none';\n attributionSubTextElement.style.opacity = '1';\n attributionSubTextElement.style.transform = 'translateY(0)';\n }\n\n if (actionsElement && animateAction) {\n actionsElement.style.transition = 'none';\n actionsElement.style.opacity = '1';\n actionsElement.style.transform = 'translateY(0)';\n }\n };\n\n const runAnimation = () => {\n const wordsList = Array.from(\n quoteTextElement.querySelectorAll('.quote-text-split-word'),\n ) as HTMLElement[];\n\n let quoteAnimationLength = 50;\n\n wordsList.forEach((word, i) => {\n setTimeout(() => {\n word.style.opacity = '1';\n word.style.transform = 'translateY(0)';\n }, i * 50);\n\n quoteAnimationLength += 50;\n });\n\n if (attributionElement) {\n setTimeout(() => {\n attributionElement.style.opacity = '1';\n attributionElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n\n if (attributionSubTextElement) {\n setTimeout(() => {\n attributionSubTextElement.style.opacity = '1';\n attributionSubTextElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n\n if (actionsElement && animateAction) {\n setTimeout(() => {\n actionsElement.style.opacity = '1';\n actionsElement.style.transform = 'translateY(0)';\n }, quoteAnimationLength);\n }\n };\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n runAnimation();\n observer.unobserve(entry.target);\n }\n });\n },\n {\n rootMargin: '0px 0px -120px 0px',\n threshold: 0,\n },\n );\n\n const rect = quoteTextElement.getBoundingClientRect();\n const windowHeight =\n window.innerHeight || document.documentElement.clientHeight;\n const triggerPoint = windowHeight - 120;\n const isAlreadyPast = rect.top < triggerPoint;\n\n if (isAlreadyPast) {\n applyFinalState();\n } else {\n observer.observe(quoteTextElement);\n }\n};\n"],"names":[],"mappings":"AASO,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,qBAAqB,CAAC,MAAO;AAElC,QAAM,mBAAmB,aAAa,QAAQ;AAAA,IAC5C;AAAA,EAAA;AAEF,QAAM,qBAAqB,aAAa,QAAQ;AAAA,IAC9C;AAAA,EAAA;AAEF,QAAM,4BAA4B,aAAa,QAAQ;AAAA,IACrD;AAAA,EAAA;AAEF,QAAM,iBAAiB,aAAa,QAAQ;AAAA,IAC1C;AAAA,EAAA;AAGF,QAAM,gBAAgB,CAAC,kBAAmB,kBAAkB,CAAC;AAE7D,QAAM,kBAAkB,MAAM;AAC5B,UAAM,YAAY,MAAM;AAAA,MACtB,iBAAiB,iBAAiB,wBAAwB;AAAA,IAAA;AAG5D,cAAU,QAAQ,CAAC,SAAS;AAC1B,WAAK,MAAM,aAAa;AACxB,WAAK,MAAM,UAAU;AACrB,WAAK,MAAM,YAAY;AAAA,IACzB,CAAC;AAED,QAAI,oBAAoB;AACtB,yBAAmB,MAAM,aAAa;AACtC,yBAAmB,MAAM,UAAU;AACnC,yBAAmB,MAAM,YAAY;AAAA,IACvC;AAEA,QAAI,2BAA2B;AAC7B,gCAA0B,MAAM,aAAa;AAC7C,gCAA0B,MAAM,UAAU;AAC1C,gCAA0B,MAAM,YAAY;AAAA,IAC9C;AAEA,QAAI,kBAAkB,eAAe;AACnC,qBAAe,MAAM,aAAa;AAClC,qBAAe,MAAM,UAAU;AAC/B,qBAAe,MAAM,YAAY;AAAA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|
-
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../source/composite/quote/inline.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;yBAGjC,OAAO,gBAAgB
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../source/composite/quote/inline.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;yBAGjC,OAAO,gBAAgB;;;;;;;;AAAvC,wBAiEE"}
|