@postnord/pn-marketweb-components 2.3.14 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/cjs/index-4199ff85.js +8 -4
  2. package/cjs/loader.cjs.js +1 -1
  3. package/cjs/pn-market-web-components.cjs.js +1 -1
  4. package/cjs/pn-play-on-scroll.cjs.entry.js +63 -0
  5. package/cjs/pn-scroll_2.cjs.entry.js +142 -0
  6. package/collection/collection-manifest.json +2 -0
  7. package/collection/components/animation/pn-play-on-scroll/pn-play-on-scroll.css +15 -0
  8. package/collection/components/animation/pn-play-on-scroll/pn-play-on-scroll.js +91 -0
  9. package/collection/components/animation/pn-play-on-scroll/pn-play-on-scroll.stories.js +102 -0
  10. package/collection/components/animation/pn-play-on-scroll/pn-video-overlay/pn-video-overlay.css +24 -0
  11. package/collection/components/animation/pn-play-on-scroll/pn-video-overlay/pn-video-overlay.js +116 -0
  12. package/collection/components/animation/pn-play-on-scroll/pn-video-overlay/translations.js +29 -0
  13. package/collection/components/animation/pn-scroll/pn-scroll.js +82 -37
  14. package/components/index.d.ts +2 -0
  15. package/components/index.js +2 -0
  16. package/components/pn-play-on-scroll.d.ts +11 -0
  17. package/components/pn-play-on-scroll.js +93 -0
  18. package/components/pn-scroll.js +1 -74
  19. package/components/pn-scroll2.js +87 -0
  20. package/components/pn-video-overlay.d.ts +11 -0
  21. package/components/pn-video-overlay.js +6 -0
  22. package/components/pn-video-overlay2.js +95 -0
  23. package/esm/index-c118284d.js +8 -4
  24. package/esm/loader.js +1 -1
  25. package/esm/pn-market-web-components.js +1 -1
  26. package/esm/pn-play-on-scroll.entry.js +59 -0
  27. package/esm/pn-scroll_2.entry.js +137 -0
  28. package/esm-es5/index-c118284d.js +1 -1
  29. package/esm-es5/loader.js +1 -1
  30. package/esm-es5/pn-market-web-components.js +1 -1
  31. package/esm-es5/pn-play-on-scroll.entry.js +1 -0
  32. package/esm-es5/pn-scroll_2.entry.js +1 -0
  33. package/package.json +1 -1
  34. package/pn-market-web-components/p-1b18da01.entry.js +1 -0
  35. package/pn-market-web-components/p-3d4e0250.entry.js +1 -0
  36. package/pn-market-web-components/p-510b7ee1.system.entry.js +1 -0
  37. package/pn-market-web-components/p-8c493f7f.system.entry.js +1 -0
  38. package/pn-market-web-components/p-d295ef71.system.js +1 -1
  39. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  40. package/types/components/animation/pn-play-on-scroll/pn-play-on-scroll.d.ts +13 -0
  41. package/types/components/animation/pn-play-on-scroll/pn-video-overlay/pn-video-overlay.d.ts +15 -0
  42. package/types/components/animation/pn-play-on-scroll/pn-video-overlay/translations.d.ts +29 -0
  43. package/types/components/animation/pn-scroll/pn-scroll.d.ts +4 -1
  44. package/types/components.d.ts +43 -2
  45. package/umd/pn-marketweb-init.js +1 -1
  46. package/umd/pn-marketweb-salesforce.js +1 -1
  47. package/cjs/pn-scroll.cjs.entry.js +0 -59
  48. package/esm/pn-scroll.entry.js +0 -55
  49. package/esm-es5/pn-scroll.entry.js +0 -1
  50. package/pn-market-web-components/p-12f461db.entry.js +0 -1
  51. package/pn-market-web-components/p-bab17118.system.entry.js +0 -1
@@ -0,0 +1,102 @@
1
+ import readme from './readme.md';
2
+
3
+ export default {
4
+ title: 'Scroller/Fade',
5
+ parameters: {
6
+ notes: readme,
7
+ layout: 'fullscreen',
8
+ },
9
+ };
10
+
11
+ const PlayOnScrollTemplate = args => {
12
+ return `
13
+ <br>
14
+ <br>
15
+ <br>
16
+ <br>
17
+ <br>
18
+ <br>
19
+ <br>
20
+ <br>
21
+ <br>
22
+ <br>
23
+ <br>
24
+ <br>
25
+ <br>
26
+ <br>
27
+ <br>
28
+ <br>
29
+ <br>
30
+ <br>
31
+ <br>
32
+ <br>
33
+ <br>
34
+ <br>
35
+ <br>
36
+ <br>
37
+ <br>
38
+ <br>
39
+ <br>
40
+ <br>
41
+ <br>
42
+ <br>
43
+ <br>
44
+ <br>
45
+ <br>
46
+ <br>
47
+ <br>
48
+ <br>
49
+ <br>
50
+ <br>
51
+ <br>
52
+ <br>
53
+ <br>
54
+ <br>
55
+ <br>
56
+ <br>
57
+ <br>
58
+ <br>
59
+ <br>
60
+ <br>
61
+ <br>
62
+ <br>
63
+ <br>
64
+ <br>
65
+ <br>
66
+ <br>
67
+ <br>
68
+ <br>
69
+ <br>
70
+ <br>
71
+ <br>
72
+ <br>
73
+ <br>
74
+ <br>
75
+ <br>
76
+ <br>
77
+ <br>
78
+ <br>
79
+ <br>
80
+ <br>
81
+ <br>
82
+ <br>
83
+ <br>
84
+ <pn-play-on-scroll></pn-play-on-scroll>
85
+ <br>
86
+ <br>
87
+ <br>
88
+ <br>
89
+ <br>
90
+ <br>
91
+ <br>
92
+ <br>
93
+ <br>
94
+ <br>
95
+ <br>
96
+ <br>
97
+ <br>
98
+ `;
99
+ };
100
+
101
+ export const PlayOnScroll = PlayOnScrollTemplate.bind({});
102
+ PlayOnScroll.args = {};
@@ -0,0 +1,24 @@
1
+ pn-video-overlay button {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ border-radius: 50%;
6
+ padding: 12px;
7
+ border: none;
8
+ outline: none;
9
+ cursor: pointer;
10
+ background-color: #005D92;
11
+ }
12
+ pn-video-overlay button:hover {
13
+ background-color: #003d5f;
14
+ }
15
+ pn-video-overlay button:active {
16
+ background-color: #001c2c;
17
+ }
18
+ pn-video-overlay button:focus, pn-video-overlay button:focus-visible {
19
+ outline: 2px solid #FFFFFF;
20
+ }
21
+ pn-video-overlay button svg {
22
+ width: 20px;
23
+ height: 20px;
24
+ }
@@ -0,0 +1,116 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import { translations } from './translations';
3
+ export class PnVideoOverlay {
4
+ constructor() {
5
+ this.handlePlayPauseClicked = () => {
6
+ this.playPauseClicked.emit();
7
+ };
8
+ this.renderPlayIcon = () => {
9
+ return (h("svg", { width: "19", height: "19", viewBox: "0 0 19 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17 9.125C17 4.77576 13.4742 1.25 9.125 1.25C7.0653 1.25 5.19152 2.03991 3.78779 3.33445C3.53404 3.56846 3.13864 3.55246 2.90463 3.29871C2.67062 3.04496 2.68662 2.64956 2.94037 2.41555C4.56585 0.916511 6.7391 0 9.125 0C14.1646 0 18.25 4.0854 18.25 9.125C18.25 14.1646 14.1646 18.25 9.125 18.25C4.0854 18.25 0 14.1646 0 9.125C0 8.77982 0.279821 8.5 0.625 8.5C0.970178 8.5 1.25 8.77982 1.25 9.125C1.25 13.4742 4.77576 17 9.125 17C13.4742 17 17 13.4742 17 9.125ZM6.30222 4.5898C6.48977 4.47669 6.72286 4.47 6.91659 4.57219L13.9166 8.2645C14.1151 8.36921 14.2422 8.57231 14.2497 8.79661C14.2571 9.02091 14.1437 9.23198 13.9526 9.3496L6.95256 13.6573C6.75972 13.776 6.51778 13.781 6.32012 13.6706C6.12246 13.5601 6 13.3514 6 13.125V5.125C6 4.90597 6.11466 4.70292 6.30222 4.5898ZM7.25 6.16129V12.0065L12.3646 8.85909L7.25 6.16129ZM2.22949 4.85425C2.57467 4.85425 2.85449 4.57443 2.85449 4.22925C2.85449 3.88407 2.57467 3.60425 2.22949 3.60425C1.88431 3.60425 1.60449 3.88407 1.60449 4.22925C1.60449 4.57443 1.88431 4.85425 2.22949 4.85425Z", fill: "white" })));
10
+ };
11
+ this.renderPauseIcon = () => {
12
+ return (h("svg", { width: "20", height: "20", viewBox: "0 0 19 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17 9.1C17 4.8 13.5 1.2 9.1 1.2C7.1 1.2 5.2 2 3.8 3.3C3.5 3.5 3.2 3.5 2.9 3.3C2.6 3.1 2.7 2.7 2.9 2.4C4.6 0.9 6.7 0 9.1 0C14.1 0 18.2 4.1 18.2 9.1C18.2 14.1 14.1 18.2 9.1 18.2C4.1 18.2 0 14.2 0 9.1C0 8.8 0.3 8.5 0.6 8.5C0.9 8.5 1.2 8.8 1.2 9.1C1.2 13.4 4.7 17 9.1 17C13.5 17 17 13.5 17 9.1ZM2.2 4.9C2.5 4.9 2.8 4.6 2.8 4.3C2.8 4 2.6 3.6 2.2 3.6C1.8 3.6 1.6 3.9 1.6 4.2C1.6 4.5 1.9 4.9 2.2 4.9Z", fill: "white" }), h("path", { d: "M10.7143 4C10.3733 4 10.0463 4.14223 9.80515 4.39541C9.56403 4.64858 9.42857 4.99196 9.42857 5.35V11.65C9.42857 12.008 9.56403 12.3514 9.80515 12.6046C10.0463 12.8578 10.3733 13 10.7143 13C11.0553 13 11.3823 12.8578 11.6234 12.6046C11.8645 12.3514 12 12.008 12 11.65V5.35C12 4.99196 11.8645 4.64858 11.6234 4.39541C11.3823 4.14223 11.0553 4 10.7143 4ZM11.1429 11.65C11.1428 11.7693 11.0977 11.8838 11.0173 11.9682C10.9369 12.0525 10.8279 12.0999 10.7143 12.0999C10.6006 12.0999 10.4916 12.0525 10.4113 11.9682C10.3309 11.8838 10.2857 11.7693 10.2857 11.65V5.35C10.2857 5.23066 10.3309 5.11622 10.4113 5.03185C10.4916 4.94747 10.6006 4.90007 10.7143 4.90007C10.8279 4.90007 10.9369 4.94747 11.0173 5.03185C11.0977 5.11622 11.1428 5.23066 11.1429 5.35V11.65ZM7.28571 4C6.94472 4 6.6177 4.14223 6.37658 4.39541C6.13546 4.64858 6 4.99196 6 5.35V11.65C6 12.008 6.13546 12.3514 6.37658 12.6046C6.6177 12.8578 6.94472 13 7.28571 13C7.62671 13 7.95373 12.8578 8.19485 12.6046C8.43597 12.3514 8.57143 12.008 8.57143 11.65V5.35C8.57143 4.99196 8.43597 4.64858 8.19485 4.39541C7.95373 4.14223 7.62671 4 7.28571 4ZM7.71429 11.65C7.71427 11.7693 7.66911 11.8838 7.58874 11.9682C7.50837 12.0525 7.39937 12.0999 7.28571 12.0999C7.17206 12.0999 7.06306 12.0525 6.98269 11.9682C6.90232 11.8838 6.85716 11.7693 6.85714 11.65V5.35C6.85716 5.23066 6.90232 5.11622 6.98269 5.03185C7.06306 4.94747 7.17206 4.90007 7.28571 4.90007C7.39937 4.90007 7.50837 4.94747 7.58874 5.03185C7.66911 5.11622 7.71427 5.23066 7.71429 5.35V11.65Z", fill: "white" })));
13
+ };
14
+ this.language = 'en';
15
+ this.isPaused = false;
16
+ this.i18n = undefined;
17
+ }
18
+ componentWillLoad() {
19
+ this.setTranslations();
20
+ }
21
+ setTranslations() {
22
+ if (this.language === 'nb') {
23
+ this.language = 'no';
24
+ }
25
+ if (this.language && translations[this.language]) {
26
+ this.i18n = translations[this.language];
27
+ }
28
+ }
29
+ onLanguageChange() {
30
+ this.setTranslations();
31
+ }
32
+ render() {
33
+ return (h(Host, null, h("button", { "aria-label": `${this.i18n.ariaLabel}`, onClick: this.handlePlayPauseClicked }, this.isPaused ? this.renderPlayIcon() : this.renderPauseIcon())));
34
+ }
35
+ static get is() { return "pn-video-overlay"; }
36
+ static get originalStyleUrls() {
37
+ return {
38
+ "$": ["pn-video-overlay.scss"]
39
+ };
40
+ }
41
+ static get styleUrls() {
42
+ return {
43
+ "$": ["pn-video-overlay.css"]
44
+ };
45
+ }
46
+ static get properties() {
47
+ return {
48
+ "language": {
49
+ "type": "string",
50
+ "mutable": false,
51
+ "complexType": {
52
+ "original": "string",
53
+ "resolved": "string",
54
+ "references": {}
55
+ },
56
+ "required": false,
57
+ "optional": false,
58
+ "docs": {
59
+ "tags": [],
60
+ "text": ""
61
+ },
62
+ "attribute": "language",
63
+ "reflect": false,
64
+ "defaultValue": "'en'"
65
+ },
66
+ "isPaused": {
67
+ "type": "boolean",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "boolean",
71
+ "resolved": "boolean",
72
+ "references": {}
73
+ },
74
+ "required": false,
75
+ "optional": false,
76
+ "docs": {
77
+ "tags": [],
78
+ "text": ""
79
+ },
80
+ "attribute": "is-paused",
81
+ "reflect": false,
82
+ "defaultValue": "false"
83
+ }
84
+ };
85
+ }
86
+ static get states() {
87
+ return {
88
+ "i18n": {}
89
+ };
90
+ }
91
+ static get events() {
92
+ return [{
93
+ "method": "playPauseClicked",
94
+ "name": "playPauseClicked",
95
+ "bubbles": true,
96
+ "cancelable": true,
97
+ "composed": true,
98
+ "docs": {
99
+ "tags": [],
100
+ "text": ""
101
+ },
102
+ "complexType": {
103
+ "original": "void",
104
+ "resolved": "void",
105
+ "references": {}
106
+ }
107
+ }];
108
+ }
109
+ static get elementRef() { return "hostElement"; }
110
+ static get watchers() {
111
+ return [{
112
+ "propName": "language",
113
+ "methodName": "onLanguageChange"
114
+ }];
115
+ }
116
+ }
@@ -0,0 +1,29 @@
1
+ export const translations = {
2
+ sv: {
3
+ ariaLabel: 'Spela eller pausa video',
4
+ },
5
+ en: {
6
+ ariaLabel: 'Play or pause video',
7
+ },
8
+ da: {
9
+ ariaLabel: 'Afspil eller sæt video på pause',
10
+ },
11
+ no: {
12
+ ariaLabel: 'Spill av eller sett video på pause',
13
+ },
14
+ fi: {
15
+ ariaLabel: 'Toista tai keskeytä video',
16
+ },
17
+ de: {
18
+ ariaLabel: 'Video abspielen oder anhalten',
19
+ },
20
+ zh: {
21
+ sharelabel: 'Play or pause video',
22
+ },
23
+ it: {
24
+ sharelabel: 'Play or pause video',
25
+ },
26
+ nl: {
27
+ sharelabel: 'Play or pause video',
28
+ },
29
+ };
@@ -1,20 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import { h, Host } from '@stencil/core';
3
- const defaultIntersectionCallback = (entries, observer, shouldLoop = false) => {
4
- entries.forEach(entry => {
5
- if (!shouldLoop) {
6
- if (entry.isIntersecting) {
7
- entry.target.classList.add('in-view');
8
- //stop observering after added
9
- observer.unobserve(entry.target);
10
- }
11
- }
12
- else {
13
- //toggle and keep observing and toggling, for continous behavior on element
14
- entry.target.classList.toggle('in-view', entry.isIntersecting);
15
- }
16
- });
17
- };
18
3
  const defaultObserverOptions = {
19
4
  root: null,
20
5
  threshold: 0,
@@ -23,21 +8,45 @@ const defaultObserverOptions = {
23
8
  const SCROLL_ID = `pn-scroll-wrapper-id-`;
24
9
  export class PnScroll {
25
10
  constructor() {
26
- this.intersectionCustomCallback = defaultIntersectionCallback;
27
11
  this.observerOptions = defaultObserverOptions;
28
12
  this.behaviourClasses = 'fade slide-up';
29
13
  this.transitionDurationSeconds = 0.5;
14
+ this.shouldLoop = false;
15
+ this.intersectFunc = undefined;
16
+ this.notIntersectFunc = undefined;
30
17
  this.compId = null;
31
18
  }
32
19
  generateUniqueId() {
33
20
  return uuidv4();
34
21
  }
22
+ handleIntersection(entries, observer, onIntersecting, onNotIntersecting, shouldLoop) {
23
+ entries.forEach(entry => {
24
+ if (!shouldLoop) {
25
+ if (!entry.isIntersecting) {
26
+ onNotIntersecting === null || onNotIntersecting === void 0 ? void 0 : onNotIntersecting(entry, observer);
27
+ return;
28
+ }
29
+ entry.target.classList.add('in-view');
30
+ onIntersecting === null || onIntersecting === void 0 ? void 0 : onIntersecting(entry, observer);
31
+ observer.unobserve(entry.target);
32
+ }
33
+ else {
34
+ entry.target.classList.toggle('in-view', entry.isIntersecting);
35
+ if (entry.isIntersecting) {
36
+ onIntersecting === null || onIntersecting === void 0 ? void 0 : onIntersecting(entry, observer);
37
+ }
38
+ else {
39
+ onNotIntersecting === null || onNotIntersecting === void 0 ? void 0 : onNotIntersecting(entry, observer);
40
+ }
41
+ }
42
+ });
43
+ }
35
44
  //on load, generate unique id for this wrapper
36
45
  componentWillLoad() {
37
46
  this.compId = this.generateUniqueId();
38
47
  }
39
48
  componentDidLoad() {
40
- const observer = new IntersectionObserver(this.intersectionCustomCallback, this.observerOptions);
49
+ const observer = new IntersectionObserver((entries, observer) => this.handleIntersection(entries, observer, this.intersectFunc, this.notIntersectFunc, this.shouldLoop), this.observerOptions);
41
50
  const objectToObserve = document.getElementById(`${SCROLL_ID}${this.compId}`);
42
51
  observer.observe(objectToObserve);
43
52
  }
@@ -57,26 +66,6 @@ export class PnScroll {
57
66
  }
58
67
  static get properties() {
59
68
  return {
60
- "intersectionCustomCallback": {
61
- "type": "unknown",
62
- "mutable": false,
63
- "complexType": {
64
- "original": "IntersectionObserverCallback",
65
- "resolved": "IntersectionObserverCallback",
66
- "references": {
67
- "IntersectionObserverCallback": {
68
- "location": "global"
69
- }
70
- }
71
- },
72
- "required": false,
73
- "optional": false,
74
- "docs": {
75
- "tags": [],
76
- "text": ""
77
- },
78
- "defaultValue": "defaultIntersectionCallback"
79
- },
80
69
  "observerOptions": {
81
70
  "type": "unknown",
82
71
  "mutable": false,
@@ -132,6 +121,62 @@ export class PnScroll {
132
121
  "attribute": "transition-duration-seconds",
133
122
  "reflect": false,
134
123
  "defaultValue": "0.5"
124
+ },
125
+ "shouldLoop": {
126
+ "type": "boolean",
127
+ "mutable": false,
128
+ "complexType": {
129
+ "original": "boolean",
130
+ "resolved": "boolean",
131
+ "references": {}
132
+ },
133
+ "required": false,
134
+ "optional": true,
135
+ "docs": {
136
+ "tags": [],
137
+ "text": ""
138
+ },
139
+ "attribute": "should-loop",
140
+ "reflect": false,
141
+ "defaultValue": "false"
142
+ },
143
+ "intersectFunc": {
144
+ "type": "unknown",
145
+ "mutable": false,
146
+ "complexType": {
147
+ "original": "Function",
148
+ "resolved": "Function",
149
+ "references": {
150
+ "Function": {
151
+ "location": "global"
152
+ }
153
+ }
154
+ },
155
+ "required": false,
156
+ "optional": true,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": ""
160
+ }
161
+ },
162
+ "notIntersectFunc": {
163
+ "type": "unknown",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "Function",
167
+ "resolved": "Function",
168
+ "references": {
169
+ "Function": {
170
+ "location": "global"
171
+ }
172
+ }
173
+ },
174
+ "required": false,
175
+ "optional": true,
176
+ "docs": {
177
+ "tags": [],
178
+ "text": ""
179
+ }
135
180
  }
136
181
  };
137
182
  }
@@ -35,6 +35,7 @@ export { PnMarketwebSiteheaderUnifiedLogin as PnMarketwebSiteheaderUnifiedLogin
35
35
  export { PnMultiFormField as PnMultiFormfield } from '../types/components/layout-components/pn-multi-formfield/pn-multi-formfield';
36
36
  export { PnSpotlight as PnParcelTracker } from '../types/components/cta/pn-parcel-tracker/pn-parcel-tracker';
37
37
  export { PnPexPricefinder as PnPexPricefinder } from '../types/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder';
38
+ export { PnPlayOnScroll as PnPlayOnScroll } from '../types/components/animation/pn-play-on-scroll/pn-play-on-scroll';
38
39
  export { PnProductCard as PnProductCard } from '../types/components/widgets/pn-product-card/pn-product-card';
39
40
  export { PnProductCardInfo as PnProductCardInfo } from '../types/components/widgets/pn-product-card/pn-product-card-info';
40
41
  export { PnProductCardPrice as PnProductCardPrice } from '../types/components/widgets/pn-product-card/pn-product-card-price';
@@ -74,6 +75,7 @@ export { PnStatsInfo as PnStatsInfo } from '../types/components/data-visualizati
74
75
  export { PnStatsInfoData as PnStatsInfoData } from '../types/components/data-visualization/pn-stats-info/pn-stats-info-data/pn-stats-info-data';
75
76
  export { PnTeaserCard as PnTeaserCard } from '../types/components/cards/pn-teaser-card/pn-teaser-card';
76
77
  export { PnTiletag as PnTitletag } from '../types/components/minor/pn-titletag/pn-titletag';
78
+ export { PnVideoOverlay as PnVideoOverlay } from '../types/components/animation/pn-play-on-scroll/pn-video-overlay/pn-video-overlay';
77
79
 
78
80
  /**
79
81
  * Used to manually set the base path where assets can be found.
@@ -35,6 +35,7 @@ export { PnMarketwebSiteheaderUnifiedLogin, defineCustomElement as defineCustomE
35
35
  export { PnMultiFormfield, defineCustomElement as defineCustomElementPnMultiFormfield } from './pn-multi-formfield.js';
36
36
  export { PnParcelTracker, defineCustomElement as defineCustomElementPnParcelTracker } from './pn-parcel-tracker.js';
37
37
  export { PnPexPricefinder, defineCustomElement as defineCustomElementPnPexPricefinder } from './pn-pex-pricefinder.js';
38
+ export { PnPlayOnScroll, defineCustomElement as defineCustomElementPnPlayOnScroll } from './pn-play-on-scroll.js';
38
39
  export { PnProductCard, defineCustomElement as defineCustomElementPnProductCard } from './pn-product-card.js';
39
40
  export { PnProductCardInfo, defineCustomElement as defineCustomElementPnProductCardInfo } from './pn-product-card-info.js';
40
41
  export { PnProductCardPrice, defineCustomElement as defineCustomElementPnProductCardPrice } from './pn-product-card-price.js';
@@ -74,3 +75,4 @@ export { PnStatsInfo, defineCustomElement as defineCustomElementPnStatsInfo } fr
74
75
  export { PnStatsInfoData, defineCustomElement as defineCustomElementPnStatsInfoData } from './pn-stats-info-data.js';
75
76
  export { PnTeaserCard, defineCustomElement as defineCustomElementPnTeaserCard } from './pn-teaser-card.js';
76
77
  export { PnTitletag, defineCustomElement as defineCustomElementPnTitletag } from './pn-titletag.js';
78
+ export { PnVideoOverlay, defineCustomElement as defineCustomElementPnVideoOverlay } from './pn-video-overlay.js';
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PnPlayOnScroll extends Components.PnPlayOnScroll, HTMLElement {}
4
+ export const PnPlayOnScroll: {
5
+ prototype: PnPlayOnScroll;
6
+ new (): PnPlayOnScroll;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,93 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$3 } from './pn-scroll2.js';
3
+ import { d as defineCustomElement$2 } from './pn-video-overlay2.js';
4
+ import { v as v4 } from './v4.js';
5
+
6
+ const pnPlayOnScrollCss = "pn-play-on-scroll pn-scroll [slot=scroll-affected]{position:relative}pn-play-on-scroll pn-scroll [slot=scroll-affected] video{width:100%}pn-play-on-scroll pn-scroll [slot=scroll-affected] video:hover{cursor:pointer}pn-play-on-scroll pn-scroll [slot=scroll-affected] pn-video-overlay{position:absolute;bottom:0;left:0;padding:24px}";
7
+
8
+ /*
9
+ play content when scoll observer sees content as inview
10
+ */
11
+ const onIntersecting = (video, isManualPaused) => {
12
+ //what to do when intersecting, eg video.play()
13
+ if (!isManualPaused) {
14
+ video && video.play();
15
+ }
16
+ };
17
+ const onNotIntersecting = (video) => {
18
+ //what to do when not intersecting, eg video.pause()
19
+ video && video.pause();
20
+ };
21
+ const observerOptions = {
22
+ root: null,
23
+ threshold: 0,
24
+ rootMargin: '0px 0px 0px 0px',
25
+ };
26
+ const PnPlayOnScroll$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
27
+ constructor() {
28
+ super();
29
+ this.__registerHost();
30
+ this.testAdditionalParamIntoCallback = true;
31
+ this.handlePlayPauseClicked = () => {
32
+ if (this.video.paused || this.video.ended) {
33
+ this.video.play();
34
+ this.isPaused = false;
35
+ }
36
+ else {
37
+ this.video.pause();
38
+ this.isPaused = true;
39
+ }
40
+ };
41
+ this.videoSrc = '';
42
+ this.videoId = '';
43
+ this.isPaused = false;
44
+ }
45
+ generateUniqueId() {
46
+ return v4();
47
+ }
48
+ componentWillLoad() {
49
+ this.videoId = this.generateUniqueId();
50
+ }
51
+ componentDidLoad() {
52
+ this.video = document.getElementById(this.videoId);
53
+ this.video.addEventListener('click', this.handlePlayPauseClicked);
54
+ }
55
+ render() {
56
+ return (h(Host, null, h("pn-scroll", { intersectFunc: () => onIntersecting(this.video, this.isPaused), notIntersectFunc: () => onNotIntersecting(this.video), shouldLoop: true, behaviourClasses: 'some-behaviour-class', observerOptions: observerOptions }, h("div", { slot: "scroll-affected" }, h("video", { muted: true, autoPlay: true, id: `${this.videoId}` }, h("source", { src: this.videoSrc, type: "video/mp4" })), h("pn-video-overlay", { isPaused: this.isPaused, onPlayPauseClicked: this.handlePlayPauseClicked })))));
57
+ }
58
+ get hostElement() { return this; }
59
+ static get style() { return pnPlayOnScrollCss; }
60
+ }, [0, "pn-play-on-scroll", {
61
+ "videoSrc": [1, "video-src"],
62
+ "videoId": [32],
63
+ "isPaused": [32]
64
+ }]);
65
+ function defineCustomElement$1() {
66
+ if (typeof customElements === "undefined") {
67
+ return;
68
+ }
69
+ const components = ["pn-play-on-scroll", "pn-scroll", "pn-video-overlay"];
70
+ components.forEach(tagName => { switch (tagName) {
71
+ case "pn-play-on-scroll":
72
+ if (!customElements.get(tagName)) {
73
+ customElements.define(tagName, PnPlayOnScroll$1);
74
+ }
75
+ break;
76
+ case "pn-scroll":
77
+ if (!customElements.get(tagName)) {
78
+ defineCustomElement$3();
79
+ }
80
+ break;
81
+ case "pn-video-overlay":
82
+ if (!customElements.get(tagName)) {
83
+ defineCustomElement$2();
84
+ }
85
+ break;
86
+ } });
87
+ }
88
+ defineCustomElement$1();
89
+
90
+ const PnPlayOnScroll = PnPlayOnScroll$1;
91
+ const defineCustomElement = defineCustomElement$1;
92
+
93
+ export { PnPlayOnScroll, defineCustomElement };
@@ -1,77 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { v as v4 } from './v4.js';
3
-
4
- const pnScrollCss = "pn-scroll .scroll-wrapper{-webkit-transition:all var(--transition-duration) ease-in-out 250ms;transition:all var(--transition-duration) ease-in-out 250ms}pn-scroll .scroll-wrapper.fade{opacity:0}pn-scroll .scroll-wrapper.fade.in-view{opacity:1}pn-scroll .scroll-wrapper.slide-up{-webkit-transform:translateY(50px);transform:translateY(50px)}pn-scroll .scroll-wrapper.slide-up.in-view{-webkit-transform:translateY(0);transform:translateY(0)}";
5
-
6
- const defaultIntersectionCallback = (entries, observer, shouldLoop = false) => {
7
- entries.forEach(entry => {
8
- if (!shouldLoop) {
9
- if (entry.isIntersecting) {
10
- entry.target.classList.add('in-view');
11
- //stop observering after added
12
- observer.unobserve(entry.target);
13
- }
14
- }
15
- else {
16
- //toggle and keep observing and toggling, for continous behavior on element
17
- entry.target.classList.toggle('in-view', entry.isIntersecting);
18
- }
19
- });
20
- };
21
- const defaultObserverOptions = {
22
- root: null,
23
- threshold: 0,
24
- rootMargin: '0px 0px -150px 0px',
25
- };
26
- const SCROLL_ID = `pn-scroll-wrapper-id-`;
27
- const PnScroll$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
28
- constructor() {
29
- super();
30
- this.__registerHost();
31
- this.intersectionCustomCallback = defaultIntersectionCallback;
32
- this.observerOptions = defaultObserverOptions;
33
- this.behaviourClasses = 'fade slide-up';
34
- this.transitionDurationSeconds = 0.5;
35
- this.compId = null;
36
- }
37
- generateUniqueId() {
38
- return v4();
39
- }
40
- //on load, generate unique id for this wrapper
41
- componentWillLoad() {
42
- this.compId = this.generateUniqueId();
43
- }
44
- componentDidLoad() {
45
- const observer = new IntersectionObserver(this.intersectionCustomCallback, this.observerOptions);
46
- const objectToObserve = document.getElementById(`${SCROLL_ID}${this.compId}`);
47
- observer.observe(objectToObserve);
48
- }
49
- render() {
50
- return (h(Host, null, h("div", { class: `scroll-wrapper ${this.behaviourClasses}`, id: `${SCROLL_ID}${this.compId}`, style: { '--transition-duration': `${this.transitionDurationSeconds}s` } }, h("slot", { name: "scroll-affected" }))));
51
- }
52
- get hostElement() { return this; }
53
- static get style() { return pnScrollCss; }
54
- }, [4, "pn-scroll", {
55
- "intersectionCustomCallback": [16],
56
- "observerOptions": [16],
57
- "behaviourClasses": [1, "behaviour-classes"],
58
- "transitionDurationSeconds": [2, "transition-duration-seconds"],
59
- "compId": [32]
60
- }]);
61
- function defineCustomElement$1() {
62
- if (typeof customElements === "undefined") {
63
- return;
64
- }
65
- const components = ["pn-scroll"];
66
- components.forEach(tagName => { switch (tagName) {
67
- case "pn-scroll":
68
- if (!customElements.get(tagName)) {
69
- customElements.define(tagName, PnScroll$1);
70
- }
71
- break;
72
- } });
73
- }
74
- defineCustomElement$1();
1
+ import { P as PnScroll$1, d as defineCustomElement$1 } from './pn-scroll2.js';
75
2
 
76
3
  const PnScroll = PnScroll$1;
77
4
  const defineCustomElement = defineCustomElement$1;