Skip to content

Commit 9e35fd2

Browse files
committed
Merge pull request #427 from afshin/partially-remove-jquery-bootstrap
(Partially) remove jQuery and Bootstrap
2 parents 7493f19 + 61f1c1a commit 9e35fd2

25 files changed

+1606
-1390
lines changed

jupyter-js-widgets/examples/web2/manager.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require('bootstrap/dist/css/bootstrap.css');
21
require('jquery-ui/themes/smoothness/jquery-ui.min.css');
32

43
var widgets = require('jupyter-js-widgets');

jupyter-js-widgets/examples/web2/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"author": "IPython",
1212
"license": "BSD-3-Clause",
1313
"dependencies": {
14-
"bootstrap": "^3.3.6",
1514
"codemirror": "^5.9.0",
1615
"font-awesome": "^4.5.0",
1716
"jquery": "^2.1.4",

jupyter-js-widgets/less/widgets.less

Lines changed: 133 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
// minimal imports from bootstrap - only variables and mixins
5-
@import "./bootstrap/less/variables.less";
6-
@import "./bootstrap/less/mixins.less";
7-
84
// minimal imports from font-awesome
95
@import "./font-awesome/less/variables.less";
106

@@ -66,7 +62,7 @@
6662
&.connection-problems .prompt:after {
6763
content: @fa-var-chain-broken;
6864
font-family: 'FontAwesome';
69-
color: @brand-danger;
65+
color: #d9534f;
7066
top: 3px;
7167
padding: 3px;
7268
}
@@ -214,61 +210,66 @@
214210
}
215211
}
216212

217-
.widget-button {
218-
/* Button */
213+
.widget-checkbox {
214+
width: @widget-width-short;
215+
}
216+
217+
.widget-button, .widget-toggle-button {
218+
background-image: none;
219+
border: 1px solid #dbdbdb;
220+
color: white;
221+
cursor: pointer;
222+
display: inline-block;
223+
margin-bottom: 0;
224+
text-align: center;
225+
vertical-align: middle;
226+
white-space: nowrap;
219227
width : @widget-width-short;
220228

221229
.outside-shadow-2dp();
222230

223-
&.btn,
224-
&.btn:active,
225-
&.btn:focus,
226-
&.btn.hover {
231+
&:hover {
227232
outline: none !important;
228233
}
229-
230-
&.btn:active {
234+
&:active {
231235
.outside-shadow-4dp();
232236
}
233-
}
234-
235-
.widget-checkbox {
236-
width: @widget-width-short;
237-
}
238-
239-
.widget-toggle-button {
240-
/* Button */
241-
width : @widget-width-short;
242237

243-
.outside-shadow-2dp();
238+
&.mod-primary {
239+
background-color: #337ab7;
240+
border-color: #245580;
241+
}
244242

245-
&.btn,
246-
&.btn:active,
247-
&.btn:focus,
248-
&.btn.hover {
249-
outline: none !important;
243+
&.mod-success {
244+
background-color: #5cb85c;
245+
border-color: #3e8f3e;
250246
}
251247

252-
// &.btn:active {
253-
// .outside-shadow-4dp();
254-
// }
255-
}
248+
&.mod-info {
249+
background-color: #5bc0de;
250+
border-color: #28a4c9;
251+
}
256252

257-
.widget-toggle-buttons {
253+
&.mod-warning {
254+
background-color: #f0ad4e;
255+
border-color: #e38d13;
256+
}
258257

259-
.btn,
260-
.btn:active,
261-
.btn:focus,
262-
.btn.hover {
263-
outline: none !important;
258+
&.mod-danger {
259+
background-color: #d9534f;
260+
border-color: #b92c28;
264261
}
265262

266-
.btn.active {
267-
box-shadow: none !important;
263+
&.mod-active {
264+
border-color: #000000;
265+
color: #000000;
268266
}
267+
}
269268

270-
.btn-group {
271-
.outside-shadow-2dp();
269+
.widget-toggle-buttons {
270+
button {
271+
margin: 2px;
272+
min-width: 100px;
272273
}
273274
}
274275

@@ -288,23 +289,71 @@
288289
}
289290

290291
.widget-dropdown {
291-
/* Dropdown */
292-
width : @widget-width;
292+
display: block;
293293

294-
.widget_item {
294+
div.widget-item {
295295
display: flex;
296-
flex-grow: 1;
296+
margin: 0;
297+
padding: 0;
298+
width : @widget-width;
299+
300+
button {
301+
flex: 1;
302+
outline: 0;
303+
}
304+
305+
button:last-child {
306+
flex: 0;
307+
flex-basis: 2em;
308+
margin-left: -1px;
309+
310+
i.widget-caret {
311+
font-size: 1em;
312+
font-style: normal;
313+
font-family: FontAwesome;
314+
line-height: 1em;
315+
position: relative;
316+
}
317+
318+
i.widget-caret:before {
319+
content: "\f0d7";
320+
}
321+
}
297322
}
323+
}
298324

299-
.widget-combo-btn {
300-
flex-grow: 1;
301-
min-width: 10px;
325+
ul.widget-dropdown-droplist {
326+
background: #eeeeee;
327+
border-width: 1px;
328+
border-style: solid;
329+
border-color: #dddddd;
330+
box-sizing: border-box;
331+
list-style-type: none;
332+
position: absolute;
333+
margin: 0;
334+
z-index: 2; /* This might not be necessary once Bootstrap is gone. */
335+
width : @widget-width;
336+
padding: 0;
337+
height: auto;
338+
overflow: auto;
339+
display: none;
340+
341+
a {
342+
color: inherit;
343+
text-decoration: none;
302344
}
303345

304-
.dropdown-menu {
305-
max-height: 200px;
306-
overflow: hidden;
307-
overflow-y: auto;
346+
li {
347+
display: block;
348+
padding: 0 5px;
349+
350+
&:hover {
351+
background: #dddddd;
352+
}
353+
}
354+
355+
&.mod-active {
356+
display: block;
308357
}
309358
}
310359

@@ -368,11 +417,30 @@
368417
}
369418

370419
.widget-valid {
371-
/* Valid Check */
372-
margin-top: 8px;
373-
margin-bottom: 16px;
374-
margin-left: 5px;
375-
margin-right: 5px;
420+
font-size: 1em;
421+
position: relative;
422+
i {margin-right: 1.5em;}
423+
i:before {
424+
font-family: FontAwesome;
425+
font-style: normal;
426+
font-size: 1.5em;
427+
position: absolute;
428+
top: 0;
429+
}
430+
&.mod-valid {
431+
color: green;
432+
i:before {
433+
/* Check mark character icon */
434+
content: "\f00c";
435+
}
436+
}
437+
&.mod-invalid {
438+
color: red;
439+
i:before {
440+
/* "X" character icon */
441+
content: "\f00d";
442+
}
443+
}
376444
}
377445

378446
.widget-hbox {
@@ -439,6 +507,7 @@
439507

440508
}
441509

510+
442511
.widget-box {
443512
/* Box */
444513
.border-box-sizing();
@@ -457,4 +526,10 @@
457526
margin-bottom: 2px;
458527
margin-left: 22px;
459528
}
529+
530+
input {
531+
float: left;
532+
margin-right: 5px;
533+
}
534+
460535
}

jupyter-js-widgets/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
global.jQuery = global.$ = require('./jquery');
66
var _ = require('underscore');
77

8-
var managerBase = require("./manager-base");
9-
var widget = require("./widget");
8+
var managerBase = require('./manager-base');
9+
var widget = require('./widget');
1010

1111
module.exports = {
1212
shims: {
13-
services: require("./services-shim")
13+
services: require('./services-shim')
1414
}
1515
};
1616

jupyter-js-widgets/src/jquery.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// Distributed under the terms of the Modified BSD License.
33

44
// TODO: REMOVE ALL JQUERY FROM THE CODEBASE
5+
// Update March 2016: JQuery removed from most widgets, only
6+
// still used in slider (jquery-ui) in widget_int.js.
7+
58
var $;
69
if (typeof window !== 'undefined' && window['$']) {
710
$ = window['$'];
811
} else {
9-
$ = require("jquery");
12+
$ = require('jquery');
1013
global.jQuery = $; // Required for bootstrap to load correctly
1114

12-
require("jquery-ui");
13-
require("bootstrap");
15+
require('jquery-ui');
1416
}
1517
module.exports = $;

0 commit comments

Comments
 (0)