Skip to content

Commit ea6528e

Browse files
authored
fix deprecated note styles (#937)
1 parent 2c8542a commit ea6528e

File tree

7 files changed

+33
-15
lines changed

7 files changed

+33
-15
lines changed

apps/svelte.dev/content/docs/svelte/98-reference/20-svelte.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ for more info.
150150

151151
## SvelteComponentTyped
152152

153-
<blockquote class="tag deprecated">
153+
<blockquote class="tag deprecated note">
154154

155155
Use `Component` instead. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more information.
156156

@@ -172,7 +172,7 @@ class SvelteComponentTyped<
172172

173173
## afterUpdate
174174

175-
<blockquote class="tag deprecated">
175+
<blockquote class="tag deprecated note">
176176

177177
Use `$effect` instead — see https://svelte.dev/docs/svelte/$effect
178178

@@ -196,7 +196,7 @@ function afterUpdate(fn: () => void): void;
196196

197197
## beforeUpdate
198198

199-
<blockquote class="tag deprecated">
199+
<blockquote class="tag deprecated note">
200200

201201
Use `$effect.pre` instead — see https://svelte.dev/docs/svelte/$effect#$effect.pre
202202

@@ -220,7 +220,7 @@ function beforeUpdate(fn: () => void): void;
220220

221221
## createEventDispatcher
222222

223-
<blockquote class="tag deprecated">
223+
<blockquote class="tag deprecated note">
224224

225225
Use callback props and/or the `$host()` rune instead — see https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events
226226

@@ -593,7 +593,7 @@ The custom element version of the component. Only present if compiled with the `
593593

594594
## ComponentConstructorOptions
595595

596-
<blockquote class="tag deprecated">
596+
<blockquote class="tag deprecated note">
597597

598598
In Svelte 4, components are classes. In Svelte 5, they are functions.
599599
Use `mount` instead to instantiate components.
@@ -693,7 +693,7 @@ $$inline?: boolean;
693693

694694
## ComponentEvents
695695

696-
<blockquote class="tag deprecated">
696+
<blockquote class="tag deprecated note">
697697

698698
The new `Component` type does not have a dedicated Events type. Use `ComponentProps` instead.
699699

@@ -770,7 +770,7 @@ type ComponentProps<
770770

771771
## ComponentType
772772

773-
<blockquote class="tag deprecated">
773+
<blockquote class="tag deprecated note">
774774

775775
This type is obsolete when working with the new `Component` type.
776776

apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function preprocess(
159159

160160
## walk
161161

162-
<blockquote class="tag deprecated">
162+
<blockquote class="tag deprecated note">
163163

164164
Replace this with `import { walk } from 'estree-walker'`
165165

apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-legacy.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727

2828
## asClassComponent
2929

30-
<blockquote class="tag deprecated">
30+
<blockquote class="tag deprecated note">
3131

3232
Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
3333

@@ -58,7 +58,7 @@ function asClassComponent<
5858

5959
## createBubbler
6060

61-
<blockquote class="tag deprecated">
61+
<blockquote class="tag deprecated note">
6262

6363
Use this only as a temporary solution to migrate your automatically delegated events in Svelte 5.
6464

@@ -80,7 +80,7 @@ function createBubbler(): (
8080

8181
## createClassComponent
8282

83-
<blockquote class="tag deprecated">
83+
<blockquote class="tag deprecated note">
8484

8585
Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
8686

@@ -199,7 +199,7 @@ function preventDefault(
199199

200200
## run
201201

202-
<blockquote class="tag deprecated">
202+
<blockquote class="tag deprecated note">
203203

204204
Use this only as a temporary solution to migrate your component code to Svelte 5.
205205

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export async function get_types(code: string, statements: ts.NodeArray<ts.Statem
7676
let start = statement.pos;
7777
let comment = '';
7878
let deprecated_notice: string | null = null;
79+
let since_notice: string | null = null;
7980

8081
// @ts-ignore i think typescript is bad at typescript
8182
if (statement.jsDoc) {
@@ -97,6 +98,10 @@ export async function get_types(code: string, statements: ts.NodeArray<ts.Statem
9798
deprecated_notice = tag.comment;
9899
}
99100

101+
if (tag.tagName.escapedText === 'since') {
102+
since_notice = tag.comment;
103+
}
104+
100105
if (tag.tagName.escapedText === 'example') {
101106
comment += `\n\n${tag.comment}`;
102107
}
@@ -174,6 +179,7 @@ export async function get_types(code: string, statements: ts.NodeArray<ts.Statem
174179
name,
175180
comment: cleanup_comment(comment),
176181
deprecated: deprecated_notice,
182+
since: since_notice,
177183
overloads: []
178184
};
179185

packages/site-kit/src/lib/components/Text.svelte

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,9 @@
439439
&.deprecated {
440440
p:first-child::before {
441441
content: 'Deprecated ';
442-
display: block;
443-
font-style: normal;
442+
font: var(--sk-font-ui-medium);
443+
text-transform: uppercase;
444+
color: var(--sk-fg-4);
444445
}
445446
}
446447
@@ -462,6 +463,12 @@
462463
}
463464
}
464465
466+
.since p {
467+
font: var(--sk-font-ui-medium);
468+
text-transform: uppercase;
469+
color: var(--sk-fg-4);
470+
}
471+
465472
details {
466473
position: relative;
467474

packages/site-kit/src/lib/markdown/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface Declaration {
1515
name: string;
1616
comment: string;
1717
deprecated?: string | null;
18+
since?: string | null;
1819
overloads: Array<{
1920
snippet: string;
2021
children: TypeElement[];

packages/site-kit/src/lib/markdown/preprocess.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ function render_declaration(declaration: Declaration, full: boolean) {
122122
let content = '';
123123

124124
if (declaration.deprecated) {
125-
content += `<blockquote class="tag deprecated">\n\n${declaration.deprecated}\n\n</blockquote>\n\n`;
125+
content += `<blockquote class="tag deprecated note">\n\n${declaration.deprecated}\n\n</blockquote>\n\n`;
126+
}
127+
128+
if (declaration.since) {
129+
content += `<blockquote class="since note">\n\nAvailable since ${declaration.since}\n\n</blockquote>\n\n`;
126130
}
127131

128132
if (declaration.comment) {

0 commit comments

Comments
 (0)