@vkontakte/icons-sprite
Advanced tools
Comparing version 2.1.0 to 2.2.0
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _create_class } from "@swc/helpers/_/_create_class"; | ||
import { _ as _define_property } from "@swc/helpers/_/_define_property"; | ||
import { BrowserSymbol } from "./browser-symbol"; | ||
var namespaceURI = "http://www.w3.org/2000/svg"; | ||
import { BrowserSymbol } from './browser-symbol'; | ||
var namespaceURI = 'http://www.w3.org/2000/svg'; | ||
export var BrowserSprite = /*#__PURE__*/ function() { | ||
@@ -14,6 +14,6 @@ "use strict"; | ||
attrs: { | ||
"xmlns": namespaceURI, | ||
"xmlns:xlink": "http://www.w3.org/1999/xlink", | ||
"style": "position:absolute;width:0;height:0", | ||
"aria-hidden": "true" | ||
'xmlns': namespaceURI, | ||
'xmlns:xlink': 'http://www.w3.org/1999/xlink', | ||
'style': 'position:absolute;width:0;height:0', | ||
'aria-hidden': 'true' | ||
} | ||
@@ -57,3 +57,3 @@ }); | ||
// Create symbols from existing DOM nodes, add and mount them | ||
target.querySelectorAll("symbol").forEach(function(symbolNode) { | ||
target.querySelectorAll('symbol').forEach(function(symbolNode) { | ||
var symbol = BrowserSymbol.createFromExistingNode(symbolNode); | ||
@@ -83,3 +83,3 @@ _this.add(symbol); | ||
value: function render() { | ||
var el = document.createElementNS(namespaceURI, "svg"); | ||
var el = document.createElementNS(namespaceURI, 'svg'); | ||
Object.entries(this.config.attrs).forEach(function(entry) { | ||
@@ -86,0 +86,0 @@ return el.setAttribute(entry[0], entry[1]); |
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _create_class } from "@swc/helpers/_/_create_class"; | ||
import { _ as _define_property } from "@swc/helpers/_/_define_property"; | ||
import { parse } from "./utils/parse"; | ||
import { parse } from './utils/parse'; | ||
export var BrowserSymbol = /*#__PURE__*/ function() { | ||
@@ -46,3 +46,3 @@ "use strict"; | ||
var symbol = new BrowserSymbol({ | ||
content: "" | ||
content: '' | ||
}); | ||
@@ -49,0 +49,0 @@ symbol.node = node; |
@@ -15,3 +15,3 @@ "use strict"; | ||
var _browsersymbol = require("./browser-symbol"); | ||
var namespaceURI = "http://www.w3.org/2000/svg"; | ||
var namespaceURI = 'http://www.w3.org/2000/svg'; | ||
var BrowserSprite = /*#__PURE__*/ function() { | ||
@@ -25,6 +25,6 @@ "use strict"; | ||
attrs: { | ||
"xmlns": namespaceURI, | ||
"xmlns:xlink": "http://www.w3.org/1999/xlink", | ||
"style": "position:absolute;width:0;height:0", | ||
"aria-hidden": "true" | ||
'xmlns': namespaceURI, | ||
'xmlns:xlink': 'http://www.w3.org/1999/xlink', | ||
'style': 'position:absolute;width:0;height:0', | ||
'aria-hidden': 'true' | ||
} | ||
@@ -68,3 +68,3 @@ }); | ||
// Create symbols from existing DOM nodes, add and mount them | ||
target.querySelectorAll("symbol").forEach(function(symbolNode) { | ||
target.querySelectorAll('symbol').forEach(function(symbolNode) { | ||
var symbol = _browsersymbol.BrowserSymbol.createFromExistingNode(symbolNode); | ||
@@ -94,3 +94,3 @@ _this.add(symbol); | ||
value: function render() { | ||
var el = document.createElementNS(namespaceURI, "svg"); | ||
var el = document.createElementNS(namespaceURI, 'svg'); | ||
Object.entries(this.config.attrs).forEach(function(entry) { | ||
@@ -97,0 +97,0 @@ return el.setAttribute(entry[0], entry[1]); |
@@ -56,3 +56,3 @@ "use strict"; | ||
var symbol = new BrowserSymbol({ | ||
content: "" | ||
content: '' | ||
}); | ||
@@ -59,0 +59,0 @@ symbol.node = node; |
@@ -18,7 +18,19 @@ "use strict"; | ||
}, | ||
IconAppearanceProvider: function() { | ||
return _IconAppearanceProvider.IconAppearanceProvider; | ||
}, | ||
IconSettingsProvider: function() { | ||
return _IconSettings.IconSettingsProvider; | ||
}, | ||
appearanceTypes: function() { | ||
return _IconAppearanceProvider.appearanceTypes; | ||
}, | ||
makeIcon: function() { | ||
return _SvgIcon.makeIcon; | ||
}, | ||
makeRasterIcon: function() { | ||
return _RasterIcon.makeRasterIcon; | ||
}, | ||
useIconAppearance: function() { | ||
return _IconAppearanceProvider.useIconAppearance; | ||
} | ||
@@ -29,4 +41,6 @@ }); | ||
var _SvgIcon = require("./SvgIcon"); | ||
var _RasterIcon = require("./raster/components/RasterIcon/RasterIcon"); | ||
var _IconSettings = require("./IconSettings"); | ||
var _IconAppearanceProvider = require("./raster/components/IconAppearanceProvider/IconAppearanceProvider"); | ||
//# sourceMappingURL=index.js.map |
@@ -21,6 +21,6 @@ "use strict"; | ||
var _react = require("react"); | ||
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement); | ||
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
var browserSprite; | ||
if (canUseDOM) { | ||
var spriteId = "__SVG_SPRITE_NODE__"; | ||
var spriteId = '__SVG_SPRITE_NODE__'; | ||
browserSprite = new _browsersprite.BrowserSprite({ | ||
@@ -38,8 +38,8 @@ attrs: { | ||
} | ||
document.removeEventListener("DOMContentLoaded", mount); | ||
document.removeEventListener('DOMContentLoaded', mount); | ||
}; | ||
if (document.querySelector("body")) { | ||
if (document.querySelector('body')) { | ||
mount(); | ||
} else { | ||
document.addEventListener("DOMContentLoaded", mount); | ||
document.addEventListener('DOMContentLoaded', mount); | ||
} | ||
@@ -46,0 +46,0 @@ } else { |
@@ -20,3 +20,3 @@ "use strict"; | ||
var SvgIcon = function(_param) { | ||
var _param_width = _param.width, width = _param_width === void 0 ? 0 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 0 : _param_height, viewBox = _param.viewBox, id = _param.id, _param_className = _param.className, className = _param_className === void 0 ? "" : _param_className, fill = _param.fill, getRootRef = _param.getRootRef, tmp = _param.style, propsStyle = tmp === void 0 ? {} : tmp, title = _param.title, children = _param.children, restProps = _object_without_properties._(_param, [ | ||
var _param_width = _param.width, width = _param_width === void 0 ? 0 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 0 : _param_height, viewBox = _param.viewBox, id = _param.id, _param_className = _param.className, className = _param_className === void 0 ? '' : _param_className, fill = _param.fill, getRootRef = _param.getRootRef, tmp = _param.style, propsStyle = tmp === void 0 ? {} : tmp, title = _param.title, children = _param.children, restProps = _object_without_properties._(_param, [ | ||
"width", | ||
@@ -34,3 +34,3 @@ "height", | ||
var child = _react.default.Children.toArray(children)[0]; | ||
var hasIconChildren = /*#__PURE__*/ _react.default.isValidElement(child) && typeof child.type === "function" && "mountIcon" in child.type; | ||
var hasIconChildren = /*#__PURE__*/ _react.default.isValidElement(child) && typeof child.type === 'function' && 'mountIcon' in child.type; | ||
var size = Math.max(width, height); | ||
@@ -46,3 +46,3 @@ var style = _object_spread._({ | ||
className: [ | ||
"vkuiIcon", | ||
'vkuiIcon', | ||
"vkuiIcon--".concat(size), | ||
@@ -53,3 +53,3 @@ "vkuiIcon--w-".concat(width), | ||
className | ||
].join(" ").trim(), | ||
].join(' ').trim(), | ||
viewBox: viewBox, | ||
@@ -63,3 +63,3 @@ width: width, | ||
style: { | ||
fill: "currentColor", | ||
fill: 'currentColor', | ||
color: fill | ||
@@ -83,4 +83,4 @@ } | ||
if (deprecated) { | ||
var replacementNotice = replacement ? ". Замените на ".concat(replacement) : ""; | ||
warn("Иконка устарела" + replacementNotice); | ||
var replacementNotice = replacement ? ". Замените на ".concat(replacement) : ''; | ||
warn('Иконка устарела' + replacementNotice); | ||
} | ||
@@ -87,0 +87,0 @@ return /*#__PURE__*/ _react.default.createElement(SvgIcon, _object_spread_props._(_object_spread._({}, props), { |
@@ -13,3 +13,3 @@ "use strict"; | ||
var hasImportNode = !!document.importNode; | ||
var el = new DOMParser().parseFromString(content, "image/svg+xml").documentElement; | ||
var el = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement; | ||
/** | ||
@@ -16,0 +16,0 @@ * Fix for browser which are throwing WrongDocumentError |
@@ -14,3 +14,3 @@ "use strict"; | ||
return function(message) { | ||
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "warn"; | ||
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'warn'; | ||
if (!didWarn[message]) { | ||
@@ -17,0 +17,0 @@ console[type]("[@vkontakte/icons][".concat(componentName, "] ").concat(message)); |
@@ -1,2 +0,2 @@ | ||
import React from "react"; | ||
import React from 'react'; | ||
/** | ||
@@ -3,0 +3,0 @@ * @deprecated В v3 будет удалено |
export { BrowserSprite } from './browser-sprite'; | ||
export { BrowserSymbol } from './browser-symbol'; | ||
export { makeIcon } from './SvgIcon'; | ||
export { makeRasterIcon } from './raster/components/RasterIcon/RasterIcon'; | ||
export { IconSettingsProvider } from './IconSettings'; | ||
export { appearanceTypes, IconAppearanceProvider, type IconAppearance, useIconAppearance, } from './raster/components/IconAppearanceProvider/IconAppearanceProvider'; |
@@ -1,6 +0,8 @@ | ||
export { BrowserSprite } from "./browser-sprite"; | ||
export { BrowserSymbol } from "./browser-symbol"; | ||
export { makeIcon } from "./SvgIcon"; | ||
export { IconSettingsProvider } from "./IconSettings"; | ||
export { BrowserSprite } from './browser-sprite'; | ||
export { BrowserSymbol } from './browser-symbol'; | ||
export { makeIcon } from './SvgIcon'; | ||
export { makeRasterIcon } from './raster/components/RasterIcon/RasterIcon'; | ||
export { IconSettingsProvider } from './IconSettings'; | ||
export { appearanceTypes, IconAppearanceProvider, useIconAppearance } from './raster/components/IconAppearanceProvider/IconAppearanceProvider'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,7 @@ | ||
import { BrowserSprite } from "./browser-sprite"; | ||
import { useLayoutEffect, useEffect } from "react"; | ||
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement); | ||
import { BrowserSprite } from './browser-sprite'; | ||
import { useLayoutEffect, useEffect } from 'react'; | ||
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
var browserSprite; | ||
if (canUseDOM) { | ||
var spriteId = "__SVG_SPRITE_NODE__"; | ||
var spriteId = '__SVG_SPRITE_NODE__'; | ||
browserSprite = new BrowserSprite({ | ||
@@ -19,8 +19,8 @@ attrs: { | ||
} | ||
document.removeEventListener("DOMContentLoaded", mount); | ||
document.removeEventListener('DOMContentLoaded', mount); | ||
}; | ||
if (document.querySelector("body")) { | ||
if (document.querySelector('body')) { | ||
mount(); | ||
} else { | ||
document.addEventListener("DOMContentLoaded", mount); | ||
document.addEventListener('DOMContentLoaded', mount); | ||
} | ||
@@ -27,0 +27,0 @@ } else { |
import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; | ||
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; | ||
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; | ||
import React from "react"; | ||
import { BrowserSymbol } from "./browser-symbol"; | ||
import { addSpriteSymbol, useIsomorphicLayoutEffect } from "./sprite"; | ||
import { warnOnce } from "./warnOnce"; | ||
import React from 'react'; | ||
import { BrowserSymbol } from './browser-symbol'; | ||
import { addSpriteSymbol, useIsomorphicLayoutEffect } from './sprite'; | ||
import { warnOnce } from './warnOnce'; | ||
var SvgIcon = function(_param) { | ||
var _param_width = _param.width, width = _param_width === void 0 ? 0 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 0 : _param_height, viewBox = _param.viewBox, id = _param.id, _param_className = _param.className, className = _param_className === void 0 ? "" : _param_className, fill = _param.fill, getRootRef = _param.getRootRef, tmp = _param.style, propsStyle = tmp === void 0 ? {} : tmp, title = _param.title, children = _param.children, restProps = _object_without_properties(_param, [ | ||
var _param_width = _param.width, width = _param_width === void 0 ? 0 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 0 : _param_height, viewBox = _param.viewBox, id = _param.id, _param_className = _param.className, className = _param_className === void 0 ? '' : _param_className, fill = _param.fill, getRootRef = _param.getRootRef, tmp = _param.style, propsStyle = tmp === void 0 ? {} : tmp, title = _param.title, children = _param.children, restProps = _object_without_properties(_param, [ | ||
"width", | ||
@@ -22,3 +22,3 @@ "height", | ||
var child = React.Children.toArray(children)[0]; | ||
var hasIconChildren = /*#__PURE__*/ React.isValidElement(child) && typeof child.type === "function" && "mountIcon" in child.type; | ||
var hasIconChildren = /*#__PURE__*/ React.isValidElement(child) && typeof child.type === 'function' && 'mountIcon' in child.type; | ||
var size = Math.max(width, height); | ||
@@ -34,3 +34,3 @@ var style = _object_spread({ | ||
className: [ | ||
"vkuiIcon", | ||
'vkuiIcon', | ||
"vkuiIcon--".concat(size), | ||
@@ -41,3 +41,3 @@ "vkuiIcon--w-".concat(width), | ||
className | ||
].join(" ").trim(), | ||
].join(' ').trim(), | ||
viewBox: viewBox, | ||
@@ -51,3 +51,3 @@ width: width, | ||
style: { | ||
fill: "currentColor", | ||
fill: 'currentColor', | ||
color: fill | ||
@@ -71,4 +71,4 @@ } | ||
if (deprecated) { | ||
var replacementNotice = replacement ? ". Замените на ".concat(replacement) : ""; | ||
warn("Иконка устарела" + replacementNotice); | ||
var replacementNotice = replacement ? ". Замените на ".concat(replacement) : ''; | ||
warn('Иконка устарела' + replacementNotice); | ||
} | ||
@@ -75,0 +75,0 @@ return /*#__PURE__*/ React.createElement(SvgIcon, _object_spread_props(_object_spread({}, props), { |
export function parse(content) { | ||
var hasImportNode = !!document.importNode; | ||
var el = new DOMParser().parseFromString(content, "image/svg+xml").documentElement; | ||
var el = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement; | ||
/** | ||
@@ -5,0 +5,0 @@ * Fix for browser which are throwing WrongDocumentError |
export function warnOnce(componentName) { | ||
var didWarn = {}; | ||
return function(message) { | ||
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "warn"; | ||
var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'warn'; | ||
if (!didWarn[message]) { | ||
@@ -6,0 +6,0 @@ console[type]("[@vkontakte/icons][".concat(componentName, "] ").concat(message)); |
{ | ||
"name": "@vkontakte/icons-sprite", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"homepage": "https://vkcom.github.io/icons/", | ||
@@ -25,11 +25,11 @@ "repository": { | ||
"dependencies": { | ||
"@swc/helpers": "^0.5.10" | ||
"@swc/helpers": "^0.5.11" | ||
}, | ||
"devDependencies": { | ||
"@size-limit/file": "^11.1.2", | ||
"@size-limit/webpack": "^11.1.2", | ||
"@size-limit/file": "^11.1.4", | ||
"@size-limit/webpack": "^11.1.4", | ||
"@swc/cli": "^0.3.12", | ||
"@swc/core": "^1.4.16", | ||
"@swc/core": "^1.5.7", | ||
"@swc/jest": "^0.2.36", | ||
"@types/node": "^20.12.7", | ||
"@types/node": "^20.12.12", | ||
"@types/react": "16.14.34", | ||
@@ -40,3 +40,3 @@ "concurrently": "^8.2.2", | ||
"react": "16.10.0", | ||
"size-limit": "^11.1.2", | ||
"size-limit": "^11.1.4", | ||
"ts-node": "^10.9.2", | ||
@@ -43,0 +43,0 @@ "typescript": "^5.4.5" |
export { BrowserSprite } from './browser-sprite'; | ||
export { BrowserSymbol } from './browser-symbol'; | ||
export { makeIcon } from './SvgIcon'; | ||
export { makeRasterIcon } from './raster/components/RasterIcon/RasterIcon'; | ||
export { IconSettingsProvider } from './IconSettings'; | ||
export { | ||
appearanceTypes, | ||
IconAppearanceProvider, | ||
type IconAppearance, | ||
useIconAppearance, | ||
} from './raster/components/IconAppearanceProvider/IconAppearanceProvider'; |
@@ -10,3 +10,4 @@ { | ||
"isolatedModules": true, | ||
"strict": true | ||
"strict": true, | ||
"skipLibCheck": true | ||
}, | ||
@@ -13,0 +14,0 @@ "include": ["src/**/*.ts"], |
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
111225
84
1567
Updated@swc/helpers@^0.5.11