@vtex/ads-stories 0.2.0 → 0.3.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/CHANGELOG.md +7 -0
- package/README.md +12 -4
- package/dist/cdn/vtex-ads-stories.js +221 -2
- package/dist/cdn/vtex-ads-stories.js.map +1 -1
- package/dist/cjs/index.cjs +391 -25
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +5 -5
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/cjs/react.d.cts +1 -4
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +391 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.d.ts +1 -4
- package/package.json +2 -1
- package/src/components/card/card.ts +124 -0
- package/src/components/card/index.ts +2 -0
- package/src/components/icons/LICENSE +21 -0
- package/src/components/icons/assets/close.svg +1 -0
- package/src/components/icons/assets/collapse.svg +1 -0
- package/src/components/icons/assets/expand.svg +1 -0
- package/src/components/icons/assets/play-fill.svg +1 -0
- package/src/components/icons/index.ts +25 -0
- package/src/components/player/index.ts +2 -0
- package/src/components/player/player.ts +254 -0
- package/src/raw.d.ts +5 -0
- package/src/react.ts +1 -4
- package/src/story/story.ts +62 -28
- package/src/types.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @vtex/ads-stories
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d9298f3: The Story card is now a button with a play icon in the middle (on hover or keyboard focus with a mouse, always on touch screens). Clicking it, or pressing Enter or Space, opens the same Story in a player at the bottom right of the page. Its expand button switches to an expanded view, centered over a dark backdrop (full screen on phones), and back. The player closes from its close button, with Escape, or by clicking the backdrop of the expanded view.
|
|
8
|
+
- e9bb636: `<vtex-ads-story>` now renders a placeholder 9:16 card (500px tall) instead of the "Hello world" greeting. The card corners use the `--vtex-ads-story-radius` CSS variable (default `20px`). The `name` attribute was removed.
|
|
9
|
+
|
|
3
10
|
## 0.2.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
VTEX Ads Stories web component. Framework-agnostic: works on any HTML5 page,
|
|
4
4
|
including VTEX IO, FastStore and non-VTEX storefronts.
|
|
5
5
|
|
|
6
|
-
> Work in progress. Currently renders
|
|
6
|
+
> Work in progress. Currently renders one placeholder 9:16 card that opens in a
|
|
7
|
+
> player at the bottom right; video and Stories from the ad API come next.
|
|
7
8
|
|
|
8
9
|
## npm
|
|
9
10
|
|
|
@@ -20,7 +21,7 @@ defineVtexAdsStories();
|
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
```html
|
|
23
|
-
<vtex-ads-story
|
|
24
|
+
<vtex-ads-story></vtex-ads-story>
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
Importing the package has no side effects: nothing is registered until
|
|
@@ -41,7 +42,7 @@ project (requires `@types/react` 18.2.6 or newer, including 19):
|
|
|
41
42
|
// e.g. in your app's entry file or a .d.ts file
|
|
42
43
|
import type {} from "@vtex/ads-stories/react";
|
|
43
44
|
|
|
44
|
-
export const Ad = () => <vtex-ads-story
|
|
45
|
+
export const Ad = () => <vtex-ads-story />;
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
Or add `"@vtex/ads-stories/react"` to `compilerOptions.types` in `tsconfig.json`.
|
|
@@ -63,7 +64,7 @@ page. Always pin an exact version: a pinned URL never changes.
|
|
|
63
64
|
crossorigin="anonymous"
|
|
64
65
|
></script>
|
|
65
66
|
|
|
66
|
-
<vtex-ads-story
|
|
67
|
+
<vtex-ads-story></vtex-ads-story>
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
- The full file URL works too:
|
|
@@ -92,9 +93,16 @@ page. Always pin an exact version: a pinned URL never changes.
|
|
|
92
93
|
vtex-ads-story {
|
|
93
94
|
--vtex-ads-story-font-family: "Inter", sans-serif;
|
|
94
95
|
--vtex-ads-story-color-text: #1f1f1f;
|
|
96
|
+
--vtex-ads-story-radius: 20px;
|
|
95
97
|
}
|
|
96
98
|
```
|
|
97
99
|
|
|
100
|
+
| Variable | Default | Used for |
|
|
101
|
+
| ------------------------------ | --------- | ------------ |
|
|
102
|
+
| `--vtex-ads-story-font-family` | inherited | All text |
|
|
103
|
+
| `--vtex-ads-story-color-text` | inherited | All text |
|
|
104
|
+
| `--vtex-ads-story-radius` | `20px` | Card corners |
|
|
105
|
+
|
|
98
106
|
## Development
|
|
99
107
|
|
|
100
108
|
Run from the repository root:
|
|
@@ -1,8 +1,227 @@
|
|
|
1
|
-
"use strict";var VtexAdsStories=(()=>{var
|
|
1
|
+
"use strict";var VtexAdsStories=(()=>{var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var T=(r,t)=>{for(var e in t)u(r,e,{get:t[e],enumerable:!0})},N=(r,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of V(t))!P.call(r,o)&&o!==e&&u(r,o,{get:()=>t[o],enumerable:!(a=C(t,o))||a.enumerable});return r};var Z=r=>N(u({},"__esModule",{value:!0}),r);var K={};T(K,{TAG_NAME:()=>c,VtexAdsStoryElement:()=>l,defineVtexAdsStories:()=>h});var v=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
|
|
2
|
+
`;var w=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
|
|
3
|
+
`;var E=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
|
|
4
|
+
`;var A=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
|
|
5
|
+
`;var I={close:v,collapse:w,expand:E,play:A};function i(r){let t=document.createElement("template");t.innerHTML=I[r];let e=t.content.firstElementChild;return e.classList.add("icon"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e}var x=`
|
|
6
|
+
.card {
|
|
7
|
+
position: relative;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
width: calc(500px * 9 / 16);
|
|
10
|
+
height: 500px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
border-radius: var(--vtex-ads-story-radius, 20px);
|
|
13
|
+
background: #000;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card[role="button"] {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.poster {
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset: 0;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
object-fit: cover;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.play {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 50%;
|
|
31
|
+
left: 50%;
|
|
32
|
+
display: grid;
|
|
33
|
+
width: 66px;
|
|
34
|
+
height: 66px;
|
|
35
|
+
place-items: center;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
background:
|
|
38
|
+
linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)),
|
|
39
|
+
rgba(255, 255, 255, 0.15);
|
|
40
|
+
backdrop-filter: blur(2px);
|
|
41
|
+
box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
|
|
42
|
+
transform: translate(-50%, -50%);
|
|
43
|
+
transition:
|
|
44
|
+
opacity 0.3s ease,
|
|
45
|
+
transform 0.3s ease;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* The icon's triangle is 18px tall and already sits slightly right of its
|
|
49
|
+
box, so it looks centered in the circle. */
|
|
50
|
+
.play .icon {
|
|
51
|
+
width: 22px;
|
|
52
|
+
height: 22px;
|
|
53
|
+
color: #fff;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* With a mouse, the play button shows only on hover or keyboard focus.
|
|
57
|
+
Touch screens have no hover, so it stays visible there. */
|
|
58
|
+
@media (hover: hover) and (pointer: fine) {
|
|
59
|
+
.play {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transform: translate(-50%, -50%) scale(0.9);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.card:hover .play,
|
|
65
|
+
.card:focus-visible .play {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
transform: translate(-50%, -50%);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;function B(r){try{let{protocol:t}=new URL(r);return t==="https:"||t==="http:"}catch(t){return!1}}function p(r,t){let e=document.createElement("div");if(e.className="card",r.poster_url&&B(r.poster_url)){let a=document.createElement("img");a.className="poster",a.alt="",a.src=r.poster_url,e.append(a)}if(t){e.setAttribute("role","button"),e.setAttribute("aria-label",t.label),e.tabIndex=0;let a=document.createElement("span");a.className="play",a.setAttribute("aria-hidden","true"),a.append(i("play")),e.append(a),e.addEventListener("click",t.onSelect),e.addEventListener("keydown",o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),t.onSelect())})}return e}var f=`
|
|
71
|
+
.player {
|
|
72
|
+
position: fixed;
|
|
73
|
+
inset: auto 16px 16px auto;
|
|
74
|
+
z-index: 2147483000;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
width: calc(min(587px, 100vh - 80px) * 9 / 16);
|
|
77
|
+
height: min(587px, 100vh - 80px);
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
overflow: visible;
|
|
81
|
+
border: 0;
|
|
82
|
+
background: transparent;
|
|
83
|
+
color: inherit;
|
|
84
|
+
font: inherit;
|
|
85
|
+
animation: player-in 0.25s ease;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* A <dialog> shown as a popover has no open attribute, which the browser
|
|
89
|
+
hides by default. */
|
|
90
|
+
.player:popover-open {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Switching modes shows the dialog again; only the first opening fades in. */
|
|
95
|
+
.player[data-switched] {
|
|
96
|
+
animation: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.player::backdrop {
|
|
100
|
+
background: transparent;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.player-frame {
|
|
104
|
+
position: relative;
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.player .card {
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Above the card: on narrow screens the expanded card can cover them. */
|
|
116
|
+
.player-controls {
|
|
117
|
+
position: absolute;
|
|
118
|
+
right: 0;
|
|
119
|
+
bottom: calc(100% + 8px);
|
|
120
|
+
z-index: 1;
|
|
121
|
+
display: flex;
|
|
122
|
+
gap: 8px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.player-button {
|
|
126
|
+
display: grid;
|
|
127
|
+
width: 36px;
|
|
128
|
+
height: 36px;
|
|
129
|
+
place-items: center;
|
|
130
|
+
padding: 0;
|
|
131
|
+
border: 1px solid rgba(133, 133, 133, 0.3);
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
background: rgba(0, 0, 0, 0.32);
|
|
134
|
+
backdrop-filter: blur(5px);
|
|
135
|
+
color: #fff;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
transition: background-color 0.2s;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.player-button:hover {
|
|
141
|
+
background: rgba(0, 0, 0, 0.55);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.player-button .icon {
|
|
145
|
+
width: 18px;
|
|
146
|
+
height: 18px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.player[data-expanded] {
|
|
150
|
+
inset: 0;
|
|
151
|
+
display: grid;
|
|
152
|
+
width: 100%;
|
|
153
|
+
max-width: none;
|
|
154
|
+
height: 100%;
|
|
155
|
+
max-height: none;
|
|
156
|
+
place-items: center;
|
|
157
|
+
background: rgba(0, 0, 0, 0.85);
|
|
158
|
+
animation: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.player[data-expanded] .player-frame {
|
|
162
|
+
width: calc(min(78vh, 720px) * 9 / 16);
|
|
163
|
+
height: min(78vh, 720px);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.player[data-expanded] .player-controls {
|
|
167
|
+
position: fixed;
|
|
168
|
+
top: 24px;
|
|
169
|
+
right: 24px;
|
|
170
|
+
bottom: auto;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.player[data-expanded] .player-button {
|
|
174
|
+
width: 40px;
|
|
175
|
+
height: 40px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@media (max-width: 576px) {
|
|
179
|
+
.player {
|
|
180
|
+
right: 12px;
|
|
181
|
+
width: 220px;
|
|
182
|
+
height: 391px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.player[data-expanded] {
|
|
186
|
+
background: #000;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* The video stays 9:16 and centered; the rest of the screen is black. */
|
|
190
|
+
.player[data-expanded] .player-frame {
|
|
191
|
+
width: min(100vw, 100vh * 9 / 16);
|
|
192
|
+
height: min(100vh, 100vw * 16 / 9);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.player[data-expanded] .card {
|
|
196
|
+
border-radius: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.player[data-expanded] .player-controls {
|
|
200
|
+
top: 12px;
|
|
201
|
+
right: 12px;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes player-in {
|
|
206
|
+
from {
|
|
207
|
+
opacity: 0;
|
|
208
|
+
transform: translateY(8px);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@media (prefers-reduced-motion: reduce) {
|
|
213
|
+
.player {
|
|
214
|
+
animation: none;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
`;function L(r,t,e){let a=document.createElement("button");return a.type="button",a.className=`player-button ${r}`,a.setAttribute("aria-label",t),a.append(i(e)),a}function k(r){return typeof r.showPopover=="function"}function y(r){k(r)?r.showPopover():r.show()}function b(r,t){let e=document.createElement("dialog");e.className="player",e.setAttribute("popover","manual"),e.setAttribute("aria-label",t.label);let a=document.createElement("div");a.className="player-frame";let o=document.createElement("div");o.className="player-controls";let s=L("player-expand",t.expandLabel,"expand"),g=L("player-close",t.closeLabel,"close");o.append(s,g);let n=!1;function M(){!n&&k(e)?e.hidePopover():e.close()}return s.addEventListener("click",()=>{M(),n=!n,e.toggleAttribute("data-expanded",n),e.dataset.switched="",s.setAttribute("aria-label",n?t.collapseLabel:t.expandLabel),s.replaceChildren(i(n?"collapse":"expand")),n?e.showModal():y(e),s.focus()}),g.addEventListener("click",t.onClose),e.addEventListener("click",m=>{n&&m.target===e&&t.onClose()}),e.addEventListener("cancel",m=>{m.preventDefault(),t.onClose()}),a.append(o,p(r)),e.append(a),e}var c="vtex-ads-story",H,z=(H=globalThis.HTMLElement)!=null?H:Object,G=`
|
|
2
218
|
:host {
|
|
3
219
|
display: block;
|
|
4
220
|
font-family: var(--vtex-ads-story-font-family, inherit);
|
|
5
221
|
color: var(--vtex-ads-story-color-text, inherit);
|
|
6
222
|
}
|
|
7
|
-
|
|
223
|
+
${x}
|
|
224
|
+
${f}
|
|
225
|
+
`,S={ad_id:"placeholder",poster_url:"https://dummyimage.com/1080x1920/e31c57/fff"},d={watch:"Assistir v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo"},l=class extends z{constructor(){super(...arguments);this.player=null;this.onKeyDown=e=>{e.key==="Escape"&&this.closePlayer()}}render(){var a;let e=(a=this.shadowRoot)==null?void 0:a.querySelector(".root");e&&e.replaceChildren(p(S,{label:d.watch,onSelect:()=>this.openPlayer()}))}openPlayer(){var e;this.player||!this.shadowRoot||(this.player=b(S,{label:d.player,expandLabel:d.expand,collapseLabel:d.collapse,closeLabel:d.close,onClose:()=>this.closePlayer()}),this.shadowRoot.append(this.player),y(this.player),document.addEventListener("keydown",this.onKeyDown),(e=this.player.querySelector(".player-close"))==null||e.focus())}closePlayer({restoreFocus:e=!0}={}){var a,o;this.player&&(document.removeEventListener("keydown",this.onKeyDown),this.player.remove(),this.player=null,e&&((o=(a=this.shadowRoot)==null?void 0:a.querySelector(".root .card"))==null||o.focus()))}connectedCallback(){if(!this.shadowRoot){let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>${G}</style><div class="root"></div>`}this.render()}disconnectedCallback(){this.closePlayer({restoreFocus:!1})}};function h(){typeof customElements!="undefined"&&(customElements.get(c)||customElements.define(c,l))}h();return Z(K);})();
|
|
226
|
+
/*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */
|
|
8
227
|
//# sourceMappingURL=vtex-ads-stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cdn.ts","../../src/story/story.ts"],"sourcesContent":["import { defineVtexAdsStories } from \"./story\";\n\ndefineVtexAdsStories();\n\nexport { VtexAdsStoryElement, defineVtexAdsStories, TAG_NAME } from \"./story\";\n","export const TAG_NAME = \"vtex-ads-story\";\n\n// Keeps the module importable where HTMLElement doesn't exist (SSR, Node).\nconst BaseElement: typeof HTMLElement = globalThis.HTMLElement ?? Object;\n\nconst styles = `\n :host {\n display: block;\n font-family: var(--vtex-ads-story-font-family, inherit);\n color: var(--vtex-ads-story-color-text, inherit);\n }\n`;\n\nconst DEFAULT_NAME = \"world\";\n\nexport class VtexAdsStoryElement extends BaseElement {\n static get observedAttributes() {\n return [\"name\"];\n }\n\n get name(): string {\n return this.getAttribute(\"name\")?.trim() ?? \"\";\n }\n\n set name(value: string) {\n this.setAttribute(\"name\", value);\n }\n\n private render() {\n const container = this.shadowRoot?.querySelector(\"[part='root']\");\n if (!container) return;\n\n // textContent keeps the name as plain text (no HTML injection).\n container.textContent = `Hello ${this.name || DEFAULT_NAME}!`;\n }\n\n connectedCallback() {\n if (!this.shadowRoot) {\n const root = this.attachShadow({ mode: \"open\" });\n root.innerHTML = `<style>${styles}</style><div part=\"root\"></div>`;\n }\n\n this.upgradeProperty(\"name\");\n this.render();\n }\n\n // A property set before the element is defined (e.g. while the CDN script\n // loads) becomes an own property that shadows the class getter/setter.\n // Remove it and set it again so it goes through the setter.\n private upgradeProperty(prop: \"name\") {\n if (!Object.prototype.hasOwnProperty.call(this, prop)) return;\n\n const value = this[prop];\n Reflect.deleteProperty(this, prop);\n this[prop] = value;\n }\n\n attributeChangedCallback() {\n this.render();\n }\n}\n\n// Types `document.createElement(\"vtex-ads-story\")` and `querySelector` results\n// as VtexAdsStoryElement in any TypeScript project, no framework needed.\ndeclare global {\n interface HTMLElementTagNameMap {\n \"vtex-ads-story\": VtexAdsStoryElement;\n }\n}\n\nexport function defineVtexAdsStories() {\n if (typeof customElements === \"undefined\") return;\n if (customElements.get(TAG_NAME)) return;\n\n customElements.define(TAG_NAME, VtexAdsStoryElement);\n}\n"],"mappings":"kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,wBAAAC,EAAA,yBAAAC,ICAO,IAAMC,EAAW,iBAAxBC,EAGMC,GAAkCD,EAAA,WAAW,cAAX,KAAAA,EAA0B,OAE5DE,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQTC,EAAe,QAERC,EAAN,cAAkCH,CAAY,CACnD,WAAW,oBAAqB,CAC9B,MAAO,CAAC,MAAM,CAChB,CAEA,IAAI,MAAe,CApBrB,IAAAD,EAAAK,EAqBI,OAAOA,GAAAL,EAAA,KAAK,aAAa,MAAM,IAAxB,YAAAA,EAA2B,SAA3B,KAAAK,EAAqC,EAC9C,CAEA,IAAI,KAAKC,EAAe,CACtB,KAAK,aAAa,OAAQA,CAAK,CACjC,CAEQ,QAAS,CA5BnB,IAAAN,EA6BI,IAAMO,GAAYP,EAAA,KAAK,aAAL,YAAAA,EAAiB,cAAc,iBAC5CO,IAGLA,EAAU,YAAc,SAAS,KAAK,MAAQJ,CAAY,IAC5D,CAEA,mBAAoB,CAClB,GAAI,CAAC,KAAK,WAAY,CACpB,IAAMK,EAAO,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EAC/CA,EAAK,UAAY,UAAUN,CAAM,iCACnC,CAEA,KAAK,gBAAgB,MAAM,EAC3B,KAAK,OAAO,CACd,CAKQ,gBAAgBO,EAAc,CACpC,GAAI,CAAC,OAAO,UAAU,eAAe,KAAK,KAAMA,CAAI,EAAG,OAEvD,IAAMH,EAAQ,KAAKG,CAAI,EACvB,QAAQ,eAAe,KAAMA,CAAI,EACjC,KAAKA,CAAI,EAAIH,CACf,CAEA,0BAA2B,CACzB,KAAK,OAAO,CACd,CACF,EAUO,SAASI,GAAuB,CACjC,OAAO,gBAAmB,cAC1B,eAAe,IAAIX,CAAQ,GAE/B,eAAe,OAAOA,EAAUK,CAAmB,EACrD,CDzEAO,EAAqB","names":["cdn_exports","__export","TAG_NAME","VtexAdsStoryElement","defineVtexAdsStories","TAG_NAME","_a","BaseElement","styles","DEFAULT_NAME","VtexAdsStoryElement","_b","value","container","root","prop","defineVtexAdsStories","defineVtexAdsStories"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cdn.ts","raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/close.svg","raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/collapse.svg","raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/expand.svg","raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/play-fill.svg","../../src/components/icons/index.ts","../../src/components/card/card.ts","../../src/components/player/player.ts","../../src/story/story.ts"],"sourcesContent":["import { defineVtexAdsStories } from \"./story\";\n\ndefineVtexAdsStories();\n\nexport { VtexAdsStoryElement, defineVtexAdsStories, TAG_NAME } from \"./story\";\n","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z\"/></svg>\n","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z\"/></svg>\n","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z\"/></svg>\n","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z\"/></svg>\n","/*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */\n\n// SVG files as downloaded from Phosphor: regular weight, or the weight in the\n// file name. They are bundled as text: `?raw` is handled by Vite in dev and\n// tests, and by the raw plugin in tsup.config.ts.\nimport close from \"./assets/close.svg?raw\";\nimport collapse from \"./assets/collapse.svg?raw\";\nimport expand from \"./assets/expand.svg?raw\";\nimport play from \"./assets/play-fill.svg?raw\";\n\nexport const icons = { close, collapse, expand, play };\n\nexport type IconName = keyof typeof icons;\n\n/** Renders a bundled icon. It is decorative: name the control around it. */\nexport function createIcon(name: IconName) {\n const template = document.createElement(\"template\");\n template.innerHTML = icons[name];\n\n const svg = template.content.firstElementChild as SVGSVGElement;\n svg.classList.add(\"icon\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.setAttribute(\"focusable\", \"false\");\n return svg;\n}\n","import { createIcon } from \"../icons\";\nimport type { StoryAd } from \"../../types\";\n\nexport const cardStyles = `\n .card {\n position: relative;\n box-sizing: border-box;\n width: calc(500px * 9 / 16);\n height: 500px;\n overflow: hidden;\n border-radius: var(--vtex-ads-story-radius, 20px);\n background: #000;\n }\n\n .card[role=\"button\"] {\n cursor: pointer;\n }\n\n .poster {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .play {\n position: absolute;\n top: 50%;\n left: 50%;\n display: grid;\n width: 66px;\n height: 66px;\n place-items: center;\n border-radius: 50%;\n background:\n linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)),\n rgba(255, 255, 255, 0.15);\n backdrop-filter: blur(2px);\n box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);\n transform: translate(-50%, -50%);\n transition:\n opacity 0.3s ease,\n transform 0.3s ease;\n }\n\n /* The icon's triangle is 18px tall and already sits slightly right of its\n box, so it looks centered in the circle. */\n .play .icon {\n width: 22px;\n height: 22px;\n color: #fff;\n }\n\n /* With a mouse, the play button shows only on hover or keyboard focus.\n Touch screens have no hover, so it stays visible there. */\n @media (hover: hover) and (pointer: fine) {\n .play {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n\n .card:hover .play,\n .card:focus-visible .play {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n }\n`;\n\nexport interface CardOptions {\n /** Accessible name of the card. */\n label: string;\n /** Called on click, Enter or Space. */\n onSelect: () => void;\n}\n\n// Only absolute http(s) URLs reach the DOM.\nfunction isHttpUrl(value: string) {\n try {\n const { protocol } = new URL(value);\n return protocol === \"https:\" || protocol === \"http:\";\n } catch {\n return false;\n }\n}\n\n/**\n * A 9:16 card with the Story cover. With options, the card is a button with\n * a play icon in the middle.\n */\nexport function createCard(story: StoryAd, options?: CardOptions) {\n const card = document.createElement(\"div\");\n card.className = \"card\";\n\n if (story.poster_url && isHttpUrl(story.poster_url)) {\n const poster = document.createElement(\"img\");\n poster.className = \"poster\";\n poster.alt = \"\";\n poster.src = story.poster_url;\n card.append(poster);\n }\n\n if (options) {\n card.setAttribute(\"role\", \"button\");\n card.setAttribute(\"aria-label\", options.label);\n card.tabIndex = 0;\n\n const play = document.createElement(\"span\");\n play.className = \"play\";\n play.setAttribute(\"aria-hidden\", \"true\");\n play.append(createIcon(\"play\"));\n card.append(play);\n\n card.addEventListener(\"click\", options.onSelect);\n card.addEventListener(\"keydown\", (event) => {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n options.onSelect();\n });\n }\n\n return card;\n}\n","import { createCard } from \"../card\";\nimport { createIcon, type IconName } from \"../icons\";\nimport type { StoryAd } from \"../../types\";\n\n// The player is a <dialog> shown in the top layer, so no store z-index,\n// overflow or transform can hide or move it.\n//\n// Mini: a manual popover (non-modal, the page stays usable), with the card at\n// the bottom right and the controls above it. Without popover support it is a\n// non-modal dialog, fixed with a high z-index.\n// Expanded: a modal dialog (showModal), so the browser makes the page behind\n// it inert. The card is centered over a dark backdrop, with the controls at\n// the top right of the screen. On narrow screens it fills the screen.\nexport const playerStyles = `\n .player {\n position: fixed;\n inset: auto 16px 16px auto;\n z-index: 2147483000;\n box-sizing: border-box;\n width: calc(min(587px, 100vh - 80px) * 9 / 16);\n height: min(587px, 100vh - 80px);\n margin: 0;\n padding: 0;\n overflow: visible;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n animation: player-in 0.25s ease;\n }\n\n /* A <dialog> shown as a popover has no open attribute, which the browser\n hides by default. */\n .player:popover-open {\n display: block;\n }\n\n /* Switching modes shows the dialog again; only the first opening fades in. */\n .player[data-switched] {\n animation: none;\n }\n\n .player::backdrop {\n background: transparent;\n }\n\n .player-frame {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .player .card {\n width: 100%;\n height: 100%;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);\n }\n\n /* Above the card: on narrow screens the expanded card can cover them. */\n .player-controls {\n position: absolute;\n right: 0;\n bottom: calc(100% + 8px);\n z-index: 1;\n display: flex;\n gap: 8px;\n }\n\n .player-button {\n display: grid;\n width: 36px;\n height: 36px;\n place-items: center;\n padding: 0;\n border: 1px solid rgba(133, 133, 133, 0.3);\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.32);\n backdrop-filter: blur(5px);\n color: #fff;\n cursor: pointer;\n transition: background-color 0.2s;\n }\n\n .player-button:hover {\n background: rgba(0, 0, 0, 0.55);\n }\n\n .player-button .icon {\n width: 18px;\n height: 18px;\n }\n\n .player[data-expanded] {\n inset: 0;\n display: grid;\n width: 100%;\n max-width: none;\n height: 100%;\n max-height: none;\n place-items: center;\n background: rgba(0, 0, 0, 0.85);\n animation: none;\n }\n\n .player[data-expanded] .player-frame {\n width: calc(min(78vh, 720px) * 9 / 16);\n height: min(78vh, 720px);\n }\n\n .player[data-expanded] .player-controls {\n position: fixed;\n top: 24px;\n right: 24px;\n bottom: auto;\n }\n\n .player[data-expanded] .player-button {\n width: 40px;\n height: 40px;\n }\n\n @media (max-width: 576px) {\n .player {\n right: 12px;\n width: 220px;\n height: 391px;\n }\n\n .player[data-expanded] {\n background: #000;\n }\n\n /* The video stays 9:16 and centered; the rest of the screen is black. */\n .player[data-expanded] .player-frame {\n width: min(100vw, 100vh * 9 / 16);\n height: min(100vh, 100vw * 16 / 9);\n }\n\n .player[data-expanded] .card {\n border-radius: 0;\n }\n\n .player[data-expanded] .player-controls {\n top: 12px;\n right: 12px;\n }\n }\n\n @keyframes player-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .player {\n animation: none;\n }\n }\n`;\n\nexport interface PlayerOptions {\n /** Accessible name of the player. */\n label: string;\n /** Accessible names of the buttons. */\n expandLabel: string;\n collapseLabel: string;\n closeLabel: string;\n onClose: () => void;\n}\n\nfunction createButton(className: string, label: string, icon: IconName) {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = `player-button ${className}`;\n button.setAttribute(\"aria-label\", label);\n button.append(createIcon(icon));\n return button;\n}\n\nfunction supportsPopover(player: HTMLDialogElement) {\n return typeof player.showPopover === \"function\";\n}\n\n/** Shows the player as the mini player. It must already be in the page. */\nexport function showPlayer(player: HTMLDialogElement) {\n if (supportsPopover(player)) player.showPopover();\n else player.show();\n}\n\n/**\n * The Story player. It opens as the mini player (see showPlayer); expand\n * switches to the expanded view, a modal dialog, and back. Clicking the\n * backdrop of the expanded view or pressing Escape in it closes the player.\n */\nexport function createPlayer(story: StoryAd, options: PlayerOptions) {\n const player = document.createElement(\"dialog\");\n player.className = \"player\";\n player.setAttribute(\"popover\", \"manual\");\n player.setAttribute(\"aria-label\", options.label);\n\n const frame = document.createElement(\"div\");\n frame.className = \"player-frame\";\n\n const controls = document.createElement(\"div\");\n controls.className = \"player-controls\";\n\n const expand = createButton(\"player-expand\", options.expandLabel, \"expand\");\n const close = createButton(\"player-close\", options.closeLabel, \"close\");\n controls.append(expand, close);\n\n let expanded = false;\n\n // A dialog can't be shown as a popover and as a modal at the same time, so\n // switching modes hides it first, the same way it was shown.\n function hide() {\n if (!expanded && supportsPopover(player)) player.hidePopover();\n else player.close();\n }\n\n expand.addEventListener(\"click\", () => {\n hide();\n expanded = !expanded;\n player.toggleAttribute(\"data-expanded\", expanded);\n player.dataset.switched = \"\";\n expand.setAttribute(\n \"aria-label\",\n expanded ? options.collapseLabel : options.expandLabel,\n );\n expand.replaceChildren(createIcon(expanded ? \"collapse\" : \"expand\"));\n\n if (expanded) player.showModal();\n else showPlayer(player);\n expand.focus();\n });\n\n close.addEventListener(\"click\", options.onClose);\n\n // Clicks on the backdrop of the expanded view reach the dialog itself.\n player.addEventListener(\"click\", (event) => {\n if (expanded && event.target === player) options.onClose();\n });\n\n // Escape on a modal dialog would only hide it: close the player instead.\n player.addEventListener(\"cancel\", (event) => {\n event.preventDefault();\n options.onClose();\n });\n\n frame.append(controls, createCard(story));\n player.append(frame);\n return player;\n}\n","import { cardStyles, createCard } from \"../components/card\";\nimport { createPlayer, playerStyles, showPlayer } from \"../components/player\";\nimport type { StoryAd } from \"../types\";\n\nexport const TAG_NAME = \"vtex-ads-story\";\n\n// Keeps the module importable where HTMLElement doesn't exist (SSR, Node).\nconst BaseElement: typeof HTMLElement = globalThis.HTMLElement ?? Object;\n\nconst styles = `\n :host {\n display: block;\n font-family: var(--vtex-ads-story-font-family, inherit);\n color: var(--vtex-ads-story-color-text, inherit);\n }\n ${cardStyles}\n ${playerStyles}\n`;\n\n// Temporary: rendered until the element reads Stories from the ad API.\nconst PLACEHOLDER_STORY: StoryAd = {\n ad_id: \"placeholder\",\n poster_url: \"https://dummyimage.com/1080x1920/e31c57/fff\",\n};\n\n// Temporary: fixed texts until the store can set them by attribute.\nconst LABELS = {\n watch: \"Assistir vídeo\",\n player: \"Vídeo\",\n expand: \"Expandir vídeo\",\n collapse: \"Reduzir vídeo\",\n close: \"Fechar vídeo\",\n};\n\nexport class VtexAdsStoryElement extends BaseElement {\n private player: HTMLDialogElement | null = null;\n\n private readonly onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") this.closePlayer();\n };\n\n private render() {\n const container = this.shadowRoot?.querySelector(\".root\");\n if (!container) return;\n\n container.replaceChildren(\n createCard(PLACEHOLDER_STORY, {\n label: LABELS.watch,\n onSelect: () => this.openPlayer(),\n }),\n );\n }\n\n private openPlayer() {\n if (this.player || !this.shadowRoot) return;\n\n this.player = createPlayer(PLACEHOLDER_STORY, {\n label: LABELS.player,\n expandLabel: LABELS.expand,\n collapseLabel: LABELS.collapse,\n closeLabel: LABELS.close,\n onClose: () => this.closePlayer(),\n });\n this.shadowRoot.append(this.player);\n showPlayer(this.player);\n document.addEventListener(\"keydown\", this.onKeyDown);\n\n this.player.querySelector<HTMLElement>(\".player-close\")?.focus();\n }\n\n private closePlayer({ restoreFocus = true } = {}) {\n if (!this.player) return;\n\n document.removeEventListener(\"keydown\", this.onKeyDown);\n this.player.remove();\n this.player = null;\n\n if (restoreFocus) {\n this.shadowRoot?.querySelector<HTMLElement>(\".root .card\")?.focus();\n }\n }\n\n connectedCallback() {\n if (!this.shadowRoot) {\n const root = this.attachShadow({ mode: \"open\" });\n root.innerHTML = `<style>${styles}</style><div class=\"root\"></div>`;\n }\n\n this.render();\n }\n\n disconnectedCallback() {\n this.closePlayer({ restoreFocus: false });\n }\n}\n\n// Types `document.createElement(\"vtex-ads-story\")` and `querySelector` results\n// as VtexAdsStoryElement in any TypeScript project, no framework needed.\ndeclare global {\n interface HTMLElementTagNameMap {\n \"vtex-ads-story\": VtexAdsStoryElement;\n }\n}\n\nexport function defineVtexAdsStories() {\n if (typeof customElements === \"undefined\") return;\n if (customElements.get(TAG_NAME)) return;\n\n customElements.define(TAG_NAME, VtexAdsStoryElement);\n}\n"],"mappings":"kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,wBAAAC,EAAA,yBAAAC,ICAA,IAAAC,EAAA;ECAA,IAAAC,EAAA;ECAA,IAAAC,EAAA;ECAA,IAAAC,EAAA;ECUO,IAAMC,EAAQ,CAAE,MAAAC,EAAO,SAAAC,EAAU,OAAAC,EAAQ,KAAAC,CAAK,EAK9C,SAASC,EAAWC,EAAgB,CACzC,IAAMC,EAAW,SAAS,cAAc,UAAU,EAClDA,EAAS,UAAYP,EAAMM,CAAI,EAE/B,IAAME,EAAMD,EAAS,QAAQ,kBAC7B,OAAAC,EAAI,UAAU,IAAI,MAAM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C,EAAG,CAtEpD,IAAAb,EAAAc,EAuES,KAAK,SAEV,SAAS,oBAAoB,UAAW,KAAK,SAAS,EACtD,KAAK,OAAO,OAAO,EACnB,KAAK,OAAS,KAEVD,KACFC,GAAAd,EAAA,KAAK,aAAL,YAAAA,EAAiB,cAA2B,iBAA5C,MAAAc,EAA4D,SAEhE,CAEA,mBAAoB,CAClB,GAAI,CAAC,KAAK,WAAY,CACpB,IAAMC,EAAO,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EAC/CA,EAAK,UAAY,UAAUb,CAAM,kCACnC,CAEA,KAAK,OAAO,CACd,CAEA,sBAAuB,CACrB,KAAK,YAAY,CAAE,aAAc,EAAM,CAAC,CAC1C,CACF,EAUO,SAASc,GAAuB,CACjC,OAAO,gBAAmB,cAC1B,eAAe,IAAIjB,CAAQ,GAE/B,eAAe,OAAOA,EAAUQ,CAAmB,EACrD,CR3GAU,EAAqB","names":["cdn_exports","__export","TAG_NAME","VtexAdsStoryElement","defineVtexAdsStories","close_default","collapse_default","expand_default","play_fill_default","icons","close_default","collapse_default","expand_default","play_fill_default","createIcon","name","template","svg","cardStyles","isHttpUrl","value","protocol","e","createCard","story","options","card","poster","play","createIcon","event","playerStyles","createButton","className","label","icon","button","createIcon","supportsPopover","player","showPlayer","createPlayer","story","options","frame","controls","expand","close","expanded","hide","event","createCard","TAG_NAME","_a","BaseElement","styles","cardStyles","playerStyles","PLACEHOLDER_STORY","LABELS","VtexAdsStoryElement","event","container","createCard","createPlayer","showPlayer","restoreFocus","_b","root","defineVtexAdsStories","defineVtexAdsStories"]}
|