@arcblock/ux 1.15.33 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +0 -56
- package/lib/Switch/index.js +107 -0
- package/lib/index.js +0 -8
- package/package.json +4 -9
- package/lib/GraphQLPlayground/graphiql.css +0 -1850
- package/lib/GraphQLPlayground/index.js +0 -301
- package/lib/GraphQLPlayground/util.js +0 -55
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -16,59 +16,3 @@ import ClickToCopy from '@arcblock/ux/lib/ClickToCopy';
|
|
|
16
16
|
import Icon from '@arcblock/ux/lib/Icon';
|
|
17
17
|
import ActivityIndicator from '@arcblock/ux/lib/ActivityIndicator';
|
|
18
18
|
```
|
|
19
|
-
|
|
20
|
-
## FAQ
|
|
21
|
-
|
|
22
|
-
### How to use `GraphQLPlayground` comonent in SSR env such as gatsby?
|
|
23
|
-
|
|
24
|
-
Because `graphiql` and `graphiql-code-exporter` uses browser globals such as `window`, we need to mock them both during building time for gatsby.
|
|
25
|
-
|
|
26
|
-
First we need to create an mock for `graphqil`, `src/mocks/graphiql`:
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
function graphiql() {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
graphiql.Logo = () => null;
|
|
34
|
-
graphiql.Toolbar = () => null;
|
|
35
|
-
graphiql.QueryEditor = () => null;
|
|
36
|
-
graphiql.VariableEditor = () => null;
|
|
37
|
-
graphiql.ResultViewer = () => null;
|
|
38
|
-
graphiql.Button = () => null;
|
|
39
|
-
graphiql.ToolbarButton = () => null;
|
|
40
|
-
graphiql.Group = () => null;
|
|
41
|
-
graphiql.Menu = () => null;
|
|
42
|
-
graphiql.MenuItem = () => null;
|
|
43
|
-
graphiql.Select = () => null;
|
|
44
|
-
graphiql.SelectOption = () => null;
|
|
45
|
-
graphiql.Footer = () => null;
|
|
46
|
-
|
|
47
|
-
module.exports = graphiql;
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Then, in `gatsby-node.js`, use the mocks:
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const path = require('path');
|
|
54
|
-
|
|
55
|
-
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
|
|
56
|
-
if (stage === 'build-html') {
|
|
57
|
-
actions.setWebpackConfig({
|
|
58
|
-
resolve: {
|
|
59
|
-
alias: {
|
|
60
|
-
graphiql: path.resolve(__dirname, './src/mocks/graphiql.js'),
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
module: {
|
|
64
|
-
rules: [
|
|
65
|
-
{
|
|
66
|
-
test: /node_modules\/codemirror\//,
|
|
67
|
-
use: loaders.null(),
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styles = require("@material-ui/core/styles");
|
|
13
|
+
|
|
14
|
+
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
15
|
+
|
|
16
|
+
var _Switch = _interopRequireDefault(require("@material-ui/core/Switch"));
|
|
17
|
+
|
|
18
|
+
const _excluded = ["classes"],
|
|
19
|
+
_excluded2 = ["labelProps"];
|
|
20
|
+
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
|
|
23
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
24
|
+
|
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
26
|
+
|
|
27
|
+
// 参考: https://v4.mui.com/components/switches/
|
|
28
|
+
const IOSSwitch = (0, _styles.withStyles)(theme => ({
|
|
29
|
+
root: {
|
|
30
|
+
width: 42,
|
|
31
|
+
height: 26,
|
|
32
|
+
padding: 0,
|
|
33
|
+
margin: theme.spacing(1)
|
|
34
|
+
},
|
|
35
|
+
switchBase: {
|
|
36
|
+
padding: 1,
|
|
37
|
+
'&$checked': {
|
|
38
|
+
transform: 'translateX(16px)',
|
|
39
|
+
color: theme.palette.common.white,
|
|
40
|
+
'& + $track': {
|
|
41
|
+
backgroundColor: '#52d869',
|
|
42
|
+
opacity: 1,
|
|
43
|
+
border: 'none'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
'&$focusVisible $thumb': {
|
|
47
|
+
color: '#52d869',
|
|
48
|
+
border: '6px solid #fff'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
thumb: {
|
|
52
|
+
width: 24,
|
|
53
|
+
height: 24
|
|
54
|
+
},
|
|
55
|
+
track: {
|
|
56
|
+
// fix: 下边框截断问题
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
borderRadius: 26 / 2,
|
|
59
|
+
border: "1px solid ".concat(theme.palette.grey[400]),
|
|
60
|
+
backgroundColor: theme.palette.grey[50],
|
|
61
|
+
opacity: 1,
|
|
62
|
+
transition: theme.transitions.create(['background-color', 'border'])
|
|
63
|
+
},
|
|
64
|
+
checked: {},
|
|
65
|
+
focusVisible: {}
|
|
66
|
+
}))(_ref => {
|
|
67
|
+
let {
|
|
68
|
+
classes
|
|
69
|
+
} = _ref,
|
|
70
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_Switch.default, Object.assign({
|
|
73
|
+
focusVisibleClassName: classes.focusVisible,
|
|
74
|
+
disableRipple: true,
|
|
75
|
+
classes: {
|
|
76
|
+
root: classes.root,
|
|
77
|
+
switchBase: classes.switchBase,
|
|
78
|
+
thumb: classes.thumb,
|
|
79
|
+
track: classes.track,
|
|
80
|
+
checked: classes.checked
|
|
81
|
+
}
|
|
82
|
+
}, props));
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* 抽取 blocklet server 中使用的 iOS 风格的 Switch, 该组件把 FormControlLabel 和 MuiSwitch 组合在一起,
|
|
86
|
+
* 兼容 mui Switch props, 使用 labelProps 控制 FormControlLabel
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
function Switch(_ref2) {
|
|
90
|
+
let {
|
|
91
|
+
labelProps
|
|
92
|
+
} = _ref2,
|
|
93
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
94
|
+
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, Object.assign({
|
|
96
|
+
control: /*#__PURE__*/_react.default.createElement(IOSSwitch, rest)
|
|
97
|
+
}, labelProps));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Switch.propTypes = {
|
|
101
|
+
labelProps: _propTypes.default.object
|
|
102
|
+
};
|
|
103
|
+
Switch.defaultProps = {
|
|
104
|
+
labelProps: {}
|
|
105
|
+
};
|
|
106
|
+
var _default = Switch;
|
|
107
|
+
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -75,12 +75,6 @@ Object.defineProperty(exports, "Footer", {
|
|
|
75
75
|
return _Footer.default;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
Object.defineProperty(exports, "GraphQLPlayground", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function get() {
|
|
81
|
-
return _GraphQLPlayground.default;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
78
|
Object.defineProperty(exports, "Icon", {
|
|
85
79
|
enumerable: true,
|
|
86
80
|
get: function get() {
|
|
@@ -214,8 +208,6 @@ var _Earth = _interopRequireDefault(require("./Earth"));
|
|
|
214
208
|
|
|
215
209
|
var _Footer = _interopRequireDefault(require("./Footer"));
|
|
216
210
|
|
|
217
|
-
var _GraphQLPlayground = _interopRequireDefault(require("./GraphQLPlayground"));
|
|
218
|
-
|
|
219
211
|
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
220
212
|
|
|
221
213
|
var _selector = _interopRequireDefault(require("./Locale/selector"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"react": ">=16.12.0",
|
|
53
53
|
"react-ga": "^2.7.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e0eb7e0b693d098e3d3139d171bbab02630ea499",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/icons": "^1.
|
|
58
|
-
"@arcblock/react-hooks": "^1.
|
|
57
|
+
"@arcblock/icons": "^1.16.0",
|
|
58
|
+
"@arcblock/react-hooks": "^1.16.0",
|
|
59
59
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
60
60
|
"@material-ui/core": "^4.12.3",
|
|
61
61
|
"@material-ui/icons": "4.11.2",
|
|
@@ -65,10 +65,6 @@
|
|
|
65
65
|
"core-js": "^3.6.4",
|
|
66
66
|
"d3-geo": "^1.11.6",
|
|
67
67
|
"devices.css": "^0.1.15",
|
|
68
|
-
"graphiql": "^0.13.2",
|
|
69
|
-
"graphiql-code-exporter": "^2.0.5",
|
|
70
|
-
"graphiql-explorer": "^0.4.3",
|
|
71
|
-
"graphql": "^14.6.0",
|
|
72
68
|
"highlight.js": "^9.15.8",
|
|
73
69
|
"is-svg": "^4.3.1",
|
|
74
70
|
"js-cookie": "^2.2.0",
|
|
@@ -77,7 +73,6 @@
|
|
|
77
73
|
"react-cookie-consent": "^6.4.1",
|
|
78
74
|
"react-helmet": "^5.2.1",
|
|
79
75
|
"react-intersection-observer": "^8.31.1",
|
|
80
|
-
"react-load-script": "^0.0.6",
|
|
81
76
|
"react-player": "^1.15.2",
|
|
82
77
|
"react-router-dom": "^5.1.2",
|
|
83
78
|
"react-shadow": "^19.0.2",
|