Socket
Socket
Sign inDemoInstall

@jupyterlab/ui-components

Package Overview
Dependencies
Maintainers
17
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/ui-components - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

style/icons/toolbar/add.svg

18

lib/icon/iconimports.js

@@ -29,2 +29,10 @@ /*-----------------------------------------------------------------------------

import trustedSvg from '../../style/icons/statusbar/trusted.svg';
import addSvg from '../../style/icons/toolbar/add.svg';
import copySvg from '../../style/icons/toolbar/copy.svg';
import cutSvg from '../../style/icons/toolbar/cut.svg';
import pasteSvg from '../../style/icons/toolbar/paste.svg';
import refreshSvg from '../../style/icons/toolbar/refresh.svg';
import runSvg from '../../style/icons/toolbar/run.svg';
import saveSvg from '../../style/icons/toolbar/save.svg';
import stopSvg from '../../style/icons/toolbar/stop.svg';
// defaultIcons definition

@@ -56,5 +64,13 @@ export var IconImports;

{ name: 'terminal', svg: terminalSvg },
{ name: 'trusted', svg: trustedSvg }
{ name: 'trusted', svg: trustedSvg },
{ name: 'add', svg: addSvg },
{ name: 'copy', svg: copySvg },
{ name: 'cut', svg: cutSvg },
{ name: 'paste', svg: pasteSvg },
{ name: 'refresh', svg: refreshSvg },
{ name: 'run', svg: runSvg },
{ name: 'save', svg: saveSvg },
{ name: 'stop', svg: stopSvg }
];
})(IconImports || (IconImports = {}));
//# sourceMappingURL=iconimports.js.map

@@ -23,2 +23,3 @@ import React from 'react';

}): React.ReactElement;
private _resolveName;
resolveName(name: string): string;

@@ -25,0 +26,0 @@ resolveSvg(name: string): HTMLElement | null;

@@ -47,3 +47,3 @@ // Copyright (c) Jupyter Development Team.

contains(name) {
return name in this._svg || name in this._classNameToName;
return !!this._resolveName(name);
}

@@ -54,9 +54,23 @@ /**

icon(props) {
const { name, className, title, container } = props, propsStyle = __rest(props, ["name", "className", "title", "container"]);
const { name, className, title, fallback, container } = props, propsStyle = __rest(props, ["name", "className", "title", "fallback", "container"]);
// we may have been handed a className in place of name
let resolvedName = this.resolveName(name);
if (!resolvedName) {
// bail if failing silently or icon node is already set
// TODO: remove fallback in jlab 2.0
if (fallback) {
if (container) {
container.textContent = title || '';
container.className = classes(name, className, propsStyle ? iconStyleFlat(propsStyle) : '');
return container;
}
else {
// the non-container fallback isn't implemented
console.error('unimplemented');
return null;
}
}
// bail if failing silently
return null;
}
// check if icon element is already set
if (container &&

@@ -66,3 +80,3 @@ container.dataset.icon &&

container.children[0]) {
// return the existing icon node
// return the existing icon element
return container.children[0];

@@ -105,3 +119,3 @@ }

iconReact(props) {
const { name, className, title, tag } = props, propsStyle = __rest(props, ["name", "className", "title", "tag"]);
const { name, className, title, fallback, tag } = props, propsStyle = __rest(props, ["name", "className", "title", "fallback", "tag"]);
const Tag = tag || 'div';

@@ -111,2 +125,6 @@ // we may have been handed a className in place of name

if (!resolvedName) {
// TODO: remove fallback in jlab 2.0
if (fallback) {
return (React.createElement(Tag, { className: classes(name, className, propsStyle ? iconStyleFlat(propsStyle) : '') }, title || ''));
}
// bail if failing silently

@@ -121,2 +139,5 @@ return React.createElement(React.Fragment, null);

}
if (title) {
Private.setTitleSvg(svgElement, title);
}
return (React.createElement(Tag, { className: classes(className, propsStyle ? iconStyle(propsStyle) : ''), "data-icon": resolvedName, dangerouslySetInnerHTML: {

@@ -126,3 +147,3 @@ __html: svgElement.outerHTML

}
resolveName(name) {
_resolveName(name) {
if (!(name in this._svg)) {

@@ -138,2 +159,10 @@ // skip resolution if name is not defined

}
// couldn't resolve name, fail silently
return '';
}
return name;
}
resolveName(name) {
const resolvedName = this._resolveName(name);
if (!resolvedName) {
if (this._debug) {

@@ -149,3 +178,3 @@ // couldn't resolve name, mark as bad and warn

}
return name;
return resolvedName;
}

@@ -205,3 +234,3 @@ resolveSvg(name) {

let titleNodes = svgNode.getElementsByTagName('title');
if (titleNodes) {
if (titleNodes.length) {
titleNodes[0].textContent = title;

@@ -208,0 +237,0 @@ }

@@ -41,4 +41,14 @@ import { Token } from '@phosphor/coreutils';

interface IModel {
/**
* The icon name. For a 'foo-bar.svg' file, the icon name is 'foo-bar'.
*/
name: string;
/**
* Manually set the className corresponding to the icon name. By default,
* the className is generated from the name: 'foo-bar' -> 'jp-FooBarIcon'
*/
className?: string;
/**
* A string containing the html corresponding to an SVG element
*/
svg: string;

@@ -50,6 +60,27 @@ }

interface INodeOptions extends IIconStyle {
/**
* The icon name. For a 'foo-bar.svg' file, the icon name is 'foo-bar'.
* For backwards compatibility, 'jp-FooBarIcon' is also a valid icon name.
*
* TODO: until Jlab 2.0
* If fallback is set, the name is added to the className
* of the resulting icon node
*/
name: string;
/**
* Extra classNames, used in addition to the typestyle className
*/
className?: string;
/**
* Icon title
*/
title?: string;
/**
* If true, if icon name resolution fails, fallback to old
* icon handling behavior.
*
* TODO: remove in Jlab 2.0
*/
fallback?: boolean;
}
}

2

lib/style/icon.d.ts

@@ -13,3 +13,3 @@ import { NestedCSSProperties } from 'typestyle/lib/types';

*/
export declare type IconKindType = 'breadCrumb' | 'dockPanelBar' | 'launcherCard' | 'launcherSection' | 'listing' | 'settingsEditor' | 'sideBar' | 'splash' | 'statusBar' | 'tabManager' | 'unset';
export declare type IconKindType = 'breadCrumb' | 'dockPanelBar' | 'launcherCard' | 'launcherSection' | 'listing' | 'settingsEditor' | 'sideBar' | 'splash' | 'statusBar' | 'tabManager' | 'toolbarButton' | 'unset';
export interface IIconStyle extends NestedCSSProperties {

@@ -16,0 +16,0 @@ /**

@@ -89,2 +89,6 @@ // Copyright (c) Jupyter Development Team.

};
const iconCSSToolbarButton = {
height: '16px',
width: '16px'
};
const iconCSSKind = {

@@ -101,2 +105,3 @@ breadCrumb: iconCSSBreadCrumb,

tabManager: iconCSSTabManager,
toolbarButton: iconCSSToolbarButton,
unset: {}

@@ -151,2 +156,3 @@ };

tabManager: containerCSSTabManager,
toolbarButton: {},
unset: {}

@@ -153,0 +159,0 @@ };

{
"name": "@jupyterlab/ui-components",
"version": "1.1.1",
"version": "1.1.2",
"description": "JupyterLab - UI components written in React",

@@ -67,3 +67,3 @@ "homepage": "https://github.com/jupyterlab/jupyterlab",

},
"gitHead": "d0099f2bdcac721bbd8739f1d057fa133e61b107"
"gitHead": "9726361cad22af339eabf0afdf207dc07b6bb979"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc