All Projects → fantasticit → Ramiko

fantasticit / Ramiko

nextjs + nest.js 构建页面可视化编辑器 -- Ramiko

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ramiko

Odiff
The fastest pixel-by-pixel image visual difference tool in the world.
Stars: ✭ 1,173 (+682%)
Mutual labels:  visual
Mobile Web Best Practice
🐯 移动 web 最佳实践
Stars: ✭ 1,333 (+788.67%)
Mutual labels:  h5
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+1138%)
Mutual labels:  h5
Vue H5 Template
🎉vue搭建移动端开发,基于vue-cli4.0+webpack 4+vant ui + sass+ rem适配方案+axios封装,构建手机端模板脚手架
Stars: ✭ 1,261 (+740.67%)
Mutual labels:  h5
Projecttemplate
个人项目模板
Stars: ✭ 93 (-38%)
Mutual labels:  h5
Pipes
Repository for Pipes
Stars: ✭ 107 (-28.67%)
Mutual labels:  visual
Ui
Web UI for CodeceptJS
Stars: ✭ 65 (-56.67%)
Mutual labels:  visual
Bot Evolution
An interesting display of evolution through neural networks and a genetic algorithm
Stars: ✭ 135 (-10%)
Mutual labels:  visual
Baiduwallet
baiduWallet是一个基于H5的移动端项目,大量使用css3动画和js特效
Stars: ✭ 94 (-37.33%)
Mutual labels:  h5
Opensource
♨️ 分享GitHub优秀开源项目和主流开发使用的网站、解决问题方案收集以及学习网站或资料,涵盖了iOS, macOS X, Blockchain, Flutter, Weex, H5, Games, C++, Script等多方面的内容,其中iOS大致包涵以下内容:音视频;IM和直播;逆向开发;图像相关(OpenGL, Metal, GPUImage);内购(IAP), ApplePay和第三方支付;安全攻防和应用加固, 数据安全和算法;常用第三方库;导航栏和状态栏;侧边菜单;数据持久;蓝牙, 手势指纹面容ID解锁, 图片浏览器, 扫码, 下拉和上拉刷新, 指示器, Toast, Menu, Sensor, Privacy, WebView和进度条, 动画, 选择器, 搜索, 分享, 图片验证码, 设备相关信息, 广告, 高仿项目及Demo等。
Stars: ✭ 123 (-18%)
Mutual labels:  h5
Clock
可视化任务调度系统,精简到一个二进制文件 (Web visual task scheduler system , yes ! just one binary solve all the problems !)
Stars: ✭ 86 (-42.67%)
Mutual labels:  visual
Postcss Grid Kiss
A PostCSS plugin to keep CSS grids stupidly simple
Stars: ✭ 1,270 (+746.67%)
Mutual labels:  visual
Dctt h5
xx头条【完整项目持续迭代中】基于HBuilderX ,MUI开发(一款本地生活信息发布APP,分享新鲜事、找人找对象等生活服务)仅供学习交流
Stars: ✭ 116 (-22.67%)
Mutual labels:  h5
Plus Small Screen Client
本库已经合并进入 https://github.com/slimkit/plus 中,仅提供 2.1 及以前版本下载使用!
Stars: ✭ 83 (-44.67%)
Mutual labels:  h5
Kudos
Kudos is a simple, high-performance, easy to expand and easy to deploy distributed game service framework based on microservice architecture, It is based on RPC of rpcx, supports pomelo communication protocol and can be easily applied to game development.
Stars: ✭ 132 (-12%)
Mutual labels:  h5
Visualmasm
Visual MASM - Assembly IDE for Microsoft MASM
Stars: ✭ 1,172 (+681.33%)
Mutual labels:  visual
Aet
AET - a system that detects visual changes on web sites and performs basic page health checks
Stars: ✭ 100 (-33.33%)
Mutual labels:  visual
Vassonic
VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Stars: ✭ 11,466 (+7544%)
Mutual labels:  h5
Ahorn
Visual Map Maker and Level Editor for the game Celeste
Stars: ✭ 132 (-12%)
Mutual labels:  visual
Markvis
make visualization in markdown. 📊📈
Stars: ✭ 1,509 (+906%)
Mutual labels:  visual

next.js + nest.js 构建页面可视化编辑器 -- Ramiko

前言

最近看了不少关于 h5 页面制作工具。端午闲来无事,决定尝试下一个页面搭建工具。效果如下:

gif 录制效果不佳,可以访问以下链接进行体验。

技术栈

  • next.js:前端模块化开发
  • sass: 配合使用 css modules
  • nest.js:服务端语言
  • MySQL:数据存储

整体架构

前端开发组件库,完善组件类型,编辑器读取组件完成页面搭建,将页面数据发送至服务端保存。 访问页面,从服务端拉取页面数据,前端渲染页面即可。

编辑器设计

编辑器整体结构图

.
|____index.tsx
|____plugins               ## 组件库管理
|____Editor.tsx            ## 编辑器
|____type.ts               ## 类型定义
|____components
| |____Pannel              ## 左侧组件面板
| |____Preview             ## 中间预览面板
| |____Editor              ## 组件编辑器实现
| | |____index.tsx
| | |____PropsEditor
| | | |____index.tsx
| | | |____components
| | | | |____SwitchEditor
| | | | |____RadioEditor
| | | | |____ImgEditor
| | | | |____ColorEditor
| | | | |____TextEditor
| | | | |____TextareaEditor
| | | | |____NumberEditor
| | | |____renderEditorItem.tsx
| | | |____UnionEditor.tsx
| | |____FunctionEditor
| | |____SettingEditor
|____renderPage.tsx

数据结构

定义页面数据结构

既然是可视化页面搭建,那么页面必须可以以某种数据结构进行描述。比如:

{
  setting: {
  } // 页面设置
  components: []; // 页面使用到的组件
}

定义组件数据结构

页面核心是由组件搭建而成的,那么就要定义组件的数据结构。

import React from 'react';

export const Title = ({ title, style }) => {
  return <h1>{title}</h1>;
};

Title.defaultProps = {
  title: '标题'
};

Title.schema = {
  title: {
    title: '标题',
    type: 'text'
  }
};

核心可以抽象为:

{
  name: 'Title'; // 对应组件名
  props: {
  }
  schema: {
  }
}

name

不可能把组件源代码保存到服务端,所以这里只保存组件的名称,前端渲染时,根据该名称找到对应组件渲染即可(类似 Vue.js 的动态组件)

props

React 组件的 props,这里使用 defaultProps 赋值默认值

schema

对应 props 各个属性的描述,用于编辑器针对进行渲染。进行组件编辑,实际上编辑的是组件的 propsprops 改变组件的渲染结果自然改变。为了对 props 进行编辑,需要定义 props 的描述语言,通过 props 描述来进行属性编辑。这里使用如下的 schema

{
  title: '标题';
  type: 'text';
}

对应组件 props.title,通过 type 可以决定如何渲染编辑器组件。

无渲染组件

可能光能渲染组件是不够的,也许需要更多的功能包装,比如埋点。这一类函数本质上也是组件。可以通过 schema 定义进行 props 编辑。举个例子:

import React from 'react';

export const Tracking = ({ op, pageSn, pageElSn, children }) => {
  const onClick = () => {
    alert('埋点测试:' + op + '_' + pageSn + '_' + pageElSn);
  };

  return <div onClick={onClick}>{children}</div>;
};

Tracking.defaultProps = {
  op: 'click',
  pageSn: null,
  pageElSn: null
};

Tracking.schema = {
  op: {
    title: '曝光方式',
    type: 'radio',
    options: ['click', 'pv']
  },
  pageSn: {
    title: '页面编号',
    type: 'number'
  },
  pageElSn: {
    title: '元素编号',
    type: 'number'
  }
};

丰富完善

  1. 丰富组件库
  2. 优化编辑器:比如添加组件拖拽功能。

项目启动

Github:传送门

clientserver 分别执行 yarn dev 即可。

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].