@plusguard/reels 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.5.0/index.css" />
26
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@plusguard/reels@1.6.0/index.css" />
27
27
  <script type="module">
28
- import { initReels } from "https://cdn.jsdelivr.net/npm/@plusguard/reels@1.5.0/dist/index.js";
28
+ import { initReels } from "https://cdn.jsdelivr.net/npm/@plusguard/reels@1.6.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 either side of the video on
143
- a computer — none before the very first clip, none after the very last
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
@@ -162,7 +162,8 @@ in it, copies of the site's markup: the clip, the group's
162
162
  under it; on the close's left the group's view count — the card's
163
163
  `data-pg-reels-views` element, copied, so it looks as in the card. The
164
164
  number is the site's (from its own counting); the package shows it.
165
- - **The product:** on a computer, a panel beside the video, from its top
165
+ - **The product:** on a computer, a panel beside the video, touching it
166
+ as a post opened on Instagram (no corners where they meet), from its top
166
167
  to the window's foot, 9:16 like it: a head — the template's
167
168
  `data-pg-reels-title`, moved there, and the close; a long name takes a
168
169
  second line, the close stays at the top — a line under it; at the
package/dist/index.js CHANGED
@@ -48,8 +48,8 @@
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 ‹ › beside it (none before the first clip or after the last), → and
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
@@ -601,8 +601,9 @@ export function initReels() {
601
601
  <button type="button" data-pg-reels-view-up aria-label="Previous reel">${svg(ICONS.up)}</button>
602
602
  <button type="button" data-pg-reels-view-down aria-label="Next reel">${svg(ICONS.down)}</button>
603
603
  </div>
604
- <div data-pg-reels-column>
604
+ <div data-pg-reels-pair>
605
605
  <button type="button" data-pg-reels-view-side="prev" aria-label="Previous">${svg(ICONS.prev)}</button>
606
+ <div data-pg-reels-column>
606
607
  <div data-pg-reels-feed>
607
608
  <div data-pg-reels-view-peek="before" aria-hidden="true" hidden></div>
608
609
  <div data-pg-reels-screen>
@@ -624,7 +625,6 @@ export function initReels() {
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>
@@ -638,6 +638,8 @@ export function initReels() {
638
638
  <div data-pg-reels-panel-detail></div>
639
639
  <div data-pg-reels-panel-foot></div>
640
640
  </aside>
641
+ <button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
642
+ </div>
641
643
  </div>`;
642
644
  const part = (name) => dialog.querySelector(`[data-pg-reels-${name}]`);
643
645
  const media = part("view-media");
package/index.css CHANGED
@@ -126,7 +126,7 @@ 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
- --pg-reels-panel: clamp(20rem, min(calc((100dvh - 2rem) * 9 / 16), calc((100vw - 17rem) / 2)), 30rem);
129
+ --pg-reels-panel: clamp(20rem, min(calc((100dvh - 2rem) * 9 / 16), calc((100vw - 14rem) / 2)), 30rem);
130
130
  --pg-reels-peek: 2rem;
131
131
  position: fixed;
132
132
  inset: 0;
@@ -160,7 +160,7 @@ dialog[data-pg-reels-viewer] svg {
160
160
  it (--pg-reels-peek) — and low enough to leave room for the panel. */
161
161
  [data-pg-reels-stage] {
162
162
  --gap: 1rem;
163
- --h: min(calc(100dvh - 2 * var(--gap) - var(--pg-reels-peek)), 56rem, calc((100vw - var(--pg-reels-panel) - 17rem) * 16 / 9));
163
+ --h: min(calc(100dvh - 2 * var(--gap) - var(--pg-reels-peek)), 56rem, calc((100vw - var(--pg-reels-panel) - 14rem) * 16 / 9));
164
164
  display: flex;
165
165
  align-items: flex-start;
166
166
  justify-content: center;
@@ -170,13 +170,20 @@ dialog[data-pg-reels-viewer] svg {
170
170
  box-sizing: border-box;
171
171
  }
172
172
 
173
- /* The video's column: the feed, and the ‹ › on either side of the
174
- video's middle — the clip before, the next; none before the very first
175
- or after the very last. */
173
+ /* The video and its panel side by side, touching — as a post opened on
174
+ Instagram — and the ‹ › outside the pair, at the video's middle: the
175
+ clip before, the next; none before the very first or after the very
176
+ last. Small and see-through; white under the mouse. */
177
+ [data-pg-reels-pair] {
178
+ position: relative;
179
+ display: flex;
180
+ align-items: flex-start;
181
+ flex: none;
182
+ margin-inline: 2.5rem;
183
+ }
176
184
  [data-pg-reels-column] {
177
185
  position: relative;
178
186
  flex: none;
179
- margin-inline: 3.25rem;
180
187
  }
181
188
  dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
182
189
  position: absolute;
@@ -185,14 +192,13 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
185
192
  translate: 0 -50%;
186
193
  display: grid;
187
194
  place-items: center;
188
- width: 2.25rem;
189
- height: 2.25rem;
195
+ width: 1.75rem;
196
+ height: 1.75rem;
190
197
  padding: 0;
191
198
  border: 0;
192
199
  border-radius: 50%;
193
- background: rgb(255 255 255 / 0.92);
200
+ background: rgb(255 255 255 / 0.55);
194
201
  color: #111;
195
- box-shadow: 0 0.125rem 0.5rem rgb(0 0 0 / 0.3);
196
202
  cursor: pointer;
197
203
  transition: background-color 0.15s;
198
204
  }
@@ -209,8 +215,22 @@ dialog[data-pg-reels-viewer] [data-pg-reels-view-side][hidden] {
209
215
  display: none;
210
216
  }
211
217
  dialog[data-pg-reels-viewer] [data-pg-reels-view-side] svg {
212
- width: 1.125rem;
213
- height: 1.125rem;
218
+ width: 1rem;
219
+ height: 1rem;
220
+ stroke-width: 2.5;
221
+ }
222
+ /* Where they touch, no corners: the video's and the next one's right,
223
+ the panel's left. */
224
+ @media (min-width: 48rem) {
225
+ [data-pg-reels-pair] [data-pg-reels-screen],
226
+ [data-pg-reels-pair] [data-pg-reels-view-peek] {
227
+ border-top-right-radius: 0;
228
+ border-bottom-right-radius: 0;
229
+ }
230
+ [data-pg-reels-pair] [data-pg-reels-panel] {
231
+ border-top-left-radius: 0;
232
+ border-bottom-left-radius: 0;
233
+ }
214
234
  }
215
235
 
216
236
  /* The video, the group before it out of sight above, the next one's top
@@ -527,9 +547,11 @@ dialog[data-pg-reels-viewer] [data-pg-reels-panel-close] svg {
527
547
  display: block;
528
548
  padding: 0;
529
549
  }
550
+ [data-pg-reels-pair] {
551
+ display: contents;
552
+ }
530
553
  [data-pg-reels-column] {
531
554
  position: static;
532
- margin: 0;
533
555
  }
534
556
  dialog[data-pg-reels-viewer] [data-pg-reels-view-side] {
535
557
  display: none;
package/index.ts CHANGED
@@ -48,8 +48,8 @@
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 ‹ › beside it (none before the first clip or after the last), → and
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
@@ -619,8 +619,9 @@ export function initReels(): () => void {
619
619
  <button type="button" data-pg-reels-view-up aria-label="Previous reel">${svg(ICONS.up)}</button>
620
620
  <button type="button" data-pg-reels-view-down aria-label="Next reel">${svg(ICONS.down)}</button>
621
621
  </div>
622
- <div data-pg-reels-column>
622
+ <div data-pg-reels-pair>
623
623
  <button type="button" data-pg-reels-view-side="prev" aria-label="Previous">${svg(ICONS.prev)}</button>
624
+ <div data-pg-reels-column>
624
625
  <div data-pg-reels-feed>
625
626
  <div data-pg-reels-view-peek="before" aria-hidden="true" hidden></div>
626
627
  <div data-pg-reels-screen>
@@ -642,7 +643,6 @@ export function initReels(): () => void {
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>
@@ -656,6 +656,8 @@ export function initReels(): () => void {
656
656
  <div data-pg-reels-panel-detail></div>
657
657
  <div data-pg-reels-panel-foot></div>
658
658
  </aside>
659
+ <button type="button" data-pg-reels-view-side="next" aria-label="Next">${svg(ICONS.next)}</button>
660
+ </div>
659
661
  </div>`;
660
662
  const part = (name: string): HTMLElement => dialog.querySelector<HTMLElement>(`[data-pg-reels-${name}]`)!;
661
663
  const media = part("view-media");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusguard/reels",
3
- "version": "1.5.0",
3
+ "version": "1.6.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",