@content-blocks/js 0.4.4 → 0.6.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 +97 -84
- package/dist/cjs/content-accordion_11.cjs.entry.js.map +1 -1
- package/dist/cjs/content-blocks.cjs.js +3 -3
- package/dist/cjs/content-blocks.cjs.js.map +1 -1
- package/dist/cjs/content-carousel.cjs.entry.js +3 -2
- package/dist/cjs/content-carousel.cjs.entry.js.map +1 -1
- package/dist/cjs/content-navigation-block.cjs.entry.js +31 -29
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-split-block.cjs.entry.js +6 -6
- package/dist/cjs/content-split-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-tabs.cjs.entry.js +8 -6
- package/dist/cjs/content-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-66c390bf.js → index-9f20d89a.js} +34 -14
- 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-dbda9bbc.js → utils-db61cd70.js} +12 -4
- package/dist/cjs/utils-db61cd70.js.map +1 -0
- package/dist/cjs/{window-resize-service-35e2ab31.js → window-resize-service-ac5c2012.js} +4 -3
- package/dist/cjs/window-resize-service-ac5c2012.js.map +1 -0
- package/dist/collection/blocks/content-hero-block/content-hero-block.css +6 -4
- package/dist/collection/blocks/content-hero-block/content-hero-block.js +2 -4
- package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +1 -1
- package/dist/collection/blocks/content-split-block/content-split-block.css +0 -4
- package/dist/collection/blocks/content-split-block/content-split-block.js +2 -2
- 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 +0 -4
- package/dist/collection/blocks/content-text-block/content-text-block.js +7 -7
- package/dist/collection/blocks/content-text-block/content-text-block.js.map +1 -1
- package/dist/collection/blocks/content-tout-block/content-tout-block.css +0 -6
- package/dist/collection/blocks/content-tout-block/content-tout-block.js +0 -2
- package/dist/collection/blocks/content-tout-block/content-tout-block.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/content-accordion/content-accordion.js +2 -2
- package/dist/collection/components/content-accordion/content-accordion.js.map +1 -1
- package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js.map +1 -1
- package/dist/collection/components/content-carousel/content-carousel.css +0 -4
- package/dist/collection/components/content-carousel/content-carousel.js +2 -1
- package/dist/collection/components/content-carousel/content-carousel.js.map +1 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.css +0 -6
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +27 -25
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -1
- package/dist/collection/components/content-overlay/content-overlay.css +6 -9
- package/dist/collection/components/content-overlay/content-overlay.js +34 -16
- package/dist/collection/components/content-overlay/content-overlay.js.map +1 -1
- package/dist/collection/components/content-overlay/libraries/aria-dialog.js.map +1 -1
- package/dist/collection/components/content-overlay/libraries/aria-utilities.js.map +1 -1
- package/dist/collection/components/content-tabs/content-tabs.css +0 -4
- package/dist/collection/components/content-tabs/content-tabs.js +4 -2
- package/dist/collection/components/content-tabs/content-tabs.js.map +1 -1
- package/dist/collection/components/content-tabs/libraries/w3_tabs.js.map +1 -1
- package/dist/collection/elements/content-button/content-button.css +0 -4
- package/dist/collection/elements/content-button/content-button.js +12 -11
- package/dist/collection/elements/content-button/content-button.js.map +1 -1
- package/dist/collection/elements/content-image/content-image.css +4 -11
- package/dist/collection/elements/content-image/content-image.js +81 -23
- package/dist/collection/elements/content-image/content-image.js.map +1 -1
- package/dist/collection/elements/content-line/content-line.js +10 -14
- package/dist/collection/elements/content-line/content-line.js.map +1 -1
- package/dist/collection/elements/content-video/content-video.css +1 -5
- package/dist/collection/elements/content-video/content-video.js +1 -1
- package/dist/collection/elements/content-video/content-video.js.map +1 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +1 -4
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +46 -3
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -1
- package/dist/collection/formatters/content-spacer/content-spacer.css +0 -3
- package/dist/collection/formatters/content-spacer/content-spacer.js +4 -3
- package/dist/collection/formatters/content-spacer/content-spacer.js.map +1 -1
- package/dist/collection/services/content-events-service.js.map +1 -1
- package/dist/collection/services/window-resize-service.js +2 -1
- package/dist/collection/services/window-resize-service.js.map +1 -1
- package/dist/collection/stories/ContentHeroBlock.stories.js +22 -18
- package/dist/collection/stories/ContentHeroBlock.stories.js.map +1 -1
- package/dist/collection/stories/ContentNavigationBlock.stories.js +26 -0
- package/dist/collection/stories/ContentNavigationBlock.stories.js.map +1 -0
- package/dist/collection/stories/ContentSpacer.stories.js +20 -0
- package/dist/collection/stories/ContentSpacer.stories.js.map +1 -0
- package/dist/collection/stories/ContentTextBlock.stories.js +17 -0
- package/dist/collection/stories/ContentTextBlock.stories.js.map +1 -0
- package/dist/collection/stories/ContentToutBlock.stories.js +17 -0
- package/dist/collection/stories/ContentToutBlock.stories.js.map +1 -0
- package/dist/collection/stories/FullPageExample.stories.js +482 -0
- package/dist/collection/stories/FullPageExample.stories.js.map +1 -0
- package/dist/collection/utils/utils.js +9 -0
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/content-accordion.js +1 -1
- package/dist/components/content-accordion.js.map +1 -1
- package/dist/components/content-button.js +13 -12
- package/dist/components/content-button.js.map +1 -1
- package/dist/components/content-carousel.js +2 -1
- package/dist/components/content-carousel.js.map +1 -1
- package/dist/components/content-grid-formatter2.js +8 -2
- package/dist/components/content-grid-formatter2.js.map +1 -1
- package/dist/components/content-hero-block.js +2 -4
- package/dist/components/content-hero-block.js.map +1 -1
- package/dist/components/content-image.js +28 -24
- package/dist/components/content-image.js.map +1 -1
- package/dist/components/content-line.js +8 -12
- package/dist/components/content-line.js.map +1 -1
- package/dist/components/content-navigation-block.js +28 -26
- package/dist/components/content-navigation-block.js.map +1 -1
- package/dist/components/content-overlay.js +32 -14
- package/dist/components/content-overlay.js.map +1 -1
- package/dist/components/content-spacer.js +3 -3
- package/dist/components/content-spacer.js.map +1 -1
- package/dist/components/content-split-block.js +3 -3
- package/dist/components/content-split-block.js.map +1 -1
- package/dist/components/content-tabs.js +5 -3
- package/dist/components/content-tabs.js.map +1 -1
- package/dist/components/content-text-block.js +8 -8
- package/dist/components/content-text-block.js.map +1 -1
- package/dist/components/content-tout-block.js +1 -3
- package/dist/components/content-tout-block.js.map +1 -1
- package/dist/components/content-video.js +1 -1
- package/dist/components/content-video.js.map +1 -1
- package/dist/components/utils.js +12 -2
- package/dist/components/utils.js.map +1 -1
- package/dist/components/window-resize-service.js +2 -1
- package/dist/components/window-resize-service.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-167a9155.entry.js +2 -0
- package/dist/content-blocks/p-167a9155.entry.js.map +1 -0
- package/dist/content-blocks/{p-3d21ae2b.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-4038cd42.entry.js +10 -0
- package/dist/content-blocks/p-4038cd42.entry.js.map +1 -0
- package/dist/content-blocks/p-4bfbd7ef.entry.js +2 -0
- package/dist/content-blocks/p-4bfbd7ef.entry.js.map +1 -0
- package/dist/content-blocks/p-8cc22c1e.entry.js +2 -0
- package/dist/content-blocks/p-8cc22c1e.entry.js.map +1 -0
- package/dist/content-blocks/{p-070bc93d.js → p-b04fe808.js} +2 -2
- package/dist/content-blocks/p-b04fe808.js.map +1 -0
- package/dist/content-blocks/{p-451e7694.js → p-cfb4593f.js} +2 -2
- package/dist/content-blocks/p-cfb4593f.js.map +1 -0
- package/dist/esm/content-accordion_11.entry.js +97 -84
- package/dist/esm/content-accordion_11.entry.js.map +1 -1
- package/dist/esm/content-blocks.js +4 -4
- package/dist/esm/content-blocks.js.map +1 -1
- package/dist/esm/content-carousel.entry.js +3 -2
- package/dist/esm/content-carousel.entry.js.map +1 -1
- package/dist/esm/content-navigation-block.entry.js +31 -29
- package/dist/esm/content-navigation-block.entry.js.map +1 -1
- package/dist/esm/content-split-block.entry.js +6 -6
- package/dist/esm/content-split-block.entry.js.map +1 -1
- package/dist/esm/content-tabs.entry.js +8 -6
- package/dist/esm/content-tabs.entry.js.map +1 -1
- package/dist/esm/{index-2674652b.js → index-e848c048.js} +34 -14
- 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-72b3a8bd.js → utils-4f78228e.js} +13 -3
- package/dist/esm/utils-4f78228e.js.map +1 -0
- package/dist/esm/{window-resize-service-8419bd19.js → window-resize-service-f40ec51c.js} +4 -3
- package/dist/esm/window-resize-service-f40ec51c.js.map +1 -0
- package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +0 -1
- package/dist/types/blocks/content-split-block/content-split-block.d.ts +1 -1
- package/dist/types/blocks/content-text-block/content-text-block.d.ts +1 -1
- package/dist/types/blocks/content-tout-block/content-tout-block.d.ts +0 -1
- package/dist/types/components/content-accordion/content-accordion.d.ts +6 -6
- package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +2 -2
- package/dist/types/components/content-overlay/content-overlay.d.ts +4 -3
- package/dist/types/components/content-tabs/content-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +37 -3
- package/dist/types/elements/content-button/content-button.d.ts +1 -1
- package/dist/types/elements/content-image/content-image.d.ts +13 -1
- package/dist/types/elements/content-line/content-line.d.ts +1 -1
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +8 -2
- package/dist/types/formatters/content-spacer/content-spacer.d.ts +1 -1
- package/dist/types/stories/ContentHeroBlock.stories.d.ts +4 -5
- package/dist/types/stories/ContentNavigationBlock.stories.d.ts +11 -0
- package/dist/types/stories/ContentSpacer.stories.d.ts +15 -0
- package/dist/types/stories/ContentTextBlock.stories.d.ts +15 -0
- package/dist/types/stories/ContentToutBlock.stories.d.ts +9 -0
- package/dist/types/stories/FullPageExample.stories.d.ts +10 -0
- package/dist/types/typings.d.ts +3 -3
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +6 -3
- package/dist/cjs/index-66c390bf.js.map +0 -1
- package/dist/cjs/utils-dbda9bbc.js.map +0 -1
- package/dist/cjs/window-resize-service-35e2ab31.js.map +0 -1
- package/dist/content-blocks/p-070bc93d.js.map +0 -1
- package/dist/content-blocks/p-171693ef.js +0 -3
- package/dist/content-blocks/p-171693ef.js.map +0 -1
- package/dist/content-blocks/p-3d21ae2b.entry.js.map +0 -1
- package/dist/content-blocks/p-3e27514e.entry.js +0 -10
- package/dist/content-blocks/p-3e27514e.entry.js.map +0 -1
- package/dist/content-blocks/p-451e7694.js.map +0 -1
- package/dist/content-blocks/p-6ddbb176.entry.js +0 -2
- package/dist/content-blocks/p-6ddbb176.entry.js.map +0 -1
- package/dist/content-blocks/p-a78f9c91.entry.js +0 -2
- package/dist/content-blocks/p-a78f9c91.entry.js.map +0 -1
- package/dist/content-blocks/p-dac292e3.entry.js +0 -2
- package/dist/content-blocks/p-dac292e3.entry.js.map +0 -1
- package/dist/esm/index-2674652b.js.map +0 -1
- package/dist/esm/utils-72b3a8bd.js.map +0 -1
- package/dist/esm/window-resize-service-8419bd19.js.map +0 -1
|
@@ -16,27 +16,27 @@ export class ContentButton {
|
|
|
16
16
|
this.controls = undefined;
|
|
17
17
|
this.linkLabel = undefined;
|
|
18
18
|
this.linkClass = undefined;
|
|
19
|
+
this.hasContentToActivate = undefined;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
let promises = [];
|
|
21
|
+
componentWillLoad() {
|
|
22
22
|
this.activatedContent = this.hostElement.querySelector('[slot="activatedContent"]');
|
|
23
23
|
this.hasContentToActivate = !!this.activatedContent;
|
|
24
24
|
// If this is a clickable block, forcefully add a # to force an anchor link
|
|
25
25
|
if (!this.href || this.href === '#') {
|
|
26
26
|
this.href = 'javascript:void(0);';
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
WindowResizeService.registerProp(this.linkClass).subscribe(newValue => {
|
|
29
29
|
this.linkClass = newValue;
|
|
30
|
-
})
|
|
31
|
-
|
|
30
|
+
});
|
|
31
|
+
WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
32
32
|
this.classString = newValue;
|
|
33
|
-
})
|
|
34
|
-
return promises;
|
|
33
|
+
});
|
|
35
34
|
}
|
|
36
35
|
onHandleClickEvent(ev) {
|
|
36
|
+
console.log(ev);
|
|
37
37
|
if (this.hasContentToActivate) {
|
|
38
38
|
ev.preventDefault();
|
|
39
|
-
ev.stopPropagation();
|
|
39
|
+
// ev.stopPropagation();
|
|
40
40
|
this.activatedContent.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: this.activatedContent }));
|
|
41
41
|
this.activatedContent.scrollIntoView({ behavior: 'smooth' });
|
|
42
42
|
}
|
|
@@ -44,9 +44,9 @@ export class ContentButton {
|
|
|
44
44
|
let element = document.getElementById(this.href.substring(1));
|
|
45
45
|
if (element) {
|
|
46
46
|
ev.preventDefault();
|
|
47
|
-
ev.stopPropagation();
|
|
47
|
+
// ev.stopPropagation();
|
|
48
48
|
element.dispatchEvent(new CustomEvent('contentBlockActivated', { detail: element }));
|
|
49
|
-
element.scrollIntoView({ behavior: 'smooth' });
|
|
49
|
+
// element.scrollIntoView({ behavior: 'smooth' });
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -253,7 +253,8 @@ export class ContentButton {
|
|
|
253
253
|
}
|
|
254
254
|
static get states() {
|
|
255
255
|
return {
|
|
256
|
-
"classString": {}
|
|
256
|
+
"classString": {},
|
|
257
|
+
"hasContentToActivate": {}
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
static get elementRef() { return "hostElement"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-button.js","sourceRoot":"","sources":["../../../../src/elements/content-button/content-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAsB,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AAMH,MAAM,OAAO,aAAa;;;;uBAmBN,EAAE;2BACG,EAAE;8BAIS,KAAK
|
|
1
|
+
{"version":3,"file":"content-button.js","sourceRoot":"","sources":["../../../../src/elements/content-button/content-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAsB,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AAMH,MAAM,OAAO,aAAa;;;;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;QACpD,2EAA2E;QAC3E,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QACpC,CAAC;QAED,mBAAmB,CAAC,YAAY,CAAC,IAAI,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ED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW;YAC3B,uBACc,IAAI,CAAC,SAAS,EAC1B,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EACzD,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,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,CAAC,CAAC,CAAC,CACtB;gBACE,YAAM,IAAI,EAAC,SAAS,GAAQ;gBAC5B,eAAa,CACR,CACR,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,mCAAmC;gBAC5C,YAAM,IAAI,EAAC,SAAS,GAAQ;gBAC5B,eAAa,CACT,CACP,CACC;YACJ,YAAM,IAAI,EAAC,kBAAkB,GAAQ,CAChC,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\nimport { Element, 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: HTMLStencilElement;\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 console.log(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"]}
|
|
@@ -7,10 +7,6 @@ content-image {
|
|
|
7
7
|
height: auto;
|
|
8
8
|
transition: opacity 0.3s;
|
|
9
9
|
position: relative;
|
|
10
|
-
visibility: hidden;
|
|
11
|
-
}
|
|
12
|
-
content-image.hydrated {
|
|
13
|
-
visibility: inherit;
|
|
14
10
|
}
|
|
15
11
|
content-image.content-image-loading {
|
|
16
12
|
opacity: 0;
|
|
@@ -18,6 +14,10 @@ content-image.content-image-loading {
|
|
|
18
14
|
content-image.content-image-loaded {
|
|
19
15
|
opacity: 1;
|
|
20
16
|
}
|
|
17
|
+
content-image[aspect-ratio] img, content-image[aspect-ratio] picture, content-image[aspect-ratio] video {
|
|
18
|
+
aspect-ratio: var(--aspect-ratio);
|
|
19
|
+
object-fit: cover;
|
|
20
|
+
}
|
|
21
21
|
content-image img,
|
|
22
22
|
content-image picture,
|
|
23
23
|
content-image video {
|
|
@@ -25,13 +25,6 @@ content-image video {
|
|
|
25
25
|
width: 100%;
|
|
26
26
|
height: 100%;
|
|
27
27
|
}
|
|
28
|
-
content-hero-block content-image img, content-grid-formatter content-image img,
|
|
29
|
-
content-hero-block content-image picture,
|
|
30
|
-
content-grid-formatter content-image picture,
|
|
31
|
-
content-hero-block content-image video,
|
|
32
|
-
content-grid-formatter content-image video {
|
|
33
|
-
height: auto;
|
|
34
|
-
}
|
|
35
28
|
content-image .content-image__media-content {
|
|
36
29
|
display: none;
|
|
37
30
|
position: absolute;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { WindowResizeService } from "../../services/window-resize-service";
|
|
3
|
-
import {
|
|
3
|
+
import { getCurrentValue } from "../../utils/utils";
|
|
4
4
|
/**
|
|
5
5
|
* @slot mediaContent - Content displayed over media. If you want to reveal content on hover, use a tout block
|
|
6
6
|
*/
|
|
@@ -13,6 +13,8 @@ export class ContentImage {
|
|
|
13
13
|
this.alt = undefined;
|
|
14
14
|
this.width = '16';
|
|
15
15
|
this.height = '9';
|
|
16
|
+
this.aspectRatio = undefined;
|
|
17
|
+
this.type = 'image';
|
|
16
18
|
this.videoType = 'video/mp4';
|
|
17
19
|
this.showContent = 'false|true';
|
|
18
20
|
this.lazyLoadIsComplete = false;
|
|
@@ -21,6 +23,7 @@ export class ContentImage {
|
|
|
21
23
|
this.classString = '';
|
|
22
24
|
this.inlineStyle = {};
|
|
23
25
|
this.hasMediaContent = false;
|
|
26
|
+
this.pictureImageSrc = undefined;
|
|
24
27
|
}
|
|
25
28
|
preloadImage(src) {
|
|
26
29
|
return new Promise(r => {
|
|
@@ -30,14 +33,24 @@ export class ContentImage {
|
|
|
30
33
|
image.src = src;
|
|
31
34
|
});
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
componentWillLoad() {
|
|
34
37
|
this.hasMediaContent = !!this.hostElement.querySelector('[slot="mediaContent"]');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
let observer = new IntersectionObserver(entries => {
|
|
39
|
+
entries.forEach(async (entry) => {
|
|
40
|
+
if (entry.isIntersecting) {
|
|
41
|
+
this.lazyLoadIsComplete = true;
|
|
42
|
+
this.pictureImageSrc = getCurrentValue(this.src);
|
|
43
|
+
this.showVideoAsGif = this.pictureImageSrc.indexOf('.mp4') >= 0 || getCurrentValue(this.type) === 'video';
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}, {
|
|
47
|
+
root: null,
|
|
48
|
+
rootMargin: `${Math.max(100, window.innerHeight * 0.15)}px`,
|
|
49
|
+
threshold: 0.1,
|
|
50
|
+
});
|
|
51
|
+
observer.observe(this.hostElement);
|
|
52
|
+
WindowResizeService.registerProp(this.aspectRatio).subscribe(newValue => {
|
|
53
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--aspect-ratio': `${newValue}` });
|
|
41
54
|
});
|
|
42
55
|
WindowResizeService.registerProp(this.alt).subscribe(newValue => {
|
|
43
56
|
this.alt = newValue;
|
|
@@ -49,7 +62,7 @@ export class ContentImage {
|
|
|
49
62
|
this.showContent = newValue;
|
|
50
63
|
});
|
|
51
64
|
WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
52
|
-
this.classString = `${
|
|
65
|
+
this.classString = `${newValue}`;
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
68
|
watchLazyLoadIsComplete(newValue) {
|
|
@@ -66,19 +79,7 @@ export class ContentImage {
|
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
render() {
|
|
69
|
-
|
|
70
|
-
let pictureImageSrc = '';
|
|
71
|
-
if (this.src) {
|
|
72
|
-
breakpointValues.forEach((_bp, index) => {
|
|
73
|
-
if (index === 0) {
|
|
74
|
-
pictureImageSrc = getValueAtIndex(0, this.src);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
pictureSrcSet += `${getValueAtIndex(index, this.src)} ${breakpointValues[index]}w,`;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return (h(Host, { class: 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 })))));
|
|
82
|
+
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("img", { width: this.width, height: this.height, src: this.pictureImageSrc, alt: this.alt }))));
|
|
82
83
|
}
|
|
83
84
|
static get is() { return "content-image"; }
|
|
84
85
|
static get originalStyleUrls() {
|
|
@@ -261,6 +262,62 @@ export class ContentImage {
|
|
|
261
262
|
"reflect": false,
|
|
262
263
|
"defaultValue": "'9'"
|
|
263
264
|
},
|
|
265
|
+
"aspectRatio": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"mutable": true,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "ResponsiveString",
|
|
270
|
+
"resolved": "string",
|
|
271
|
+
"references": {
|
|
272
|
+
"ResponsiveString": {
|
|
273
|
+
"location": "import",
|
|
274
|
+
"path": "../../typings",
|
|
275
|
+
"id": "src/typings.d.ts::ResponsiveString"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [{
|
|
283
|
+
"name": "type",
|
|
284
|
+
"text": "String"
|
|
285
|
+
}, {
|
|
286
|
+
"name": "responsive",
|
|
287
|
+
"text": undefined
|
|
288
|
+
}],
|
|
289
|
+
"text": ""
|
|
290
|
+
},
|
|
291
|
+
"attribute": "aspect-ratio",
|
|
292
|
+
"reflect": false
|
|
293
|
+
},
|
|
294
|
+
"type": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"mutable": false,
|
|
297
|
+
"complexType": {
|
|
298
|
+
"original": "'image' | 'video'",
|
|
299
|
+
"resolved": "\"image\" | \"video\"",
|
|
300
|
+
"references": {}
|
|
301
|
+
},
|
|
302
|
+
"required": false,
|
|
303
|
+
"optional": true,
|
|
304
|
+
"docs": {
|
|
305
|
+
"tags": [{
|
|
306
|
+
"name": "type",
|
|
307
|
+
"text": "Select"
|
|
308
|
+
}, {
|
|
309
|
+
"name": "options",
|
|
310
|
+
"text": "image"
|
|
311
|
+
}, {
|
|
312
|
+
"name": "options",
|
|
313
|
+
"text": "video"
|
|
314
|
+
}],
|
|
315
|
+
"text": ""
|
|
316
|
+
},
|
|
317
|
+
"attribute": "type",
|
|
318
|
+
"reflect": false,
|
|
319
|
+
"defaultValue": "'image'"
|
|
320
|
+
},
|
|
264
321
|
"videoType": {
|
|
265
322
|
"type": "string",
|
|
266
323
|
"mutable": false,
|
|
@@ -325,7 +382,8 @@ export class ContentImage {
|
|
|
325
382
|
"activeLazyLoadClass": {},
|
|
326
383
|
"classString": {},
|
|
327
384
|
"inlineStyle": {},
|
|
328
|
-
"hasMediaContent": {}
|
|
385
|
+
"hasMediaContent": {},
|
|
386
|
+
"pictureImageSrc": {}
|
|
329
387
|
};
|
|
330
388
|
}
|
|
331
389
|
static get elementRef() { return "hostElement"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-image.js","sourceRoot":"","sources":["../../../../src/elements/content-image/content-image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,
|
|
1
|
+
{"version":3,"file":"content-image.js","sourceRoot":"","sources":["../../../../src/elements/content-image/content-image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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 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.15)}px`,\n threshold: 0.1,\n },\n );\n observer.observe(this.hostElement);\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 @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.src : 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"]}
|
|
@@ -13,20 +13,16 @@ export class ContentLine {
|
|
|
13
13
|
this.maxWidth = '100%';
|
|
14
14
|
this.inlineStyle = {};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
promises.push(WindowResizeService.registerProp(this.textAlign).subscribe(newValue => {
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
WindowResizeService.registerProp(this.textAlign).subscribe(newValue => {
|
|
19
18
|
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--text-align': newValue });
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
promises.push(WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
19
|
+
});
|
|
20
|
+
WindowResizeService.registerProp(this.maxWidth).subscribe((newValue) => {
|
|
21
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--max-width': isNaN(newValue) ? newValue : newValue + '%' });
|
|
22
|
+
});
|
|
23
|
+
WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
27
24
|
this.classString = newValue;
|
|
28
|
-
})
|
|
29
|
-
return Promise.allSettled(promises);
|
|
25
|
+
});
|
|
30
26
|
}
|
|
31
27
|
render() {
|
|
32
28
|
// The capital case in this JSX variable is important
|
|
@@ -55,7 +51,7 @@ export class ContentLine {
|
|
|
55
51
|
"references": {
|
|
56
52
|
"ContentLineTagOptions": {
|
|
57
53
|
"location": "local",
|
|
58
|
-
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/
|
|
54
|
+
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/packages/content-blocks-stenciljs/src/elements/content-line/content-line.tsx",
|
|
59
55
|
"id": "src/elements/content-line/content-line.tsx::ContentLineTagOptions"
|
|
60
56
|
}
|
|
61
57
|
}
|
|
@@ -115,7 +111,7 @@ export class ContentLine {
|
|
|
115
111
|
"references": {
|
|
116
112
|
"ContentLineTextAlignOptions": {
|
|
117
113
|
"location": "local",
|
|
118
|
-
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/
|
|
114
|
+
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/packages/content-blocks-stenciljs/src/elements/content-line/content-line.tsx",
|
|
119
115
|
"id": "src/elements/content-line/content-line.tsx::ContentLineTextAlignOptions"
|
|
120
116
|
}
|
|
121
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-line.js","sourceRoot":"","sources":["../../../../src/elements/content-line/content-line.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAI3E;;;GAGG;AAMH,MAAM,OAAO,WAAW;;mBAgBe,KAAK;yBAWO,SAAS;;;wBAerB,MAAM;2BACO,EAAE;;IAEpD,
|
|
1
|
+
{"version":3,"file":"content-line.js","sourceRoot":"","sources":["../../../../src/elements/content-line/content-line.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAI3E;;;GAGG;AAMH,MAAM,OAAO,WAAW;;mBAgBe,KAAK;yBAWO,SAAS;;;wBAerB,MAAM;2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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}"]}
|
|
@@ -8,13 +8,9 @@ content-video {
|
|
|
8
8
|
display: block;
|
|
9
9
|
width: 100%;
|
|
10
10
|
position: relative;
|
|
11
|
-
visibility: hidden;
|
|
12
|
-
}
|
|
13
|
-
content-video.hydrated {
|
|
14
|
-
visibility: inherit;
|
|
15
11
|
height: 100%;
|
|
16
12
|
}
|
|
17
|
-
content-video.
|
|
13
|
+
content-video.content-video--fit-container .video-js.vjs-fluid {
|
|
18
14
|
height: 100%;
|
|
19
15
|
padding: 0;
|
|
20
16
|
}
|
|
@@ -122,7 +122,7 @@ export class ContentVideo {
|
|
|
122
122
|
"references": {
|
|
123
123
|
"SupportedVideoMethods": {
|
|
124
124
|
"location": "local",
|
|
125
|
-
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/
|
|
125
|
+
"path": "/Users/shahrukceo/Developer/content-blocks-monorepo/packages/content-blocks-stenciljs/src/elements/content-video/content-video.tsx",
|
|
126
126
|
"id": "src/elements/content-video/content-video.tsx::SupportedVideoMethods"
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-video.js","sourceRoot":"","sources":["../../../../src/elements/content-video/content-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAsB,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAG5E;;;;;;GAMG;AAMH,MAAM,OAAO,YAAY;;sBASiB,SAAS;wBAKrB,KAAK;mBAKX,EAAE;qBAIA,EAAE;sBAID,CAAC;oBAIH,W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C,KAAK,EAAC,EAAE;gBAC5B,IAAI,KAAK,CAAC,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"content-video.js","sourceRoot":"","sources":["../../../../src/elements/content-video/content-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAsB,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAG5E;;;;;;GAMG;AAMH,MAAM,OAAO,YAAY;;sBASiB,SAAS;wBAKrB,KAAK;mBAKX,EAAE;qBAIA,EAAE;sBAID,CAAC;oBAIH,WAAW;mCAII,MAAM;;;wBAchB,IAAI;uBAIN,UAAU;4BAUH,OAAO;wBACX,KAAK;yBACJ,KAAK;wBACN,KAAK;;IAElC,mBAAmB;QACjB,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,WAAW,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,MAAM;YACnD,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,OAAO;YACrD,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;YAClD,SAAS,EAAE,CAAC,SAAS,CAAC;YACtB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,eAAe;oBACrB,GAAG,EAAE,IAAI,CAAC,GAAG;iBACd;aACF;YACD,OAAO,EAAE;gBACP,QAAQ,EAAE,CAAC;gBACX,GAAG,EAAE,CAAC;gBACN,cAAc,EAAE,CAAC;aAClB;SACF,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,S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,KAAK,EAAC,wBAAwB,IAChC,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CACrC,aACE,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,EAC7C,KAAK,EAAC,kCAAkC,EACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAC,WAAW,gBACX,IAAI,CAAC,mBAAmB,EAAE;gBAEtC,YAAM,IAAI,EAAC,eAAe,GAAQ;gBAClC,YAAM,IAAI,EAAC,SAAS,GAAQ;gBAC5B,eAAa,CACP,CACT,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host } from '@stencil/core';\nimport { Element, HTMLStencilElement, Prop, State } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\nimport { getCurrentValue, getHydratedClassString } from '../../utils/utils';\nexport type SupportedVideoMethods = 'html5' | 'youtube';\n\n/**\n * @slot poster - Poster shown before video is played.\n * @slot playButton - Play button contents.\n * @slot no-js-message - Contents of no JS message.\n * @slot content - Adjacent to no-js message for video. Usually not needed.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-video',\n styleUrls: ['content-video.scss'],\n shadow: false,\n})\nexport class ContentVideo {\n public player: any;\n videoElement!: HTMLVideoElement;\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type Select\n * @options youtube\n * @options html5\n */\n @Prop() method: SupportedVideoMethods = 'youtube';\n /**\n * If you're using this inside a content-overlay for example, you may want the video to play immediately on launch.\n * @type Boolean\n */\n @Prop() autoplay: boolean = false;\n /**\n * Supports YouTube and self hosted URLs.\n * @type String\n */\n @Prop() src: string = '';\n /**\n * @type Number\n */\n @Prop() width: number = 16;\n /**\n * @type Number\n */\n @Prop() height: number = 9;\n /**\n * @type String\n */\n @Prop() type: string = 'video/mp4';\n /**\n * @type String\n */\n @Prop() playButtonAriaLabel: string = 'Play';\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n /**\n * @type Boolean\n */\n @Prop() controls: boolean = true;\n /**\n * @type String\n */\n @Prop() preload: string = 'metadata';\n /**\n * Fit the container this video is placed in. When the video is used in an overlay or another place where the video will takeover the existing height, it is recommended to enable this option.\n * @responsive\n * @type String\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n fitContainer: ResponsiveString = 'false';\n @State() isLoaded: boolean = false;\n @State() hasPoster: boolean = false;\n @State() isPlayed: boolean = false;\n\n computedVideoConfig() {\n let videoConfig = {};\n videoConfig = {\n fill: getCurrentValue(this.fitContainer) === 'true',\n fluid: getCurrentValue(this.fitContainer) === 'false',\n autoplay: this.autoplay === true ? 'muted' : false,\n techOrder: ['youtube'],\n src: this.src,\n sources: [\n {\n type: 'video/youtube',\n src: this.src,\n },\n ],\n youtube: {\n showinfo: 0,\n rel: 0,\n modestbranding: 1,\n },\n };\n return videoConfig;\n }\n\n initVideo() {\n this.isLoaded = true;\n }\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue));\n }\n\n componentDidLoad() {\n let self = this;\n let options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.1,\n };\n\n let observer = new IntersectionObserver(entries => {\n let videojs;\n entries.forEach(async entry => {\n if (entry.isIntersecting) {\n if (!videojs) {\n videojs = await import('video.js');\n await import('videojs-youtube/dist/Youtube.js');\n }\n this.hasPoster = !!this.hostElement.querySelector('[slot=\"poster\"]');\n if (this.videoElement && !this.player) {\n this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {\n self.initVideo();\n if (self.hasPoster || self.autoplay) {\n self.isPlayed = true;\n setTimeout(() => this.play(), 1);\n }\n });\n }\n }\n });\n }, options);\n observer.observe(this.hostElement);\n }\n\n onClickHandler(event: MouseEvent) {\n event.preventDefault();\n if (!this.isLoaded) {\n return false;\n }\n this.initVideo();\n this.isPlayed = true;\n this.player.play();\n if (this.method === 'html5') {\n this.videoElement.play();\n }\n }\n\n render() {\n let showPlayButton = !this.autoplay && ((this.hasPoster && !this.isPlayed) || !this.isPlayed);\n return (\n <Host class={this.classString}>\n {this.hasPoster && !this.isLoaded && (\n <div class=\"content-video__poster\">\n <slot name=\"poster\"></slot>\n </div>\n )}\n {showPlayButton && (\n <button class=\"content-video__play\" aria-label={this.playButtonAriaLabel} onClick={ev => this.onClickHandler(ev)}>\n <slot name=\"playButton\"></slot>\n </button>\n )}\n <div class=\"content-video__content\">\n {(!this.hasPoster || this.isLoaded) && (\n <video\n ref={element => (this.videoElement = element)}\n class=\"video-js vjs-content-block-theme\"\n controls={this.controls}\n preload={this.preload}\n width={this.width}\n height={this.height}\n crossorigin=\"anonymous\"\n data-setup={this.computedVideoConfig()}\n >\n <slot name=\"no-js-message\"></slot>\n <slot name=\"content\"></slot>\n <slot></slot>\n </video>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
content-grid-formatter {
|
|
6
6
|
width: 100%;
|
|
7
7
|
overflow: auto;
|
|
8
|
-
visibility: hidden;
|
|
9
|
-
}
|
|
10
|
-
content-grid-formatter.hydrated {
|
|
11
|
-
visibility: inherit;
|
|
12
8
|
}
|
|
13
9
|
content-grid-formatter * {
|
|
14
10
|
box-sizing: border-box;
|
|
@@ -16,6 +12,7 @@ content-grid-formatter * {
|
|
|
16
12
|
content-grid-formatter[type=grid] {
|
|
17
13
|
display: grid;
|
|
18
14
|
grid-template-columns: repeat(var(--columns), 1fr);
|
|
15
|
+
column-gap: var(--column-gap);
|
|
19
16
|
}
|
|
20
17
|
content-grid-formatter[type=flex] {
|
|
21
18
|
display: flex;
|
|
@@ -14,10 +14,11 @@ export class ContentGridFormatter {
|
|
|
14
14
|
this.verticalAlignment = 'space-between';
|
|
15
15
|
this.horizontalAlignment = 'space-between';
|
|
16
16
|
this.columns = '1';
|
|
17
|
+
this.columnGap = '0';
|
|
17
18
|
this.activeClassString = undefined;
|
|
18
19
|
this.inlineStyle = {};
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
componentWillLoad() {
|
|
21
22
|
return Promise.allSettled([
|
|
22
23
|
WindowResizeService.registerProp(this.type).subscribe(newValue => (this.type = newValue)),
|
|
23
24
|
WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => {
|
|
@@ -34,6 +35,10 @@ export class ContentGridFormatter {
|
|
|
34
35
|
this.columns = newValue;
|
|
35
36
|
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--columns': newValue });
|
|
36
37
|
}),
|
|
38
|
+
WindowResizeService.registerProp(this.columnGap).subscribe(newValue => {
|
|
39
|
+
this.columnGap = newValue;
|
|
40
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--column-gap': newValue });
|
|
41
|
+
}),
|
|
37
42
|
WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue)),
|
|
38
43
|
]);
|
|
39
44
|
}
|
|
@@ -86,13 +91,18 @@ export class ContentGridFormatter {
|
|
|
86
91
|
"type": "string",
|
|
87
92
|
"mutable": true,
|
|
88
93
|
"complexType": {
|
|
89
|
-
"original": "GRID_TYPES",
|
|
90
|
-
"resolved": "
|
|
94
|
+
"original": "GRID_TYPES | ResponsiveString",
|
|
95
|
+
"resolved": "string",
|
|
91
96
|
"references": {
|
|
92
97
|
"GRID_TYPES": {
|
|
93
98
|
"location": "import",
|
|
94
99
|
"path": "../../typings",
|
|
95
100
|
"id": "src/typings.d.ts::GRID_TYPES"
|
|
101
|
+
},
|
|
102
|
+
"ResponsiveString": {
|
|
103
|
+
"location": "import",
|
|
104
|
+
"path": "../../typings",
|
|
105
|
+
"id": "src/typings.d.ts::ResponsiveString"
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
108
|
},
|
|
@@ -102,6 +112,9 @@ export class ContentGridFormatter {
|
|
|
102
112
|
"tags": [{
|
|
103
113
|
"name": "type",
|
|
104
114
|
"text": "Select"
|
|
115
|
+
}, {
|
|
116
|
+
"name": "options",
|
|
117
|
+
"text": "none"
|
|
105
118
|
}, {
|
|
106
119
|
"name": "options",
|
|
107
120
|
"text": "flex"
|
|
@@ -291,6 +304,36 @@ export class ContentGridFormatter {
|
|
|
291
304
|
"attribute": "columns",
|
|
292
305
|
"reflect": true,
|
|
293
306
|
"defaultValue": "'1'"
|
|
307
|
+
},
|
|
308
|
+
"columnGap": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"mutable": true,
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "ResponsiveNumber",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {
|
|
315
|
+
"ResponsiveNumber": {
|
|
316
|
+
"location": "import",
|
|
317
|
+
"path": "../../typings",
|
|
318
|
+
"id": "src/typings.d.ts::ResponsiveNumber"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"required": false,
|
|
323
|
+
"optional": false,
|
|
324
|
+
"docs": {
|
|
325
|
+
"tags": [{
|
|
326
|
+
"name": "type",
|
|
327
|
+
"text": "Number"
|
|
328
|
+
}, {
|
|
329
|
+
"name": "responsive",
|
|
330
|
+
"text": undefined
|
|
331
|
+
}],
|
|
332
|
+
"text": ""
|
|
333
|
+
},
|
|
334
|
+
"attribute": "column-gap",
|
|
335
|
+
"reflect": true,
|
|
336
|
+
"defaultValue": "'0'"
|
|
294
337
|
}
|
|
295
338
|
};
|
|
296
339
|
}
|