3 个不稳定版本
0.1.1 | 2021 年 5 月 11 日 |
---|---|
0.1.0 | 2021 年 5 月 11 日 |
0.0.1 | 2021 年 5 月 8 日 |
791 在 文本处理
635KB
6.5K SLoC
unflow
设计即代码
待办事项
Flow
DSL -> DSL Parser -> DSL Json ---pipe---> Node.js -> Sketch
设置
- 安装 nightly
- 从: https://github.com/rrevenantt/antlr4rust 下载 antlr-4.8 rust 版本
DSL
任务流程 / 用户流程示例
flow login {
SEE HomePage
DO [Click] "Login".Button
REACT Success: SHOW "Login Success".Toast with ANIMATE(bounce)
REACT Failure: SHOW "Login Failure".Dialog
SEE "Login Failure".Dialog
DO [Click] "ForgotPassword".Button
REACT: GOTO ForgotPasswordPage
SEE ForgotPasswordPage
DO [Click] "RESET PASSWORD".Button
REACT: SHOW "Please Check Email".Message
}
元素
page HomePage {
LayoutGrid: 12x
LayoutId: HomePage
Router: "/home"
}
component Navigation {
LayoutId: Navigation
}
component TitleComponent {}
component ImageComponent {
Size: 1080px
}
component BlogList {
BlogDetail, Space8
BlogDetail, Space8
BlogDetail, Space8
BlogDetail, Space8
BlogDetail, Space8
BlogDetail, Space8
}
布局示例
Layout HomePage {
--------------------------
| Navigation(RIGHT) |
--------------------------
| Empty(2x) | TitleComponent | Empty(2x) |
--------------------------
| ImageComponent |
--------------------------
| BlogList(8x) | Archives(2x) |
--------------------------
| Footer |
--------------------------
}
Layout Navigation {
--------------------------------------
| "home" |"detail" | Button("Login") |
--------------------------------------
}
库定义示例
library FontSize {
H1 = 18px
H2 = 16px
H3 = 14px
H4 = 12px
H5 = 10px
}
library Color {
Primary {
label = "Primary"
value = "#E53935"
}
Secondary {
label = "Blue"
value = "#1E88E5"
}
}
library Button {
Default [
FontSize.H2, Color.Primary
]
Primary [
FontSize.H2, Color.Primary
]
}
参考资料: AutoLayout.js,Apple 的 Auto Layout,Visual Format Language
许可证
代码基于: https://github.com/phodal/design
此代码根据 MIT 许可证分发。请参阅此目录中的 LICENSE
。
依赖项
~12MB
~233K SLoC