@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.
@@ -26,6 +26,342 @@ __export(index_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
28
 
29
+ // raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/close.svg
30
+ var close_default = '<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';
31
+
32
+ // raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/collapse.svg
33
+ var collapse_default = '<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';
34
+
35
+ // raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/expand.svg
36
+ var expand_default = '<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';
37
+
38
+ // raw:/workspace/source/ads-js/packages/ads-stories/src/components/icons/assets/play-fill.svg
39
+ var play_fill_default = '<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';
40
+
41
+ // src/components/icons/index.ts
42
+ var icons = { close: close_default, collapse: collapse_default, expand: expand_default, play: play_fill_default };
43
+ function createIcon(name) {
44
+ const template = document.createElement("template");
45
+ template.innerHTML = icons[name];
46
+ const svg = template.content.firstElementChild;
47
+ svg.classList.add("icon");
48
+ svg.setAttribute("aria-hidden", "true");
49
+ svg.setAttribute("focusable", "false");
50
+ return svg;
51
+ }
52
+
53
+ // src/components/card/card.ts
54
+ var cardStyles = `
55
+ .card {
56
+ position: relative;
57
+ box-sizing: border-box;
58
+ width: calc(500px * 9 / 16);
59
+ height: 500px;
60
+ overflow: hidden;
61
+ border-radius: var(--vtex-ads-story-radius, 20px);
62
+ background: #000;
63
+ }
64
+
65
+ .card[role="button"] {
66
+ cursor: pointer;
67
+ }
68
+
69
+ .poster {
70
+ position: absolute;
71
+ inset: 0;
72
+ width: 100%;
73
+ height: 100%;
74
+ object-fit: cover;
75
+ }
76
+
77
+ .play {
78
+ position: absolute;
79
+ top: 50%;
80
+ left: 50%;
81
+ display: grid;
82
+ width: 66px;
83
+ height: 66px;
84
+ place-items: center;
85
+ border-radius: 50%;
86
+ background:
87
+ linear-gradient(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.06)),
88
+ rgba(255, 255, 255, 0.15);
89
+ backdrop-filter: blur(2px);
90
+ box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
91
+ transform: translate(-50%, -50%);
92
+ transition:
93
+ opacity 0.3s ease,
94
+ transform 0.3s ease;
95
+ }
96
+
97
+ /* The icon's triangle is 18px tall and already sits slightly right of its
98
+ box, so it looks centered in the circle. */
99
+ .play .icon {
100
+ width: 22px;
101
+ height: 22px;
102
+ color: #fff;
103
+ }
104
+
105
+ /* With a mouse, the play button shows only on hover or keyboard focus.
106
+ Touch screens have no hover, so it stays visible there. */
107
+ @media (hover: hover) and (pointer: fine) {
108
+ .play {
109
+ opacity: 0;
110
+ transform: translate(-50%, -50%) scale(0.9);
111
+ }
112
+
113
+ .card:hover .play,
114
+ .card:focus-visible .play {
115
+ opacity: 1;
116
+ transform: translate(-50%, -50%);
117
+ }
118
+ }
119
+ `;
120
+ function isHttpUrl(value) {
121
+ try {
122
+ const { protocol } = new URL(value);
123
+ return protocol === "https:" || protocol === "http:";
124
+ } catch (e) {
125
+ return false;
126
+ }
127
+ }
128
+ function createCard(story, options) {
129
+ const card = document.createElement("div");
130
+ card.className = "card";
131
+ if (story.poster_url && isHttpUrl(story.poster_url)) {
132
+ const poster = document.createElement("img");
133
+ poster.className = "poster";
134
+ poster.alt = "";
135
+ poster.src = story.poster_url;
136
+ card.append(poster);
137
+ }
138
+ if (options) {
139
+ card.setAttribute("role", "button");
140
+ card.setAttribute("aria-label", options.label);
141
+ card.tabIndex = 0;
142
+ const play = document.createElement("span");
143
+ play.className = "play";
144
+ play.setAttribute("aria-hidden", "true");
145
+ play.append(createIcon("play"));
146
+ card.append(play);
147
+ card.addEventListener("click", options.onSelect);
148
+ card.addEventListener("keydown", (event) => {
149
+ if (event.key !== "Enter" && event.key !== " ") return;
150
+ event.preventDefault();
151
+ options.onSelect();
152
+ });
153
+ }
154
+ return card;
155
+ }
156
+
157
+ // src/components/player/player.ts
158
+ var playerStyles = `
159
+ .player {
160
+ position: fixed;
161
+ inset: auto 16px 16px auto;
162
+ z-index: 2147483000;
163
+ box-sizing: border-box;
164
+ width: calc(min(587px, 100vh - 80px) * 9 / 16);
165
+ height: min(587px, 100vh - 80px);
166
+ margin: 0;
167
+ padding: 0;
168
+ overflow: visible;
169
+ border: 0;
170
+ background: transparent;
171
+ color: inherit;
172
+ font: inherit;
173
+ animation: player-in 0.25s ease;
174
+ }
175
+
176
+ /* A <dialog> shown as a popover has no open attribute, which the browser
177
+ hides by default. */
178
+ .player:popover-open {
179
+ display: block;
180
+ }
181
+
182
+ /* Switching modes shows the dialog again; only the first opening fades in. */
183
+ .player[data-switched] {
184
+ animation: none;
185
+ }
186
+
187
+ .player::backdrop {
188
+ background: transparent;
189
+ }
190
+
191
+ .player-frame {
192
+ position: relative;
193
+ width: 100%;
194
+ height: 100%;
195
+ }
196
+
197
+ .player .card {
198
+ width: 100%;
199
+ height: 100%;
200
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
201
+ }
202
+
203
+ /* Above the card: on narrow screens the expanded card can cover them. */
204
+ .player-controls {
205
+ position: absolute;
206
+ right: 0;
207
+ bottom: calc(100% + 8px);
208
+ z-index: 1;
209
+ display: flex;
210
+ gap: 8px;
211
+ }
212
+
213
+ .player-button {
214
+ display: grid;
215
+ width: 36px;
216
+ height: 36px;
217
+ place-items: center;
218
+ padding: 0;
219
+ border: 1px solid rgba(133, 133, 133, 0.3);
220
+ border-radius: 50%;
221
+ background: rgba(0, 0, 0, 0.32);
222
+ backdrop-filter: blur(5px);
223
+ color: #fff;
224
+ cursor: pointer;
225
+ transition: background-color 0.2s;
226
+ }
227
+
228
+ .player-button:hover {
229
+ background: rgba(0, 0, 0, 0.55);
230
+ }
231
+
232
+ .player-button .icon {
233
+ width: 18px;
234
+ height: 18px;
235
+ }
236
+
237
+ .player[data-expanded] {
238
+ inset: 0;
239
+ display: grid;
240
+ width: 100%;
241
+ max-width: none;
242
+ height: 100%;
243
+ max-height: none;
244
+ place-items: center;
245
+ background: rgba(0, 0, 0, 0.85);
246
+ animation: none;
247
+ }
248
+
249
+ .player[data-expanded] .player-frame {
250
+ width: calc(min(78vh, 720px) * 9 / 16);
251
+ height: min(78vh, 720px);
252
+ }
253
+
254
+ .player[data-expanded] .player-controls {
255
+ position: fixed;
256
+ top: 24px;
257
+ right: 24px;
258
+ bottom: auto;
259
+ }
260
+
261
+ .player[data-expanded] .player-button {
262
+ width: 40px;
263
+ height: 40px;
264
+ }
265
+
266
+ @media (max-width: 576px) {
267
+ .player {
268
+ right: 12px;
269
+ width: 220px;
270
+ height: 391px;
271
+ }
272
+
273
+ .player[data-expanded] {
274
+ background: #000;
275
+ }
276
+
277
+ /* The video stays 9:16 and centered; the rest of the screen is black. */
278
+ .player[data-expanded] .player-frame {
279
+ width: min(100vw, 100vh * 9 / 16);
280
+ height: min(100vh, 100vw * 16 / 9);
281
+ }
282
+
283
+ .player[data-expanded] .card {
284
+ border-radius: 0;
285
+ }
286
+
287
+ .player[data-expanded] .player-controls {
288
+ top: 12px;
289
+ right: 12px;
290
+ }
291
+ }
292
+
293
+ @keyframes player-in {
294
+ from {
295
+ opacity: 0;
296
+ transform: translateY(8px);
297
+ }
298
+ }
299
+
300
+ @media (prefers-reduced-motion: reduce) {
301
+ .player {
302
+ animation: none;
303
+ }
304
+ }
305
+ `;
306
+ function createButton(className, label, icon) {
307
+ const button = document.createElement("button");
308
+ button.type = "button";
309
+ button.className = `player-button ${className}`;
310
+ button.setAttribute("aria-label", label);
311
+ button.append(createIcon(icon));
312
+ return button;
313
+ }
314
+ function supportsPopover(player) {
315
+ return typeof player.showPopover === "function";
316
+ }
317
+ function showPlayer(player) {
318
+ if (supportsPopover(player)) player.showPopover();
319
+ else player.show();
320
+ }
321
+ function createPlayer(story, options) {
322
+ const player = document.createElement("dialog");
323
+ player.className = "player";
324
+ player.setAttribute("popover", "manual");
325
+ player.setAttribute("aria-label", options.label);
326
+ const frame = document.createElement("div");
327
+ frame.className = "player-frame";
328
+ const controls = document.createElement("div");
329
+ controls.className = "player-controls";
330
+ const expand = createButton("player-expand", options.expandLabel, "expand");
331
+ const close = createButton("player-close", options.closeLabel, "close");
332
+ controls.append(expand, close);
333
+ let expanded = false;
334
+ function hide() {
335
+ if (!expanded && supportsPopover(player)) player.hidePopover();
336
+ else player.close();
337
+ }
338
+ expand.addEventListener("click", () => {
339
+ hide();
340
+ expanded = !expanded;
341
+ player.toggleAttribute("data-expanded", expanded);
342
+ player.dataset.switched = "";
343
+ expand.setAttribute(
344
+ "aria-label",
345
+ expanded ? options.collapseLabel : options.expandLabel
346
+ );
347
+ expand.replaceChildren(createIcon(expanded ? "collapse" : "expand"));
348
+ if (expanded) player.showModal();
349
+ else showPlayer(player);
350
+ expand.focus();
351
+ });
352
+ close.addEventListener("click", options.onClose);
353
+ player.addEventListener("click", (event) => {
354
+ if (expanded && event.target === player) options.onClose();
355
+ });
356
+ player.addEventListener("cancel", (event) => {
357
+ event.preventDefault();
358
+ options.onClose();
359
+ });
360
+ frame.append(controls, createCard(story));
361
+ player.append(frame);
362
+ return player;
363
+ }
364
+
29
365
  // src/story/story.ts
30
366
  var TAG_NAME = "vtex-ads-story";
31
367
  var _a;
@@ -36,44 +372,73 @@ var styles = `
36
372
  font-family: var(--vtex-ads-story-font-family, inherit);
37
373
  color: var(--vtex-ads-story-color-text, inherit);
38
374
  }
375
+ ${cardStyles}
376
+ ${playerStyles}
39
377
  `;
40
- var DEFAULT_NAME = "world";
378
+ var PLACEHOLDER_STORY = {
379
+ ad_id: "placeholder",
380
+ poster_url: "https://dummyimage.com/1080x1920/e31c57/fff"
381
+ };
382
+ var LABELS = {
383
+ watch: "Assistir v\xEDdeo",
384
+ player: "V\xEDdeo",
385
+ expand: "Expandir v\xEDdeo",
386
+ collapse: "Reduzir v\xEDdeo",
387
+ close: "Fechar v\xEDdeo"
388
+ };
41
389
  var VtexAdsStoryElement = class extends BaseElement {
42
- static get observedAttributes() {
43
- return ["name"];
44
- }
45
- get name() {
46
- var _a2, _b;
47
- return (_b = (_a2 = this.getAttribute("name")) == null ? void 0 : _a2.trim()) != null ? _b : "";
48
- }
49
- set name(value) {
50
- this.setAttribute("name", value);
390
+ constructor() {
391
+ super(...arguments);
392
+ this.player = null;
393
+ this.onKeyDown = (event) => {
394
+ if (event.key === "Escape") this.closePlayer();
395
+ };
51
396
  }
52
397
  render() {
53
398
  var _a2;
54
- const container = (_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("[part='root']");
399
+ const container = (_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".root");
55
400
  if (!container) return;
56
- container.textContent = `Hello ${this.name || DEFAULT_NAME}!`;
401
+ container.replaceChildren(
402
+ createCard(PLACEHOLDER_STORY, {
403
+ label: LABELS.watch,
404
+ onSelect: () => this.openPlayer()
405
+ })
406
+ );
407
+ }
408
+ openPlayer() {
409
+ var _a2;
410
+ if (this.player || !this.shadowRoot) return;
411
+ this.player = createPlayer(PLACEHOLDER_STORY, {
412
+ label: LABELS.player,
413
+ expandLabel: LABELS.expand,
414
+ collapseLabel: LABELS.collapse,
415
+ closeLabel: LABELS.close,
416
+ onClose: () => this.closePlayer()
417
+ });
418
+ this.shadowRoot.append(this.player);
419
+ showPlayer(this.player);
420
+ document.addEventListener("keydown", this.onKeyDown);
421
+ (_a2 = this.player.querySelector(".player-close")) == null ? void 0 : _a2.focus();
422
+ }
423
+ closePlayer({ restoreFocus = true } = {}) {
424
+ var _a2, _b;
425
+ if (!this.player) return;
426
+ document.removeEventListener("keydown", this.onKeyDown);
427
+ this.player.remove();
428
+ this.player = null;
429
+ if (restoreFocus) {
430
+ (_b = (_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".root .card")) == null ? void 0 : _b.focus();
431
+ }
57
432
  }
58
433
  connectedCallback() {
59
434
  if (!this.shadowRoot) {
60
435
  const root = this.attachShadow({ mode: "open" });
61
- root.innerHTML = `<style>${styles}</style><div part="root"></div>`;
436
+ root.innerHTML = `<style>${styles}</style><div class="root"></div>`;
62
437
  }
63
- this.upgradeProperty("name");
64
438
  this.render();
65
439
  }
66
- // A property set before the element is defined (e.g. while the CDN script
67
- // loads) becomes an own property that shadows the class getter/setter.
68
- // Remove it and set it again so it goes through the setter.
69
- upgradeProperty(prop) {
70
- if (!Object.prototype.hasOwnProperty.call(this, prop)) return;
71
- const value = this[prop];
72
- Reflect.deleteProperty(this, prop);
73
- this[prop] = value;
74
- }
75
- attributeChangedCallback() {
76
- this.render();
440
+ disconnectedCallback() {
441
+ this.closePlayer({ restoreFocus: false });
77
442
  }
78
443
  };
79
444
  function defineVtexAdsStories() {
@@ -87,4 +452,5 @@ function defineVtexAdsStories() {
87
452
  VtexAdsStoryElement,
88
453
  defineVtexAdsStories
89
454
  });
455
+ /*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */
90
456
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/story/story.ts"],"sourcesContent":["export { 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,WAAW;AAAxB;AAGA,IAAM,eAAkC,gBAAW,gBAAX,YAA0B;AAElE,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQf,IAAM,eAAe;AAEd,IAAM,sBAAN,cAAkC,YAAY;AAAA,EACnD,WAAW,qBAAqB;AAC9B,WAAO,CAAC,MAAM;AAAA,EAChB;AAAA,EAEA,IAAI,OAAe;AApBrB,QAAAA,KAAA;AAqBI,YAAO,MAAAA,MAAA,KAAK,aAAa,MAAM,MAAxB,gBAAAA,IAA2B,WAA3B,YAAqC;AAAA,EAC9C;AAAA,EAEA,IAAI,KAAK,OAAe;AACtB,SAAK,aAAa,QAAQ,KAAK;AAAA,EACjC;AAAA,EAEQ,SAAS;AA5BnB,QAAAA;AA6BI,UAAM,aAAYA,MAAA,KAAK,eAAL,gBAAAA,IAAiB,cAAc;AACjD,QAAI,CAAC,UAAW;AAGhB,cAAU,cAAc,SAAS,KAAK,QAAQ,YAAY;AAAA,EAC5D;AAAA,EAEA,oBAAoB;AAClB,QAAI,CAAC,KAAK,YAAY;AACpB,YAAM,OAAO,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC/C,WAAK,YAAY,UAAU,MAAM;AAAA,IACnC;AAEA,SAAK,gBAAgB,MAAM;AAC3B,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKQ,gBAAgB,MAAc;AACpC,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,EAAG;AAEvD,UAAM,QAAQ,KAAK,IAAI;AACvB,YAAQ,eAAe,MAAM,IAAI;AACjC,SAAK,IAAI,IAAI;AAAA,EACf;AAAA,EAEA,2BAA2B;AACzB,SAAK,OAAO;AAAA,EACd;AACF;AAUO,SAAS,uBAAuB;AACrC,MAAI,OAAO,mBAAmB,YAAa;AAC3C,MAAI,eAAe,IAAI,QAAQ,EAAG;AAElC,iBAAe,OAAO,UAAU,mBAAmB;AACrD;","names":["_a"]}
1
+ {"version":3,"sources":["../../src/index.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":["export { 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACUO,IAAM,QAAQ,EAAE,sBAAO,4BAAU,wBAAQ,wBAAK;AAK9C,SAAS,WAAW,MAAgB;AACzC,QAAM,WAAW,SAAS,cAAc,UAAU;AAClD,WAAS,YAAY,MAAM,IAAI;AAE/B,QAAM,MAAM,SAAS,QAAQ;AAC7B,MAAI,UAAU,IAAI,MAAM;AACxB,MAAI,aAAa,eAAe,MAAM;AACtC,MAAI,aAAa,aAAa,OAAO;AACrC,SAAO;AACT;;;ACrBO,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG;AAtEpD,QAAAA,KAAA;AAuEI,QAAI,CAAC,KAAK,OAAQ;AAElB,aAAS,oBAAoB,WAAW,KAAK,SAAS;AACtD,SAAK,OAAO,OAAO;AACnB,SAAK,SAAS;AAEd,QAAI,cAAc;AAChB,aAAAA,MAAA,KAAK,eAAL,gBAAAA,IAAiB,cAA2B,mBAA5C,mBAA4D;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,oBAAoB;AAClB,QAAI,CAAC,KAAK,YAAY;AACpB,YAAM,OAAO,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC/C,WAAK,YAAY,UAAU,MAAM;AAAA,IACnC;AAEA,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,uBAAuB;AACrB,SAAK,YAAY,EAAE,cAAc,MAAM,CAAC;AAAA,EAC1C;AACF;AAUO,SAAS,uBAAuB;AACrC,MAAI,OAAO,mBAAmB,YAAa;AAC3C,MAAI,eAAe,IAAI,QAAQ,EAAG;AAElC,iBAAe,OAAO,UAAU,mBAAmB;AACrD;","names":["_a"]}
@@ -1,13 +1,13 @@
1
1
  declare const TAG_NAME = "vtex-ads-story";
2
2
  declare const BaseElement: typeof HTMLElement;
3
3
  declare class VtexAdsStoryElement extends BaseElement {
4
- static get observedAttributes(): string[];
5
- get name(): string;
6
- set name(value: string);
4
+ private player;
5
+ private readonly onKeyDown;
7
6
  private render;
7
+ private openPlayer;
8
+ private closePlayer;
8
9
  connectedCallback(): void;
9
- private upgradeProperty;
10
- attributeChangedCallback(): void;
10
+ disconnectedCallback(): void;
11
11
  }
12
12
  declare global {
13
13
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react.ts"],"sourcesContent":["/**\n * React JSX types for <vtex-ads-story>. Types only: the JS output is empty.\n *\n * Opt in once per project, so non-React projects never need @types/react:\n *\n * import type {} from \"@vtex/ads-stories/react\";\n *\n * or add \"@vtex/ads-stories/react\" to `compilerOptions.types` in tsconfig.\n */\nimport type { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport type { VtexAdsStoryElement } from \"./story\";\n\nexport type VtexAdsStoryProps = DetailedHTMLProps<\n HTMLAttributes<VtexAdsStoryElement>,\n VtexAdsStoryElement\n> & {\n /** Name shown in the greeting; falls back to \"world\" when empty. */\n name?: string;\n};\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"vtex-ads-story\": VtexAdsStoryProps;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/react.ts"],"sourcesContent":["/**\n * React JSX types for <vtex-ads-story>. Types only: the JS output is empty.\n *\n * Opt in once per project, so non-React projects never need @types/react:\n *\n * import type {} from \"@vtex/ads-stories/react\";\n *\n * or add \"@vtex/ads-stories/react\" to `compilerOptions.types` in tsconfig.\n */\nimport type { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport type { VtexAdsStoryElement } from \"./story\";\n\nexport type VtexAdsStoryProps = DetailedHTMLProps<\n HTMLAttributes<VtexAdsStoryElement>,\n VtexAdsStoryElement\n>;\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"vtex-ads-story\": VtexAdsStoryProps;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -11,10 +11,7 @@ import { VtexAdsStoryElement } from './index.cjs';
11
11
  * or add "@vtex/ads-stories/react" to `compilerOptions.types` in tsconfig.
12
12
  */
13
13
 
14
- type VtexAdsStoryProps = DetailedHTMLProps<HTMLAttributes<VtexAdsStoryElement>, VtexAdsStoryElement> & {
15
- /** Name shown in the greeting; falls back to "world" when empty. */
16
- name?: string;
17
- };
14
+ type VtexAdsStoryProps = DetailedHTMLProps<HTMLAttributes<VtexAdsStoryElement>, VtexAdsStoryElement>;
18
15
  declare module "react" {
19
16
  namespace JSX {
20
17
  interface IntrinsicElements {
@@ -1,13 +1,13 @@
1
1
  declare const TAG_NAME = "vtex-ads-story";
2
2
  declare const BaseElement: typeof HTMLElement;
3
3
  declare class VtexAdsStoryElement extends BaseElement {
4
- static get observedAttributes(): string[];
5
- get name(): string;
6
- set name(value: string);
4
+ private player;
5
+ private readonly onKeyDown;
7
6
  private render;
7
+ private openPlayer;
8
+ private closePlayer;
8
9
  connectedCallback(): void;
9
- private upgradeProperty;
10
- attributeChangedCallback(): void;
10
+ disconnectedCallback(): void;
11
11
  }
12
12
  declare global {
13
13
  interface HTMLElementTagNameMap {