内容简介:Recently I implementedThe solution is different from others in that it’s in language level, instead of writing tools such as preprocessor, svelte-draft itself is implemented inIn example
Recently I implemented svelte-draft , which is another way to add complete typescript support to svelte. I rewrote almost all examples in https://svelte.dev/tutorial and the result is repo svelte-draft-tutorial .
The solution is different from others in that it’s in language level, instead of writing tools such as preprocessor, svelte-draft itself is implemented in TypeDraft , which is a superset of typescript with built-in support for DSL extension, code transformation and literate programming.
Language support for reactivity
In example 2-reactivity/reactive-statements , we don’t need to use “$” to denote reactivity, instead we use DSL “watch”. The intention is clear here: watch count, if changed, execute the following statements.
React style component
We still use the React way to write component, and we don’t need to return JSX, just write it as is.
JSX as Template
We use JSX, but in template way, see examples in 4-logic :
We have “await ” tag to deal with promise, which is intuitive and straightforward:
And traditional “if” and “for” logic:
Slot
We can use slot with full power of typescript as well!
Transition & Animation
Let’s take transition as an example: 10-transitions/transition :
Return 0
That’s the basics of svelte-draft , and we also have template project and TodoMVC implementation .
Any feedback is welcome! :)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
形式感+:网页视觉设计创意拓展与快速表现
晋小彦 / 清华大学出版社 / 2014-1-1 / 59.00元
网页设计师从早年的综合性工作中分化出来,形成了相对独立的专业岗位,网页设计也不再是单纯的软件应用,它衍生出了许多独立的研究方向,当网站策划、交互体验都逐渐独立之后,形式感的突破和表现成为网页视觉设计的一项重要工作。随着时代的发展,网页设计更接近于一门艺术。网络带宽和硬件的发展为网页提供了使用更大图片、动画甚至视频的权利,而这些也为视觉设计师提供了更多表现的空间。另外多终端用户屏幕(主要是各种移动设......一起来看看 《形式感+:网页视觉设计创意拓展与快速表现》 这本书的介绍吧!
CSS 压缩/解压工具
在线压缩/解压 CSS 代码
正则表达式在线测试
正则表达式在线测试