• Stars
    star
    172
  • Rank 220,311 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Multiple-backend declarative component-based JavaScript framework

glass-easel

the new component-based framework for WeChat MiniProgram

test

中文版 README

glass-easel is the new implementation of the component management framework for WeChat MiniProgram. Exactly, it is a JavaScript component-based UI framework, designed to component-based and declarative UI development.

glass-easel is a rewrite of the legacy framework. It keeps the feature-level compatibilities, while some new features are added. The framework runtime does not require specific MiniProgram environment, which means it can be executed in web or other JavaScript environments.

Major Features

glass-easel allows the same component code executed in different environments, i.e. in both web and MiniProgram environments.

Backend is an important concept, which represents the current environment of the framework runtime. When executed in browser, the backend is the DOM interface; in MiniProgram, the backend is the MiniProgram environment interface.

glass-easel contains the full implementation of custom components in MiniProgram, including templates, events, lifetimes, etc. Furthermore, glass-easel implements some extra practical features, and has better TypeScript support.

glass-easel uses a per-component tree-update algorithm (as the legacy framework), which has a balanced performance for different cases. This algorithm suits highly component-based programing.

Introduction for each Submodule

glass-easel is the core module that implements almost all features. However, its interface has some difference from the MiniProgram interface, but looks more like common JavaScript modules.

glass-easel-miniprogram-adapter is an interface adapter, which makes the core module interface more similar to the MiniProgram interface. glass-easel-miniprogram-webpack-plugin is the Webpack plugin working with the adapter. These two modules allows the use of WXML/WXSS/JS component files, just like the project directory structure of MiniProgram.

If you want to share code between web and MiniProgram environments, it is suggested to use all three modules above. If you decide to write the adapter or the build tools by yourself, the core module is enough.

glass-easel-template-compiler is the template compiler, which compiles WXML segments to JavaScript code.

glass-easel-stylesheet-compiler is the stylesheet compiler, which compiles WXSS segments to CSS code. If your code requires some style-related features, this module is needed.

Note that the two compilers are implemented in rust. If you try to compile them, rust and wasm-pack should be installed in your machine.

Submodule Name Language Description Package
glass-easel TypeScript The core module npm
glass-easel-miniprogram-adapter TypeScript The MiniProgram interface adapter npm
glass-easel-miniprogram-webpack-plugin JavaScript The Webpack plugin (work with the adapter) npm
glass-easel-template-compiler rust The template compiler crates.io npm
glass-easel-stylesheet-compiler rust The stylesheet compiler crates.io npm

Guides for Users

Like common npm packages, each submodule can be installed as you need. For example:

npm install --save glass-easel
npm install --save-dev glass-easel-template-compiler

The interface of glass-easel-miniprogram-adapter is the same as the custom component interface of MiniProgram. glass-easel-miniprogram-template is a project template.

TypeScript modules support TSDoc. The auto-generated documents are in GitHub pages.

For the rust interface, see the generated documents in docs.rs.

F.A.Q.

Is this module a part of the MiniProgram SDK?

For each submodule:

  • glass-easel is a part of the MiniProgram runtime;
  • glass-easel-template-compiler and glass-easel-stylesheet-compiler are parts of the MiniProgram compiler;
  • glass-easel-miniprogram-adapter and glass-easel-miniprogram-webpack-plugin are not, because they are designed for simulation on web environments.

However, no MiniProgram code can use any glass-easel submodules currently, because we are still checking the interface stabilities and compatibilities. When stable enough, MiniProgram code will be able to use glass-easel as the framework implementation.

Does this module contain implementation of MiniProgram components?

No. This module is the framework itself. Components like <view /> <image /> are not included.

This is because the implementation of the components are complex and deeply coupled with WeChat environment interfaces. We cannot simply reuse the code in web environments.

We will consider do another implementation on web in future.

Are some features unavailable in MiniProgram environments?

Some features of glass-easel are designed as new features, which will be available in MiniProgram environments.

However, some advanced features - like custom backend, custom template engine, external components, etc. - are impossible to use in MiniProgram code, because of the special environment limitation and some security strategies. If you are writing code that shares between web and MiniProgram, please refer to the custom components interface of MiniProgram and avoid the use of these unavailable features.

What are the differences between glass-easel and the legacy framework?

glass-easel contains all features of the legacy framework, and has 99% interface compatibilities. However, it is still a complete rewrite, which means some interface behaviors are not equivalent. Before glass-easel is formally available in the MiniProgram environment, we are trying to get better compatibilities.

glass-easel has some new features which will be available in MiniProgram.

Help us to Improve!

Bug reports and feature requests are welcomed!

Please note that glass-easel is only a small part of the MiniProgram SDK (generally the custom components part of it).

If you are trying to implement a new feature for the MiniProgram SDK, please contact us to confirm the feature should be a part of glass-easel (but not other modules of the MiniProgram SDK).

The GitHub repository is the main repository of this project.

If you are interested in new features that we are still implementing, refer to the Road Map.

LICENSE

Copyright 2023 wechat-miniprogram

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

miniprogram-demo

微信小程序组件 / API / 云开发示例
JavaScript
6,576
star
2

minigame-unity-webgl-transform

Wechat Mini Game Unity engine adapter documents.
C
2,856
star
3

weui-miniprogram

小程序WeUI组件库
TypeScript
2,070
star
4

threejs-miniprogram

WeChat MiniProgram adapted version of Three.js
JavaScript
692
star
5

api-typings

Type definitions for APIs of Wechat Mini Program in TypeScript
TypeScript
673
star
6

computed

小程序自定义组件 computed / watch 扩展
TypeScript
654
star
7

recycle-view

recycle-view: a wechat miniprogram custom component
JavaScript
620
star
8

miniprogram-simulate

小程序自定义组件测试工具集
JavaScript
487
star
9

kbone-ui

kbone-ui 是一套能同时支持 小程序(kbone) 和 vue 框架开发的多端 UI 库(PS:新版 kbone-ui 已出炉并迁移到 kbone 主仓库,此仓库仅做旧版维护之用)
Vue
439
star
10

sm-crypto

miniprogram sm crypto library
JavaScript
414
star
11

kbone-template-vue

a simple vue template for kbone
JavaScript
350
star
12

lottie-miniprogram

lottie for miniprogram
JavaScript
337
star
13

minigame-canvas-engine

轻量级canvas2d渲染引擎,开放数据域开发解决方案。
JavaScript
263
star
14

miniprogram-component-plus

JavaScript
253
star
15

miniprogram-custom-component

JavaScript
197
star
16

slide-view

weapp custom component -- slide-view
JavaScript
185
star
17

mobx-miniprogram-bindings

小程序的 MobX 绑定辅助库
TypeScript
175
star
18

minigame-demo

微信小游戏组件 / API / 云开发示例
JavaScript
150
star
19

navigation-bar

weapp custom component -- navigation-bar
JavaScript
148
star
20

wxml-to-canvas

JavaScript
146
star
21

kbone-template-react

a simple react template for kbone
JavaScript
134
star
22

minigame-adaptor

C#
131
star
23

miniprogram-i18n

小程序国际化方案 / The internationalizational (i18n) library for wechat miniprogram
TypeScript
129
star
24

miniprogram-slim

JavaScript
123
star
25

h5-to-miniprogram

a simple tool for transforming h5 to miniprogam
JavaScript
113
star
26

minigame-api-typings

Type definitions for APIs of Wechat Mini Game in TypeScript
TypeScript
106
star
27

minigame-lockstep-demo

JavaScript
102
star
28

awesome-skyline

94
star
29

kbone-api

TypeScript
73
star
30

skylint

Skyline 小程序迁移工具. Migration assistant for Skyline miniapp.
TypeScript
69
star
31

miniprogram-cli

JavaScript
68
star
32

miniprogram-compat

微信小程序 js 执行环境的兼容信息
JavaScript
66
star
33

mpflow

TypeScript
61
star
34

miniprogram-api-promise

JavaScript
59
star
35

miniprogram-file-uploader

JavaScript
57
star
36

xr-frame-cli

Tools for xr-frame in wechat miniprogram.
TypeScript
50
star
37

kbone-template-kboneui

JavaScript
43
star
38

j-component

a mock minprogram component framework
JavaScript
43
star
39

miniprogram-gesture

微信小程序手势库
JavaScript
39
star
40

h5-to-miniprogram-demo

一个简单的使用 h5-to-miniprogram 工具进行 h5 页面转换成小程序的 demo
JavaScript
31
star
41

miniprogram-elder-transform

小程序适老化自动适配工具
TypeScript
31
star
42

miniprogram-barrage

JavaScript
23
star
43

minigame-tuanjie-transform-sdk

JavaScript
22
star
44

miniprogram-hooks

小程序自定义组件 hooks
JavaScript
20
star
45

miniprogram-cloudbase-meeting-demo

云开发直播运营活动 demo
JavaScript
17
star
46

kbone-template-preact

a simple preact template for kbone
JavaScript
12
star
47

miniprogram-game-quickstart

JavaScript
12
star
48

wechat-miniprogram.github.io

HTML
11
star
49

miniprogram-quickstart

JavaScript
10
star
50

gtktest

Flutter linux demo with webview.
C++
9
star
51

miniprogram-offline-demo

小程序弱网/离线 demo
JavaScript
9
star
52

miniprogram-data-panel

小程序数据面板组件
JavaScript
6
star
53

xnet-miniprogram

Python
6
star
54

router

JavaScript
4
star
55

babel-preset-miniprogram

微信小程序 babel 构建环境预设
JavaScript
2
star
56

minigame-playable

TypeScript
2
star
57

miniprogram-mock

mock api for miniprogram
JavaScript
1
star
58

mp-user-avatar

TypeScript
1
star