All Projects → QianmiOpen → plume2

QianmiOpen / plume2

Licence: MIT license
🚀a lightweight React state container for web and app

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to plume2

Perfectwindows
PerfectWindows 软件家族 - Windows 从未如此完美!
Stars: ✭ 1,326 (+1691.89%)
Mutual labels:  simple, elegant
Ghost Theme Kaldorei
🎨 A Simple And Elegant Ghost Theme Derive From Default Theme Casper
Stars: ✭ 273 (+268.92%)
Mutual labels:  simple, elegant
Flocks.js
A radically simpler alternative to Flux - opinionated React state and rendering management
Stars: ✭ 72 (-2.7%)
Mutual labels:  flux, simple
Hacker
❤️ A simple theme for Hexo
Stars: ✭ 501 (+577.03%)
Mutual labels:  simple, elegant
Youtransfer
The simple but elegant self-hosted file transfer & sharing solution
Stars: ✭ 1,525 (+1960.81%)
Mutual labels:  simple, elegant
Riot
Simple and elegant component-based UI library
Stars: ✭ 14,596 (+19624.32%)
Mutual labels:  simple, elegant
Stockroom
🗃 Offload your store management to a worker easily.
Stars: ✭ 1,745 (+2258.11%)
Mutual labels:  flux, state-container
CalDOM
An agnostic, reactive & minimalist (3kb) JavaScript UI library with direct access to native DOM.
Stars: ✭ 176 (+137.84%)
Mutual labels:  simple
fluxy
Fluxy is a Flux architecture implementation written in Kotlin.
Stars: ✭ 25 (-66.22%)
Mutual labels:  flux
vertx-start
简单地、快速地启动vert.x的手脚架,保留了vert.x原汁原味的开发方式
Stars: ✭ 102 (+37.84%)
Mutual labels:  simple
react-molecule
Molecule is a light-weight framework that lets you reason about inter-component communication, dependency injection and logic decoupling.
Stars: ✭ 35 (-52.7%)
Mutual labels:  flux
fluxml.github.io
Flux Website
Stars: ✭ 20 (-72.97%)
Mutual labels:  flux
mocha-simple-html-reporter
Simple HTML reporter for Mocha
Stars: ✭ 16 (-78.38%)
Mutual labels:  simple
GapBot
Gap Messenger Api Bot Library for Python
Stars: ✭ 24 (-67.57%)
Mutual labels:  elegant
influxdb-client-ruby
InfluxDB 2.0 Ruby Client
Stars: ✭ 30 (-59.46%)
Mutual labels:  flux
DaggerFlux.jl
Distributed computation of differentiation pipelines to use multiple workers, devices, GPU, etc. since Julia wasn't fast enough already
Stars: ✭ 57 (-22.97%)
Mutual labels:  flux
mtDNS
动态域名解析服务,自动获取IP并解析至阿里云!
Stars: ✭ 25 (-66.22%)
Mutual labels:  simple
template-cluster-k3s
My highly opinionated template for deploying a single Kubernetes (k3s) cluster with Ansible and Terraform backed by Flux, SOPS, GitHub Actions, Renovate and more!
Stars: ✭ 861 (+1063.51%)
Mutual labels:  flux
lwpkt
Lightweight packet protocol structure for multi-device communication focused on RS-485
Stars: ✭ 71 (-4.05%)
Mutual labels:  simple
Recon
HA LDAP based key/value solution for projects configuration storing with multi master replication support
Stars: ✭ 12 (-83.78%)
Mutual labels:  simple

New Idea, New the World. 🔥🔥🔥

技术也是时尚驱动的,我们常常臣服于时尚,面对快速的变化常常让我们局促不安,
开始焦虑,唯恐错过了些什么,怎么打破这种焦虑?
需要在快速变化得世界里保持清醒,保持独立的思考和认知。
让我们回归到技术的本质, 因为解决了真实的问题,技术才变得有价值。
真正牛\*的技术,都是静悄悄的跑在线上...

plume2 🚀🚀🚀

light-weight predict scalable framework React for web and mobile

NPM

Reactive and Predictable state container for React or ReactNative.

Features

  • Light-weight
  • Reactive
  • Predict
  • Scalable
  • Trace Data Flow

Thanks

  • React/Native
  • Immutable.js
  • MapReduce
  • Functional Reactive Programming.

iflux

很早很早之前,我们爱上了 React and immutable,所以就有了很简单的 iflux。

iflux = immutable.js + react.js

NPM

保持简单

+-----------------------+
|       WebApi          |
+-----------------------+
          |
         \|/
+-----------------------+
|   Store(immutable)   |<-----+
+-----------------------+      |
           | //es5 style       |
           | StoreMixin        | msg(EventEmitter)
          \|/                  |
+------------------------+     |
|     React App          |-----|
+------------------------+
|      <Layout>          |
|        <SearchForm/>   |
|        <Toolbar/>      |
|        <DataGrid/>     |
|       </Layout>        |
+------------------------+

优点:

  • 简单直接,几乎没有什么规则
  • 单根数据源(single data source)
  • Immutable fronted UI
  • High Performance

但是随着业务的不断的发展,数据层的复杂度也在上升。这时候 iflux 就会暴露出很多的缺点

  • Big Store, Store 中大量的数据和业务的处理,代码膨胀的厉害
  • Store 是单例,不销毁,有共享的问题
  • store 的数据通过 props 不断的透传,代码写的很费劲
  • 大量的数据之间的依赖关系,需要手动的保证和处理

怎么解决?

  • 使用 MapReduce 的理念解决 big Store
  • 使用@Relax 自动注入 store 中的数据和事件
  • Store 不再是单例
  • 使用 FRP 的理念, 简单的实现反应式数据,抽象源数据和派生数据

这就是我们的 plume2

+------------------+
|     BFF-API      |
+------------------+
        ||
        \/
+------------------+
|     WebApi       |
+------------------+
        ||
        \/
+------------------+
|     Store        | ====> [Actor1, Actor2, Actor3]
+------------------+
        ||
        \/
+------------------+
|  @StoreProvider  |
+------------------+
        ||
        \/
+------------------+
|     @Relax       |
+------------------+
        ||
        \/
+------------------+
|     QL/DQL       |
+------------------+

Getting Started

# add dependencies
yarn add plume2 # npm install plume2

# web
yarn add react react-dom # yarn add preact preact-compat

quick demo

//domain Object
//Actor, Store, StoreProvider, Relax, ViewAction

class HelloActor extends Actor {
  defaultState() {
    return { text: 'hello world' };
  }
}

class HelloViewAction extends ViewAction {
  sayHello = text => {
    this.store.dispatch('say:hello', text);
  };
}

class AppStore extends Store {
  bindActor() {
    return [HelloActor];
  }

  bindViewAction() {
    return {
      HelloViewAction
    };
  }
}

@Relax
class Text extends React.Component {
  static relaxProps = {
    text: 'text',
    viewAction: 'viewAction'
  };

  render() {
    const { text, viewAction } = this.props.relaxProps;
    return (
      <div onClick={() => viewAction.HelloViewAction.sayHello(text)}>
        {text}
      </div>
    );
  }
}

@StoreProvider(AppStore)
class HelloApp extends React.Component {
  render() {
    return <Text />;
  }
}

ReactDOM.render(<HelloApp />, document.getElementById('app'));

contributes

thanks all(pr, issue)

document

plume2

FAQ

  1. TypeError: Class constructor Store can not be invoked without 'new'?

err

默认我们的 plume2 发布的模块级别是 es6,为了让我们调试方便,没有编译到 es5 的 level。这样在和 webpack 的配合的时候,webpack 一般在配置 babel-loader 的时候,会忽略 node_modules 这样会导致我们业务代码编译级别是 es5,plume2 是 es6,就会报这个错误。

[email protected] 默认发布的就是 es5 module 不再需要提前的任意转换 [email protected] 之后,默认发布的就是 es5 module,不在需要这种转换

  1. ReactNative can not find react-dom module

这是什么原因呢?因为我们的 store 模块依赖了 react-dom,在 react-native 的环境是没有 react-dom 这个模块,所以请使用我们的一个自定义的 babel 插件来解决问题。

yarn add babel-plugin-plume2 --dev
//.babelrc
{
  "plugins": [
    ["plume2", {"reactnative": true}]
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].