@khanacademy/wonder-blocks-grid 2.0.4 → 2.0.6
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/CHANGELOG.md +15 -0
- package/dist/components/cell.js.flow +1 -2
- package/dist/components/gutter.js.flow +1 -2
- package/dist/components/row.js.flow +1 -2
- package/dist/es/index.js +20 -52
- package/dist/index.js +34 -66
- package/dist/index.js.flow +1 -2
- package/dist/util/styles.js.flow +1 -2
- package/dist/util/utils.js.flow +1 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-grid
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c20f48f3: Don't transpile classes when building bundles
|
|
8
|
+
- Updated dependencies [c20f48f3]
|
|
9
|
+
- @khanacademy/wonder-blocks-core@5.0.4
|
|
10
|
+
- @khanacademy/wonder-blocks-layout@2.0.6
|
|
11
|
+
|
|
12
|
+
## 2.0.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- @khanacademy/wonder-blocks-layout@2.0.5
|
|
17
|
+
|
|
3
18
|
## 2.0.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { MediaSize } from "@khanacademy/wonder-blocks-layout";
|
|
10
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { MediaQuery } from "@khanacademy/wonder-blocks-layout";
|
|
10
9
|
declare type Props = {|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
9
|
import type { MediaQuery, MediaSize } from "@khanacademy/wonder-blocks-layout";
|
package/dist/es/index.js
CHANGED
|
@@ -3,20 +3,6 @@ import { MediaLayout, queryMatchesSize, Strut } from '@khanacademy/wonder-blocks
|
|
|
3
3
|
import { View } from '@khanacademy/wonder-blocks-core';
|
|
4
4
|
import { StyleSheet } from 'aphrodite';
|
|
5
5
|
|
|
6
|
-
function _setPrototypeOf(o, p) {
|
|
7
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
8
|
-
o.__proto__ = p;
|
|
9
|
-
return o;
|
|
10
|
-
};
|
|
11
|
-
return _setPrototypeOf(o, p);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function _inheritsLoose(subClass, superClass) {
|
|
15
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
16
|
-
subClass.prototype.constructor = subClass;
|
|
17
|
-
_setPrototypeOf(subClass, superClass);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
6
|
const WIDE_SCREEN = "@media (min-width: 1168px)";
|
|
21
7
|
const styles = StyleSheet.create({
|
|
22
8
|
row: {
|
|
@@ -46,15 +32,11 @@ const flexBasis = size => {
|
|
|
46
32
|
};
|
|
47
33
|
};
|
|
48
34
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function Cell() {
|
|
52
|
-
return _React$Component.apply(this, arguments) || this;
|
|
53
|
-
}
|
|
54
|
-
Cell.isClassOf = function isClassOf(instance) {
|
|
35
|
+
class Cell extends React.Component {
|
|
36
|
+
static isClassOf(instance) {
|
|
55
37
|
return instance && instance.type && instance.type.__IS_CELL__;
|
|
56
|
-
}
|
|
57
|
-
|
|
38
|
+
}
|
|
39
|
+
static getCols(props, mediaSize) {
|
|
58
40
|
if (!props.smallCols && !props.mediumCols && !props.largeCols && !props.cols) {
|
|
59
41
|
return undefined;
|
|
60
42
|
} else if (props.smallCols && mediaSize === "small") {
|
|
@@ -69,13 +51,12 @@ let Cell = function (_React$Component) {
|
|
|
69
51
|
return props.cols;
|
|
70
52
|
}
|
|
71
53
|
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
54
|
+
}
|
|
55
|
+
static shouldDisplay(props, mediaSize) {
|
|
74
56
|
const cols = Cell.getCols(props, mediaSize);
|
|
75
57
|
return cols !== null && cols !== 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_proto.render = function render() {
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
79
60
|
const {
|
|
80
61
|
children,
|
|
81
62
|
style
|
|
@@ -111,9 +92,8 @@ let Cell = function (_React$Component) {
|
|
|
111
92
|
style: [styles.cellFixed, flexBasis(calcWidth), style]
|
|
112
93
|
}, contents);
|
|
113
94
|
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}(React.Component);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
117
97
|
Cell.defaultProps = {
|
|
118
98
|
smallCols: 0,
|
|
119
99
|
mediumCols: 0,
|
|
@@ -122,13 +102,8 @@ Cell.defaultProps = {
|
|
|
122
102
|
};
|
|
123
103
|
Cell.__IS_CELL__ = true;
|
|
124
104
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
function Gutter() {
|
|
128
|
-
return _React$Component.apply(this, arguments) || this;
|
|
129
|
-
}
|
|
130
|
-
var _proto = Gutter.prototype;
|
|
131
|
-
_proto.render = function render() {
|
|
105
|
+
class Gutter extends React.Component {
|
|
106
|
+
render() {
|
|
132
107
|
return React.createElement(MediaLayout, null, ({
|
|
133
108
|
mediaSize,
|
|
134
109
|
mediaSpec
|
|
@@ -147,20 +122,14 @@ let Gutter = function (_React$Component) {
|
|
|
147
122
|
size: gutterWidth
|
|
148
123
|
});
|
|
149
124
|
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}(React.Component);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
153
127
|
Gutter.defaultProps = {
|
|
154
128
|
mediaQuery: "all"
|
|
155
129
|
};
|
|
156
130
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
function Row() {
|
|
160
|
-
return _React$Component.apply(this, arguments) || this;
|
|
161
|
-
}
|
|
162
|
-
var _proto = Row.prototype;
|
|
163
|
-
_proto.render = function render() {
|
|
131
|
+
class Row extends React.Component {
|
|
132
|
+
render() {
|
|
164
133
|
const {
|
|
165
134
|
style,
|
|
166
135
|
children
|
|
@@ -186,9 +155,9 @@ let Row = function (_React$Component) {
|
|
|
186
155
|
mediaSize,
|
|
187
156
|
totalColumns
|
|
188
157
|
}) : children;
|
|
189
|
-
const filteredContents = React.Children.toArray(contents).filter(item => Cell.isClassOf(item) ? Cell.shouldDisplay(item.props, mediaSize) : true).reduce((acc, elem, index) => [
|
|
158
|
+
const filteredContents = React.Children.toArray(contents).filter(item => Cell.isClassOf(item) ? Cell.shouldDisplay(item.props, mediaSize) : true).reduce((acc, elem, index) => [...acc, elem, React.createElement(Gutter, {
|
|
190
159
|
key: `gutter-${index}`
|
|
191
|
-
})]
|
|
160
|
+
})], []).slice(0, -1);
|
|
192
161
|
return React.createElement(View, {
|
|
193
162
|
style: [styles.row, !!maxWidth && styles.rowMaxWidth, !!maxWidth && {
|
|
194
163
|
maxWidth
|
|
@@ -199,9 +168,8 @@ let Row = function (_React$Component) {
|
|
|
199
168
|
size: marginWidth
|
|
200
169
|
}));
|
|
201
170
|
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
}(React.Component);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
205
173
|
Row.defaultProps = {
|
|
206
174
|
mediaQuery: "all"
|
|
207
175
|
};
|
package/dist/index.js
CHANGED
|
@@ -8,39 +8,25 @@ var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
|
8
8
|
var aphrodite = require('aphrodite');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
n["default"] = e;
|
|
25
|
-
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
n["default"] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
29
|
|
|
30
|
-
function _setPrototypeOf(o, p) {
|
|
31
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
32
|
-
o.__proto__ = p;
|
|
33
|
-
return o;
|
|
34
|
-
};
|
|
35
|
-
return _setPrototypeOf(o, p);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _inheritsLoose(subClass, superClass) {
|
|
39
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
40
|
-
subClass.prototype.constructor = subClass;
|
|
41
|
-
_setPrototypeOf(subClass, superClass);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
30
|
const WIDE_SCREEN = "@media (min-width: 1168px)";
|
|
45
31
|
const styles = aphrodite.StyleSheet.create({
|
|
46
32
|
row: {
|
|
@@ -70,15 +56,11 @@ const flexBasis = size => {
|
|
|
70
56
|
};
|
|
71
57
|
};
|
|
72
58
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
function Cell() {
|
|
76
|
-
return _React$Component.apply(this, arguments) || this;
|
|
77
|
-
}
|
|
78
|
-
Cell.isClassOf = function isClassOf(instance) {
|
|
59
|
+
class Cell extends React__namespace.Component {
|
|
60
|
+
static isClassOf(instance) {
|
|
79
61
|
return instance && instance.type && instance.type.__IS_CELL__;
|
|
80
|
-
}
|
|
81
|
-
|
|
62
|
+
}
|
|
63
|
+
static getCols(props, mediaSize) {
|
|
82
64
|
if (!props.smallCols && !props.mediumCols && !props.largeCols && !props.cols) {
|
|
83
65
|
return undefined;
|
|
84
66
|
} else if (props.smallCols && mediaSize === "small") {
|
|
@@ -93,13 +75,12 @@ let Cell = function (_React$Component) {
|
|
|
93
75
|
return props.cols;
|
|
94
76
|
}
|
|
95
77
|
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
78
|
+
}
|
|
79
|
+
static shouldDisplay(props, mediaSize) {
|
|
98
80
|
const cols = Cell.getCols(props, mediaSize);
|
|
99
81
|
return cols !== null && cols !== 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_proto.render = function render() {
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
103
84
|
const {
|
|
104
85
|
children,
|
|
105
86
|
style
|
|
@@ -135,9 +116,8 @@ let Cell = function (_React$Component) {
|
|
|
135
116
|
style: [styles.cellFixed, flexBasis(calcWidth), style]
|
|
136
117
|
}, contents);
|
|
137
118
|
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}(React__namespace.Component);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
141
121
|
Cell.defaultProps = {
|
|
142
122
|
smallCols: 0,
|
|
143
123
|
mediumCols: 0,
|
|
@@ -146,13 +126,8 @@ Cell.defaultProps = {
|
|
|
146
126
|
};
|
|
147
127
|
Cell.__IS_CELL__ = true;
|
|
148
128
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
function Gutter() {
|
|
152
|
-
return _React$Component.apply(this, arguments) || this;
|
|
153
|
-
}
|
|
154
|
-
var _proto = Gutter.prototype;
|
|
155
|
-
_proto.render = function render() {
|
|
129
|
+
class Gutter extends React__namespace.Component {
|
|
130
|
+
render() {
|
|
156
131
|
return React__namespace.createElement(wonderBlocksLayout.MediaLayout, null, ({
|
|
157
132
|
mediaSize,
|
|
158
133
|
mediaSpec
|
|
@@ -171,20 +146,14 @@ let Gutter = function (_React$Component) {
|
|
|
171
146
|
size: gutterWidth
|
|
172
147
|
});
|
|
173
148
|
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
}(React__namespace.Component);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
177
151
|
Gutter.defaultProps = {
|
|
178
152
|
mediaQuery: "all"
|
|
179
153
|
};
|
|
180
154
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
function Row() {
|
|
184
|
-
return _React$Component.apply(this, arguments) || this;
|
|
185
|
-
}
|
|
186
|
-
var _proto = Row.prototype;
|
|
187
|
-
_proto.render = function render() {
|
|
155
|
+
class Row extends React__namespace.Component {
|
|
156
|
+
render() {
|
|
188
157
|
const {
|
|
189
158
|
style,
|
|
190
159
|
children
|
|
@@ -210,9 +179,9 @@ let Row = function (_React$Component) {
|
|
|
210
179
|
mediaSize,
|
|
211
180
|
totalColumns
|
|
212
181
|
}) : children;
|
|
213
|
-
const filteredContents = React__namespace.Children.toArray(contents).filter(item => Cell.isClassOf(item) ? Cell.shouldDisplay(item.props, mediaSize) : true).reduce((acc, elem, index) => [
|
|
182
|
+
const filteredContents = React__namespace.Children.toArray(contents).filter(item => Cell.isClassOf(item) ? Cell.shouldDisplay(item.props, mediaSize) : true).reduce((acc, elem, index) => [...acc, elem, React__namespace.createElement(Gutter, {
|
|
214
183
|
key: `gutter-${index}`
|
|
215
|
-
})]
|
|
184
|
+
})], []).slice(0, -1);
|
|
216
185
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
217
186
|
style: [styles.row, !!maxWidth && styles.rowMaxWidth, !!maxWidth && {
|
|
218
187
|
maxWidth
|
|
@@ -223,9 +192,8 @@ let Row = function (_React$Component) {
|
|
|
223
192
|
size: marginWidth
|
|
224
193
|
}));
|
|
225
194
|
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
}(React__namespace.Component);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
229
197
|
Row.defaultProps = {
|
|
230
198
|
mediaQuery: "all"
|
|
231
199
|
};
|
package/dist/index.js.flow
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
declare export { default as Cell } from "./components/cell";
|
|
9
8
|
declare export { default as Row } from "./components/row";
|
package/dist/util/styles.js.flow
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import type { StyleDeclaration } from "aphrodite";
|
|
9
8
|
declare var styles: StyleDeclaration;
|
|
10
9
|
declare export default typeof styles;
|
package/dist/util/utils.js.flow
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
9
8
|
declare export var flexBasis: (size: number | string) => StyleType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-grid",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
19
|
"@khanacademy/wonder-blocks-color": "^2.0.1",
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^5.0.
|
|
21
|
-
"@khanacademy/wonder-blocks-layout": "^2.0.
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^5.0.4",
|
|
21
|
+
"@khanacademy/wonder-blocks-layout": "^2.0.6",
|
|
22
22
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"react": "16.14.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"wb-dev-build-settings": "^0.9.
|
|
29
|
+
"wb-dev-build-settings": "^0.9.5"
|
|
30
30
|
}
|
|
31
31
|
}
|