Svelte

Svelte
Original author(s)Rich Harris
Developer(s)The Svelte contributors. Key contributors include Rich Harris, Alan Faubert, Tan Li Hau, Ben McCann, and Simon Holthausen
Initial release26 November 2016; 8 years ago (26 November 2016)
Stable release
5.0.0[1] Edit this on Wikidata / 19 October 2024; 3 months ago (19 October 2024)
Repository
Written inJavaScript, TypeScript Edit this on Wikidata
PlatformWeb platform
TypeWeb framework
LicenseMIT License
WebsiteOfficial website Edit this at Wikidata

Svelte is a free and open-source component-based front-end software framework,[2] and language[3] created by Rich Harris and maintained by the Svelte core team members.[4]

Svelte is not a monolithic JavaScript library imported by applications: instead, Svelte compiles HTML templates to specialized code that manipulates the DOM directly, which may reduce the size of transferred files and give better client performance.[5] Application code is also processed by the compiler, inserting calls to automatically recompute data[2] and re-render UI elements when the data they depend on is modified.[6] This also avoids the overhead associated with runtime intermediate representations, such as virtual DOM,[7] unlike traditional frameworks (such as React and Vue) which carry out the bulk of their work at runtime, i.e. in the browser.[5][6][4][8][2][7]

The compiler itself is written in JavaScript.[9][8] Its source code is licensed under MIT License and hosted on GitHub.[8] Among comparable frontend libraries, Svelte has one of the smallest bundle footprints at merely 2KB.[10]

History

The predecessor of Svelte is Ractive.js, which Rich Harris created in 2013.[11]

Version 1 of Svelte was written in JavaScript and was released on 29 November 2016.[12] The name Svelte was chosen by Rich Harris and his coworkers at The Guardian.[12]

Version 2 of Svelte was released on 19 April 2018. It set out to correct what the maintainers viewed as mistakes in the earlier version such as replacing double curly braces with single curly braces.[12]

Version 3 of Svelte was written in TypeScript and was released on 21 April 2019. It rethought reactivity by using the compiler to instrument assignments behind the scenes.[2]

The SvelteKit web framework was announced in October 2020 and entered beta in March 2021.[13][14] SvelteKit 1.0 was released in December 2022 after two years in development.[15]

Version 4 of Svelte was released on 22 June 2023. It was a maintenance release, smaller and faster than version 3.[16] A part of this release was an internal rewrite from TypeScript back to JavaScript, with JSDoc annotations.[9] This was met with a confusion from the developer community, which was addressed by the creator of Svelte, Rich Harris.[17][18]

Version 5 of Svelte was released on October 19, 2024 at Svelte Summit Fall 2024 with Rich Harris cutting the release live while joined by the other Svelte maintainers. Svelte 5 was a ground-up rewrite of Svelte, changing core concepts such as reactivity and reusability.[19] Its primary feature, runes, reworked how reactive state is declared and used. Runes are function-like macros that are used to declare a reactive state, or code that uses reactive states. These runes are used by the compiler to indicate values that may change and are depended on by other states or the DOM.[20] Svelte 5 also introduces Snippets, which are reusable "snippets" of code that are defined once and can be reused anywhere else in the component.[21] Svelte 5 was initially met with controversy due to its many changes, and thus deprecations caused primarily by runes.[22] However, most of this has subsided since the initial announcement of runes, and the further refining of Svelte 5.

Also at Svelte Summit Fall 2024, Ben McCann announced the Svelte CLI under the sv package name on npm.[23]

Key early contributors to Svelte became involved with Conduitry joining with the release of Svelte 1, Tan Li Hau joining in 2019, and Ben McCann joining in 2020.[12] Rich Harris and Simon Holthausen joined Vercel to work on Svelte fulltime in 2022.[24] Dominic Gannaway joined Vercel from the React core team to work on Svelte fulltime in 2023.[25]

Syntax

Svelte applications and components are defined in .svelte files, which are HTML files extended with templating syntax that is based on JavaScript and is similar to JSX.

Svelte's core features are accessed through runes, which syntactically look like functions, but are used as macros by the compiler. These runes include:

  • The $state rune, used for declaring a reactive state value
  • The $derived rune, used for declaring reactive state derived from one or more states
  • The $effect rune, used for declaring code that reruns whenever its dependencies change

Additionally, the { JavaScript code } syntax can be used for templating in HTML elements and components,[26] similar to template literals in JavaScript. This syntax can also be used in element attributes for uses such as two-way data binding, event listeners, and CSS styling. A Todo List example made in Svelte is below:

<script>
	let todos = $state([]);
	let input = $state();
	let all = $derived(todos.length);
	let done = $derived(todos.filter(todo=>todo.done).length);
	function handleKey(e){
		if(e.key === "Enter"){
			todos.push({text:input.value,done:false});
			input.value = '';
		}
	}
</script>
<span style:font-size="20px" style:font-weight="bold">Todo List</span>
{done}/{all}<br>
{#each todos as {text,done},index}
	<input type="checkbox" bind:checked={todos[index].done} name={text}/>	
	<label for={text} style:text-decoration-line={done?"line-through":""}>{text}</label>
	<br>
{/each}
<br>
<label for="input">Add todo</label>
<br>
<input type="text" name="input" bind:this={input} onkeypress={handleKey}/>

Associated projects

SvelteKit
Initial release ()
Stable release
1.15.5[27][28] Edit this on Wikidata / 13 April 2023; 21 months ago (13 April 2023)
Repositoryhttps://github.com/sveltejs/kit Edit this on Wikidata
Written inJavaScript, TypeScript, Svelte Edit this on Wikidata
PlatformWeb platform
TypeWeb framework
LicenseMIT License
Websitesvelte.dev/docs/kit

The Svelte maintainers created SvelteKit as the official way to build projects with Svelte. It is a Next.js-style framework that dramatically reduces the amount of code that gets sent to the browser. The maintainers had previously created Sapper, which was the predecessor of SvelteKit.[29]

The Svelte maintainers also maintain a number of integrations for popular software projects under the Svelte organization including integrations for Vite, Rollup, Webpack, TypeScript, VS Code, Chrome Developer Tools, ESLint, and Prettier.[30] A number of external projects such as Storybook have also created integrations with Svelte and SvelteKit.

Influence

Vue.js modeled its API and single-file components after Ractive.js, the predecessor of Svelte.[11]

Adoption

Svelte is widely praised by developers. Taking the top ranking in multiple large scale developer surveys, it was chosen as the Stack Overflow 2021 most loved web framework and 2020 State of JS frontend framework with the most satisfied developers.[31][32]

Svelte has been adopted by a number of high-profile web companies including The New York Times, Apple, Spotify, Radio France (French national public radio broadcaster),[33] Square, Yahoo, ByteDance, Rakuten, Bloomberg, Reuters, Ikea, Facebook, FrontPopulaire-2024 and Brave.[34][35][36]

A community group of non-maintainers, known as the Svelte Society, run the Svelte Summit conference, write a Svelte newsletter, host a Svelte podcast, and host a directory of Svelte tooling, components, and templates.[37]

See also

References

  1. ^ https://github.com/sveltejs/svelte/releases/tag/svelte%405.0.0. Retrieved 23 October 2024. {{cite web}}: Missing or empty |title= (help)
  2. ^ a b c d Rich Harris (2019-04-22). "Svelte 3: Rethinking reactivity". svelte.dev. Retrieved 2021-08-07.
  3. ^ Harris, Rich (2018-11-26). "The truth about Svelte". GitHub Gist. Retrieved 2022-12-21.
  4. ^ a b Krill, Paul (December 2, 2016). "Slim, speedy Svelte framework puts JavaScript on a diet". InfoWorld.
  5. ^ a b "React vs. Svelte, the JavaScript build-time framework". react-etc.net.
  6. ^ a b "Svelte 3 Front-End Framework Moves Reactivity into the JavaScript Language, Q&A with Rich Harris". InfoQ.
  7. ^ a b Rich Harris (2018-12-27). "Virtual DOM is pure overhead". svelte.dev.
  8. ^ a b c "GitHub - sveltejs/svelte: Cybernetically enhanced web apps". January 11, 2020 – via GitHub.
  9. ^ a b "TS to JSDoc Conversion #8569". GitHub.com.
  10. ^ Frontendeng.dev (2023-08-01). "Svelte vs React: Which framework is better?". frontendeng.dev.
  11. ^ a b Świstak, Tomasz (2020-11-19). "About the Svelte JavaScript framework". Blog. ValueLogic. Archived from the original on 2022-03-27. Retrieved 2021-06-10. By the way, Vue's syntax has been influenced by Ractive.js, a direct predecessor of Svelte.
  12. ^ a b c d "Svelte Origins: A JavaScript Documentary". YouTube. 21 June 2022. Retrieved 2022-07-09.
  13. ^ "Rich Harris: Futuristic Web Development". YouTube. 19 October 2020. Archived from the original on 2021-12-12. Retrieved 2021-08-03.
  14. ^ Harris, Rich (2021-03-23). "SvelteKit is in public beta". svelte.dev. Retrieved 2021-08-03.
  15. ^ "Accouncing SvelteKit 1.0". 2022-12-14. Retrieved 2022-12-16.
  16. ^ team, The Svelte (2023-06-22). "Announcing Svelte 4". svelte.dev. Retrieved 2023-08-08.
  17. ^ "TS to JSDoc Conversion". Hacker News (news.ycombinator.com). 2023-05-10.
  18. ^ "Lordy, I did not expect an internal refactoring PR to end up #1 on Hacker News. ..." Hacker News (news.ycombinator.com). 2023-05-10.
  19. ^ "Svelte 5 is alive". svelte.dev. 22 October 2024.
  20. ^ "Introducing runes". svelte.dev. 20 September 2023.
  21. ^ "{#snippet ...}". Docs. svelte.dev.
  22. ^ "Svelte 5 is React, and I wanna cry". r/sveltejs. reddit.com. 14 May 2024.
  23. ^ McCann, Ben (2024-10-24). "Introducing the new Svelte CLI". svelte.dev. Retrieved 2024-12-20.
  24. ^ Harris, Rich (Nov 11, 2021). "today is a big day for @sveltejs: i've joined @vercel to work on it full time!". Twitter. Retrieved 2022-09-04.
  25. ^ "https://twitter.com/trueadm/status/1640761270566633472". X (formerly Twitter). Retrieved 2023-09-30. {{cite web}}: External link in |title= (help)
  26. ^ "Svelte tutorial page". svelte.dev. Retrieved 2022-07-06.
  27. ^ "@sveltejs/kitTypeScript icon, indicating that this package has built-in type declarations1.15.5". npmjs. Retrieved 26 November 2024.
  28. ^ "@sveltejs/[email protected]". GitHub. Retrieved 26 November 2024.
  29. ^ Harris, Rich (December 31, 2017). "Sapper: Towards the ideal web app framework". svelte.dev. Retrieved 2022-11-29.
  30. ^ "Svelte". GitHub. Retrieved 2021-08-03.
  31. ^ "Stack Overflow Developer Survey 2021". Stack Overflow. Archived from the original on 2022-06-25. Retrieved 2021-10-26.
  32. ^ "State of JS 2020: Front-end Frameworks". 2020.stateofjs.com. Retrieved 2021-10-26.
  33. ^ "Radio France migrated their site to SvelteKit". reddit.com. 2 September 2021. Retrieved 2024-06-04.
  34. ^ "Svelte • Cybernetically enhanced web apps". svelte.dev. Retrieved 2021-08-03.
  35. ^ "Websites using Svelte - Wappalyzer". www.wappalyzer.com. Retrieved 2021-08-03.
  36. ^ "Your Profile, Your Home Experience". yourhome.fb.com. Retrieved 2021-12-01.
  37. ^ "Home - Svelte Society". sveltesociety.dev. Retrieved 2021-08-03.

Read other articles:

This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: Digital Fish Library – news · newspapers · books · scholar · JSTOR (August 2009) (Learn how and when to remove this template message) This article needs ...

 

Finnish boxer Sten SuvioSuvio in 1943Personal informationBorn25 November 1911Hannila, Viipuri Province, Imperial RussiaDied19 October 1988 (aged 76)Helsinki, FinlandHeight170 cm (5 ft 7 in)Weight65–68 kg (143–150 lb)SportSportBoxing Medal record Representing  Finland Olympic Games 1936 Berlin Welterweight Sten Stepa Suvio (born Schuschin, 25 November 1911 – 19 October 1988) was a Finnish boxer who won the welterweight contest at the 1936 Summer Olympics. ...

 

Cardiff City beralih ke halaman ini. Untuk kegunaan lain, lihat Cardiff City (disambiguation). Cardiff CityNama lengkapCardiff City Football ClubJulukanThe BluebirdsNama singkatCAR, CCFC, CityBerdiri1899; 124 tahun lalu (1899) (bernama Riverside A.F.C.)StadionStadion Cardiff City(Kapasitas: 33.316[1])Pemilik Vincent TanKetua Mehmet DalmanManajer Neil WarnockLigaKejuaraan EFL2019–20ke-5, Liga Championship InggrisSitus webSitus web resmi klub Kostum kandang Kostum ketiga Mus...

Muhammad SarmujiLahir10 Juni 1974 (umur 49)Surabaya, Jawa TimurKebangsaanIndonesiaSuami/istriLuluk MaknuniahAnak1.Muhammad Sutojoyo Sulthana Nashir 2.Prabu Linuwih Muhammad A'dhom 3.Narendra Mukti Muhammad aqeelOrang tuaH. Kusmin Abdullah dan Hj. Giyah Muhammad Sarmuji, S.E., M.Si. (lahir 10 Juni 1974) adalah Anggota DPR RI periode 2014-2019 dari Partai Golongan Karya. Terpilih pada usia 40 tahun dari Daerah Pemilihan (dapil) Jatim VI. Sarmuji memulai perjalanan politiknya dengan menjad...

 

Waltham, MassachusettsKotaWaltham di tepi Sungai CharlesLetak Waltham di County Middlesex, MassachusettsNegaraAmerika SerikatNegara bagianMassachusettsCountyMiddlesexPendirian1634Pemerintahan • Wali kotaJeannette A. McCarthyLuas • Total13,6 sq mi (35,2 km2) • Luas daratan12,7 sq mi (32,9 km2) • Luas perairan0,9 sq mi (2,4 km2)Ketinggian50 ft (15 m)Populasi (2007) • Total59.7...

 

العلاقات المغربية الفانواتية المغرب فانواتو   المغرب   فانواتو تعديل مصدري - تعديل   العلاقات المغربية الفانواتية هي العلاقات الثنائية التي تجمع بين المغرب وفانواتو.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: وجه المقا...

Performing arts center in Atlanta, Georgia Woodruff Arts CenterLocation in Midtown AtlantaEstablished1968Location1280 Peachtree StreetAtlantaCoordinates33°47′21″N 84°23′07″W / 33.78925°N 84.38515°W / 33.78925; -84.38515PresidentHala ModdelmogPublic transit accessArts Center stationWebsitewww.woodruffcenter.org Woodruff Arts Center is a visual and performing arts center located in Atlanta, Georgia. The center houses three not-for-profit arts divisions on one...

 

مدرسة علمية آية الله حق شناس مدرسه علمیه آیت‌الله حق‌شناس مدرسة علمية آية الله حق شناس معلومات الموقع الجغرافي المدينة طهران البلد  إيران تعديل مصدري - تعديل   مدرسة علمية آية الله حق شناس هي مدرسة الإسلامية تاريخية تعود إلى القاجاريون، وتقع في طهران.[1] مراجع ^ Ency...

 

Cinta Fitri Season 6Genre Drama Roman Keluarga PembuatMD EntertainmentDitulis olehLintang WardhaniSkenarioLintang WardhaniSutradaraEncep MasdukiPemeran Teuku Wisnu Shireen Sungkar Dinda Kanya Dewi Shandy Syarif Verlita Evelyn Iqbal Pakula Adly Fairuz Donita Edwin Irmansyah Nuri Maulida Lian Firman Penggubah lagu temaTeuku Wisnu feat. Shireen SungkarLagu pembukaCinta Kita oleh Teuku Wisnu feat. Shireen SungkarLagu penutupCinta Kita oleh Teuku Wisnu feat. Shireen SungkarPenata musikIwang...

Zabulistan Peta Zabulistan, abad ke-7 hingga ke-10 Agama Zoroastrianisme, Buddhisme, Hinduisme, Islam Ibu kota Ghazni Wilayah Antara Khorasan dan anak benua India Zabulistan (Persia: زابلستان Zābulistān/Zābolistān/Zāwulistān or simply زابل Zābul, Pashto: زابل Zābəl), adalah sebuah wilayah di Afganistan selatan yang kurang lebih sama dengan Provinsi Zabul dan Ghazni pada zaman modern.[1][2] Setelah dikuasai oleh Ghaznawiyah, Zabul menjadi sinonim denga...

 

Voce principale: Novara Calcio. Associazione Calcio NovaraStagione 1940-1941Sport calcio Squadra Novara Allenatore Carlo Rigotti Presidente Alvise Peretti Serie A15º posto, retrocesso in Serie B. Coppa ItaliaOttavi di finale. Maggiori presenzeCampionato: Galli (30)Totale: Galli (31) Miglior marcatoreCampionato: Barberis, Pasinati (6)Totale: Barberis, Pasinati (6) 1939-1940 1941-1942 Si invita a seguire il modello di voce Questa voce raccoglie le informazioni riguardanti l'Associazione ...

 

Oxfordshire shown within England The county of Oxfordshire is divided into five districts. The districts of Oxfordshire are Oxford, Cherwell, South Oxfordshire, Vale of White Horse, and West Oxfordshire. As there are 694 Grade II* listed buildings in the county they have been split into separate lists for each district. Grade II* listed buildings in Cherwell (district) Grade II* listed buildings in Oxford Grade II* listed buildings in South Oxfordshire Grade II* listed buildings in Vale of W...

2016 New Hampshire Republican presidential primary ← 2012 February 9, 2016 (2016-02-09) 2020 → ← IASC →23 pledged delegates to the 2016 Republican National Convention   Candidate Donald Trump John Kasich Ted Cruz Home state New York Ohio Texas Delegate count 11 4 3 Popular vote 100,735 44,932 33,244 Percentage 35.23% 15.72% 11.63%   Candidate Jeb Bush Marco Rubio Chris Christie Home state Florida Florida...

 

American playwright, librettist and theater director Moss HartHart in 1940Born(1904-10-24)October 24, 1904New York City, U.S.DiedDecember 20, 1961(1961-12-20) (aged 57)Palm Springs, California, U.S.Resting placeFerncliff CemeteryOccupationsPlaywrightlibrettisttheater directorSpouse Kitty Carlisle ​(m. 1946)​Children2RelativesBarney Aaron (great-grandfather) Moss Hart (October 24, 1904 – December 20, 1961) was an American playwright, librettist, and theater ...

 

2020年夏季奥林匹克运动会波兰代表團波兰国旗IOC編碼POLNOC波蘭奧林匹克委員會網站olimpijski.pl(英文)(波兰文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員206參賽項目24个大项旗手开幕式:帕维尔·科热尼奥夫斯基(游泳)和马娅·沃什乔夫斯卡(自行车)[1]闭幕式:卡罗利娜·纳亚(皮划艇)&#...

ヨハネス12世 第130代 ローマ教皇 教皇就任 955年12月16日教皇離任 964年5月14日先代 アガペトゥス2世次代 レオ8世個人情報出生 937年スポレート公国(中部イタリア)スポレート死去 964年5月14日 教皇領、ローマ原国籍 スポレート公国親 父アルベリーコ2世(スポレート公)、母アルダその他のヨハネステンプレートを表示 ヨハネス12世(Ioannes XII、937年 - 964年5月14日)は、ロ...

 

Protestant School This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Briercrest College and Seminary – news · newspapers · books · scholar · JSTOR (December 2015) (Learn how and when to remove this message) Briercrest College and SeminaryEstablished1935PresidentMichael B. PawelkeUndergraduates640LocationCaronpo...

 

Gallo-Roman writer and physician Marcellus Empiricus, also known as Marcellus Burdigalensis (“Marcellus of Bordeaux”), was a Latin medical writer from Gaul at the turn of the 4th and 5th centuries. His only extant work is the De medicamentis, a compendium of pharmacological preparations drawing on the work of multiple medical and scientific writers as well as on folk remedies and magic. It is a significant if quirky text in the history of European medical writing, an infrequent subject of...

Cukil kayu buatan Francis Barlow, 1687; akhir dari Serigala Berbulu Domba Serigala berbulu domba adalah sebuah ungkapan atau idiom dari Alkitab yang dipakai untuk menyebut orang yang memainkan sebuah peran yang berseberangan dengan karakter asli mereka dengan tujuan berbahaya, terutama guru-guru palsu. Asal muasal Ungkapan serigala berbulu domba berasal dari khotbah Yesus di bukit yang tercantum dalam Perjanjian Baru: Waspadalah terhadap nabi-nabi palsu yang datang kepadamu dengan menyamar se...

 

1989 letter from Iranian to Soviet leader Khomeini's letter to Mikhail GorbachevCreated7 January 1989Author(s)Ruhollah KhomeiniMedia typeLetterSubjectInvited Gorbachev to consider Islam as an alternative to communist ideology This article is part of a series aboutMikhail Gorbachev Former General Secretary of the CPSU Former President of the Soviet Union Early life Secretariate (1985–1991) Soviet leader Perestroika – Uskorenie – Glasnost Anti-alcohol campaign Chernobyl disaster Demokrati...