@n1kname/components 0.39.0 → 0.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1kname/components",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,6 +13,9 @@
13
13
  * - `size="card"`: when the link around it is hovered or focused (a LinkCard), the screens fan
14
14
  * out a little, as if the stack were picked up.
15
15
  *
16
+ * `device="phone"` lays tall phone screens side by side instead, stepping up and right, each in a
17
+ * thin dark bezel with rounded corners. Give it the screen alone, without a device frame.
18
+ *
16
19
  * A picture is an imported image (it goes through astro:assets, sized and converted to webp) or a
17
20
  * plain URL. `note` labels the panel, such as "Concepts, made-up data", for screens that are not
18
21
  * shipped work: keep it short on a card.
@@ -33,6 +36,8 @@ interface Props {
33
36
  note?: string;
34
37
  /** `cover` is a 20:9 header band; `card` a 16:9 picture for a LinkCard's media slot. */
35
38
  size?: 'cover' | 'card';
39
+ /** `laptop` for wide screens (the default), `phone` for tall ones. */
40
+ device?: 'laptop' | 'phone';
36
41
  /** A view-transition-name, so a card's stack can grow into the cover on the page it opens. */
37
42
  transition?: string;
38
43
  /** Load the front screen first, for a cover above the fold. */
@@ -42,17 +47,20 @@ interface Props {
42
47
  class?: string;
43
48
  }
44
49
 
45
- const { screens, tone = 'var(--c-accent)', note, size = 'cover', transition, eager = size === 'cover', parallax = size === 'cover', class: className } = Astro.props;
50
+ const { screens, tone = 'var(--c-accent)', note, size = 'cover', device = 'laptop', transition, eager = size === 'cover', parallax = size === 'cover', class: className } = Astro.props;
46
51
  const shots = screens.slice(0, 3);
47
52
  // Back to front, so the first screen paints last and sits on top.
48
53
  const order = [...shots.keys()].reverse();
49
- const widths = size === 'cover' ? [480, 900, 1400] : [400, 800];
50
- const sizes = size === 'cover' ? '(max-width: 900px) 80vw, 760px' : '(max-width: 640px) 70vw, 220px';
54
+ const phone = device === 'phone';
55
+ const widths = phone ? (size === 'cover' ? [240, 480, 720] : [160, 320]) : size === 'cover' ? [480, 900, 1400] : [400, 800];
56
+ const sizes = phone
57
+ ? size === 'cover' ? '(max-width: 640px) 30vw, 230px' : '(max-width: 640px) 22vw, 70px'
58
+ : size === 'cover' ? '(max-width: 900px) 80vw, 760px' : '(max-width: 640px) 70vw, 220px';
51
59
  const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.width))];
52
60
  ---
53
61
 
54
62
  <div
55
- class:list={['screen-stack', size, `n${shots.length}`, className]}
63
+ class:list={['screen-stack', size, device, `n${shots.length}`, className]}
56
64
  style={`--stack-tone: ${tone};${transition ? ` view-transition-name: ${transition}; view-transition-class: media;` : ''}`}
57
65
  data-screen-stack-parallax={parallax ? '' : undefined}
58
66
  >
@@ -192,6 +200,31 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
192
200
  .card.n2 .s0 { left: 8%; top: 30%; }
193
201
  .card.n2 .s1 { left: 28%; top: 12%; }
194
202
 
203
+ /* Phones: tall screens stepping up and right, in a thin bezel. */
204
+ .phone .screen {
205
+ width: 19%;
206
+ border-radius: 11% / 5%;
207
+ box-shadow:
208
+ 0 0 0 3px rgb(18 18 20),
209
+ 0 1px 2px rgb(0 0 0 / 0.2),
210
+ 0 24px 50px -10px rgb(0 0 0 / 0.5);
211
+ }
212
+ .phone .s0 { left: 27%; top: 14%; }
213
+ .phone .s1 { left: 41%; top: 8%; }
214
+ .phone .s2 { left: 55%; top: 2%; }
215
+ .phone.n2 .s0 { left: 34%; }
216
+ .phone.n2 .s1 { left: 48%; top: 6%; }
217
+
218
+ .card.phone .screen {
219
+ width: 22%;
220
+ box-shadow:
221
+ 0 0 0 2px rgb(18 18 20),
222
+ 0 8px 18px -6px rgb(0 0 0 / 0.5);
223
+ }
224
+ .card.phone .s0 { left: 23%; top: 18%; }
225
+ .card.phone .s1 { left: 39%; top: 10%; }
226
+ .card.phone .s2 { left: 55%; top: 2%; }
227
+
195
228
  @media (prefers-reduced-motion: no-preference) {
196
229
  .screen {
197
230
  animation: stack-in var(--motion-reveal, 900ms) var(--ease-soft, cubic-bezier(0.16, 1, 0.3, 1)) both;
@@ -229,11 +262,19 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
229
262
  .cover {
230
263
  aspect-ratio: 4 / 3;
231
264
  }
232
- .cover .screen {
265
+ .cover.laptop .screen {
233
266
  width: 78%;
234
267
  }
235
- .cover .s0 { left: 6%; top: 34%; }
236
- .cover .s1 { left: 16%; top: 20%; }
237
- .cover .s2 { display: none; }
268
+ .cover.laptop .s0 { left: 6%; top: 34%; }
269
+ .cover.laptop .s1 { left: 16%; top: 20%; }
270
+ .cover.laptop .s2 { display: none; }
271
+
272
+ /* Phones keep all three, larger, overlapping more. */
273
+ .cover.phone .screen {
274
+ width: 30%;
275
+ }
276
+ .cover.phone .s0 { left: 12%; top: 14%; }
277
+ .cover.phone .s1 { left: 35%; top: 9%; }
278
+ .cover.phone .s2 { left: 58%; top: 4%; }
238
279
  }
239
280
  </style>