Skip to content

Commit

Permalink
v3.2.1 released, merge from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiz committed Jan 16, 2019
2 parents 1dd6392 + 05c262e commit b306116
Show file tree
Hide file tree
Showing 20 changed files with 246 additions and 185 deletions.
23 changes: 20 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
{
"presets": [
"es2015",
"stage-3"
[
"@babel/env",
{
"modules": 'umd',
"targets": {
"node": "8.9",
},
},
],
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true,
},
],
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-object-rest-spread",
"add-module-exports"
],
"plugins": ["add-module-exports"]
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
English | [简体中文](./CHANGELOG_CN.md)

#### V3.2.1 (2019-01-16)

- [FEATURE] Add console command prompt. (by @65147400)
- [FIX] Fix `JSON.stringify` function which was incorrectly rewritten.
- [FIX] Fix `logNumber` bug which was not reset when clear logs. (by @liuyuekeng)
- [FIX] Fix unencoded HTML tag in Network tab. (by @mokang)
- [FIX] Fix possible crash when decode content in Storage tab. (by @wolfsilver)
- [IMPROVE] Add bottom safe area to adapt to full screen such as iPhone X. (by @dingyi1993)


#### V3.2.0 (2018-04-10)

- [FEATURE] Support `console.time()` and `console.timeEnd()`.
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
[English](./CHANGELOG.md) | 简体中文

#### V3.2.1 (2019-01-16)

- 【特性】新增控制台输入提示。 (by @65147400)
- 【修复】修复 `JSON.stringify` 函数被错误地改写的问题。
- 【修复】修复清空日志时没有重置 `logNumber` 的问题。 (by @liuyuekeng)
- 【修复】修复 Network 面板中 HTML 标签未被 encode 的问题。 (by @mokang)
- 【修复】修复 Storage 面板 decode 内容时可能会导致崩溃的问题。 (by @wolfsilver)
- 【优化】增加底部安全区域,适配 iPhone X 等全面屏。 (by @dingyi1993)


#### V3.2.0 (2018-04-10)

- 【特性】支持 `console.time()``console.timeEnd()`
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ Plugin:

- [vConsole-sources](https://github.com/WechatFE/vConsole-sources)
- [vconsole-webpack-plugin](https://github.com/diamont1001/vconsole-webpack-plugin)


## CDN

- [v3.0.0](https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js) (Recommended)
- [v2.5.2](https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/2.5.2/vconsole.min.js)



## Changelog

Expand Down
7 changes: 0 additions & 7 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ vConsole 本体:



## CDN

- [v3.0.0](https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js) (推荐)
- [v2.5.2](https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/2.5.2/vconsole.min.js)



## 交流反馈

QQ 群:497430533
Expand Down
6 changes: 2 additions & 4 deletions dist/vconsole.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/demo1.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>vConsole/Demo1</title>
<link href="./lib/weui.min.css" rel="stylesheet"/>
<link href="./lib/demo.css" rel="stylesheet"/>
Expand All @@ -12,7 +12,7 @@

<!-- 引入vConsole的JS库 -->
<script src="../dist/vconsole.min.js"></script>

</head>
<body ontouchstart>
<div class="page">
Expand Down
2 changes: 1 addition & 1 deletion example/demo2.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>vConsole/Demo2</title>
<link href="./lib/weui.min.css" rel="stylesheet"/>
<link href="./lib/demo.css" rel="stylesheet"/>
Expand Down
2 changes: 1 addition & 1 deletion example/demo3.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>vConsole/Demo3</title>
<link href="./lib/weui.min.css" rel="stylesheet"/>
<link href="./lib/demo.css" rel="stylesheet"/>
Expand Down
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vconsole",
"version": "3.2.0",
"version": "3.2.1",
"description": "A lightweight, extendable front-end developer tool for mobile web page.",
"homepage": "https://github.com/Tencent/vConsole",
"main": "dist/vconsole.min.js",
Expand All @@ -19,22 +19,24 @@
},
"dependencies": {},
"devDependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.1.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-3": "^6.5.0",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"html-loader": "^0.4.3",
"jsdom": "^9.2.1",
"json-loader": "^0.5.4",
"less": "^2.5.3",
"less-loader": "^2.2.3",
"mocha": "^2.5.3",
"style-loader": "^0.13.1",
"webpack": "~1.12.11"
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"babel-loader": "^8.0.4",
"babel-plugin-add-module-exports": "^1.0.0",
"chai": "^4.2.0",
"css-loader": "^2.1.0",
"html-loader": "^0.5.5",
"jsdom": "^13.1.0",
"json-loader": "^0.5.7",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"mocha": "^5.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1"
},
"author": "Tencent",
"license": "MIT"
Expand Down
29 changes: 24 additions & 5 deletions src/core/core.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
right: 0;
bottom: 40em / @font;
-webkit-overflow-scrolling: touch;
margin-bottom: constant(safe-area-inset-bottom);
margin-bottom: env(safe-area-inset-bottom);
}
.vc-content.vc-has-topbar {
top: 71em / @font;
Expand Down Expand Up @@ -371,6 +373,21 @@
.vc-cmd-btn:active {
background-color: rgba(0,0,0,0.15);
}

.vc-cmd-prompted {
position: fixed;
width: 100%;
background-color: #FBF9FE;
border: 1px solid #D9D9D9;
overflow-x: scroll;
display: none;
}
.vc-cmd-prompted li {
list-style: none;
line-height: 30px;
padding: 0 6em / @font;
border-bottom: 1px solid #D9D9D9;
}
}

.vc-group {
Expand Down Expand Up @@ -514,6 +531,13 @@
border: none;
}
}
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
.vc-toolbar,
.vc-switch {
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
}
}

}

Expand All @@ -532,9 +556,4 @@
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
}
.vc-cmd-prompted li{
list-style: none;
line-height: 30px;
margin-left: -20px;
}
88 changes: 48 additions & 40 deletions src/lib/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,60 +132,68 @@ export function htmlEncode(text) {
}

/**
* JSON stringify, support circular structure
* Simple JSON stringify, stringify top level key-value
*/
export function JSONStringify(stringObject) {
if (!isObject(stringObject) && !isArray(stringObject)) {
return JSON.stringify(stringObject);
}

export function JSONStringify(stringObject, formatOption = '\t', replaceString = 'CIRCULAR_DEPENDECY_OBJECT') {
let cache = [];
/* const returnStringObject = JSON.stringify(stringObject, (key, value) => {
if (typeof value === 'object' && value !== null) {
if (~cache.indexOf(value)) {
return replaceString;
let prefix = '{', suffix = '}';
if (isArray(stringObject)) {
prefix = '[';
suffix = ']'
}
let str = prefix;
const keys = getObjAllKeys(stringObject);
for (let i = 0; i < keys.length; i ++) {
const key = keys[i];
const value = stringObject[key];
try {
// key
if (!isArray(stringObject)) {
if (isObject(key) || isArray(key) || isSymbol(key)) {
str += Object.prototype.toString.call(key);
} else {
str += key;
}
str += ': ';
}

// value
if (isArray(value)) {
str += 'Array[' + value.length + ']';
} else if (isObject(value) || isSymbol(value) || isFunction(value)) {
str += Object.prototype.toString.call(value);
} else {
str += JSON.stringify(value);
}
if (i < keys.length - 1) {
str += ', ';
}
cache.push(value);
} catch (e) {
continue;
}
return value;
}, formatOption);
cache = null;*/
let returnStringObject = '{\n';
let keys = getObjAllKeys(stringObject);
for(let i = 0; i < keys.length; i ++){
let key = keys[i];
try {
returnStringObject += key + ':' + stringObject[key] + ',\n';
} catch (e) {
//console.log(e);
continue;
}
}
returnStringObject+='}';
return returnStringObject;
str += suffix;
return str;
}
window.JSON.stringify=JSONStringify;

/**
* get an object's all keys ignore whether they are not enumerable
*/
export function getObjAllKeys(obj) {
if (!isObject(obj) && !isArray(obj)) {
return [];
}
/* let dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
let keys = [];
for (let key in obj) {
if (dontEnums.indexOf(key) < 0) {
keys.push(key);
}
if (isArray(obj)) {
const m = [];
obj.forEach((_, index) => {
m.push(index)
});
return m;
}
keys = keys.sort();*/
return Object.getOwnPropertyNames(obj).sort();
return Object.getOwnPropertyNames(obj).sort();
}

/**
Expand Down
Loading

0 comments on commit b306116

Please sign in to comment.