@plusguard/reels 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -16
- package/dist/index.js +13 -12
- package/index.css +98 -45
- package/index.ts +13 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,9 +23,9 @@ From npm, through jsDelivr — the npm package is the code alone (about
|
|
|
23
23
|
jsDelivr's GitHub route.
|
|
24
24
|
|
|
25
25
|
```html
|
|
26
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@plusguard/reels@1.
|
|
26
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@plusguard/reels@1.7.0/index.css" />
|
|
27
27
|
<script type="module">
|
|
28
|
-
import { initReels } from "https://cdn.jsdelivr.net/npm/@plusguard/reels@1.
|
|
28
|
+
import { initReels } from "https://cdn.jsdelivr.net/npm/@plusguard/reels@1.7.0/dist/index.js";
|
|
29
29
|
initReels();
|
|
30
30
|
</script>
|
|
31
31
|
```
|
|
@@ -139,9 +139,9 @@ in it, copies of the site's markup: the clip, the group's
|
|
|
139
139
|
`data-pg-reels-head`, the clip's product and its details.
|
|
140
140
|
|
|
141
141
|
- **Within a group:** the bars on top (none for a single clip), a press on
|
|
142
|
-
the video's right or left third, the ‹ › on
|
|
143
|
-
|
|
144
|
-
— → and ←. Its clips play on, a video to
|
|
142
|
+
the video's right or left third, the ‹ › on a computer — outside the video
|
|
143
|
+
and its panel, small and see-through, white under the mouse; none
|
|
144
|
+
before the very first clip, none after the very last — → and ←. Its clips play on, a video to
|
|
145
145
|
its end, a picture for its time; after the group's last clip, the next
|
|
146
146
|
group — after the last group, the first.
|
|
147
147
|
- **Between groups:** a finger — or the mouse — dragging the video up or
|
|
@@ -158,21 +158,24 @@ in it, copies of the site's markup: the clip, the group's
|
|
|
158
158
|
links; the rest of the clip passes presses to the taps under it.
|
|
159
159
|
- **Held down** — a finger, the mouse — it stands still, the controls
|
|
160
160
|
out of the way; let go and it goes on. Its play / pause button, Space.
|
|
161
|
-
- **Its corner:** the
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
- **Its corner:** the sound and play / pause at the video's top right,
|
|
162
|
+
the group's view count under them — the card's `data-pg-reels-views`
|
|
163
|
+
element, copied, so it looks as in the card. The number is the site's
|
|
164
|
+
(from its own counting); the package shows it. The close is a plain ✕ at
|
|
165
|
+
the window's top right, the ↑ ↓ at the window's left.
|
|
166
|
+
- **The product:** on a computer, a panel beside the video, touching it
|
|
167
|
+
as a post opened on Instagram (no corners where they meet, small ones
|
|
168
|
+
outside), from its top to the window's foot, about a third of the
|
|
169
|
+
window wide: a head — the template's `data-pg-reels-title`, moved there
|
|
170
|
+
(the example puts the category there) — a line under it; at the
|
|
169
171
|
bottom a foot — the template's `data-pg-reels-foot`, the link to the
|
|
170
172
|
product, always in sight; and between them the rest of the template,
|
|
171
173
|
scrolling.
|
|
172
174
|
The template is the product's `data-pg-reels-detail`, the site's markup: a
|
|
173
175
|
`data-pg-reels-thumb` pressed puts its picture (the attribute's value, or
|
|
174
176
|
its own `<img>`) into `data-pg-reels-big`, and is
|
|
175
|
-
`data-pg-reels-current`.
|
|
177
|
+
`data-pg-reels-current`. Below 1024px (Tailwind's `lg`) — a phone, a
|
|
178
|
+
tablet, a narrow window — the video fills the screen; the
|
|
176
179
|
product, as on the card, is a band at its foot, and a Details button
|
|
177
180
|
above the band's right opens the template under it. A clip without a
|
|
178
181
|
product: no panel.
|
|
@@ -211,7 +214,7 @@ in it, copies of the site's markup: the clip, the group's
|
|
|
211
214
|
| `--pg-reels-gap` | `1rem` | Between the cards |
|
|
212
215
|
| `--pg-reels-ratio` | `9 / 16` | The card's shape |
|
|
213
216
|
| `--pg-reels-duration` | `5s` | A picture's time |
|
|
214
|
-
| `--pg-reels-panel` |
|
|
217
|
+
| `--pg-reels-panel` | `30vw`, 21–31rem | The full view: the product panel's width on a computer |
|
|
215
218
|
| `--pg-reels-seen` | `all` | `all`: a group is seen once all its clips have been shown in the full view · `off`: never |
|
|
216
219
|
| `--pg-reels-seen-for` | `24h` | How long a group stays seen — `1h`, `30m`, `7d`, `forever` — then its ring is bright again |
|
|
217
220
|
| `--pg-reels-peek` | `2rem` | The full view: how much of the next group shows under the video on a computer |
|
|
@@ -237,7 +240,7 @@ and videos: the box has the shape, what is inside is 100% of it.
|
|
|
237
240
|
| `data-pg-reels-bars` | under the card, empty | Its bars are written here, one a clip |
|
|
238
241
|
| `data-pg-reels-product` | one a clip | The clip's product |
|
|
239
242
|
| `data-pg-reels-detail` | a `<template>` in a product — or any element, hidden, in the product or the clip | Its details, for the full view |
|
|
240
|
-
| `data-pg-reels-title` | in the template |
|
|
243
|
+
| `data-pg-reels-title` | in the template | What heads the panel — the category in the example; the product's name under the price |
|
|
241
244
|
| `data-pg-reels-foot` | in the template | The link to the product: pinned to the panel's foot; on a phone, under the opened details |
|
|
242
245
|
| `data-pg-reels-variant`, `-variant-price`, `-variant-href` | buttons in the template | A variant: chosen, its gallery, price and link |
|
|
243
246
|
| `data-pg-reels-gallery` | in the template | A variant's pictures: shown while its variant is chosen |
|
package/dist/index.js
CHANGED
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
* The full view — a <dialog>, built here on <body>, its contents copies:
|
|
49
49
|
* the clip playing, the group's data-pg-reels-head, the clip's product.
|
|
50
50
|
* Within a group: the bars on top, a press on the video's right or left,
|
|
51
|
-
* the ‹ ›
|
|
52
|
-
* ←. Between groups: a finger (or the mouse) dragging the video up
|
|
51
|
+
* the ‹ › on either side of the video and its panel (none before the
|
|
52
|
+
* first clip or after the last), → and ←. Between groups: a finger (or the mouse) dragging the video up
|
|
53
53
|
* or down — it follows, the next group coming in under it, and let go
|
|
54
54
|
* goes on or back — its ↑ and ↓ buttons, a wheel, ↑ and ↓; after a
|
|
55
55
|
* group's last clip, the next group. The product changes once it has
|
|
56
56
|
* landed. Held
|
|
57
|
-
* down — a finger, the mouse — it stands still; its
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* close it too. The
|
|
57
|
+
* down — a finger, the mouse — it stands still; its sound and play /
|
|
58
|
+
* pause at the video's top right, the group's view count under them (its
|
|
59
|
+
* data-pg-reels-views, the site's); its close at the window's top right.
|
|
60
|
+
* Esc, Back, the dark around it close it too. The
|
|
61
61
|
* product: on a computer a panel beside the video — the product's
|
|
62
62
|
* <template data-pg-reels-detail>, the site's markup: a title (its
|
|
63
63
|
* data-pg-reels-title goes to the panel's head, beside the close), a big
|
|
@@ -596,13 +596,15 @@ export function initReels() {
|
|
|
596
596
|
// keys work at once, no ring on a button nobody chose.
|
|
597
597
|
dialog.tabIndex = -1;
|
|
598
598
|
dialog.innerHTML = `
|
|
599
|
+
<button type="button" data-pg-reels-view-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
599
600
|
<div data-pg-reels-stage>
|
|
600
601
|
<div data-pg-reels-view-steps>
|
|
601
602
|
<button type="button" data-pg-reels-view-up aria-label="Previous reel">${svg(ICONS.up)}</button>
|
|
602
603
|
<button type="button" data-pg-reels-view-down aria-label="Next reel">${svg(ICONS.down)}</button>
|
|
603
604
|
</div>
|
|
604
|
-
<div data-pg-reels-
|
|
605
|
+
<div data-pg-reels-pair>
|
|
605
606
|
<button type="button" data-pg-reels-view-side="prev" aria-label="Previous">${svg(ICONS.prev)}</button>
|
|
607
|
+
<div data-pg-reels-column>
|
|
606
608
|
<div data-pg-reels-feed>
|
|
607
609
|
<div data-pg-reels-view-peek="before" aria-hidden="true" hidden></div>
|
|
608
610
|
<div data-pg-reels-screen>
|
|
@@ -614,22 +616,19 @@ export function initReels() {
|
|
|
614
616
|
<div data-pg-reels-view-row>
|
|
615
617
|
<div data-pg-reels-view-head></div>
|
|
616
618
|
<div data-pg-reels-view-tools>
|
|
617
|
-
<div data-pg-reels-view-views></div>
|
|
618
|
-
<button type="button" data-pg-reels-view-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
619
619
|
<button type="button" ${SOUND} aria-pressed="false" aria-label="Sound">${svg(ICONS.soundOff)}${svg(ICONS.soundOn)}</button>
|
|
620
620
|
<button type="button" data-pg-reels-view-play aria-label="Pause">${svg(ICONS.pause)}${svg(ICONS.play)}</button>
|
|
621
|
+
<div data-pg-reels-view-views></div>
|
|
621
622
|
</div>
|
|
622
623
|
</div>
|
|
623
624
|
</div>
|
|
624
625
|
</div>
|
|
625
626
|
<button type="button" data-pg-reels-view-peek="after" tabindex="-1" aria-label="Next reel" hidden></button>
|
|
626
627
|
</div>
|
|
627
|
-
<button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
|
|
628
628
|
</div>
|
|
629
629
|
<aside data-pg-reels-panel>
|
|
630
630
|
<div data-pg-reels-panel-head>
|
|
631
631
|
<div data-pg-reels-panel-title></div>
|
|
632
|
-
<button type="button" data-pg-reels-panel-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
633
632
|
</div>
|
|
634
633
|
<div data-pg-reels-panel-band>
|
|
635
634
|
<div data-pg-reels-panel-summary></div>
|
|
@@ -638,6 +637,8 @@ export function initReels() {
|
|
|
638
637
|
<div data-pg-reels-panel-detail></div>
|
|
639
638
|
<div data-pg-reels-panel-foot></div>
|
|
640
639
|
</aside>
|
|
640
|
+
<button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
|
|
641
|
+
</div>
|
|
641
642
|
</div>`;
|
|
642
643
|
const part = (name) => dialog.querySelector(`[data-pg-reels-${name}]`);
|
|
643
644
|
const media = part("view-media");
|
|
@@ -978,7 +979,7 @@ export function initReels() {
|
|
|
978
979
|
// The dark around it.
|
|
979
980
|
if (t === dialog || t.hasAttribute("data-pg-reels-stage"))
|
|
980
981
|
return closeView();
|
|
981
|
-
if (t.closest("[data-pg-reels-view-close]
|
|
982
|
+
if (t.closest("[data-pg-reels-view-close]"))
|
|
982
983
|
return closeView();
|
|
983
984
|
if (sliding)
|
|
984
985
|
return;
|
package/index.css
CHANGED
|
@@ -126,7 +126,8 @@ html:has(dialog[data-pg-reels-viewer][open]) {
|
|
|
126
126
|
dialog[data-pg-reels-viewer] {
|
|
127
127
|
/* The panel 9:16, as the video: its width from its height — but at
|
|
128
128
|
most half the room beside the arrows, and 20rem to 30rem. */
|
|
129
|
-
|
|
129
|
+
/* The panel as on Instagram: a third of the window, 21rem to 31rem. */
|
|
130
|
+
--pg-reels-panel: clamp(21rem, 30vw, 31rem);
|
|
130
131
|
--pg-reels-peek: 2rem;
|
|
131
132
|
position: fixed;
|
|
132
133
|
inset: 0;
|
|
@@ -160,23 +161,32 @@ dialog[data-pg-reels-viewer] svg {
|
|
|
160
161
|
it (--pg-reels-peek) — and low enough to leave room for the panel. */
|
|
161
162
|
[data-pg-reels-stage] {
|
|
162
163
|
--gap: 1rem;
|
|
163
|
-
--h: min(calc(100dvh - 2 * var(--gap) - var(--pg-reels-peek)), 56rem, calc((100vw - var(--pg-reels-panel) -
|
|
164
|
+
--h: min(calc(100dvh - 2 * var(--gap) - var(--pg-reels-peek)), 56rem, calc((100vw - var(--pg-reels-panel) - 15rem) * 16 / 9));
|
|
165
|
+
position: relative;
|
|
164
166
|
display: flex;
|
|
165
167
|
align-items: flex-start;
|
|
166
168
|
justify-content: center;
|
|
167
|
-
gap: 1.5rem;
|
|
168
169
|
height: 100%;
|
|
169
|
-
|
|
170
|
+
/* Room at the sides: the ↑ ↓ at the window's left, the close at its
|
|
171
|
+
right. */
|
|
172
|
+
padding: var(--gap) 5rem 0;
|
|
170
173
|
box-sizing: border-box;
|
|
171
174
|
}
|
|
172
175
|
|
|
173
|
-
/* The video
|
|
174
|
-
|
|
175
|
-
or after the very
|
|
176
|
+
/* The video and its panel side by side, touching — as a post opened on
|
|
177
|
+
Instagram — and the ‹ › outside the pair, at the video's middle: the
|
|
178
|
+
clip before, the next; none before the very first or after the very
|
|
179
|
+
last. Small and see-through; white under the mouse. */
|
|
180
|
+
[data-pg-reels-pair] {
|
|
181
|
+
position: relative;
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: flex-start;
|
|
184
|
+
flex: none;
|
|
185
|
+
margin-inline: 2.5rem;
|
|
186
|
+
}
|
|
176
187
|
[data-pg-reels-column] {
|
|
177
188
|
position: relative;
|
|
178
189
|
flex: none;
|
|
179
|
-
margin-inline: 3.25rem;
|
|
180
190
|
}
|
|
181
191
|
dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
|
|
182
192
|
position: absolute;
|
|
@@ -185,14 +195,13 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
|
|
|
185
195
|
translate: 0 -50%;
|
|
186
196
|
display: grid;
|
|
187
197
|
place-items: center;
|
|
188
|
-
width:
|
|
189
|
-
height:
|
|
198
|
+
width: 1.75rem;
|
|
199
|
+
height: 1.75rem;
|
|
190
200
|
padding: 0;
|
|
191
201
|
border: 0;
|
|
192
202
|
border-radius: 50%;
|
|
193
|
-
background: rgb(255 255 255 / 0.
|
|
203
|
+
background: rgb(255 255 255 / 0.55);
|
|
194
204
|
color: #111;
|
|
195
|
-
box-shadow: 0 0.125rem 0.5rem rgb(0 0 0 / 0.3);
|
|
196
205
|
cursor: pointer;
|
|
197
206
|
transition: background-color 0.15s;
|
|
198
207
|
}
|
|
@@ -209,8 +218,22 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side][hidden] {
|
|
|
209
218
|
display: none;
|
|
210
219
|
}
|
|
211
220
|
dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
212
|
-
width:
|
|
213
|
-
height:
|
|
221
|
+
width: 1rem;
|
|
222
|
+
height: 1rem;
|
|
223
|
+
stroke-width: 2.5;
|
|
224
|
+
}
|
|
225
|
+
/* Where they touch, no corners: the video's and the next one's right,
|
|
226
|
+
the panel's left. */
|
|
227
|
+
@media (min-width: 64rem) {
|
|
228
|
+
[data-pg-reels-pair] [data-pg-reels-screen],
|
|
229
|
+
[data-pg-reels-pair] [data-pg-reels-view-peek] {
|
|
230
|
+
border-top-right-radius: 0;
|
|
231
|
+
border-bottom-right-radius: 0;
|
|
232
|
+
}
|
|
233
|
+
[data-pg-reels-pair] [data-pg-reels-panel] {
|
|
234
|
+
border-top-left-radius: 0;
|
|
235
|
+
border-bottom-left-radius: 0;
|
|
236
|
+
}
|
|
214
237
|
}
|
|
215
238
|
|
|
216
239
|
/* The video, the group before it out of sight above, the next one's top
|
|
@@ -231,7 +254,7 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
|
231
254
|
flex: none;
|
|
232
255
|
height: var(--h);
|
|
233
256
|
aspect-ratio: var(--pg-reels-ratio, 9 / 16);
|
|
234
|
-
border-radius: 0.
|
|
257
|
+
border-radius: 0.25rem;
|
|
235
258
|
overflow: hidden;
|
|
236
259
|
background: #000;
|
|
237
260
|
isolation: isolate;
|
|
@@ -265,7 +288,7 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
|
265
288
|
aspect-ratio: var(--pg-reels-ratio, 9 / 16);
|
|
266
289
|
padding: 0;
|
|
267
290
|
border: 0;
|
|
268
|
-
border-radius: 0.
|
|
291
|
+
border-radius: 0.25rem;
|
|
269
292
|
overflow: hidden;
|
|
270
293
|
background: #000;
|
|
271
294
|
color: #fff;
|
|
@@ -353,9 +376,9 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
|
353
376
|
[data-pg-reels-view-head] {
|
|
354
377
|
min-width: 0;
|
|
355
378
|
}
|
|
356
|
-
/* The
|
|
357
|
-
|
|
358
|
-
|
|
379
|
+
/* The video's top right: the sound and play / pause, the group's view
|
|
380
|
+
count under them. Only the buttons take a press: the rest of the corner
|
|
381
|
+
is the video's. */
|
|
359
382
|
[data-pg-reels-view-row] > [data-pg-reels-view-tools] {
|
|
360
383
|
display: grid;
|
|
361
384
|
grid-template-columns: auto auto;
|
|
@@ -363,20 +386,17 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
|
363
386
|
pointer-events: none;
|
|
364
387
|
}
|
|
365
388
|
[data-pg-reels-view-tools] > button {
|
|
366
|
-
grid-column: 2;
|
|
367
389
|
pointer-events: auto;
|
|
368
390
|
}
|
|
369
391
|
[data-pg-reels-view-views] {
|
|
370
|
-
grid-column: 1;
|
|
371
|
-
|
|
372
|
-
align-self: center;
|
|
392
|
+
grid-column: 1 / -1;
|
|
393
|
+
justify-self: end;
|
|
373
394
|
}
|
|
374
395
|
[data-pg-reels-view-views]:empty {
|
|
375
396
|
display: none;
|
|
376
397
|
}
|
|
377
398
|
[data-pg-reels-view-tools] > button,
|
|
378
|
-
[data-pg-reels-view-steps] > button
|
|
379
|
-
[data-pg-reels-panel-close] {
|
|
399
|
+
[data-pg-reels-view-steps] > button {
|
|
380
400
|
position: relative;
|
|
381
401
|
display: grid;
|
|
382
402
|
place-items: center;
|
|
@@ -403,10 +423,39 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
|
|
|
403
423
|
/* ↑ ↓: the group before, the next — left of the video, at its middle,
|
|
404
424
|
round and grey, their name beside them under the mouse. */
|
|
405
425
|
[data-pg-reels-view-steps] {
|
|
426
|
+
position: absolute;
|
|
427
|
+
left: 1.25rem;
|
|
428
|
+
top: calc(var(--gap) + var(--h) / 2);
|
|
429
|
+
translate: 0 -50%;
|
|
406
430
|
display: flex;
|
|
407
431
|
flex-direction: column;
|
|
408
432
|
gap: 1rem;
|
|
409
|
-
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* The close: the window's top right, a plain ✕ as on Instagram. */
|
|
436
|
+
dialog[data-pg-reels-viewer] [data-pg-reels-view-close] {
|
|
437
|
+
position: absolute;
|
|
438
|
+
z-index: 3;
|
|
439
|
+
top: 0.75rem;
|
|
440
|
+
right: 0.75rem;
|
|
441
|
+
display: grid;
|
|
442
|
+
place-items: center;
|
|
443
|
+
width: 2.75rem;
|
|
444
|
+
height: 2.75rem;
|
|
445
|
+
padding: 0;
|
|
446
|
+
border: 0;
|
|
447
|
+
border-radius: 50%;
|
|
448
|
+
background: none;
|
|
449
|
+
color: #fff;
|
|
450
|
+
cursor: pointer;
|
|
451
|
+
transition: background-color 0.15s;
|
|
452
|
+
}
|
|
453
|
+
dialog[data-pg-reels-viewer] [data-pg-reels-view-close]:hover {
|
|
454
|
+
background: rgb(255 255 255 / 0.12);
|
|
455
|
+
}
|
|
456
|
+
dialog[data-pg-reels-viewer] [data-pg-reels-view-close] svg {
|
|
457
|
+
width: 1.75rem;
|
|
458
|
+
height: 1.75rem;
|
|
410
459
|
}
|
|
411
460
|
dialog[data-pg-reels-viewer] [data-pg-reels-view-steps] > button {
|
|
412
461
|
width: 3.5rem;
|
|
@@ -460,7 +509,7 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-steps] svg {
|
|
|
460
509
|
box-sizing: border-box;
|
|
461
510
|
width: var(--pg-reels-panel);
|
|
462
511
|
height: calc(100dvh - 2 * var(--gap));
|
|
463
|
-
border-radius: 0.
|
|
512
|
+
border-radius: 0.25rem;
|
|
464
513
|
background: #fff;
|
|
465
514
|
color: #111;
|
|
466
515
|
overflow: hidden;
|
|
@@ -473,25 +522,14 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-steps] svg {
|
|
|
473
522
|
align-items: flex-start;
|
|
474
523
|
gap: 0.75rem;
|
|
475
524
|
flex: none;
|
|
476
|
-
padding:
|
|
525
|
+
padding: 1rem 1.25rem;
|
|
477
526
|
border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent);
|
|
478
527
|
}
|
|
479
528
|
[data-pg-reels-panel-title] {
|
|
480
529
|
flex: 1 1 auto;
|
|
481
530
|
min-width: 0;
|
|
482
531
|
align-self: center;
|
|
483
|
-
|
|
484
|
-
dialog[data-pg-reels-viewer] [data-pg-reels-panel-close] {
|
|
485
|
-
flex: none;
|
|
486
|
-
background: color-mix(in srgb, currentColor 10%, transparent);
|
|
487
|
-
transition: background-color 0.15s;
|
|
488
|
-
}
|
|
489
|
-
dialog[data-pg-reels-viewer] [data-pg-reels-panel-close]:hover {
|
|
490
|
-
background: color-mix(in srgb, currentColor 18%, transparent);
|
|
491
|
-
}
|
|
492
|
-
dialog[data-pg-reels-viewer] [data-pg-reels-panel-close] svg {
|
|
493
|
-
width: 1.5rem;
|
|
494
|
-
height: 1.5rem;
|
|
532
|
+
min-height: 1.5rem;
|
|
495
533
|
}
|
|
496
534
|
[data-pg-reels-panel-detail] {
|
|
497
535
|
flex: 1 1 auto;
|
|
@@ -519,17 +557,28 @@ dialog[data-pg-reels-viewer] [data-pg-reels-panel-close] svg {
|
|
|
519
557
|
display: none;
|
|
520
558
|
}
|
|
521
559
|
|
|
522
|
-
/* ----------
|
|
523
|
-
The groups above and under it wait
|
|
524
|
-
finger; the product is a band at the
|
|
525
|
-
|
|
560
|
+
/* ---------- Below 1024px (Tailwind's lg): the video fills the screen ----------
|
|
561
|
+
A phone, a tablet, a narrow window. The groups above and under it wait
|
|
562
|
+
out of sight, full size, for the finger; the product is a band at the
|
|
563
|
+
foot, its content centred and no wider than 40rem. */
|
|
564
|
+
@media (max-width: 63.99rem) {
|
|
526
565
|
[data-pg-reels-stage] {
|
|
527
566
|
display: block;
|
|
528
567
|
padding: 0;
|
|
529
568
|
}
|
|
569
|
+
/* The close over the video's top right; the sound and pause beside it. */
|
|
570
|
+
dialog[data-pg-reels-viewer] [data-pg-reels-view-close] {
|
|
571
|
+
top: max(0.5rem, env(safe-area-inset-top));
|
|
572
|
+
right: 0.375rem;
|
|
573
|
+
}
|
|
574
|
+
[data-pg-reels-view-row] > [data-pg-reels-view-tools] {
|
|
575
|
+
margin-right: 2.75rem;
|
|
576
|
+
}
|
|
577
|
+
[data-pg-reels-pair] {
|
|
578
|
+
display: contents;
|
|
579
|
+
}
|
|
530
580
|
[data-pg-reels-column] {
|
|
531
581
|
position: static;
|
|
532
|
-
margin: 0;
|
|
533
582
|
}
|
|
534
583
|
dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
|
|
535
584
|
display: none;
|
|
@@ -585,6 +634,10 @@ dialog[data-pg-reels-viewer] [data-pg-reels-panel-close] svg {
|
|
|
585
634
|
[data-pg-reels-no-product] [data-pg-reels-panel] {
|
|
586
635
|
display: none;
|
|
587
636
|
}
|
|
637
|
+
[data-pg-reels-panel] > * {
|
|
638
|
+
max-width: 40rem;
|
|
639
|
+
margin-inline: auto;
|
|
640
|
+
}
|
|
588
641
|
[data-pg-reels-panel-band] {
|
|
589
642
|
display: block;
|
|
590
643
|
position: relative;
|
package/index.ts
CHANGED
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
* The full view — a <dialog>, built here on <body>, its contents copies:
|
|
49
49
|
* the clip playing, the group's data-pg-reels-head, the clip's product.
|
|
50
50
|
* Within a group: the bars on top, a press on the video's right or left,
|
|
51
|
-
* the ‹ ›
|
|
52
|
-
* ←. Between groups: a finger (or the mouse) dragging the video up
|
|
51
|
+
* the ‹ › on either side of the video and its panel (none before the
|
|
52
|
+
* first clip or after the last), → and ←. Between groups: a finger (or the mouse) dragging the video up
|
|
53
53
|
* or down — it follows, the next group coming in under it, and let go
|
|
54
54
|
* goes on or back — its ↑ and ↓ buttons, a wheel, ↑ and ↓; after a
|
|
55
55
|
* group's last clip, the next group. The product changes once it has
|
|
56
56
|
* landed. Held
|
|
57
|
-
* down — a finger, the mouse — it stands still; its
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* close it too. The
|
|
57
|
+
* down — a finger, the mouse — it stands still; its sound and play /
|
|
58
|
+
* pause at the video's top right, the group's view count under them (its
|
|
59
|
+
* data-pg-reels-views, the site's); its close at the window's top right.
|
|
60
|
+
* Esc, Back, the dark around it close it too. The
|
|
61
61
|
* product: on a computer a panel beside the video — the product's
|
|
62
62
|
* <template data-pg-reels-detail>, the site's markup: a title (its
|
|
63
63
|
* data-pg-reels-title goes to the panel's head, beside the close), a big
|
|
@@ -614,13 +614,15 @@ export function initReels(): () => void {
|
|
|
614
614
|
// keys work at once, no ring on a button nobody chose.
|
|
615
615
|
dialog.tabIndex = -1;
|
|
616
616
|
dialog.innerHTML = `
|
|
617
|
+
<button type="button" data-pg-reels-view-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
617
618
|
<div data-pg-reels-stage>
|
|
618
619
|
<div data-pg-reels-view-steps>
|
|
619
620
|
<button type="button" data-pg-reels-view-up aria-label="Previous reel">${svg(ICONS.up)}</button>
|
|
620
621
|
<button type="button" data-pg-reels-view-down aria-label="Next reel">${svg(ICONS.down)}</button>
|
|
621
622
|
</div>
|
|
622
|
-
<div data-pg-reels-
|
|
623
|
+
<div data-pg-reels-pair>
|
|
623
624
|
<button type="button" data-pg-reels-view-side="prev" aria-label="Previous">${svg(ICONS.prev)}</button>
|
|
625
|
+
<div data-pg-reels-column>
|
|
624
626
|
<div data-pg-reels-feed>
|
|
625
627
|
<div data-pg-reels-view-peek="before" aria-hidden="true" hidden></div>
|
|
626
628
|
<div data-pg-reels-screen>
|
|
@@ -632,22 +634,19 @@ export function initReels(): () => void {
|
|
|
632
634
|
<div data-pg-reels-view-row>
|
|
633
635
|
<div data-pg-reels-view-head></div>
|
|
634
636
|
<div data-pg-reels-view-tools>
|
|
635
|
-
<div data-pg-reels-view-views></div>
|
|
636
|
-
<button type="button" data-pg-reels-view-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
637
637
|
<button type="button" ${SOUND} aria-pressed="false" aria-label="Sound">${svg(ICONS.soundOff)}${svg(ICONS.soundOn)}</button>
|
|
638
638
|
<button type="button" data-pg-reels-view-play aria-label="Pause">${svg(ICONS.pause)}${svg(ICONS.play)}</button>
|
|
639
|
+
<div data-pg-reels-view-views></div>
|
|
639
640
|
</div>
|
|
640
641
|
</div>
|
|
641
642
|
</div>
|
|
642
643
|
</div>
|
|
643
644
|
<button type="button" data-pg-reels-view-peek="after" tabindex="-1" aria-label="Next reel" hidden></button>
|
|
644
645
|
</div>
|
|
645
|
-
<button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
|
|
646
646
|
</div>
|
|
647
647
|
<aside data-pg-reels-panel>
|
|
648
648
|
<div data-pg-reels-panel-head>
|
|
649
649
|
<div data-pg-reels-panel-title></div>
|
|
650
|
-
<button type="button" data-pg-reels-panel-close aria-label="Close">${svg(ICONS.close)}</button>
|
|
651
650
|
</div>
|
|
652
651
|
<div data-pg-reels-panel-band>
|
|
653
652
|
<div data-pg-reels-panel-summary></div>
|
|
@@ -656,6 +655,8 @@ export function initReels(): () => void {
|
|
|
656
655
|
<div data-pg-reels-panel-detail></div>
|
|
657
656
|
<div data-pg-reels-panel-foot></div>
|
|
658
657
|
</aside>
|
|
658
|
+
<button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
|
|
659
|
+
</div>
|
|
659
660
|
</div>`;
|
|
660
661
|
const part = (name: string): HTMLElement => dialog.querySelector<HTMLElement>(`[data-pg-reels-${name}]`)!;
|
|
661
662
|
const media = part("view-media");
|
|
@@ -987,7 +988,7 @@ export function initReels(): () => void {
|
|
|
987
988
|
}
|
|
988
989
|
// The dark around it.
|
|
989
990
|
if (t === dialog || t.hasAttribute("data-pg-reels-stage")) return closeView();
|
|
990
|
-
if (t.closest("[data-pg-reels-view-close]
|
|
991
|
+
if (t.closest("[data-pg-reels-view-close]")) return closeView();
|
|
991
992
|
if (sliding) return;
|
|
992
993
|
if (t.closest('[data-pg-reels-view-on], [data-pg-reels-view-side="next"]')) return nextClip();
|
|
993
994
|
if (t.closest('[data-pg-reels-view-back], [data-pg-reels-view-side="prev"]')) return prevClip();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusguard/reels",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Shoppable reels for a store: a strip of video cards — each a group of clips, each clip with its own product — that opens into a full view. Up and down between groups, left and right within one, the product beside the video on a computer and under it on a phone. No dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|