-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
516 lines (475 loc) · 21.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<link rel="manifest" href="/site.webmanifest" />
<title>Advent of Web</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
<header>
<h1>Frontend Advent Calendar 2024</h1>
<p>Explore new JavaScript and CSS features every day!</p>
</header>
<main>
<section class="days">
<h2>📅 Days:</h2>
<details>
<summary>Day 01</summary>
<p>Scroll-Driven Animations</p>
<p>Task: Animate a Header’s Size While Scrolling.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_scroll-driven_animations"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Use @scroll-timeline to link scrolling progress to a
CSS animation.
</li>
<li>
Create a keyframe animation for the header’s height
and font size.
</li>
<li>Apply the animation using animation-timeline.</li>
</ol>
<a href="/day-01/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Removes the need for complex JavaScript
scroll listeners, making animations smoother and more
declarative.
</p>
</details>
<details>
<summary>Day 02</summary>
<p>Container Queries</p>
<p>Task: Create a Responsive Product Card.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_queries"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Design a card layout that adjusts from vertical to
horizontal at 500px card's (container) width.
</li>
<li>Use @container to conditionally apply styles.</li>
</ol>
<a href="/day-02/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Allows truly modular components that
adapt to their containers without relying on global
breakpoints.
</p>
</details>
<details>
<summary>Day 03</summary>
<p>:has() Pseudo-Class</p>
<p>Task: Enable Submit Button Conditionally.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/:has"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Style a submit button to remain disabled unless all
form fields are valid.
</li>
<li>
Use :has(:invalid) to dynamically toggle styles.
</li>
</ol>
<a href="/day-03/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Reduces reliance on JavaScript for
interactive form behavior, improving maintainability.
</p>
</details>
<details>
<summary>Day 04</summary>
<p>Scroll-Driven Animations 2</p>
<p>
Task: Animate the Card’s Size And Background While
Scrolling.
</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timeline/view"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>Use your knowledge from Day 01</li>
<li>
Use the view() function to scale cards from 0.5 to 1
and change its background as it scrolls into view
</li>
</ol>
<a href="/day-04/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Simplifies scroll-driven animations
without relying on JavaScript, improving performance and
maintainability.
</p>
</details>
<details>
<summary>Day 05</summary>
<p>Popover API with Anchor Positioning</p>
<p>Task: Implement a Custom Popover Component.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API"
target="_blank"
>Documentation 1</a
>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/position-anchor"
target="_blank"
>Documentation 2</a
>
<p>Steps:</p>
<ol>
<li>
Use the Popover API to manage the popover’s
visibility.
</li>
<li>
Use the Anchor Positioning API to position the
popover relative to the anchor element.
</li>
</ol>
<a href="/day-05/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Simplifies the creation of interactive
components with built-in popover functionality.
</p>
</details>
<details>
<summary>Day 06</summary>
<p>text-wrap: balance and pretty</p>
<p>
Task: Implement Balanced and Aesthetically Pleasing Text
Wrapping.
</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Use the text-wrap: balance property on the
paragraphs to enable balanced text wrapping.
</li>
<li>
Use the text-wrap: pretty property on the headings
to enable aesthetically pleasing text wrapping.
</li>
<li>
Highlight the difference between between traditional
text wrapping and the new properties. And notice
performance affects of text-wrap: pretty.
</li>
</ol>
<a href="/day-06/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Simplifies the creation of aesthetically
pleasing text layouts, improving readability and user
experience.
</p>
</details>
<details>
<summary>Day 07</summary>
<p>light-dark() function</p>
<p>Task: Implement a Light-Dark Theme.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Define and use CSS variables for text and background
colors for both light and dark themes using
light-dark() function.
</li>
<li>
Highlight how the light-dark() function simplifies
theme management compared to manually toggling
classes or redefining variables.
</li>
</ol>
<a href="/day-07/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Simplifies theme management and enhances
user experience by enabling dynamic color adjustments
based on the selected theme.
</p>
</details>
<details>
<summary>Day 08</summary>
<p>Accent-Color Property</p>
<p>Task: Style a Form with Accent Colors.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Apply a consistent accent-color to all form controls
(checkboxes, radio buttons, progress bars).
</li>
</ol>
<a href="/day-08/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Provides a simple, declarative way to
style form controls consistently without custom styling
for each.
</p>
</details>
<details>
<summary>Day 09</summary>
<p>Object.groupBy</p>
<p>Task: Group Transactions by Category.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Take an array of transaction objects with properties
like category and amount.
</li>
<li>
Use Object.groupBy to organize transactions by
category.
</li>
</ol>
<a href="/day-09/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Reduces boilerplate for grouping arrays,
making it more intuitive and easier to read.
</p>
</details>
<details>
<summary>Day 10</summary>
<p>New Array Methods: toSorted, toReversed, toSpliced</p>
<p>Task: Manipulate Arrays Without Mutation.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted"
target="_blank"
>Documentation 1</a
>
<a
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed"
target="_blank"
>Documentation 2</a
>
<a
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced"
target="_blank"
>Documentation 3</a
>
<p>Steps:</p>
<ol>
<li>
Use sort, reverse and splice methods to manipulate
data and see that it mutates the original data.
</li>
<li>
Use the new toSorted, toReversed, toSpliced methods
to create a new array with the desired changes
without mutating the original data.
</li>
</ol>
<a href="/day-10/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Provides a more intuitive and safer way
to manipulate arrays without mutating the original data.
</p>
</details>
<details>
<summary>Day 11</summary>
<p>New Array Methods: with</p>
<p>Task: Update Array Element Without Mutation.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/with"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Create a copy of the array manually ([...colors]).
Replace one element by directly modifying the copy.
</li>
<li>
Use the with method to create a new array with the
specified element replaced, leaving the original
array untouched.
</li>
<li>
Compare the with method with the traditional
approach to achieve the same result.
</li>
</ol>
<a href="/day-11/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Avoids manual copying, reducing the risk
of accidental mutations.
</p>
</details>
<details>
<summary>Day 12</summary>
<p>View Transition</p>
<p>Task: Add View Transitions When Switching Tabs.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API"
target="_blank"
>Documentation 1</a
>
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API/Using"
target="_blank"
>Documentation 2</a
>
<p>Steps:</p>
<ol>
<li>
Update the `updateView` function to use
startViewTransition() from the View Transitions API.
</li>
<li>
Define smooth sliding animations for entering and
exiting content during transitions with @keyframes.
</li>
<li>
Use the `::view-transition-group`,
`::view-transition-old`, and `::view-transition-new`
pseudo-elements to apply the animations during
transitions.
</li>
<li>
Link the CSS transitions to the `#content` element
by specifying a `view-transition-name`.
</li>
</ol>
<a href="/day-12/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Simplifies the creation of smooth
animations for dynamic content.
</p>
</details>
<details>
<summary>Day 13</summary>
<p>View Transition 2</p>
<p>Task: Animate page transition.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>
Go to the root main.css file and define
@view-transition rule to turn cross-document
transitions on
</li>
<li>
Define animations for entering and exiting pages
(for example, fade in/out, sliding effect) during
navigation with @keyframes.
</li>
<li>
Use the `::view-transition-old` and
`::view-transition-new` pseudo-elements to apply the
animations during transitions.
</li>
<li>
Go to the task page (it will open in the same tab)
and then you can go back and forth between the two
pages to see the transition effect.
</li>
</ol>
<a href="/day-13/">Go to the task page</a>
<p>
DX Improvement: Provides a native way to animate page
transitions without relying on JavaScript or third-party
libraries.
</p>
</details>
<details>
<summary>Day 14</summary>
<p>Relative colors</p>
<p>Task: Implement a color palette with relative colors.</p>
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Relative_colors"
target="_blank"
>Documentation</a
>
<p>Steps:</p>
<ol>
<li>Define --base-color value at the :root</li>
<li>
Use hsl() function with relative values for the
color palette using the base color.
</li>
<li>See the results for static palette.</li>
</ol>
<ol>
<li>
Define the --base-hue (use number value from 0 to
360) and --secondary-color (hsl) values at the :root
</li>
<li>
Use hsl() function with relative values for the
color palette using the --base-hue and
--secondary-color.
</li>
<li>
Use JavaScript to handle the range input and update
the --base-hue value accordingly.
</li>
<li>See the results for dynamic palette.</li>
</ol>
<a href="/day-14/" target="_blank">Go to the task page</a>
<p>
DX Improvement: Allows to create more flexible and
maintainable color palettes, enables dynamic color
adjustments based on a single base color.
</p>
</details>
</section>
</main>
</body>
</html>