@content-blocks/js 0.5.0 → 0.7.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/dist/cjs/content-accordion_11.cjs.entry.js +79 -61
- package/dist/cjs/content-accordion_11.cjs.entry.js.map +1 -1
- package/dist/cjs/content-blocks.cjs.js +2 -2
- package/dist/cjs/content-carousel.cjs.entry.js +2 -1
- package/dist/cjs/content-carousel.cjs.entry.js.map +1 -1
- package/dist/cjs/content-navigation-block.cjs.entry.js +24 -20
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-split-block.cjs.entry.js +4 -4
- package/dist/cjs/content-split-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-tabs.cjs.entry.js +3 -3
- package/dist/cjs/{index-072153fb.js → index-9f20d89a.js} +34 -4
- package/dist/cjs/index-9f20d89a.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-9856e159.js → utils-db61cd70.js} +1 -3
- package/dist/cjs/utils-db61cd70.js.map +1 -0
- package/dist/cjs/{window-resize-service-77b2c64e.js → window-resize-service-ac5c2012.js} +2 -2
- package/dist/cjs/{window-resize-service-77b2c64e.js.map → window-resize-service-ac5c2012.js.map} +1 -1
- package/dist/collection/blocks/content-hero-block/content-hero-block.css +6 -0
- package/dist/collection/blocks/content-split-block/content-split-block.js +1 -1
- package/dist/collection/blocks/content-split-block/content-split-block.js.map +1 -1
- package/dist/collection/blocks/content-text-block/content-text-block.css +8 -8
- package/dist/collection/blocks/content-text-block/content-text-block.js +4 -4
- package/dist/collection/blocks/content-text-block/content-text-block.js.map +1 -1
- package/dist/collection/components/content-accordion/content-accordion.js +4 -6
- package/dist/collection/components/content-accordion/content-accordion.js.map +1 -1
- package/dist/collection/components/content-carousel/content-carousel.js +1 -0
- package/dist/collection/components/content-carousel/content-carousel.js.map +1 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +21 -17
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -1
- package/dist/collection/components/content-overlay/content-overlay.css +12 -9
- package/dist/collection/components/content-overlay/content-overlay.js +32 -17
- package/dist/collection/components/content-overlay/content-overlay.js.map +1 -1
- package/dist/collection/elements/content-button/content-button.js +2 -6
- package/dist/collection/elements/content-button/content-button.js.map +1 -1
- package/dist/collection/elements/content-image/content-image.css +4 -7
- package/dist/collection/elements/content-image/content-image.js +82 -21
- package/dist/collection/elements/content-image/content-image.js.map +1 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +1 -0
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +58 -15
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -1
- package/dist/collection/formatters/content-spacer/content-spacer.css +16 -3
- package/dist/collection/formatters/content-spacer/content-spacer.js +47 -5
- package/dist/collection/formatters/content-spacer/content-spacer.js.map +1 -1
- package/dist/collection/stories/ContentHeroBlock.stories.js +2 -2
- package/dist/collection/stories/ContentHeroBlock.stories.js.map +1 -1
- package/dist/collection/stories/FullPageExample.stories.js +11 -11
- package/dist/collection/stories/FullPageExample.stories.js.map +1 -1
- package/dist/components/content-accordion.js +3 -4
- package/dist/components/content-accordion.js.map +1 -1
- package/dist/components/content-button.js +3 -6
- package/dist/components/content-button.js.map +1 -1
- package/dist/components/content-carousel.js +2 -0
- package/dist/components/content-carousel.js.map +1 -1
- package/dist/components/content-grid-formatter2.js +19 -12
- package/dist/components/content-grid-formatter2.js.map +1 -1
- package/dist/components/content-hero-block.js +2 -1
- package/dist/components/content-hero-block.js.map +1 -1
- package/dist/components/content-image.js +30 -22
- package/dist/components/content-image.js.map +1 -1
- package/dist/components/content-line.js +1 -0
- package/dist/components/content-line.js.map +1 -1
- package/dist/components/content-navigation-block.js +22 -17
- package/dist/components/content-navigation-block.js.map +1 -1
- package/dist/components/content-overlay.js +29 -13
- package/dist/components/content-overlay.js.map +1 -1
- package/dist/components/content-spacer.js +8 -4
- package/dist/components/content-spacer.js.map +1 -1
- package/dist/components/content-split-block.js +2 -1
- package/dist/components/content-split-block.js.map +1 -1
- package/dist/components/content-tabs.js +1 -0
- package/dist/components/content-tabs.js.map +1 -1
- package/dist/components/content-text-block.js +5 -4
- package/dist/components/content-text-block.js.map +1 -1
- package/dist/components/content-tout-block.js +1 -0
- package/dist/components/content-tout-block.js.map +1 -1
- package/dist/components/content-video.js +1 -0
- package/dist/components/content-video.js.map +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/content-blocks/content-blocks.esm.js +1 -1
- package/dist/content-blocks/content-blocks.esm.js.map +1 -1
- package/dist/content-blocks/index.esm.js +1 -1
- package/dist/content-blocks/p-24657e66.entry.js +10 -0
- package/dist/content-blocks/p-24657e66.entry.js.map +1 -0
- package/dist/content-blocks/{p-30ab003a.entry.js → p-271fb304.entry.js} +2 -2
- package/dist/content-blocks/p-271fb304.entry.js.map +1 -0
- package/dist/content-blocks/p-288eace9.js +3 -0
- package/dist/content-blocks/p-288eace9.js.map +1 -0
- package/dist/content-blocks/{p-fd14acd9.entry.js → p-4bfbd7ef.entry.js} +2 -2
- package/dist/content-blocks/{p-fd14acd9.entry.js.map → p-4bfbd7ef.entry.js.map} +1 -1
- package/dist/content-blocks/{p-ebaee21f.entry.js → p-6a177aef.entry.js} +2 -2
- package/dist/content-blocks/{p-ebaee21f.entry.js.map → p-6a177aef.entry.js.map} +1 -1
- package/dist/content-blocks/{p-2c515f18.entry.js → p-8cc22c1e.entry.js} +2 -2
- package/dist/content-blocks/{p-da2c36ea.js → p-b04fe808.js} +2 -2
- package/dist/content-blocks/{p-da2c36ea.js.map → p-b04fe808.js.map} +1 -1
- package/dist/content-blocks/{p-3b4b9ad1.js → p-cfb4593f.js} +2 -2
- package/dist/esm/content-accordion_11.entry.js +79 -61
- package/dist/esm/content-accordion_11.entry.js.map +1 -1
- package/dist/esm/content-blocks.js +3 -3
- package/dist/esm/content-carousel.entry.js +2 -1
- package/dist/esm/content-carousel.entry.js.map +1 -1
- package/dist/esm/content-navigation-block.entry.js +24 -20
- package/dist/esm/content-navigation-block.entry.js.map +1 -1
- package/dist/esm/content-split-block.entry.js +4 -4
- package/dist/esm/content-split-block.entry.js.map +1 -1
- package/dist/esm/content-tabs.entry.js +3 -3
- package/dist/esm/{index-5c31f78b.js → index-e848c048.js} +34 -4
- package/dist/esm/index-e848c048.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-4f29a9cf.js → utils-4f78228e.js} +2 -2
- package/dist/esm/utils-4f78228e.js.map +1 -0
- package/dist/esm/{window-resize-service-332e7420.js → window-resize-service-f40ec51c.js} +2 -2
- package/dist/esm/{window-resize-service-332e7420.js.map → window-resize-service-f40ec51c.js.map} +1 -1
- package/dist/types/blocks/content-text-block/content-text-block.d.ts +1 -1
- package/dist/types/components/content-accordion/content-accordion.d.ts +6 -7
- package/dist/types/components/content-overlay/content-overlay.d.ts +6 -4
- package/dist/types/components.d.ts +67 -15
- package/dist/types/elements/content-button/content-button.d.ts +2 -2
- package/dist/types/elements/content-image/content-image.d.ts +13 -0
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +10 -4
- package/dist/types/formatters/content-spacer/content-spacer.d.ts +11 -2
- package/dist/types/typings.d.ts +3 -3
- package/package.json +1 -1
- package/dist/cjs/index-072153fb.js.map +0 -1
- package/dist/cjs/utils-9856e159.js.map +0 -1
- package/dist/content-blocks/p-2faf0c78.js +0 -3
- package/dist/content-blocks/p-2faf0c78.js.map +0 -1
- package/dist/content-blocks/p-30ab003a.entry.js.map +0 -1
- package/dist/content-blocks/p-b8009321.entry.js +0 -10
- package/dist/content-blocks/p-b8009321.entry.js.map +0 -1
- package/dist/esm/index-5c31f78b.js.map +0 -1
- package/dist/esm/utils-4f29a9cf.js.map +0 -1
- /package/dist/content-blocks/{p-2c515f18.entry.js.map → p-8cc22c1e.entry.js.map} +0 -0
- /package/dist/content-blocks/{p-3b4b9ad1.js.map → p-cfb4593f.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-accordion.js","mappings":";;;AAAA,MAAM,mBAAmB,GAAG,wUAAwU;;MCevVA,kBAAgB;;;;;oBASO,
|
|
1
|
+
{"file":"content-accordion.js","mappings":";;;AAAA,MAAM,mBAAmB,GAAG,wUAAwU;;MCevVA,kBAAgB;;;;;oBASO,OAAO;8BAKhB,iBAAiB;4BAMnB,eAAe;6BAMd,CAAC;sBAEP,KAAK;wBACK,EAAE;2BACP,EAAE;;IAGzB,gBAAgB,CAAC,CAAa;QAC5B,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrC;IAED,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC,aAAa;QACvD,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAClC;QACD,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACrD,EAAE,CAAC,CAAC,CAAC;SACP;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAClD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;gBAC1E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;aACrB,EAAE,aAAa,CAAC,CAAC;SACnB;KACF;IAED,iBAAiB;QACf,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC;QACpF,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE;YACvB,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC;SACtE;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;SACzI;QACD,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC5D,IAAI,CAAC,MAAM,GAAG,QAAQ,KAAK,MAAM,CAAC;YAClC,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;aAC7B;SACF,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAClD,cAAQ,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,mBAAiB,IAAI,CAAC,MAAM,mBAAiB,IAAI,CAAC,QAAQ,IACtG,YAAM,IAAI,EAAC,SAAS,GAAQ,CACrB,EACT,WAAK,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAC,uDAAuD,IACnF,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentAccordion"],"sources":["src/components/content-accordion/content-accordion.scss?tag=content-accordion","src/components/content-accordion/content-accordion.tsx"],"sourcesContent":["content-accordion {\n display: block;\n\n > button {\n display: block;\n width: 100%;\n padding: 0;\n border: none;\n font: inherit;\n color: inherit;\n background-color: transparent;\n cursor: pointer;\n }\n\n &[expanded] > .content-accordion__reveal {\n display: block;\n }\n\n > .content-accordion__reveal {\n display: none;\n }\n}\n","import { Component, h, Host, Element } from '@stencil/core';\nimport { HostElement, Prop, State } from '@stencil/core/internal';\nimport W3DisclosureButton from './libraries/w3_disclosure_button';\nimport { ResponsiveBoolean } from '../../typings';\nimport { WindowResizeService } from '../../services/window-resize-service';\n\n/**\n * @slot content - This slot will usually serve a content button.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-accordion',\n styleUrl: 'content-accordion.scss',\n shadow: false,\n})\nexport class ContentAccordion {\n @Element() hostElement: HostElement;\n\n @State() revealElement!: HTMLDivElement;\n /**\n *\n * @type Boolean\n * @responsive\n */\n @Prop() open: ResponsiveBoolean = 'false';\n /**\n * The starting animation class in case you want to control content styling.\n * @type String\n */\n @Prop() animationStart = 'animation-start';\n\n /**\n * The ending animation class in case you want to control content styling.\n * @type String\n */\n @Prop() animationEnd = 'animation-end';\n\n /**\n * The amount of time in milliseconds to run the closing animation, before the class is removed\n * @type Number\n */\n @Prop() animationTime = 0;\n\n @State() isOpen = false;\n @State() randomID: string = '';\n @State() classString = '';\n\n timeoutHolder;\n handleClickEvent(e: MouseEvent) {\n this.animateAccordion(!this.isOpen);\n }\n\n animateAccordion(open, animationTime = this.animationTime) {\n if (this.timeoutHolder) {\n clearTimeout(this.timeoutHolder);\n }\n if (open) {\n this.isOpen = true;\n this.timeoutHolder = setTimeout(() => {\n this.hostElement.classList.add(this.animationStart);\n }, 0);\n } else {\n this.hostElement.classList.add(this.animationEnd);\n this.timeoutHolder = setTimeout(() => {\n this.hostElement.classList.remove(this.animationStart, this.animationEnd);\n this.isOpen = false;\n }, animationTime);\n }\n }\n\n componentWillLoad() {\n this.revealElement = this.hostElement.querySelector('.js-content-accordion-reveal');\n if (this.hostElement.id) {\n this.randomID = `${this.hostElement.tagName}_${this.hostElement.id}`;\n } else {\n this.randomID = `${this.hostElement.tagName}_${Math.floor(Math.random() * document.querySelectorAll(this.hostElement.tagName).length)}`;\n }\n WindowResizeService.registerProp(this.open).subscribe(newValue => {\n this.isOpen = newValue === 'true';\n if (this.isOpen) {\n this.animateAccordion(true);\n }\n });\n }\n\n render() {\n return (\n <Host class={this.classString} expanded={this.isOpen}>\n <button onClick={e => this.handleClickEvent(e)} aria-expanded={this.isOpen} aria-controls={this.randomID}>\n <slot name=\"trigger\"></slot>\n </button>\n <div id={this.randomID} class=\"js-content-accordion-reveal content-accordion__reveal\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -33,21 +33,17 @@ const ContentButton$1 = /*@__PURE__*/ proxyCustomElement(class ContentButton ext
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
onHandleClickEvent(ev) {
|
|
36
|
-
console.log(ev);
|
|
37
36
|
if (this.hasContentToActivate) {
|
|
38
|
-
console.log('this.hascontenttoactivate');
|
|
39
37
|
ev.preventDefault();
|
|
40
|
-
ev.stopPropagation();
|
|
38
|
+
// ev.stopPropagation();
|
|
41
39
|
this.activatedContent.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: this.activatedContent }));
|
|
42
40
|
this.activatedContent.scrollIntoView({ behavior: 'smooth' });
|
|
43
41
|
}
|
|
44
42
|
else if (this.href && this.href.length > 1 && this.href.substring(0, 1) === '#') {
|
|
45
43
|
let element = document.getElementById(this.href.substring(1));
|
|
46
|
-
console.log(this.href.substring(1));
|
|
47
44
|
if (element) {
|
|
48
45
|
ev.preventDefault();
|
|
49
|
-
ev.stopPropagation();
|
|
50
|
-
console.log(element);
|
|
46
|
+
// ev.stopPropagation();
|
|
51
47
|
element.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: element }));
|
|
52
48
|
// element.scrollIntoView({ behavior: 'smooth' });
|
|
53
49
|
}
|
|
@@ -83,6 +79,7 @@ function defineCustomElement$1() {
|
|
|
83
79
|
break;
|
|
84
80
|
} });
|
|
85
81
|
}
|
|
82
|
+
defineCustomElement$1();
|
|
86
83
|
|
|
87
84
|
const ContentButton = ContentButton$1;
|
|
88
85
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-button.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,knBAAknB;;MCe9nBA,eAAa;;;;;;uBAmBN,EAAE;2BACG,EAAE;8BAIS,KAAK;;;;;;;IAmCvC,iBAAiB;QACf,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC;QACpF,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;;QAEpD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,EAAE;YACnC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;SACnC;QAED,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ;YACjE,IAAI,CAAC,SAAS,GAAG,QAAkB,CAAC;SACrC,CAAC,CAAC;QAEH,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC/D,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC;SACvC,CAAC,CAAC;KACJ;IAED,kBAAkB,CAAC,EAAE;QACnB,
|
|
1
|
+
{"file":"content-button.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,knBAAknB;;MCe9nBA,eAAa;;;;;;uBAmBN,EAAE;2BACG,EAAE;8BAIS,KAAK;;;;;;;IAmCvC,iBAAiB;QACf,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,2BA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AC,uBAAuB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;;aAEtF;SACF;KACF;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,IAC3B,uBACc,IAAI,CAAC,SAAS,EAC1B,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,qBAAqB,GAAG,QAAQ,GAAG,EAAE,EACzD,OAAO,EAAE,EAAE,IAAI,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,mBAC3B,IAAI,CAAC,QAAQ,mBACb,IAAI,CAAC,QAAQ,EAC5B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,CAAC,IAAI,CAAC,cAAc,IACnB,gBACE,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACR,KAEP,WAAK,KAAK,EAAC,mCAAmC,IAC5C,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACP,CACC,EACJ,YAAM,IAAI,EAAC,kBAAkB,GAAQ,CAChC,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentButton"],"sources":["src/elements/content-button/content-button.scss?tag=content-button","src/elements/content-button/content-button.tsx"],"sourcesContent":["content-button {\n display: inline-block;\n > a, > button {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n }\n > button {\n appearance: none;\n background: inherit;\n cursor: pointer;\n }\n\n &[clickable-block=\"true\"] {\n display: block;\n width: 100%;\n height: 100%;\n > a,\n > button {\n height: 100%;\n width: 100%;\n > * {\n display: block;\n width: 100%;\n }\n }\n .content-button__clickable-content {\n width: 100%;\n height: 100%;\n }\n }\n\n}","import { Component, h, Host, Prop } from '@stencil/core';\nimport { Element, HostElement, HTMLStencilElement, State } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\n\n/**\n * @slot content - Inner contents of the button, usually plaintext.\n * @slot - Default slot, same as content slot.\n * @slot activatedContent - If this slot is used, the content in this will be scrolled to and triggered.\n */\n@Component({\n tag: 'content-button',\n styleUrl: 'content-button.scss',\n shadow: false,\n})\nexport class ContentButton {\n @Element() hostElement: HostElement;\n /**\n * @type URL\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n href: string;\n /**\n * @type String\n */\n @Prop() target: string;\n /**\n * The classes for the button.\n * @type String\n * @responsive\n */\n @Prop() classes = '';\n @State() classString = '';\n /**\n * @type Boolean\n */\n @Prop() clickableBlock: boolean = false;\n /**\n * @type Boolean\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n expanded: string;\n /**\n\n /**\n * Aria-controls value\n * @type Target\n */\n @Prop() controls: string;\n\n /**\n * @type String\n * @responsive\n */\n @Prop() linkLabel: ResponsiveString;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n linkClass: ResponsiveString;\n @State() hasContentToActivate: boolean;\n\n public activatedContent: HTMLDivElement;\n\n componentWillLoad() {\n this.activatedContent = this.hostElement.querySelector('[slot=\"activatedContent\"]');\n this.hasContentToActivate = !!this.activatedContent;\n // If this is a clickable block, forcefully add a # to force an anchor link\n if (!this.href || this.href === '#') {\n this.href = 'javascript:void(0);';\n }\n\n WindowResizeService.registerProp(this.linkClass).subscribe(newValue => {\n this.linkClass = newValue as string;\n });\n\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n onHandleClickEvent(ev) {\n if (this.hasContentToActivate) {\n ev.preventDefault();\n // ev.stopPropagation();\n this.activatedContent.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: this.activatedContent }));\n this.activatedContent.scrollIntoView({ behavior: 'smooth' });\n } else if (this.href && this.href.length > 1 && this.href.substring(0, 1) === '#') {\n let element = document.getElementById(this.href.substring(1));\n if (element) {\n ev.preventDefault();\n // ev.stopPropagation();\n element.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: element }));\n // element.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n\n render() {\n return (\n <Host class={this.classString}>\n <a\n aria-label={this.linkLabel}\n class={this.linkClass}\n role={this.href === 'javascript:void(0);' ? 'button' : ''}\n onClick={ev => this.onHandleClickEvent(ev)}\n aria-expanded={this.expanded}\n aria-controls={this.controls}\n href={this.href}\n target={this.target}\n >\n {!this.clickableBlock ? (\n <span>\n <slot name=\"content\"></slot>\n <slot></slot>\n </span>\n ) : (\n <div class=\"content-button__clickable-content\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n )}\n </a>\n <slot name=\"activatedContent\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -12,6 +12,7 @@ const ContentCarousel$1 = /*@__PURE__*/ proxyCustomElement(class ContentCarousel
|
|
|
12
12
|
this.swiperOptions = '{"slidesPerView": 1, "slidesPerGroup": 1, "autoplay": true, "loop": false}';
|
|
13
13
|
}
|
|
14
14
|
getSwiperOptions(newOptions) {
|
|
15
|
+
console.log(this.swiperNextElement);
|
|
15
16
|
return Object.assign({
|
|
16
17
|
observer: true,
|
|
17
18
|
observeParents: true,
|
|
@@ -89,6 +90,7 @@ function defineCustomElement$1() {
|
|
|
89
90
|
break;
|
|
90
91
|
} });
|
|
91
92
|
}
|
|
93
|
+
defineCustomElement$1();
|
|
92
94
|
|
|
93
95
|
const ContentCarousel = ContentCarousel$1;
|
|
94
96
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-carousel.js","mappings":";;;AAAA,MAAM,kBAAkB,GAAG,20jBAA20jB;;MCez1jBA,iBAAe;;;;QAsB1B,eAAU,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;0BAf7B,MAAM;6BAKX,4EAA4E;;IAY5G,gBAAgB,CAAC,UAAkB;QACjC,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB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AAI,CAAC,iBAAiB,GAAG,EAAoB,GAAQ,EAChG,WAAK,KAAK,EAAC,oBAAoB,EAAC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,iBAAiB,GAAG,EAAoB,GAAQ,EAEhG,WAAK,KAAK,EAAC,kBAAkB,EAAC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,eAAe,GAAG,EAAoB,GAAQ,CACxF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentCarousel"],"sources":["src/components/content-carousel/content-carousel.scss?tag=content-carousel","src/components/content-carousel/content-carousel.tsx"],"sourcesContent":["@import \"~swiper/swiper-bundle.min.css\";\ncontent-carousel {\n display: block;\n overflow: hidden;\n}","import { Component, h, Host, Prop, Listen, Element } from '@stencil/core';\nimport { HTMLStencilElement } from '@stencil/core/internal';\nimport { BehaviorSubject } from 'rxjs';\n// import { A11y, Navigation, Pagination } from 'swiper/modules';\n\n/**\n * @slot content - This slot will usually serve a content hero block or image.\n * @slot - Default slot, same as content slot.\n */\nexport type InitMethodType = 'load' | 'event';\n@Component({\n tag: 'content-carousel',\n styleUrl: 'content-carousel.scss',\n shadow: false,\n})\nexport class ContentCarousel {\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type Select\n * @options load\n * @options init\n */\n @Prop() initMethod: InitMethodType = 'load';\n /**\n * @type JSON\n * @schema Swiper Options\n */\n @Prop() swiperOptions: string = '{\"slidesPerView\": 1, \"slidesPerGroup\": 1, \"autoplay\": true, \"loop\": false}';\n public swiperCarousel: any;\n public swiper?: HTMLDivElement;\n public swiperWrapper?: HTMLDivElement;\n public swiperPagination?: HTMLDivElement;\n public swiperPrevElement?: HTMLDivElement;\n public swiperNextElement?: HTMLDivElement;\n public swiperScrollbar?: HTMLDivElement;\n public swiperOptionsFinal;\n\n loadStatus: BehaviorSubject<boolean> = new BehaviorSubject(false);\n\n getSwiperOptions(newOptions: string): string {\n console.log(this.swiperNextElement);\n return Object.assign({\n observer: true,\n observeParents: true,\n pagination: {\n el: this.swiperPagination,\n },\n navigation: {\n nextEl: this.swiperNextElement,\n prevEl: this.swiperPrevElement,\n },\n scrollbar: {\n el: this.swiperScrollbar,\n },\n }, newOptions);\n }\n componentDidLoad() {\n if (this.initMethod === 'load') {\n if (this.swiperOptions) {\n this.swiperOptionsFinal = this.getSwiperOptions(JSON.parse(this.swiperOptions as string || ''));\n }\n \n let options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.1,\n }\n \n let observer = new IntersectionObserver((entries) => {\n entries.forEach(async entry => {\n if (entry.isIntersecting && !this.loadStatus.getValue()) {\n await this.initSwiper();\n this.loadStatus.next(true);\n }\n });\n }, options);\n observer.observe(this.hostElement);\n }\n }\n\n @Listen('setSwiperOptions')\n setSwiperOptionsCallback(event: CustomEvent) {\n this.loadStatus.subscribe(async () => {\n let loaded = this.loadStatus.value;\n if (loaded) {\n this.swiperOptionsFinal = this.getSwiperOptions(event.detail);\n await this.initSwiper();\n }\n });\n }\n\n async initSwiper() {\n let Swiper = await import('swiper');\n for (const slide of this.swiperWrapper.children as any) {\n slide.classList.add('swiper-slide');\n }\n // configure Swiper to use modules\n this.swiperCarousel = new Swiper.Swiper(this.swiper, {\n ...this.swiperOptionsFinal, ...{\n // modules: [A11y, Navigation, Pagination]\n }\n });\n }\n\n render() {\n return (\n <Host>\n <div class=\"swiper\" ref={el => this.swiper = el as HTMLDivElement}>\n <div class=\"swiper-wrapper\" ref={el => this.swiperWrapper = el as HTMLDivElement}>\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n <div class=\"swiper-pagination\" ref={el => this.swiperPagination = el as HTMLDivElement}></div>\n\n <div class=\"swiper-button-prev\" ref={el => this.swiperPrevElement = el as HTMLDivElement}></div>\n <div class=\"swiper-button-next\" ref={el => this.swiperNextElement = el as HTMLDivElement}></div>\n\n <div class=\"swiper-scrollbar\" ref={el => this.swiperScrollbar = el as HTMLDivElement}></div>\n </div>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { W as WindowResizeService } from './window-resize-service.js';
|
|
3
3
|
|
|
4
|
-
const contentGridFormatterCss = "*{box-sizing:border-box}content-grid-formatter{width:100%;overflow:auto}content-grid-formatter *{box-sizing:border-box}content-grid-formatter[type=grid]{display:grid;grid-template-columns:repeat(var(--columns), 1fr)}content-grid-formatter[type=flex]{display:flex;align-items:var(--align-items);justify-content:var(--justify-content);flex-wrap:wrap}content-grid-formatter[type=flex]>*{overflow:auto;flex:0 0 auto;width:calc(100% / var(--columns))}content-grid-formatter>[flex-shrink=true]{width:auto;flex-shrink:1}content-grid-formatter[flex-shrink=true]>*{flex-shrink:1}content-grid-formatter[flex-grow=true]>*{flex-grow:1}content-grid-formatter>[flex-grow=true]{width:auto;flex-grow:1}";
|
|
4
|
+
const contentGridFormatterCss = "*{box-sizing:border-box}content-grid-formatter{width:100%;overflow:auto}content-grid-formatter *{box-sizing:border-box}content-grid-formatter[type=grid]{display:grid;grid-template-columns:repeat(var(--columns), 1fr);column-gap:var(--column-gap)}content-grid-formatter[type=flex]{display:flex;align-items:var(--align-items);justify-content:var(--justify-content);flex-wrap:wrap}content-grid-formatter[type=flex]>*{overflow:auto;flex:0 0 auto;width:calc(100% / var(--columns))}content-grid-formatter>[flex-shrink=true]{width:auto;flex-shrink:1}content-grid-formatter[flex-shrink=true]>*{flex-shrink:1}content-grid-formatter[flex-grow=true]>*{flex-grow:1}content-grid-formatter>[flex-grow=true]{width:auto;flex-grow:1}";
|
|
5
5
|
|
|
6
6
|
const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridFormatter extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -12,22 +12,23 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
12
12
|
this.type = 'flex';
|
|
13
13
|
this.flexGrow = 'false';
|
|
14
14
|
this.flexShrink = 'false';
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
15
|
+
this.vertical = 'space-between';
|
|
16
|
+
this.horizontal = 'space-between';
|
|
17
17
|
this.columns = '1';
|
|
18
|
+
this.columnGap = '0';
|
|
18
19
|
this.activeClassString = undefined;
|
|
19
20
|
this.inlineStyle = {};
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
componentWillLoad() {
|
|
22
23
|
return Promise.allSettled([
|
|
23
24
|
WindowResizeService.registerProp(this.type).subscribe(newValue => (this.type = newValue)),
|
|
24
|
-
WindowResizeService.registerProp(this.
|
|
25
|
-
this.
|
|
26
|
-
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--align-items': this.
|
|
25
|
+
WindowResizeService.registerProp(this.vertical).subscribe(newValue => {
|
|
26
|
+
this.vertical = newValue;
|
|
27
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--align-items': this.vertical });
|
|
27
28
|
}),
|
|
28
|
-
WindowResizeService.registerProp(this.
|
|
29
|
-
this.
|
|
30
|
-
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--justify-content': this.
|
|
29
|
+
WindowResizeService.registerProp(this.horizontal).subscribe(newValue => {
|
|
30
|
+
this.horizontal = newValue;
|
|
31
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--justify-content': this.horizontal });
|
|
31
32
|
}),
|
|
32
33
|
WindowResizeService.registerProp(this.flexShrink).subscribe(newValue => (this.flexShrink = newValue)),
|
|
33
34
|
WindowResizeService.registerProp(this.flexGrow).subscribe(newValue => (this.flexGrow = newValue)),
|
|
@@ -35,6 +36,10 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
35
36
|
this.columns = newValue;
|
|
36
37
|
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--columns': newValue });
|
|
37
38
|
}),
|
|
39
|
+
WindowResizeService.registerProp(this.columnGap).subscribe(newValue => {
|
|
40
|
+
this.columnGap = newValue;
|
|
41
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--column-gap': newValue });
|
|
42
|
+
}),
|
|
38
43
|
WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue)),
|
|
39
44
|
]);
|
|
40
45
|
}
|
|
@@ -47,9 +52,10 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
47
52
|
"type": [1537],
|
|
48
53
|
"flexGrow": [1537, "flex-grow"],
|
|
49
54
|
"flexShrink": [1537, "flex-shrink"],
|
|
50
|
-
"
|
|
51
|
-
"
|
|
55
|
+
"vertical": [1537],
|
|
56
|
+
"horizontal": [1537],
|
|
52
57
|
"columns": [1537],
|
|
58
|
+
"columnGap": [1537, "column-gap"],
|
|
53
59
|
"classString": [32],
|
|
54
60
|
"activeClassString": [32],
|
|
55
61
|
"inlineStyle": [32]
|
|
@@ -67,6 +73,7 @@ function defineCustomElement() {
|
|
|
67
73
|
break;
|
|
68
74
|
} });
|
|
69
75
|
}
|
|
76
|
+
defineCustomElement();
|
|
70
77
|
|
|
71
78
|
export { ContentGridFormatter as C, defineCustomElement as d };
|
|
72
79
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-grid-formatter2.js","mappings":";;;AAAA,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"file":"content-grid-formatter2.js","mappings":";;;AAAA,MAAM,uBAAuB,GAAG,6sBAA6sB;;MCahuB,oBAAoB;;;;;;oBAmBO,MAAM;wBAUd,OAAO;0BAUL,OAAO;wBAcN,eAAe;0BAeb,eAAe;uBAStB,GAAG;yBAUD,GAAG;;2BAGiB,EAAE;;IAEpD,iBAAiB;QACf,OAAO,OAAO,CAAC,UAAU,CAAC;YACxB,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,GAAG,QAAsB,CAAC,CAA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C,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC,CAAC;SAC9G,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,IACpD,eAAQ,CACH,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/formatters/content-grid-formatter/content-grid-formatter.scss?tag=content-grid-formatter","src/formatters/content-grid-formatter/content-grid-formatter.tsx"],"sourcesContent":["content-grid-formatter {\n width: 100%;\n overflow: auto;\n * {\n box-sizing: border-box;\n }\n &[type=\"grid\"] {\n display: grid;\n grid-template-columns: repeat(var(--columns), 1fr);\n column-gap: var(--column-gap);\n }\n\n &[type=\"flex\"] {\n display: flex;\n align-items: var(--align-items);\n justify-content: var(--justify-content);\n flex-wrap: wrap; \n > * {\n overflow: auto;\n flex: 0 0 auto;\n width: calc(100%/var(--columns));\n }\n }\n > [flex-shrink=\"true\"] {\n width: auto;\n flex-shrink: 1;\n }\n &[flex-shrink=\"true\"] > * {\n flex-shrink: 1;\n }\n &[flex-grow=\"true\"] > * {\n flex-grow: 1;\n }\n > [flex-grow=\"true\"] {\n width: auto;\n flex-grow: 1;\n }\n}","import { Component, h, Host, Prop, State } from '@stencil/core';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { FLEX_JUSTIFY_OPTIONS, GRID_TYPES, ResponsiveBoolean, ResponsiveNumber, ResponsiveString } from '../../typings';\n\n/**\n * @slot media - This slot can either be a video or image component.\n * @slot content - This slot will usually serve a content text block.\n */\n@Component({\n tag: 'content-grid-formatter',\n styleUrl: 'content-grid-formatter.scss',\n shadow: false,\n})\nexport class ContentGridFormatter {\n /**\n * @type String\n * @responsive\n */\n @Prop() classes: ResponsiveString;\n @State() classString;\n /**\n * Flex or grid\n * @type Select\n * @options none\n * @options flex\n * @options grid\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n type: GRID_TYPES | ResponsiveString = 'flex';\n /**\n * Setting this true to will grow all children. Alternatively, add the attribute [flex-grow=\"true\"] to a specific grid child and that child will grow.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n flexGrow: ResponsiveBoolean = 'false';\n /**\n * Setting this true to will shrink all children. Alternatively, add the attribute [flex-shrink=\"true\"] to a specific grid child and that child will shrink.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n flexShrink: ResponsiveBoolean = 'false';\n /**\n * Vertical axis alignment\n * @type Select\n * @options flex-start\n * @options space-between\n * @options center\n * @options space-evenly\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n vertical: FLEX_JUSTIFY_OPTIONS = 'space-between';\n\n /**\n * Horizontal axis alignment\n * @type Select\n * @options flex-start\n * @options space-between\n * @options center\n * @options space-evenly\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n horizontal: FLEX_JUSTIFY_OPTIONS = 'space-between';\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n columns: ResponsiveNumber = '1';\n\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n columnGap: ResponsiveNumber = '0';\n\n @State() activeClassString: string;\n @State() inlineStyle: { [key: string]: string } = {};\n\n componentWillLoad() {\n return Promise.allSettled([\n WindowResizeService.registerProp(this.type).subscribe(newValue => (this.type = newValue as GRID_TYPES)),\n WindowResizeService.registerProp(this.vertical).subscribe(newValue => {\n this.vertical = newValue as FLEX_JUSTIFY_OPTIONS;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--align-items': this.vertical,\n };\n }),\n WindowResizeService.registerProp(this.horizontal).subscribe(newValue => {\n this.horizontal = newValue as FLEX_JUSTIFY_OPTIONS;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--justify-content': this.horizontal,\n };\n }),\n WindowResizeService.registerProp(this.flexShrink).subscribe(newValue => (this.flexShrink = newValue as string)),\n WindowResizeService.registerProp(this.flexGrow).subscribe(newValue => (this.flexGrow = newValue as string)),\n WindowResizeService.registerProp(this.columns).subscribe(newValue => {\n this.columns = newValue as string;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--columns': newValue as string,\n };\n }),\n WindowResizeService.registerProp(this.columnGap).subscribe(newValue => {\n this.columnGap = newValue as string;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--column-gap': newValue as string,\n };\n }),\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue as string)),\n ]);\n }\n\n render() {\n return (\n <Host class={this.classString} style={this.inlineStyle}>\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { W as WindowResizeService } from './window-resize-service.js';
|
|
3
3
|
|
|
4
|
-
const contentHeroBlockCss = "*{box-sizing:border-box}content-hero-block{position:relative}content-hero-block[content-position=above]{display:grid;grid-template-columns:1fr}content-hero-block[content-position=above] .content-hero-block__background,content-hero-block[content-position=above] .content-hero-block__content{grid-row-start:1;grid-column-start:1}content-hero-block[content-position=above] .content-hero-block__background{height:100%;overflow:hidden}content-hero-block[content-position=above] .content-hero-block__content{display:flex;top:0;left:0;width:100%;height:100%;grid-row-start:1;grid-column-start:1}content-hero-block[content-position=above] .content-hero-block__content>*{width:100%}content-hero-block[content-position=above] .content-hero-block__content{position:relative;z-index:1}content-hero-block[content-position=below]{display:block}";
|
|
4
|
+
const contentHeroBlockCss = "*{box-sizing:border-box}content-hero-block{position:relative}content-hero-block[content-position=above]{display:grid;grid-template-columns:1fr}content-hero-block[content-position=above] .content-hero-block__background,content-hero-block[content-position=above] .content-hero-block__content{grid-row-start:1;grid-column-start:1}content-hero-block[content-position=above] .content-hero-block__background{height:100%;overflow:hidden}content-hero-block[content-position=above] .content-hero-block__background content-image,content-hero-block[content-position=above] .content-hero-block__background content-image picture,content-hero-block[content-position=above] .content-hero-block__background content-image img,content-hero-block[content-position=above] .content-hero-block__background content-image video{height:100%}content-hero-block[content-position=above] .content-hero-block__content{display:flex;top:0;left:0;width:100%;height:100%;grid-row-start:1;grid-column-start:1}content-hero-block[content-position=above] .content-hero-block__content>*{width:100%}content-hero-block[content-position=above] .content-hero-block__content{position:relative;z-index:1}content-hero-block[content-position=below]{display:block}";
|
|
5
5
|
|
|
6
6
|
const ContentHeroBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentHeroBlock extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -49,6 +49,7 @@ function defineCustomElement$1() {
|
|
|
49
49
|
break;
|
|
50
50
|
} });
|
|
51
51
|
}
|
|
52
|
+
defineCustomElement$1();
|
|
52
53
|
|
|
53
54
|
const ContentHeroBlock = ContentHeroBlock$1;
|
|
54
55
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-hero-block.js","mappings":";;;AAAA,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"file":"content-hero-block.js","mappings":";;;AAAA,MAAM,mBAAmB,GAAG,ksCAAksC;;MCgBjtCA,kBAAgB;;;;6BAEO,KAAK;+BAY2B,aAAa;;;mCAQvC,KAAK;;IAG7C,iBAAiB;QACf,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC;QACtF,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,eAAe,GAAG,QAAkB,CAAC,CAAC,CAAC;QAC1H,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC,CAAC,CAAC;KAC/G;IAGD,6BAA6B,CAAC,KAA+B;QAC3D,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,MAAM,EAAE;YACrC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;SACpD;KACF;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,IAC1B,IAAI,CAAC,aAAa,KACjB,WAAK,KAAK,EAAC,gCAAgC,IACzC,YAAM,IAAI,EAAC,YAAY,GAAQ,CAC3B,CACP,EACD,WAAK,KAAK,EAAC,6BAA6B,IACtC,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentHeroBlock"],"sources":["src/blocks/content-hero-block/content-hero-block.scss?tag=content-hero-block","src/blocks/content-hero-block/content-hero-block.tsx"],"sourcesContent":["content-hero-block {\n position: relative;\n &[content-position=\"above\"] {\n display: grid;\n grid-template-columns: 1fr;\n .content-hero-block__background,\n .content-hero-block__content {\n grid-row-start: 1;\n grid-column-start: 1;\n }\n .content-hero-block__background {\n height: 100%;\n overflow: hidden;\n\n content-image,\n content-image picture,\n content-image img,\n content-image video {\n height: 100%;\n }\n }\n .content-hero-block__content {\n display: flex;\n // position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n grid-row-start: 1;\n grid-column-start: 1;\n \n > * {\n // display: block;\n width: 100%;\n }\n \n }\n .content-hero-block__content {\n position: relative;\n z-index: 1;\n }\n }\n &[content-position=\"below\"] {\n display: block;\n }\n}","import { Component, h, Host, Prop } from '@stencil/core';\nimport { Element, HTMLStencilElement, Listen, State } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\nimport { getHydratedClassString } from '../../utils/utils';\nexport type HeroContentPlacementOptions = 'above' | 'below';\n/**\n * @slot background - This slot is usually either a video or image component.\n * @slot content - This slot will usually serve a text block.\n * @slot - Default slot, same as content slot\n */\n@Component({\n tag: 'content-hero-block',\n styleUrl: 'content-hero-block.scss',\n shadow: false,\n})\nexport class ContentHeroBlock {\n @Element() hostElement: HTMLStencilElement;\n @State() hasBackground: boolean = false;\n /**\n * Pipe separated HeroContentPlacementOptions that will determine whether the content sits below the media slot or overlapped above.\n * @type Select\n * @options below\n * @options above\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n contentPosition: ResponsiveString | HeroContentPlacementOptions = 'below|above';\n\n /**\n * @type String\n * @responsive\n */\n @Prop() classes: ResponsiveString;\n @State() classString;\n @State() revealHiddenContent: boolean = false;\n hasHiddenContent: boolean;\n\n componentWillLoad() {\n this.hasBackground = !!this.hostElement.querySelector('[slot=\"background\"]');\n this.hasHiddenContent = !!this.hostElement.querySelector('[slot=\"activatedContent\"]');\n WindowResizeService.registerProp(this.contentPosition).subscribe(newValue => (this.contentPosition = newValue as string));\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue as string));\n }\n\n @Listen('contentBlockActivated', { target: 'window' })\n contentBlockActivationHandler(event: CustomEvent<HTMLElement>) {\n if (this.hostElement === event.detail) {\n this.hostElement.setAttribute('activated', 'true');\n }\n }\n\n render() {\n return (\n <Host class={this.classString}>\n {this.hasBackground && (\n <div class=\"content-hero-block__background\">\n <slot name=\"background\"></slot>\n </div>\n )}\n <div class=\"content-hero-block__content\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { W as WindowResizeService } from './window-resize-service.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as getCurrentValue } from './utils.js';
|
|
4
4
|
|
|
5
|
-
const contentImageCss = "*{box-sizing:border-box}content-image{display:block;height:auto;transition:opacity 0.3s;position:relative}content-image.content-image-loading{opacity:0}content-image.content-image-loaded{opacity:1}content-image img,content-image picture,content-image video{
|
|
5
|
+
const contentImageCss = "*{box-sizing:border-box}content-image{display:block;height:auto;transition:opacity 0.3s;position:relative}content-image.content-image-loading{opacity:0}content-image.content-image-loaded{opacity:1}content-image[aspect-ratio] img,content-image[aspect-ratio] picture,content-image[aspect-ratio] video{aspect-ratio:var(--aspect-ratio);object-fit:cover}content-image img,content-image picture,content-image video{display:block;width:100%;height:100%}content-image .content-image__media-content{display:none;position:absolute;width:100%;height:100%;top:0;left:0;align-items:center;justify-content:center;overflow:hidden}content-image .content-image__media-content [slot=mediaContent]{height:100%;width:100%}content-image[content=true] .content-image__media-content{display:flex}";
|
|
6
6
|
|
|
7
7
|
const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
@@ -15,6 +15,8 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
15
15
|
this.alt = undefined;
|
|
16
16
|
this.width = '16';
|
|
17
17
|
this.height = '9';
|
|
18
|
+
this.aspectRatio = undefined;
|
|
19
|
+
this.type = 'image';
|
|
18
20
|
this.videoType = 'video/mp4';
|
|
19
21
|
this.showContent = 'false|true';
|
|
20
22
|
this.lazyLoadIsComplete = false;
|
|
@@ -23,6 +25,7 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
23
25
|
this.classString = '';
|
|
24
26
|
this.inlineStyle = {};
|
|
25
27
|
this.hasMediaContent = false;
|
|
28
|
+
this.pictureImageSrc = undefined;
|
|
26
29
|
}
|
|
27
30
|
preloadImage(src) {
|
|
28
31
|
return new Promise(r => {
|
|
@@ -34,12 +37,8 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
34
37
|
}
|
|
35
38
|
componentWillLoad() {
|
|
36
39
|
this.hasMediaContent = !!this.hostElement.querySelector('[slot="mediaContent"]');
|
|
37
|
-
WindowResizeService.registerProp(this.
|
|
38
|
-
this.
|
|
39
|
-
if (!this.lazyLoadIsComplete) {
|
|
40
|
-
this.lazyLoadIsComplete = true;
|
|
41
|
-
}
|
|
42
|
-
this.src = newValue;
|
|
40
|
+
WindowResizeService.registerProp(this.aspectRatio).subscribe(newValue => {
|
|
41
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--aspect-ratio': `${newValue}` });
|
|
43
42
|
});
|
|
44
43
|
WindowResizeService.registerProp(this.alt).subscribe(newValue => {
|
|
45
44
|
this.alt = newValue;
|
|
@@ -54,6 +53,23 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
54
53
|
this.classString = `${newValue}`;
|
|
55
54
|
});
|
|
56
55
|
}
|
|
56
|
+
componentDidLoad() {
|
|
57
|
+
let observer = new IntersectionObserver(entries => {
|
|
58
|
+
entries.forEach(async (entry) => {
|
|
59
|
+
if (entry.isIntersecting) {
|
|
60
|
+
this.lazyLoadIsComplete = true;
|
|
61
|
+
this.pictureImageSrc = getCurrentValue(this.src);
|
|
62
|
+
this.showVideoAsGif = this.pictureImageSrc.indexOf('.mp4') >= 0 || getCurrentValue(this.type) === 'video';
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}, {
|
|
66
|
+
root: null,
|
|
67
|
+
// rootMargin: `${Math.max(100, window.innerHeight * 0.95)}px`,
|
|
68
|
+
rootMargin: `0px`,
|
|
69
|
+
threshold: 0.1,
|
|
70
|
+
});
|
|
71
|
+
observer.observe(this.hostElement);
|
|
72
|
+
}
|
|
57
73
|
watchLazyLoadIsComplete(newValue) {
|
|
58
74
|
if (newValue === true) {
|
|
59
75
|
this.activeLazyLoadClass = 'content-image-loaded';
|
|
@@ -68,19 +84,7 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
68
84
|
}
|
|
69
85
|
}
|
|
70
86
|
render() {
|
|
71
|
-
|
|
72
|
-
let pictureImageSrc = '';
|
|
73
|
-
if (this.src) {
|
|
74
|
-
breakpointValues.forEach((_bp, index) => {
|
|
75
|
-
if (index === 0) {
|
|
76
|
-
pictureImageSrc = getValueAtIndex(0, this.src);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
pictureSrcSet += `${getValueAtIndex(index, this.src)} ${breakpointValues[index]}w,`;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return (h(Host, { class: `${this.activeLazyLoadClass} ${this.classString}`, style: this.inlineStyle, content: this.showContent }, this.hasMediaContent && (h("div", { class: "content-image__media-content" }, h("slot", { name: "mediaContent" }))), this.showVideoAsGif ? (h("video", { autoplay: true, muted: true, loop: true, preload: "none", playsinline: true, width: this.width, height: this.height }, h("source", { src: this.lazyLoadIsComplete ? this.src : null, type: this.videoType }))) : (h("picture", null, h("source", { srcSet: pictureSrcSet }), h("img", { width: this.width, height: this.height, src: pictureImageSrc, alt: this.alt })))));
|
|
87
|
+
return (h(Host, { class: `${this.activeLazyLoadClass} ${this.classString}`, style: this.inlineStyle, content: this.showContent }, this.hasMediaContent && (h("div", { class: "content-image__media-content" }, h("slot", { name: "mediaContent" }))), this.showVideoAsGif ? (h("video", { autoplay: true, muted: true, loop: true, preload: "none", playsinline: true, width: this.width, height: this.height }, h("source", { src: this.lazyLoadIsComplete ? this.pictureImageSrc : null, type: this.videoType }))) : (h("img", { width: this.width, height: this.height, src: this.pictureImageSrc, alt: this.alt }))));
|
|
84
88
|
}
|
|
85
89
|
get hostElement() { return this; }
|
|
86
90
|
static get watchers() { return {
|
|
@@ -94,6 +98,8 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
94
98
|
"alt": [1537],
|
|
95
99
|
"width": [1025],
|
|
96
100
|
"height": [1025],
|
|
101
|
+
"aspectRatio": [1025, "aspect-ratio"],
|
|
102
|
+
"type": [1],
|
|
97
103
|
"videoType": [1, "video-type"],
|
|
98
104
|
"showContent": [1537, "show-content"],
|
|
99
105
|
"activeSrc": [32],
|
|
@@ -102,7 +108,8 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
102
108
|
"activeLazyLoadClass": [32],
|
|
103
109
|
"classString": [32],
|
|
104
110
|
"inlineStyle": [32],
|
|
105
|
-
"hasMediaContent": [32]
|
|
111
|
+
"hasMediaContent": [32],
|
|
112
|
+
"pictureImageSrc": [32]
|
|
106
113
|
}, undefined, {
|
|
107
114
|
"lazyLoadIsComplete": ["watchLazyLoadIsComplete"]
|
|
108
115
|
}]);
|
|
@@ -119,6 +126,7 @@ function defineCustomElement$1() {
|
|
|
119
126
|
break;
|
|
120
127
|
} });
|
|
121
128
|
}
|
|
129
|
+
defineCustomElement$1();
|
|
122
130
|
|
|
123
131
|
const ContentImage = ContentImage$1;
|
|
124
132
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-image.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,
|
|
1
|
+
{"file":"content-image.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,uwBAAuwB;;MCclxBA,cAAY;;;;;wBAcK,IAAI;;;;qBA4BN,IAAI;sBASH,GAAG;;oBAgBK,OAAO;yBAMb,WAAW;2BAWP,YAAY;kCAEN,KAAK;8BACT,KAAK;mCACT,EAAE;2BACV,EAAE;2BAC0B,EAAE;+BACjB,KAAK;;;IAEzC,YAAY,CAAC,GAAG;QACd,OAAO,IAAI,OAAO,CAAC,CAAC;YAClB,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACjB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;YAClB,KAAK,CAAC,GAAG,GAAG,GA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K,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI,CAC1F,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentImage"],"sources":["src/elements/content-image/content-image.scss?tag=content-image","src/elements/content-image/content-image.tsx"],"sourcesContent":["content-image {\n display: block;\n height: auto;\n transition: opacity .3s;\n position: relative;\n &.content-image-loading {\n opacity: 0;\n }\n &.content-image-loaded {\n opacity: 1;\n }\n\n &[aspect-ratio] {\n img, picture, video {\n aspect-ratio: var(--aspect-ratio);\n object-fit: cover;\n }\n }\n img,\n picture,\n video {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .content-image__media-content {\n display: none;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n [slot=\"mediaContent\"] {\n height: 100%;\n width: 100%;\n }\n }\n &[content=\"true\"] .content-image__media-content {\n display: flex;\n }\n}\n","import { Component, h, Host, Element, Prop, State, Watch } from '@stencil/core';\nimport { HostElement } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveBoolean, ResponsiveNumber, ResponsiveString } from '../../typings';\nimport { breakpointValues, getCurrentValue, getValueAtIndex } from '../../utils/utils';\n\n/**\n * @slot mediaContent - Content displayed over media. If you want to reveal content on hover, use a tout block\n */\n@Component({\n tag: 'content-image',\n styleUrl: 'content-image.scss',\n shadow: false,\n})\nexport class ContentImage {\n @Element() hostElement: HostElement;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n /**\n * @type Boolean\n */\n @Prop() lazyLoad: boolean = true;\n /**\n * @type Media\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n src!: ResponsiveString;\n @State() activeSrc;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n alt: ResponsiveString;\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n width: ResponsiveNumber = '16';\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n height: ResponsiveNumber = '9';\n\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n aspectRatio: ResponsiveString;\n /**\n * @type Select\n * @options image\n * @options video\n */\n @Prop() type?: 'image' | 'video' = 'image';\n\n /**\n * @type Select\n * @options video/mp4\n */\n @Prop() videoType?: string = 'video/mp4';\n\n /**\n * If true, the content in the mediaContent slot will be visible.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n showContent: ResponsiveBoolean = 'false|true';\n\n @State() lazyLoadIsComplete: boolean = false;\n @State() showVideoAsGif: boolean = false;\n @State() activeLazyLoadClass = '';\n @State() classString = '';\n @State() inlineStyle?: { [key: string]: string } = {};\n @State() hasMediaContent: boolean = false;\n @State() pictureImageSrc: string;\n preloadImage(src) {\n return new Promise(r => {\n const image = new Image();\n image.onload = r;\n image.onerror = r;\n image.src = src;\n });\n }\n\n componentWillLoad() {\n this.hasMediaContent = !!this.hostElement.querySelector('[slot=\"mediaContent\"]');\n WindowResizeService.registerProp(this.aspectRatio).subscribe(newValue => {\n this.inlineStyle = { ...this.inlineStyle, '--aspect-ratio': `${newValue}` };\n });\n WindowResizeService.registerProp(this.alt).subscribe(newValue => {\n this.alt = newValue as string;\n });\n WindowResizeService.registerProp(this.height).subscribe(newValue => {\n this.height = newValue as string;\n });\n WindowResizeService.registerProp(this.showContent).subscribe(newValue => {\n this.showContent = newValue as string;\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = `${newValue}`;\n });\n }\n\n componentDidLoad() {\n let observer = new IntersectionObserver(\n entries => {\n entries.forEach(async entry => {\n if (entry.isIntersecting) {\n this.lazyLoadIsComplete = true;\n this.pictureImageSrc = getCurrentValue(this.src);\n this.showVideoAsGif = this.pictureImageSrc.indexOf('.mp4') >= 0 || getCurrentValue(this.type) === 'video';\n }\n });\n },\n {\n root: null,\n // rootMargin: `${Math.max(100, window.innerHeight * 0.95)}px`,\n rootMargin: `0px`,\n threshold: 0.1,\n },\n );\n observer.observe(this.hostElement);\n }\n\n @Watch('lazyLoadIsComplete')\n watchLazyLoadIsComplete(newValue: boolean) {\n if (newValue === true) {\n this.activeLazyLoadClass = 'content-image-loaded';\n } else {\n if (!this.lazyLoad) {\n this.activeLazyLoadClass = 'content-image-no-lazyload';\n } else {\n this.activeLazyLoadClass = 'content-image-loading';\n }\n }\n }\n\n render() {\n return (\n <Host class={`${this.activeLazyLoadClass} ${this.classString}`} style={this.inlineStyle} content={this.showContent}>\n {this.hasMediaContent && (\n <div class=\"content-image__media-content\">\n <slot name=\"mediaContent\"></slot>\n </div>\n )}\n {this.showVideoAsGif ? (\n <video autoplay muted loop preload=\"none\" playsinline width={this.width} height={this.height}>\n <source src={this.lazyLoadIsComplete ? this.pictureImageSrc : null} type={this.videoType} />\n </video>\n ) : (\n <img width={this.width} height={this.height} src={this.pictureImageSrc} alt={this.alt} />\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-line.js","mappings":";;;AAAA,MAAM,cAAc,GAAG,oQAAoQ;;MCc9QA,aAAW;;;;mBAgBe,KAAK;yBAWO,SAAS;;;wBAerB,MAAM;2BACO,EAAE;;IAEpD,iBAAiB;QACf,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ;YACjE,IAAI,CAAC,WAAW,mCACX,IAAI,CAAC,WAAW,KACnB,cAAc,EAAE,QAAuC,GACxD,CAAC;SACH,CAAC,CAAC;QACH,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,C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I,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC/D,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC;SACvC,CAAC,CAAC;KACJ;IAED,MAAM;;QAEJ,MAAM,gBAAgB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvC,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,IACpD,EAAC,gBAAgB,IAAC,KAAK,EAAC,qBAAqB,IAC3C,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACI,CACd,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentLine"],"sources":["src/elements/content-line/content-line.scss?tag=content-line","src/elements/content-line/content-line.tsx"],"sourcesContent":["content-line {\n --text-align: default;\n --inner-max-width: 100%;\n\n display: block;\n text-align: var(--text-align);\n word-break: break-word;\n white-space: normal;\n \n .content-line__inner {\n display: inline-block;\n width: auto;\n max-width: var(--max-width);\n }\n}","import { Component, Prop, h, State, Host } from '@stencil/core';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveNumber, ResponsiveString } from '../../typings';\nexport type ContentLineTagOptions = 'div' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'section' | 'article';\nexport type ContentLineTextAlignOptions = 'default' | 'left' | 'center' | 'right';\n/**\n * @slot content - Inner contents of the line, usually plaintext.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-line',\n styleUrl: 'content-line.scss',\n shadow: false,\n})\nexport class ContentLine {\n /**\n * The element tag to use.\n * @type Select\n * @options div\n * @options p\n * @options h1\n * @options h2\n * @options h3\n * @options h4\n * @options h5\n * @options h6\n * @options span\n * @options section\n * @options article\n */\n @Prop() tag: ContentLineTagOptions = 'div';\n\n /**\n * Pipe separated list of ContentLineTextAlignOptions for text alignment.\n * @type Select\n * @options default\n * @options left\n * @options center\n * @options right\n * @responsive\n */\n @Prop() textAlign: ContentLineTextAlignOptions = 'default';\n\n /**\n * The font class for the line.\n * @type String\n * @responsive\n */\n @Prop() classes;\n @State() classString;\n\n /**\n * Pipe separated list of max width numbers. You can also use units such as \"px\" and \"vw\". If no unit is provided, defaults to percentage.\n * @type String\n * @responsive\n */\n @Prop() maxWidth: ResponsiveNumber = '100%';\n @State() inlineStyle: { [key: string]: string } = {};\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.textAlign).subscribe(newValue => {\n this.inlineStyle = {\n ...this.inlineStyle,\n '--text-align': newValue as ContentLineTextAlignOptions,\n };\n });\n WindowResizeService.registerProp(this.maxWidth).subscribe((newValue: string | number) => {\n this.inlineStyle = {\n ...this.inlineStyle,\n '--max-width': isNaN(newValue as number) ? (newValue as string) : newValue + '%',\n };\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n render() {\n // The capital case in this JSX variable is important\n const ElementTagParsed = `${this.tag}`;\n return (\n <Host class={this.classString} style={this.inlineStyle}>\n <ElementTagParsed class=\"content-line__inner\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </ElementTagParsed>\n </Host>\n );\n }\n}"],"version":3}
|
|
@@ -27,26 +27,30 @@ const ContentNavigationBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentN
|
|
|
27
27
|
let openButton = this.hostElement.querySelector('[slot="openButton"]');
|
|
28
28
|
let closeButton = this.hostElement.querySelector('[slot="closeButton"]');
|
|
29
29
|
let content = this.hostElement.querySelector('[slot="content"]');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (openButton) {
|
|
31
|
+
openButton.onclick = () => {
|
|
32
|
+
this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';
|
|
33
|
+
content.setAttribute('hidden', this.ariaExpanded === 'false' ? 'true' : 'false');
|
|
34
|
+
if (this.ariaExpanded === 'false') {
|
|
35
|
+
document.body.classList.remove('content-navigation-block-open');
|
|
36
|
+
}
|
|
37
|
+
else if (this.bodyToggle) {
|
|
38
|
+
document.body.classList.add('content-navigation-block-open');
|
|
39
|
+
}
|
|
40
|
+
setTimeout(() => closeButton.focus(), 1);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (closeButton) {
|
|
44
|
+
closeButton.onclick = () => {
|
|
45
|
+
this.ariaExpanded = 'false';
|
|
46
|
+
content.setAttribute('hidden', 'true');
|
|
34
47
|
document.body.classList.remove('content-navigation-block-open');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
setTimeout(() => closeButton.focus(), 1);
|
|
40
|
-
};
|
|
41
|
-
closeButton.onclick = () => {
|
|
42
|
-
this.ariaExpanded = 'false';
|
|
43
|
-
content.setAttribute('hidden', 'true');
|
|
44
|
-
document.body.classList.remove('content-navigation-block-open');
|
|
45
|
-
setTimeout(() => openButton.focus(), 1);
|
|
46
|
-
};
|
|
48
|
+
setTimeout(() => openButton.focus(), 1);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
render() {
|
|
49
|
-
return (h(Host, { class: this.classString, "aria-expanded": this.ariaExpanded }, h("slot",
|
|
53
|
+
return (h(Host, { class: this.classString, "aria-expanded": this.ariaExpanded }, h("slot", { name: "openButton" }), h("slot", { name: "closeButton" }), h("div", { class: "content-navigation__menu" }, h("slot", { name: "content" }), h("slot", null))));
|
|
50
54
|
}
|
|
51
55
|
get hostElement() { return this; }
|
|
52
56
|
static get style() { return contentNavigationBlockCss; }
|
|
@@ -70,6 +74,7 @@ function defineCustomElement$1() {
|
|
|
70
74
|
break;
|
|
71
75
|
} });
|
|
72
76
|
}
|
|
77
|
+
defineCustomElement$1();
|
|
73
78
|
|
|
74
79
|
const ContentNavigationBlock = ContentNavigationBlock$1;
|
|
75
80
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content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I,CAAC,SAAS,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;gBAChE,UAAU,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;aACzC,CAAC;SACH;KACF;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,mBAAiB,IAAI,CAAC,YAAY,IAC7D,YAAM,IAAI,EAAC,YAAY,GAAQ,EAC/B,YAAM,IAAI,EAAC,aAAa,GAAQ,EAChC,WAAK,KAAK,EAAC,0BAA0B,IACnC,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentNavigationBlock"],"sources":["src/components/content-navigation-block/content-navigation-block.scss?tag=content-navigation-block","src/components/content-navigation-block/content-navigation-block.tsx"],"sourcesContent":["body.content-navigation-block-open {\n overflow: hidden;\n}\ncontent-navigation-block {\n &[hamburger=\"fixed\"],\n &[hamburger=\"absolute\"],\n &[hamburger=\"static\"] {\n display: inline-block;\n &[aria-expanded=\"false\"] {\n [slot=\"closeButton\"] {\n display: none;\n }\n }\n [slot=\"openButton\"],\n [slot=\"closeButton\"] {\n cursor: pointer;\n }\n \n [slot=\"content\"] {\n display: none;\n background: white;\n &[hidden=\"false\"] {\n display: block;\n }\n }\n }\n\n &[hamburger=\"fixed\"] {\n [slot=\"content\"] {\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n z-index: 100;\n }\n }\n &[hamburger=\"absolute\"] {\n [slot=\"content\"] {\n position: absolute;\n z-index: 100;\n }\n }\n &[hamburger=\"static\"] {\n [slot=\"content\"] {\n position: static;\n }\n }\n \n &[hamburger=\"none\"] {\n display: block;\n [slot=\"openButton\"],\n [slot=\"closeButton\"] {\n display: none;\n }\n }\n}","import { Component, Prop, Host, h, State, Element } from '@stencil/core';\nimport { HTMLStencilElement } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\n\n/**\n * @slot openButton - This slot will expand the navigation when clicked.\n * @slot closeButton - This slot will close the navigation when clicked.\n * @slot content - Default slot\n */\n@Component({\n tag: 'content-navigation-block',\n styleUrl: 'content-navigation-block.scss',\n shadow: false,\n})\nexport class ContentNavigationBlock {\n /**\n * @type Select\n * @responsive\n * @options fixed\n * @options absolute\n * @options static\n * @options none\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n hamburger: ResponsiveString = 'fixed|none';\n\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n @Element() hostElement: HTMLStencilElement;\n @State() ariaExpanded: string = 'false';\n @State() bodyToggle: boolean = false;\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {\n this.hamburger = newValue as string;\n this.bodyToggle = this.hamburger === 'fixed';\n document.body.classList.remove('content-navigation-block-open');\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n componentDidLoad() {\n let openButton = this.hostElement.querySelector('[slot=\"openButton\"]') as HTMLElement;\n let closeButton = this.hostElement.querySelector('[slot=\"closeButton\"]') as HTMLElement;\n let content = this.hostElement.querySelector('[slot=\"content\"]') as HTMLElement;\n if (openButton) {\n openButton.onclick = () => {\n this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';\n content.setAttribute('hidden', this.ariaExpanded === 'false' ? 'true' : 'false');\n if (this.ariaExpanded === 'false') {\n document.body.classList.remove('content-navigation-block-open');\n } else if (this.bodyToggle) {\n document.body.classList.add('content-navigation-block-open');\n }\n setTimeout(() => closeButton.focus(), 1);\n };\n }\n if (closeButton) {\n closeButton.onclick = () => {\n this.ariaExpanded = 'false';\n content.setAttribute('hidden', 'true');\n document.body.classList.remove('content-navigation-block-open');\n setTimeout(() => openButton.focus(), 1);\n };\n }\n }\n\n render() {\n return (\n <Host class={this.classString} aria-expanded={this.ariaExpanded}>\n <slot name=\"openButton\"></slot>\n <slot name=\"closeButton\"></slot>\n <div class=\"content-navigation__menu\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|