Skip to content

Commit 2354f9a

Browse files
Merge branch 'main' into pkg-pr-new-version
2 parents 99ead20 + 5a635e6 commit 2354f9a

File tree

32 files changed

+64
-139
lines changed

32 files changed

+64
-139
lines changed

apps/svelte.dev/content/docs/svelte/02-runes/04-$effect.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Most of the effects in a Svelte app are created by Svelte itself — they're the
88

99
But you can also create your own effects with the `$effect` rune, which is useful when you need to synchronize an external system (whether that's a library, or a `<canvas>` element, or something across a network) with state inside your Svelte app.
1010

11-
> [!NOTE] Avoid overusing effects! When you do too much work in them, code often becomes difficult to understand and maintain. See [when not to use effects](#When-not-to-use-effects) to learn about alternative approaches.
11+
> [!NOTE] Avoid overusing `$effect`! When you do too much work in effects, code often becomes difficult to understand and maintain. See [when not to use `$effect`](#When-not-to-use-$effect) to learn about alternative approaches.
1212
1313
Your effects run after the component has been mounted to the DOM, and in a [microtask](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide) after state changes ([demo](/playground/untitled#H4sIAAAAAAAAE31S246bMBD9lZF3pSRSAqTVvrCAVPUP2sdSKY4ZwJJjkD0hSVH-vbINuWxXfQH5zMyZc2ZmZLVUaFn6a2R06ZGlHmBrpvnBvb71fWQHVOSwPbf4GS46TajJspRlVhjZU1HqkhQSWPkHIYdXS5xw-Zas3ueI6FRn7qHFS11_xSRZhIxbFtcDtw7SJb1iXaOg5XIFeQGjzyPRaevYNOGZIJ8qogbpe8CWiy_VzEpTXiQUcvPDkSVrSNZz1UlW1N5eLcqmpdXUvaQ4BmqlhZNUCgxuzFHDqUWNAxrYeUM76AzsnOsdiJbrBp_71lKpn3RRbii-4P3f-IMsRxS-wcDV_bL4PmSdBa2wl7pKnbp8DMgVvJm8ZNskKRkEM_OzyOKQFkgqOYBQ3Nq89Ns0nbIl81vMFN-jKoLMTOr-SOBOJS-Z8f5Y6D1wdcR8dFqvEBdetK-PHwj-z-cH8oHPY54wRJ8Ys7iSQ3Bg3VA9azQbmC9k35kKzYa6PoVtfwbbKVnBixBiGn7Pq0rqJoUtHiCZwAM3jdTPWCVtr_glhVrhecIa3vuksJ_b7TqFs4DPyriSjd5IwoNNQaAmNI-ESfR2p8zimzvN1swdCkvJHPH6-_oX8o1SgcIDAAA=)):
1414

@@ -261,7 +261,7 @@ The `$effect.root` rune is an advanced feature that creates a non-tracked scope
261261
</script>
262262
```
263263

264-
## When not to use effects
264+
## When not to use `$effect`
265265

266266
In general, `$effect` is best considered something of an escape hatch — useful for things like analytics and direct DOM manipulation — rather than a tool you should use frequently. In particular, avoid using it to synchronise state. Instead of this...
267267

@@ -288,7 +288,7 @@ In general, `$effect` is best considered something of an escape hatch — useful
288288

289289
> [!NOTE] For things that are more complicated than a simple expression like `count * 2`, you can also use `$derived.by`.
290290
291-
You might be tempted to do something convoluted with effects to link one value to another. The following example shows two inputs for "money spent" and "money left" that are connected to each other. If you update one, the other should update accordingly. Don't use effects for this ([demo](/playground/untitled#H4sIAAAAAAAACpVRy2rDMBD8lWXJwYE0dg-9KFYg31H3oNirIJBlYa1DjPG_F8l1XEop9LgzOzP7mFAbSwHF-4ROtYQCL97jAXn0sQh3skx4wNANfR2RMtS98XyuXMWWGLhjZUHCa1GcVix4cgwSdoEVU1bsn4wl_Y1I2kS6inekNdWcZXuQZ5giFDWpfwl5WYyT2fynbB1g1UWbTVbm2w6utOpKNq1TGucHhri6rLBX7kYVwtW4RtyVHUhOyXeGVj3klLxnyJP0i8lXNJUx6en-v6A48K85kTimpi0sYj-yAo-Wlh9FcL1LY4K3ahSgLT1OC3ZTXkBxfKN2uVC6T5LjAduuMdpQg4L7geaP-RNHPuClMQIAAA==)):
291+
You might be tempted to do something convoluted with effects to link one value to another. The following example shows two inputs for "money spent" and "money left" that are connected to each other. If you update one, the other should update accordingly. Don't use effects for this ([demo](/playground/untitled#H4sIAAAAAAAACpVRy26DMBD8FcvKgUhtoIdeHBwp31F6MGSJkBbHwksEQvx77aWQqooq9bgzOzP7mGTdIHipPiZJowOpGJAv0po2VmfnDv4OSBErjYdneHWzBJaCjcx91TWOToUtCIEE3cig0OIty44r5l1oDtjOkyFIsv3GINQ_CNYyGegd1DVUlCR7oU9iilDUcP8S8roYs9n8p2wdYNVFm4csTx872BxNCcjr5I11fdgonEkXsjP2CoUUZWMv6m6wBz2x7yxaM-iJvWeRsvSbSVeUy5i0uf8vKA78NIeJLSZWv1I8jQjLdyK4XuTSeIdmVKJGGI4LdjVOiezwDu1yG74My8PLCQaSiroe5s_5C2PHrkVGAgAA)):
292292

293293
```svelte
294294
<script>
@@ -316,7 +316,7 @@ You might be tempted to do something convoluted with effects to link one value t
316316
</label>
317317
```
318318

319-
Instead, use callbacks where possible ([demo](/playground/untitled#H4sIAAAAAAAACo2SP2-DMBDFv8rp1CFR84cOXQhU6p6tY-ngwoEsGWPhI0pk8d0rG5yglqGj37v7veMJh7VUZDH9dKhFS5jiuzG4Q74Z_7AXUky4Q9sNfemVzJa9NPxW6IIVMXDHQkEOL0lyipo1pBlyeLIsmDbJ9u4oqhdG2A2mLrgedMmy0zCYSjB9eMaGtuC8WXBkPtOBRd8QHy5CDXSa3Jk7HbOfDgjWuAo_U71kz9vr6Bgc2X44orPjow2dKfFNKhSTSW0GBl9iXmAvdEMFQqDmLgBH6HQYyt3ie0doxTV3IWqEY2DN88eohqePvsf9O9mf_if4HMSVXD89NfEI99qvbMs3RdPv4MXYaSWtUeKWQq3oOlfZCJNCcnildlFgWMcdtl0la0kVptwPNH6NP_uzV0acAgAA)):
319+
Instead, use callbacks where possible ([demo](/playground/untitled#H4sIAAAAAAAACo1SMW6EMBD8imWluFMSIEUaDiKlvy5lSOHjlhOSMRZeTiDkv8deMEEJRcqdmZ1ZjzzxqpZgePo5cRw18JQA_sSVaPz0rnVk7iDRYxdhYA8vW4Wg0NnwzJRdrfGtUAVKQIYtCsly9pIkp4AZ7cQOezAoEA7JcWUkVBuCdol0dNWrEutWsV5fHfnhPQ5wZJMnCwyejxCh6G6A0V3IHk4zu_jOxzzPBxBld83PTr7xXrb3rUNw8PbiYJ3FP22oTIoLSComq5XuXTeu8LzgnVA3KDgj13wiQ8taRaJ82rzXskYM-URRlsXktejjgNLoo9e4fyf70_8EnwncySX1GuunX6kGRwnzR_BgaPNaGy3FmLJKwrCUeBM6ZUn0Cs2mOlp3vwthQJ5i14P9st9vZqQlsQIAAA==)):
320320

321321
```svelte
322322
<script>
@@ -346,7 +346,7 @@ Instead, use callbacks where possible ([demo](/playground/untitled#H4sIAAAAAAAAC
346346
</label>
347347
```
348348

349-
If you need to use bindings, for whatever reason (for example when you want some kind of "writable `$derived`"), consider using getters and setters to synchronise state ([demo](/playground/untitled#H4sIAAAAAAAACo2SQW-DMAyF_4pl7dBqXcsOu1CYtHtvO44dsmKqSCFExFRFiP8-xRCGth52tJ_9PecpA1bakMf0Y0CrasIU35zDHXLvQuGvZJhwh77p2nPoZP7casevhS3YEAM3rAzk8Jwkx9jzjixDDg-eFdMm2S6KoWolyK6ItuCqs2fWjYXOlYrpPTA2tIUhiAVH5iPtWbUX4v1VmY6Okzpzp2OepgNEGu_CT1St2fP2fXQ0juwwHNHZ4ScNmxn1RUaCybR1HUMIMS-wVfZCBYJQ80GAIzRWhvJh9d4RanXLB7Ea4SCsef4Qu1IG68Xu387h9D_GJ2ne8ZXpxTZUv1w994amjxCaMc1Se2dUn0Jl6DaHeFEuhWT_QvUqOlnHHdZNqStNJabcdjR-jt8IbC-7lgIAAA==)):
349+
If you need to use bindings, for whatever reason (for example when you want some kind of "writable `$derived`"), consider using getters and setters to synchronise state ([demo](/playground/untitled#H4sIAAAAAAAACpWRwW6DMBBEf8WyekikFOihFwcq9TvqHkyyQUjGsfCCQMj_XnvBNKpy6Qn2DTOD1wu_tRocF18Lx9kCFwT4iRvVxenT2syNoDGyWjl4xi93g2AwxPDSXfrW4oc0EjUgwzsqzSr2VhTnxJwNHwf24lAhHIpjVDZNwy1KS5wlNoGMSg9wOCYksQccerMlv65p51X0p_Xpdt_4YEy9yTkmV3z4MJT579-bUqsaNB2kbI0dwlnCgirJe2UakJzVrbkKaqkWivasU1O1ULxnOVk3JU-Uxti0p_-vKO4no_enbQ_yXhnZn0aHs4b1jiJMK7q2zmo1C3bTMG3LaZQVrMjeoSPgaUtkDxePMCEX2Ie6b_8D4WyJJEwCAAA=)):
350350

351351
```svelte
352352
<script>

apps/svelte.dev/scripts/sync-docs/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ if (parsed.values.pull) {
167167
}
168168

169169
async function sync(pkg: Package) {
170+
if (!fs.existsSync(`${REPOS}/${pkg.name}/${pkg.docs}`)) {
171+
console.warn(`No linked repo found for ${pkg.name}`);
172+
return;
173+
}
174+
170175
const dest = `${DOCS}/${pkg.name}`;
171176

172177
fs.rmSync(dest, { force: true, recursive: true });

apps/svelte.dev/src/lib/components/Modal.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
width: calc(100vw - 2rem);
6868
max-width: 56rem;
6969
background: var(--sk-bg-2);
70-
color: var(--sk-fg-2);
7170
padding: 2rem;
7271
border: none;
7372
border-radius: 0.5rem;

apps/svelte.dev/src/lib/components/SecondaryNav.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
justify-content: space-between;
1818
padding: 0.6rem var(--sk-page-padding-side);
1919
background-color: var(--sk-bg-2);
20-
color: var(--sk-fg-2);
2120
white-space: nowrap;
2221
flex: 0;
2322
gap: 1rem;

apps/svelte.dev/src/routes/(authed)/apps/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
padding: 0 0 0 3.2rem;
157157
position: relative;
158158
margin: 1rem 0;
159-
color: var(--sk-fg-2);
160159
font: var(--sk-font-ui-medium);
161160
162161
.avatar {

apps/svelte.dev/src/routes/blog/+page.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
7575
h2 {
7676
display: inline-block;
77-
color: var(--sk-fg-2);
77+
color: var(--sk-fg-1);
7878
font: var(--sk-font-h3);
7979
}
8080
@@ -87,14 +87,14 @@
8787
8888
h2 {
8989
font: var(--sk-font-h1);
90-
color: var(--sk-fg-2);
90+
color: var(--sk-fg-1);
9191
}
9292
}
9393
9494
a {
9595
display: block;
9696
text-decoration: none;
97-
color: var(--sk-fg-2);
97+
color: inherit;
9898
9999
&:hover h2 {
100100
text-decoration: underline;
@@ -163,7 +163,7 @@
163163
a {
164164
display: block;
165165
font: var(--sk-font-body);
166-
color: var(--sk-fg-2);
166+
color: inherit;
167167
}
168168
}
169169
}

apps/svelte.dev/src/routes/docs/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
112112
.options a {
113113
display: block;
114-
color: var(--sk-fg-2);
114+
color: inherit;
115115
margin: 1em -1.6rem;
116116
padding: 1.6rem;
117117
background-color: var(--sk-bg-1);

apps/svelte.dev/src/routes/docs/[...path]/OnThisPage.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@
9696
padding: 0.2rem 0 0 3rem;
9797
height: 3rem;
9898
text-transform: uppercase;
99-
color: var(--sk-fg-4);
100-
101-
&:hover {
102-
color: var(--sk-fg-3);
103-
}
99+
user-select: none;
104100
105101
&::before,
106102
&::after {
@@ -148,6 +144,10 @@
148144
color: var(--sk-fg-4);
149145
margin: 0;
150146
display: block;
147+
148+
&:hover {
149+
color: var(--sk-fg-3);
150+
}
151151
}
152152
}
153153

apps/svelte.dev/src/routes/tutorial/[...slug]/Chrome.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
border: 1px solid var(--sk-border);
7878
/* TODO this should apply to all buttons/inputs? */
7979
border-radius: var(--sk-border-radius);
80-
color: var(--sk-fg-2);
8180
font: var(--sk-font-ui-medium);
8281
height: 3.2rem;
8382
}

apps/svelte.dev/src/routes/tutorial/[...slug]/filetree/ContextMenu.svelte

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
{#if $menu_items}
2525
<nav style="position: fixed; z-index: 5; top:{$menu_items.y}px; left:{$menu_items.x}px">
26-
<div class="navbar" id="navbar">
26+
<div class="context-menu">
2727
<ul>
2828
{#each $menu_items.items as item}
2929
<li>
@@ -38,50 +38,39 @@
3838
<svelte:window on:click={() => menu_items.set(null)} />
3939

4040
<style>
41-
.navbar {
41+
.context-menu {
4242
display: inline-flex;
43-
border: 1px solid rgba(0, 0, 0, 0.1);
44-
background-color: var(--back);
43+
background-color: var(--sk-bg-2);
4544
border-radius: var(--sk-border-radius);
4645
overflow: hidden;
4746
flex-direction: column;
48-
filter: drop-shadow(1px 1px 4px rgba(0, 0, 0, 0.1));
47+
filter: var(--sk-shadow);
4948
}
5049
5150
ul {
5251
margin: 0;
53-
padding: 0;
54-
background-color: var(--sk-bg-3);
55-
border: 1px solid var(--sk-fg-accent);
52+
padding: 0.5rem;
53+
background-color: var(--sk-bg-2);
5654
}
5755
5856
li {
5957
display: block;
6058
list-style-type: none;
61-
width: 1fr;
62-
}
63-
li:hover {
64-
background-color: var(--sk-bg-accent);
59+
60+
&:hover {
61+
background-color: var(--sk-bg-4);
62+
}
6563
}
6664
6765
button {
68-
color: var(--sk-fg-2);
66+
display: block;
6967
width: 100%;
68+
height: 100%;
7069
text-align: left;
7170
border: 0px;
72-
padding: 0.4rem 1rem 0.2rem 1rem;
71+
padding: 1rem;
7372
font: var(--sk-font-ui-small);
74-
}
75-
76-
li:first-child button {
77-
padding-top: 0.5rem;
78-
}
79-
80-
li:last-child button {
81-
padding-bottom: 0.4rem;
82-
}
83-
84-
button:hover {
85-
background-color: var(--back-api);
73+
line-height: 1;
74+
border-radius: var(--sk-border-radius);
8675
}
8776
</style>

0 commit comments

Comments
 (0)