@khanacademy/wonder-blocks-icon
Advanced tools
Comparing version 1.2.37 to 1.2.38
# @khanacademy/wonder-blocks-icon | ||
## 1.2.38 | ||
### Patch Changes | ||
- d816af08: Update build and test configs use TypeScript | ||
- 3891f544: Update babel config to include plugins that Storybook needed | ||
- 3813715d: Update wonder-stuff dependencies (non-functional changes) | ||
- 0d28bb1c: Configured TypeScript | ||
- 3d05f764: Fix HOCs and other type errors | ||
- c2ec4902: Update eslint configuration, fix lint | ||
- 2983c05b: Include 'types' field in package.json | ||
- 77ff6a66: Generate Flow types from TypeScript types | ||
- ec8d4b7f: Fix miscellaneous TypeScript errors | ||
- Updated dependencies [d816af08] | ||
- Updated dependencies [3891f544] | ||
- Updated dependencies [0d28bb1c] | ||
- Updated dependencies [873f4a14] | ||
- Updated dependencies [3d05f764] | ||
- Updated dependencies [c2ec4902] | ||
- Updated dependencies [2983c05b] | ||
- Updated dependencies [77ff6a66] | ||
- Updated dependencies [ec8d4b7f] | ||
- @khanacademy/wonder-blocks-core@4.8.0 | ||
## 1.2.37 | ||
@@ -4,0 +28,0 @@ |
@@ -1,3 +0,1 @@ | ||
import _extends from '@babel/runtime/helpers/extends'; | ||
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose'; | ||
import * as React from 'react'; | ||
@@ -7,2 +5,44 @@ import { StyleSheet } from 'aphrodite'; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
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; | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
_setPrototypeOf(subClass, superClass); | ||
} | ||
const viewportPixelsForSize = size => ({ | ||
@@ -15,3 +55,3 @@ small: 16, | ||
const getPathForIcon = (icon, size) => { | ||
if (icon[size]) { | ||
if (typeof icon[size] === "number") { | ||
return { | ||
@@ -24,3 +64,2 @@ assetSize: size, | ||
const availableSizes = Object.keys(icon); | ||
const sortFn = availableSize => { | ||
@@ -31,6 +70,4 @@ const availablePixelSize = viewportPixelsForSize(availableSize); | ||
}; | ||
const assetSizes = availableSizes.sort((a, b) => sortFn(a) - sortFn(b)); | ||
const bestAssetSize = assetSizes[0]; | ||
if (bestAssetSize && icon[bestAssetSize]) { | ||
@@ -49,14 +86,18 @@ return { | ||
const StyledSVG = addStyle("svg"); | ||
class Icon extends React.PureComponent { | ||
render() { | ||
let Icon = function (_React$PureComponent) { | ||
_inheritsLoose(Icon, _React$PureComponent); | ||
function Icon() { | ||
return _React$PureComponent.apply(this, arguments) || this; | ||
} | ||
var _proto = Icon.prototype; | ||
_proto.render = function render() { | ||
const _this$props = this.props, | ||
{ | ||
color, | ||
icon, | ||
size, | ||
style, | ||
testId | ||
} = _this$props, | ||
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded); | ||
{ | ||
color, | ||
icon, | ||
size, | ||
style, | ||
testId | ||
} = _this$props, | ||
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded); | ||
const { | ||
@@ -78,5 +119,5 @@ assetSize, | ||
})); | ||
} | ||
} | ||
}; | ||
return Icon; | ||
}(React.PureComponent); | ||
Icon.defaultProps = { | ||
@@ -166,25 +207,25 @@ color: "currentColor", | ||
var iconAssets = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
add: add, | ||
caretDown: caretDown, | ||
caretLeft: caretLeft, | ||
caretRight: caretRight, | ||
caretUp: caretUp, | ||
check: check, | ||
contentArticle: contentArticle, | ||
contentExercise: contentExercise, | ||
contentVideo: contentVideo, | ||
correct: correct, | ||
'delete': _delete, | ||
dismiss: dismiss, | ||
hint: hint, | ||
incorrect: incorrect, | ||
info: info, | ||
search: search, | ||
sortableArrowDown: sortableArrowDown, | ||
sortableArrowUp: sortableArrowUp, | ||
zoomIn: zoomIn, | ||
zoomOut: zoomOut | ||
__proto__: null, | ||
add: add, | ||
caretDown: caretDown, | ||
caretLeft: caretLeft, | ||
caretRight: caretRight, | ||
caretUp: caretUp, | ||
check: check, | ||
contentArticle: contentArticle, | ||
contentExercise: contentExercise, | ||
contentVideo: contentVideo, | ||
correct: correct, | ||
'delete': _delete, | ||
dismiss: dismiss, | ||
hint: hint, | ||
incorrect: incorrect, | ||
info: info, | ||
search: search, | ||
sortableArrowDown: sortableArrowDown, | ||
sortableArrowUp: sortableArrowUp, | ||
zoomIn: zoomIn, | ||
zoomOut: zoomOut | ||
}); | ||
export { Icon as default, iconAssets as icons }; |
@@ -5,4 +5,2 @@ 'use strict'; | ||
var _extends = require('@babel/runtime/helpers/extends'); | ||
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose'); | ||
var React = require('react'); | ||
@@ -12,26 +10,64 @@ var aphrodite = require('aphrodite'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); | ||
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
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; | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
_setPrototypeOf(subClass, superClass); | ||
} | ||
const viewportPixelsForSize = size => ({ | ||
@@ -44,3 +80,3 @@ small: 16, | ||
const getPathForIcon = (icon, size) => { | ||
if (icon[size]) { | ||
if (typeof icon[size] === "number") { | ||
return { | ||
@@ -53,3 +89,2 @@ assetSize: size, | ||
const availableSizes = Object.keys(icon); | ||
const sortFn = availableSize => { | ||
@@ -60,6 +95,4 @@ const availablePixelSize = viewportPixelsForSize(availableSize); | ||
}; | ||
const assetSizes = availableSizes.sort((a, b) => sortFn(a) - sortFn(b)); | ||
const bestAssetSize = assetSizes[0]; | ||
if (bestAssetSize && icon[bestAssetSize]) { | ||
@@ -78,14 +111,18 @@ return { | ||
const StyledSVG = wonderBlocksCore.addStyle("svg"); | ||
class Icon extends React__namespace.PureComponent { | ||
render() { | ||
let Icon = function (_React$PureComponent) { | ||
_inheritsLoose(Icon, _React$PureComponent); | ||
function Icon() { | ||
return _React$PureComponent.apply(this, arguments) || this; | ||
} | ||
var _proto = Icon.prototype; | ||
_proto.render = function render() { | ||
const _this$props = this.props, | ||
{ | ||
color, | ||
icon, | ||
size, | ||
style, | ||
testId | ||
} = _this$props, | ||
sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded); | ||
{ | ||
color, | ||
icon, | ||
size, | ||
style, | ||
testId | ||
} = _this$props, | ||
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded); | ||
const { | ||
@@ -97,3 +134,3 @@ assetSize, | ||
const viewboxPixelSize = viewportPixelsForSize(assetSize); | ||
return React__namespace.createElement(StyledSVG, _extends__default["default"]({}, sharedProps, { | ||
return React__namespace.createElement(StyledSVG, _extends({}, sharedProps, { | ||
style: [styles.svg, style], | ||
@@ -108,5 +145,5 @@ width: pixelSize, | ||
})); | ||
} | ||
} | ||
}; | ||
return Icon; | ||
}(React__namespace.PureComponent); | ||
Icon.defaultProps = { | ||
@@ -196,23 +233,23 @@ color: "currentColor", | ||
var iconAssets = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
add: add, | ||
caretDown: caretDown, | ||
caretLeft: caretLeft, | ||
caretRight: caretRight, | ||
caretUp: caretUp, | ||
check: check, | ||
contentArticle: contentArticle, | ||
contentExercise: contentExercise, | ||
contentVideo: contentVideo, | ||
correct: correct, | ||
'delete': _delete, | ||
dismiss: dismiss, | ||
hint: hint, | ||
incorrect: incorrect, | ||
info: info, | ||
search: search, | ||
sortableArrowDown: sortableArrowDown, | ||
sortableArrowUp: sortableArrowUp, | ||
zoomIn: zoomIn, | ||
zoomOut: zoomOut | ||
__proto__: null, | ||
add: add, | ||
caretDown: caretDown, | ||
caretLeft: caretLeft, | ||
caretRight: caretRight, | ||
caretUp: caretUp, | ||
check: check, | ||
contentArticle: contentArticle, | ||
contentExercise: contentExercise, | ||
contentVideo: contentVideo, | ||
correct: correct, | ||
'delete': _delete, | ||
dismiss: dismiss, | ||
hint: hint, | ||
incorrect: incorrect, | ||
info: info, | ||
search: search, | ||
sortableArrowDown: sortableArrowDown, | ||
sortableArrowUp: sortableArrowUp, | ||
zoomIn: zoomIn, | ||
zoomOut: zoomOut | ||
}); | ||
@@ -219,0 +256,0 @@ |
{ | ||
"name": "@khanacademy/wonder-blocks-icon", | ||
"version": "1.2.37", | ||
"version": "1.2.38", | ||
"design": "v1", | ||
@@ -11,3 +11,3 @@ "publishConfig": { | ||
"module": "dist/es/index.js", | ||
"source": "src/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -20,7 +20,7 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"@babel/runtime": "^7.18.6", | ||
"@khanacademy/wonder-blocks-core": "^4.7.0" | ||
"@khanacademy/wonder-blocks-core": "^4.8.0" | ||
}, | ||
"devDependencies": { | ||
"@khanacademy/wonder-stuff-core": "^1.2.1", | ||
"wb-dev-build-settings": "^0.7.1" | ||
"@khanacademy/wonder-stuff-core": "^1.2.2", | ||
"wb-dev-build-settings": "^0.7.2" | ||
}, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
100972
21
1200
1
1