Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* chore: bump version

* fix(miniapp): usePageShow not work in wechat (#1999)

* fix(jsx2mp): usingComponents path error when disableCopyNpm (#1988)

* fix(miniapp): judge __sharedEventNames

* refactor: optimize miniapp runtime render (#2002)

* fix: render error

* fix: render error

* refactor: optimize render

* refactor: class

* chore: refactor attribute

* refactor(miniapp): getElement in document and element

* refactor(miniapp): use BFS to replace resursion

* refactor(miniapp): use map to replace object

* fix(miniapp): lint error

* refactor: native props

* docs(miniapp): add get element example

* fix(miniapp): exclude self node in element getelement

* chore: remove tag props

* fix(miniapp): separate nodeIdMap from idMap

* refactor(miniapp): __eventHandlerMap

* refactor(miniapp): style value

* refactor: style

* refactor: style

* feat(miniapp): remove builtin components props

* refactor(miniapp): node renderInfo

* fix(miniapp): onchange not work in textarea

* refactor: driver createElement

* chore: bump version

* chore: remove useless code

* chore(example): add multipleSlots config in example

* fix: custom component render

* fix: custom component render

* chore: remove lock file

* fix(miniapp): input/textarea

* fix(miniapp): test case (#2014)

* fix(miniapp): test case

* fix(miniapp): event process

* fix(miniapp): dataset and classList

* fix(miniapp): lint error

* fix(miniapp): classList toggle

* fix(miniapp): can't extend from Set

* fix(miniapp): lint error

* fix(miniapp): use contain to replace has

Co-authored-by: 逆葵 <[email protected]>
Co-authored-by: NK <[email protected]>

* fix(miniapp): input/textarea focus-state not update

* fix(miniapp): not trigger style update if node is not rendered

Co-authored-by: NK <[email protected]>
Co-authored-by: 逆葵 <[email protected]>
  • Loading branch information
3 people authored Sep 16, 2020
1 parent 714948f commit 0f83651
Show file tree
Hide file tree
Showing 96 changed files with 1,511 additions and 4,750 deletions.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ npm run build
* app-lifecycle: 使用 app 生命周期
* page-lifecycle-with-router: 使用 page 生命周期 + 路由跳转
* event-handler: 事件绑定(编译时小程序)

* get-element: document/element getElementXXX 相关 API
3 changes: 3 additions & 0 deletions examples/get-element/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['rax']
};
17 changes: 17 additions & 0 deletions examples/get-element/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

*~
*.swp
*.log

.DS_Store
.idea/
.temp/

build/
dist/
lib/
coverage/
node_modules/

template.yml
15 changes: 15 additions & 0 deletions examples/get-element/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# rax-materials-basic-app

## Getting Started

### `npm run start`

Runs the app in development mode.

Open [http://localhost:9999](http://localhost:9999) to view it in the browser.

The page will reload if you make edits.

### `npm run build`

Builds the app for production to the `build` folder.
7 changes: 7 additions & 0 deletions examples/get-element/abc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "rax",
"builder": "@ali/builder-rax-v1",
"info": {
"raxVersion": "1.x"
}
}
20 changes: 20 additions & 0 deletions examples/get-element/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"inlineStyle": false,
"plugins": [
[
"build-plugin-rax-app",
{
"targets": [
"miniapp",
"wechat-miniprogram"
],
"miniapp": {
"buildType": "runtime"
},
"wechat-miniprogram": {
"buildType": "runtime"
}
}
]
]
}
33 changes: 33 additions & 0 deletions examples/get-element/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@rax-materials/scaffolds-app-js",
"author": "rax",
"description": "Rax 无线跨端应用工程,使用 JavaScript。",
"version": "0.1.0",
"scripts": {
"build": "build-scripts build",
"start": "build-scripts start",
"lint": "eslint --ext .js --ext .jsx ./"
},
"dependencies": {
"rax": "^1.1.0",
"rax-app": "^2.0.0",
"driver-universal": "^3.0.0",
"rax-image": "^2.0.0",
"rax-link": "^1.0.1",
"rax-text": "^1.0.0",
"rax-view": "^1.0.0",
"rax-document": "^0.1.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.0",
"babel-eslint": "^10.0.3",
"build-plugin-rax-app": "^5.0.0",
"eslint": "^6.8.0",
"eslint-config-rax": "^0.1.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-module": "^0.1.0",
"eslint-plugin-react": "^7.18.0"
},
"private": true,
"originTemplate": "@rax-materials/scaffolds-app-js"
}
28 changes: 28 additions & 0 deletions examples/get-element/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { runApp, useAppLaunch, useAppShow, useAppHide, useAppShare, useAppError } from 'rax-app';
import appConfig from './app.json';

useAppLaunch((options) => {
console.log('app launch', options);
});

useAppShow((options) => {
console.log('app show', options);
});

useAppHide(() => {
console.log('app hide');
});

useAppShare(() => {
return {
title: '分享标题',
desc: '分享详细说明',
path: 'pages/Home/index'
};
});

useAppError(() => {
console.log('app error');
});

runApp(appConfig);
11 changes: 11 additions & 0 deletions examples/get-element/src/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"routes": [
{
"path": "/",
"source": "pages/Home/index"
}
],
"window": {
"title": "Rax App"
}
}
5 changes: 5 additions & 0 deletions examples/get-element/src/components/Logo/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.logo {
width: 200rpx;
height: 180rpx;
margin-bottom: 20rpx;
}
15 changes: 15 additions & 0 deletions examples/get-element/src/components/Logo/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createElement } from 'rax';
import Image from 'rax-image';

import './index.css';

export default (props) => {
const { uri } = props;
const source = { uri };
return (
<Image
className="logo"
source={source}
/>
);
};
21 changes: 21 additions & 0 deletions examples/get-element/src/document/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createElement } from 'rax';
import { Root, Style, Script} from 'rax-document';

function Document() {
return (
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,viewport-fit=cover" />
<title>rax-materials-basic-app</title>
<Style />
</head>
<body>
{/* root container */}
<Root />
<Script />
</body>
</html>
);
}
export default Document;
16 changes: 16 additions & 0 deletions examples/get-element/src/pages/Home/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.home {
align-items: center;
margin-top: 200rpx;
}

.title {
font-size: 45rpx;
font-weight: bold;
margin: 20rpx 0;
}

.info {
font-size: 36rpx;
margin: 8rpx 0;
color: #555;
}
61 changes: 61 additions & 0 deletions examples/get-element/src/pages/Home/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { createElement, useEffect } from 'rax';
import View from 'rax-view';
import Text from 'rax-text';

import './index.css';

import Logo from '../../components/Logo';

export default function Home() {
useEffect(() => {
const father1 = document.getElementById('father');
const father2 = document.querySelector('#father');
const father3 = document.querySelectorAll('#father');

console.log('Home -> father1', father1);
console.log('Home -> father2', father2);
console.log('Home -> father3', father3);

const home1 = document.getElementsByClassName('home');
const home2 = document.querySelector('.home');
const home3 = document.querySelectorAll('.home');
console.log('Home -> home1', home1);
console.log('Home -> home2', home2);
console.log('Home -> home3', home3);

const div1 = document.getElementsByTagName('div');
const div2 = document.querySelector('div');
const div3 = document.querySelectorAll('div');
console.log('Home -> div1', div1);
console.log('Home -> div2', div2);
console.log('Home -> div3', div3);

const child = document.getElementById('child1');
const subDiv1 = child.getElementsByTagName('div');
const subDiv2 = child.querySelector('div');
const subDiv3 = child.querySelectorAll('div');
console.log('Home -> subDiv1', subDiv1);
console.log('Home -> subDiv2', subDiv2);
console.log('Home -> subDiv3', subDiv3);

const red1 = child.getElementsByClassName('red');
const red2 = child.querySelector('.red');
const red3 = child.querySelectorAll('.red');
console.log('Home -> red1', red1);
console.log('Home -> red2', red2);
console.log('Home -> red3', red3);
});
return (
<View id="father" className="home">
<div id="child1" className="son">
<div className="red"></div>
<div className="green"></div>
<div className="red"></div>
</div>
<div id="child2" className="son"></div>
<div id="child3" className="son"></div>
<div id="child4" className="son"></div>
<div id="child5" className="son"></div>
</View>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Component({
options: {
multipleSlots: true
},
methods: {
onClick() {
this.triggerEvent('click');
Expand Down
28 changes: 27 additions & 1 deletion examples/with-miniapp-plugin-component/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,33 @@
"miniprogramRoot": "build/wechat-miniprogram/",
"pluginRoot": "wechat-miniprogram-plugin/",
"compileType": "plugin",
"setting": {},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false
},
"appid": "wxc0575284fd6f4091",
"projectname": "with-miniapp-plugin-component",
"simulatorType": "wechat",
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-miniapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "driver-miniapp",
"version": "0.1.2",
"version": "0.1.3",
"description": "MiniApp (runtime) driver for Rax",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down
Loading

0 comments on commit 0f83651

Please sign in to comment.