@vkontakte/icons-sprite
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -18,7 +18,7 @@ "use strict"; | ||
}, | ||
IconSettingsProvider: function() { | ||
return _IconSettings.IconSettingsProvider; | ||
}, | ||
makeIcon: function() { | ||
return _SvgIcon.makeIcon; | ||
}, | ||
IconSettingsProvider: function() { | ||
return _IconSettings.IconSettingsProvider; | ||
} | ||
@@ -25,0 +25,0 @@ }); |
@@ -32,2 +32,4 @@ "use strict"; | ||
]); | ||
var child = _react.default.Children.toArray(children)[0]; | ||
var hasIconChildren = /*#__PURE__*/ _react.default.isValidElement(child) && typeof child.type === "function" && "mountIcon" in child.type; | ||
var size = Math.max(width, height); | ||
@@ -55,3 +57,3 @@ var style = _object_spread._({ | ||
ref: getRootRef | ||
}), title && /*#__PURE__*/ _react.default.createElement("title", null, title), /*#__PURE__*/ _react.default.createElement("use", { | ||
}), title && /*#__PURE__*/ _react.default.createElement("title", null, title), hasIconChildren && children, /*#__PURE__*/ _react.default.createElement("use", { | ||
xlinkHref: "#".concat(id), | ||
@@ -62,6 +64,7 @@ style: { | ||
} | ||
}, children)); | ||
}, !hasIconChildren && children)); | ||
}; | ||
function makeIcon(componentName, id, viewBox, content, width, height, deprecated, replacement) { | ||
var mountIcon = function mountIcon() { | ||
var isMounted = false; | ||
function mountIcon() { | ||
if (!isMounted) { | ||
@@ -73,4 +76,3 @@ (0, _sprite.addSpriteSymbol)(new _browsersymbol.BrowserSymbol({ | ||
} | ||
}; | ||
var isMounted = false; | ||
} | ||
var warn = (0, _warnOnce.warnOnce)(componentName); | ||
@@ -77,0 +79,0 @@ var Icon = function(props) { |
@@ -8,2 +8,2 @@ import React from 'react'; | ||
} | ||
export declare function makeIcon<Props extends SvgIconProps = SvgIconProps>(componentName: string, id: string, viewBox: string, content: string, width: number, height: number, deprecated?: boolean, replacement?: string): React.FC<Props>; | ||
export declare function makeIcon<Props extends SvgIconProps = SvgIconProps, Subcomponents = {}>(componentName: string, id: string, viewBox: string, content: string, width: number, height: number, deprecated?: boolean, replacement?: string): React.FC<Props> & Subcomponents; |
@@ -21,2 +21,4 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; | ||
]); | ||
var child = React.Children.toArray(children)[0]; | ||
var hasIconChildren = /*#__PURE__*/ React.isValidElement(child) && typeof child.type === "function" && "mountIcon" in child.type; | ||
var size = Math.max(width, height); | ||
@@ -44,3 +46,3 @@ var style = _object_spread({ | ||
ref: getRootRef | ||
}), title && /*#__PURE__*/ React.createElement("title", null, title), /*#__PURE__*/ React.createElement("use", { | ||
}), title && /*#__PURE__*/ React.createElement("title", null, title), hasIconChildren && children, /*#__PURE__*/ React.createElement("use", { | ||
xlinkHref: "#".concat(id), | ||
@@ -51,6 +53,7 @@ style: { | ||
} | ||
}, children)); | ||
}, !hasIconChildren && children)); | ||
}; | ||
export function makeIcon(componentName, id, viewBox, content, width, height, deprecated, replacement) { | ||
var mountIcon = function mountIcon() { | ||
var isMounted = false; | ||
function mountIcon() { | ||
if (!isMounted) { | ||
@@ -62,4 +65,3 @@ addSpriteSymbol(new BrowserSymbol({ | ||
} | ||
}; | ||
var isMounted = false; | ||
} | ||
var warn = warnOnce(componentName); | ||
@@ -66,0 +68,0 @@ var Icon = function(props) { |
{ | ||
"name": "@vkontakte/icons-sprite", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"homepage": "https://vkcom.github.io/icons/", | ||
@@ -16,4 +16,5 @@ "repository": { | ||
"build": "concurrently 'yarn:build:*'", | ||
"build:cjs": "swc src/ --config-file package.swcrc -d dist/cjs -C module.type=commonjs", | ||
"build:es6": "swc src/ --config-file package.swcrc -d dist", | ||
"swc-base": "swc src/ --config-file package.swcrc --strip-leading-paths", | ||
"build:cjs": "yarn swc-base -d dist/cjs -C module.type=commonjs", | ||
"build:es6": "yarn swc-base -d dist", | ||
"build:types": "tsc --emitDeclarationOnly --declaration", | ||
@@ -25,19 +26,19 @@ "prepack": "yarn build", | ||
"dependencies": { | ||
"@swc/helpers": "^0.5.1" | ||
"@swc/helpers": "^0.5.10" | ||
}, | ||
"devDependencies": { | ||
"@size-limit/file": "^8.2.6", | ||
"@size-limit/webpack": "^8.2.6", | ||
"@swc/cli": "^0.1.61", | ||
"@swc/core": "^1.3.76", | ||
"@swc/jest": "^0.2.29", | ||
"@types/node": "^20.5.0", | ||
"@size-limit/file": "^11.1.2", | ||
"@size-limit/webpack": "^11.1.2", | ||
"@swc/cli": "^0.3.12", | ||
"@swc/core": "^1.4.16", | ||
"@swc/jest": "^0.2.36", | ||
"@types/node": "^20.12.7", | ||
"@types/react": "16.14.34", | ||
"concurrently": "^8.2.0", | ||
"jest": "^29.6.2", | ||
"jest-environment-jsdom": "^29.6.2", | ||
"concurrently": "^8.2.2", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"react": "16.10.0", | ||
"size-limit": "^8.2.6", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
"size-limit": "^11.1.2", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -52,3 +53,3 @@ "peerDependencies": { | ||
"path": "dist/index.js", | ||
"gzip": false, | ||
"brotli": false, | ||
"import": "*" | ||
@@ -59,2 +60,3 @@ }, | ||
"path": "dist/index.js", | ||
"gzip": true, | ||
"import": "*" | ||
@@ -65,6 +67,8 @@ }, | ||
"path": "dist/index.js", | ||
"brotli": true, | ||
"import": "*" | ||
} | ||
] | ||
], | ||
"publishConfig": { | ||
"provenance": true | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
78399
1149
Updated@swc/helpers@^0.5.10