阅读 275

一起学习下一代前端框架 Omi

Omi 是什么

去万物糟粕,合精华为一, 4kb JavaScript 的下一代 Web 框架 (Web Components + JSX + Proxy + Store + Path Updating).

Omi 设计思想

  • Web Components 也可以数据驱动视图, UI = fn(data)
  • 基于 Shadow/Light Dom 设计样式天然原生态隔离,社区生态的最优解决方案
  • Shadowt DOM 与 Virtual DOM 融合双管齐下解决 View 层的各种问题
  • Web ComponentsJSX 融合为一个框架 Omi
  • 框架无关任何框架可以使用 Omi 自定义元素
  • 提供桌面、移动和小程序整体解决方案

Omi Demo

有 react 开发经验的可以很快速的迁移 omi 的核心本身也就是 webcomponent + jsx

import { define, WeElement } from 'omi'

define('hello-element', class extends WeElement {
  onClick = evt => {
    // trigger CustomEvent
    this.fire('Abc', { name: 'dntzhang', age: 12 })
    evt.stopPropagation()
  }

  static propTypes = {
    msg: String
  }

  static css = `
      div {
        color: red;
        cursor: pointer;
      }`

  render(props) {
    return (
      <div onClick={this.onClick}>
        Hello {props.msg}
        <div>Click Me!</div>
      </div>
    )
  }
})

复制代码

Omi 学习资料

WebComponent 学习github.com/Tencent/omi…

Omi 官方文档tencent.github.io/omi/site/do…

awesame-webcomponentproject-awesome.org/mateusortiz…

MDN webcomponentdeveloper.mozilla.org/zh-CN/docs/…

关于 Omi 贡献

欢迎更多用户加入 Omi 生态中,也欢迎各位开发者为 Omi 贡献代码。及时提出 issue 提出你的痛点,我们一起解决,也欢迎大家不要吝啬 pull requst 保证最快进行反馈。

Omi 周边生态

Omi 自最新版后本着大道至简的原则官方推荐使用以及 Readme 文档对一些内容进行了隐藏,因此需要在 GitHub Omi 项目中切换到 V6 分支进行查看.

Ecosystem of Omi

💯Base

ProjectDescription
omi-docs and codepen and webcomponents.devOmi official documents
omix小程序全局状态管理框架,数据触手可及,状态无处遁形
omimCross frameworks and themes components.(DOCS & REPL && JOIN US!)
omi-kbone使用 omi + kbone 多端开发(小程序和Web)的贪吃蛇游戏。
omioOmi for old browsers with same api(IE8+)
omisOmis + React
omi-ssrServer-side rendering(support omio only)
omi-routerOmi official router in 1KB js
omi-cliProject scaffolding. → Base Templates and → Other Templates
omi-devtoolsBrowser DevTools extension
omiuSimple Omi UI
omilWebpack loader for Omi.js components.(DOCS)
omi-snippetsA beautify VSCode extension for .omi or .eno file, Install now!
obaa or JSONPatcherProxyObserve or Proxy any object's any change

🐍Snake MVP

ProjectDescription
omi-snake → Touch the demoThe Snake-Eating Game Based on MVP Architecture Written by Omi
omi-kbone-snakeomi-kbone 写的 MVP 架构的跨端贪吃蛇游戏,支持小程序和 H5
Preact-snake & → Touch the demoThe Snake-Eating Game Based on MVP Architecture Written by Preact + Preact-CSS + Omis
[P]react-snake & → Touch the demoThe Snake-Eating Game Based on MVP Architecture Written by React/Preact
omix-snakeThe Snake-Eating Game Based on MVP Architecture Written by Omix

👍Mini Program(小程序)

ProjectDescription
omix小程序全局状态管理框架,数据触手可及,状态无处遁形
react-kbone直接使用 React 开发小程序或 Web,基于 kbone
preact-kbone直接使用 Preact 开发小程序或 Web,基于 kbone
omi-cloud小程序•云开发
omip直接使用 Omi 开发小程序或 H5 SPA
mps原生小程序增强框架(JSX + Less 输出 WXML + WXSS),也支持 QQ 轻应用
cax小程序 Canvas 和 SVG 渲染引擎
omi-mp通过微信小程序开发和生成 Web 单页应用(H5 SPA)
westore小程序状态管理
comi小程序代码高亮和 markdown 渲染组件
wx-touch-event基于 AlloyFinger 改造的小程序手势解决方案

📚Other

ProjectDescription
omi-pianoBuild piano with Omi and Omi Snippets, Enjoy now!
omi-chartSimple HTML5 Charts using chart-x tag.
md2siteStatic Site Generator with markdown powered by Omio.
omi-30-secondsUseful Omi snippets that you can understand in 30 seconds.
omi-canvasPerfect fusion of web components, jsx and canvas.
omi-swiperOmi + Swiper
omi-vscodeVSCode extension for omi, Install now!
omi-exOmi.js extension(TypeScript)
omi-transformOmi / css3transform integration. Made css3 transform super easy in your Omi project.
omi-fingerSupport touch and gesture events in your Omi project.
omi-touchSmooth scrolling, rotation, pull to refresh and any motion for the web.
omi-nativeRender web components to native
omi-i18nInternationalization solution for omi.js using i18next ecosystem
omi-pageTiny client-side router by page
omieBuild cross platform desktop apps with Omi.js and Electron.js
omi-cvCreate a front-end engineer curriculum vitae, Get Started!
SooHas same API as omi but is great alternative if you want to create custom elements without JSX, virtual DOM and store
CEEFork from custom-elements-everywhere
文章分类
前端