@n1kname/components 0.39.0 → 0.40.1

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.1",
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,38 @@ 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
+ /* The phones leave the left quarter free, so a note wraps there instead of running under them. */
219
+ .cover.phone .note {
220
+ max-width: 21%;
221
+ border-radius: 10px;
222
+ padding-block: var(--sp-1);
223
+ }
224
+
225
+ .card.phone .screen {
226
+ width: 22%;
227
+ box-shadow:
228
+ 0 0 0 2px rgb(18 18 20),
229
+ 0 8px 18px -6px rgb(0 0 0 / 0.5);
230
+ }
231
+ .card.phone .s0 { left: 23%; top: 18%; }
232
+ .card.phone .s1 { left: 39%; top: 10%; }
233
+ .card.phone .s2 { left: 55%; top: 2%; }
234
+
195
235
  @media (prefers-reduced-motion: no-preference) {
196
236
  .screen {
197
237
  animation: stack-in var(--motion-reveal, 900ms) var(--ease-soft, cubic-bezier(0.16, 1, 0.3, 1)) both;
@@ -229,11 +269,22 @@ const fit = (img: ImageMetadata) => [...new Set(widths.filter((w) => w <= img.wi
229
269
  .cover {
230
270
  aspect-ratio: 4 / 3;
231
271
  }
232
- .cover .screen {
272
+ .cover.laptop .screen {
233
273
  width: 78%;
234
274
  }
235
- .cover .s0 { left: 6%; top: 34%; }
236
- .cover .s1 { left: 16%; top: 20%; }
237
- .cover .s2 { display: none; }
275
+ .cover.laptop .s0 { left: 6%; top: 34%; }
276
+ .cover.laptop .s1 { left: 16%; top: 20%; }
277
+ .cover.laptop .s2 { display: none; }
278
+
279
+ /* Phones keep all three, larger, overlapping more. */
280
+ .cover.phone .screen {
281
+ width: 30%;
282
+ }
283
+ .cover.phone .s0 { left: 12%; top: 24%; }
284
+ .cover.phone .s1 { left: 35%; top: 19%; }
285
+ .cover.phone .s2 { left: 58%; top: 14%; }
286
+ .cover.phone .note {
287
+ max-width: calc(100% - 2 * var(--sp-3));
288
+ }
238
289
  }
239
290
  </style>
package/src/Steps.astro CHANGED
@@ -25,13 +25,16 @@ interface Step {
25
25
  interface Props {
26
26
  steps: Step[];
27
27
  caption?: string;
28
+ /** Phone screens: each picture held to 220px wide, centred on its plate, so a row of tall
29
+ * screens stays a sensible height instead of growing with its column. */
30
+ phone?: boolean;
28
31
  class?: string;
29
32
  }
30
33
 
31
- const { steps, caption, class: className } = Astro.props;
34
+ const { steps, caption, phone = false, class: className } = Astro.props;
32
35
  ---
33
36
 
34
- <figure class:list={['steps', className]}>
37
+ <figure class:list={['steps', { phone }, className]}>
35
38
  <ol>
36
39
  {
37
40
  steps.map((s, i) => (
@@ -139,6 +142,16 @@ const { steps, caption, class: className } = Astro.props;
139
142
  border-radius: 2px;
140
143
  }
141
144
 
145
+ .phone .shot :global(img),
146
+ .phone .placeholder {
147
+ max-width: 220px;
148
+ margin-inline: auto;
149
+ }
150
+
151
+ .phone .shot :global(img) {
152
+ border-radius: 6% / 3%;
153
+ }
154
+
142
155
  .placeholder {
143
156
  display: grid;
144
157
  place-items: center;