1
1
( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
2
- var css = "/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2015, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nbody {\n font-family: sans-serif;\n margin: 0;\n padding: 0;\n}\n#main {\n position: absolute;\n top: 10px;\n left: 10px;\n right: 10px;\n bottom: 10px;\n}\n.p-TabBar {\n min-height: 24px;\n}\n.p-TabBar-content {\n bottom: 1px;\n align-items: flex-end;\n}\n.p-TabBar-content > .p-Tab {\n flex-basis: 125px;\n max-height: 21px;\n margin-left: -1px;\n border: 1px solid #C0C0C0;\n border-bottom: none;\n padding: 0px 10px;\n background: #E5E5E5;\n font: 12px Helvetica, Arial, sans-serif;\n}\n.p-TabBar-content > .p-Tab.p-mod-first {\n margin-left: 0;\n}\n.p-TabBar-content > .p-Tab.p-mod-selected {\n min-height: 24px;\n background: white;\n transform: translateY(1px);\n}\n.p-TabBar-content > .p-Tab:hover:not(.p-mod-selected) {\n background: #F0F0F0;\n}\n.p-TabBar-content > .p-Tab > span {\n line-height: 21px;\n}\n.p-TabBar-footer {\n display: block;\n height: 1px;\n background: #C0C0C0;\n}\n.p-TabPanel > .p-StackedPanel {\n padding: 10px;\n background: white;\n border: 1px solid #C0C0C0;\n border-top: none;\n}\n.p-Menu {\n background: white;\n color: rgba(0, 0, 0, 0.87);\n border: 1px solid #C0C0C0;\n font: 12px Helvetica, Arial, sans-serif;\n box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2);\n}\n.p-Menu-item.p-mod-active {\n background: #E5E5E5;\n}\n.p-Menu-item.p-mod-disabled {\n color: rgba(0, 0, 0, 0.26);\n}\n.p-Menu-item.p-mod-separator-type > span::after {\n border-top: 1px solid #DDDDDD;\n}\n.p-Menu-item-icon::before,\n.p-Menu-item-submenu-icon::before {\n font-family: FontAwesome;\n}\n.p-Menu-item.p-mod-check-type.p-mod-checked > .p-Menu-item-icon::before {\n content: '\\f00c';\n}\n.p-Menu-item.p-mod-has-submenu > .p-Menu-item-submenu-icon::before {\n content: '\\f0da';\n}\n.p-Menu-item.copy > .p-Menu-item-icon::before {\n content: '\\f0c5';\n}\n.p-Menu-item.cut > .p-Menu-item-icon::before {\n content: '\\f0c4';\n}\n.p-Menu-item.paste > .p-Menu-item-icon::before {\n content: '\\f0ea';\n}\n.p-Menu-item.close > .p-Menu-item-icon::before {\n content: '\\f00d';\n}\n.p-Menu-item.undo > .p-Menu-item-icon::before {\n content: '\\f0e2';\n}\n.p-Menu-item.repeat > .p-Menu-item-icon::before {\n content: '\\f01e';\n}\n.p-MenuBar {\n min-height: 24px;\n padding-left: 5px;\n background: #FAFAFA;\n color: rgba(0, 0, 0, 0.87);\n border-bottom: 1px solid #DDDDDD;\n font: 13px Helvetica, Arial, sans-serif;\n}\n.p-MenuBar-menu {\n transform: translateY(-1px);\n}\n.p-MenuBar-item {\n padding: 4px 8px;\n border-left: 1px solid transparent;\n border-right: 1px solid transparent;\n}\n.p-MenuBar-item.p-mod-active {\n background: #E5E5E5;\n}\n.p-MenuBar-item.p-mod-disabled {\n color: rgba(0, 0, 0, 0.26);\n}\n.p-MenuBar-item.p-mod-separator-type {\n margin: 2px;\n padding: 0;\n border: none;\n border-left: 1px solid #DDDDDD;\n}\n.p-MenuBar.p-mod-active > .p-MenuBar-content > .p-MenuBar-item.p-mod-active {\n z-index: 1000000;\n background: white;\n border-left: 1px solid #C0C0C0;\n border-right: 1px solid #C0C0C0;\n box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);\n}\n" ; ( require ( "browserify-css" ) . createStyle ( css , { "href" : "index.css" } ) ) ; module . exports = css ;
2
+ var css = "/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2015, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nbody {\n font-family: sans-serif;\n margin: 0;\n padding: 0;\n}\n#main {\n position: absolute;\n top: 35px;\n left: 10px;\n right: 10px;\n bottom: 10px;\n}\n.ContextArea {\n padding-left: 10px;\n}\n.p-TabBar {\n min-height: 24px;\n}\n.p-TabBar-content {\n bottom: 1px;\n align-items: flex-end;\n}\n.p-TabBar-content > .p-Tab {\n flex-basis: 125px;\n max-height: 21px;\n margin-left: -1px;\n border: 1px solid #C0C0C0;\n border-bottom: none;\n padding: 0px 10px;\n background: #E5E5E5;\n font: 12px Helvetica, Arial, sans-serif;\n}\n.p-TabBar-content > .p-Tab.p-mod-first {\n margin-left: 0;\n}\n.p-TabBar-content > .p-Tab.p-mod-selected {\n min-height: 24px;\n background: white;\n transform: translateY(1px);\n}\n.p-TabBar-content > .p-Tab:hover:not(.p-mod-selected) {\n background: #F0F0F0;\n}\n.p-TabBar-content > .p-Tab > span {\n line-height: 21px;\n}\n.p-TabBar-footer {\n display: block;\n height: 1px;\n background: #C0C0C0;\n}\n.p-TabPanel > .p-StackedPanel {\n background: white;\n border: 1px solid #C0C0C0;\n border-top: none;\n}\n.p-Menu {\n background: white;\n color: rgba(0, 0, 0, 0.87);\n border: 1px solid #C0C0C0;\n font: 12px Helvetica, Arial, sans-serif;\n box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2);\n}\n.p-Menu-item.p-mod-active {\n background: #E5E5E5;\n}\n.p-Menu-item.p-mod-disabled {\n color: rgba(0, 0, 0, 0.26);\n}\n.p-Menu-item.p-mod-separator-type > span::after {\n border-top: 1px solid #DDDDDD;\n}\n.p-Menu-item-icon::before,\n.p-Menu-item-submenu-icon::before {\n font-family: FontAwesome;\n}\n.p-Menu-item.p-mod-check-type.p-mod-checked > .p-Menu-item-icon::before {\n content: '\\f00c';\n}\n.p-Menu-item.p-mod-has-submenu > .p-Menu-item-submenu-icon::before {\n content: '\\f0da';\n}\n.p-Menu-item.copy > .p-Menu-item-icon::before {\n content: '\\f0c5';\n}\n.p-Menu-item.cut > .p-Menu-item-icon::before {\n content: '\\f0c4';\n}\n.p-Menu-item.paste > .p-Menu-item-icon::before {\n content: '\\f0ea';\n}\n.p-Menu-item.close > .p-Menu-item-icon::before {\n content: '\\f00d';\n}\n.p-Menu-item.undo > .p-Menu-item-icon::before {\n content: '\\f0e2';\n}\n.p-Menu-item.repeat > .p-Menu-item-icon::before {\n content: '\\f01e';\n}\n.p-MenuBar {\n min-height: 24px;\n padding-left: 5px;\n background: #FEFEFE;\n color: rgba(0, 0, 0, 0.87);\n border-bottom: 1px solid #DDDDDD;\n font: 13px Helvetica, Arial, sans-serif;\n}\n.p-MenuBar-menu {\n transform: translateY(-1px);\n}\n.p-MenuBar-item {\n padding: 4px 8px;\n border-left: 1px solid transparent;\n border-right: 1px solid transparent;\n}\n.p-MenuBar-item.p-mod-active {\n background: #E5E5E5;\n}\n.p-MenuBar-item.p-mod-disabled {\n color: rgba(0, 0, 0, 0.26);\n}\n.p-MenuBar-item.p-mod-separator-type {\n margin: 2px;\n padding: 0;\n border: none;\n border-left: 1px solid #DDDDDD;\n}\n.p-MenuBar.p-mod-active > .p-MenuBar-content > .p-MenuBar-item.p-mod-active {\n z-index: 1000000;\n background: white;\n border-left: 1px solid #C0C0C0;\n border-right: 1px solid #C0C0C0;\n box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);\n}\n" ; ( require ( "browserify-css" ) . createStyle ( css , { "href" : &quo
57AE
t;index.css" } ) ) ; module . exports = css ;
3
3
} , { "browserify-css" :3 } ] , 2 :[ function ( require , module , exports ) {
4
4
/*-----------------------------------------------------------------------------
5
5
| Copyright (c) 2014-2015, PhosphorJS Contributors
@@ -55,9 +55,22 @@ var CodeMirrorWidget = (function (_super) {
55
55
} ;
56
56
return CodeMirrorWidget ;
57
57
} ) ( phosphor_widget_1 . Widget ) ;
58
+ /**
59
+ * Log a message to the log element.
60
+ */
61
+ function log ( value ) {
62
+ var node = document . getElementById ( 'log-span' ) ;
63
+ node . textContent = value ;
64
+ }
65
+ /**
66
+ * Log the text of a menu item to the log element.
67
+ */
58
68
function logItem ( item ) {
59
- console . log ( item . text ) ;
69
+ log ( item . text . replace ( / & / g , '' ) ) ;
60
70
}
71
+ /**
72
+ * The template for the application menu bar.
73
+ */
61
74
var MENU_BAR_TEMPLATE = [
62
75
{
63
76
text : 'File' ,
@@ -219,6 +232,9 @@ var MENU_BAR_TEMPLATE = [
219
232
]
220
233
}
221
234
] ;
235
+ /**
236
+ * The template for the application context menu.
237
+ */
222
238
var CONTEXT_MENU_TEMPLATE = [
223
239
{
224
240
text : '&Copy' ,
@@ -255,7 +271,7 @@ var CONTEXT_MENU_TEMPLATE = [
255
271
text : '&Save On Exit' ,
256
272
handler : function ( item ) {
257
273
item . checked = ! item . checked ;
258
- console . log ( 'Save On Exit:' , item . checked ) ;
274
+ log ( 'Save On Exit - ' + item . checked ) ;
259
275
}
260
276
} ,
261
277
{
@@ -298,17 +314,15 @@ var CONTEXT_MENU_TEMPLATE = [
298
314
handler : logItem
299
315
}
300
316
] ;
317
+ /**
318
+ * The main application entry point.
319
+ */
301
320
function main ( ) {
302
- var menuHost = new phosphor_widget_1 . Widget ( ) ;
303
- menuHost . children = [ phosphor_menus_1 . MenuBar . fromTemplate ( MENU_BAR_TEMPLATE ) ] ;
304
- var contextMenu = phosphor_menus_1 . Menu . fromTemplate ( CONTEXT_MENU_TEMPLATE ) ;
305
- menuHost . node . addEventListener ( 'contextmenu' , function ( event ) {
306
- event . preventDefault ( ) ;
307
- var x = event . clientX ;
308
- var y = event . clientY ;
309
- contextMenu . popup ( x , y ) ;
310
- } ) ;
311
- phosphor_tabs_1 . TabPanel . setTab ( menuHost , new phosphor_tabs_1 . Tab ( 'Demo' ) ) ;
321
+ var contextArea = new phosphor_widget_1 . Widget ( ) ;
322
+ contextArea . addClass ( 'ContextArea' ) ;
323
+ contextArea . node . innerHTML = ( '<h2>Notice the menu bar at the top of the document.' +
324
+ '<h2>Right click this panel for a context menu.</h2>' +
325
+ '<h3>Clicked Item: <span id="log-span"></span></h3>' ) ;
312
326
var cmSource = new CodeMirrorWidget ( {
313
327
mode : 'text/javascript' ,
314
328
lineNumbers : true ,
@@ -321,11 +335,21 @@ function main() {
321
335
tabSize : 2 ,
322
336
} ) ;
323
337
cmCss . loadTarget ( './index.css' ) ;
338
+ phosphor_tabs_1 . TabPanel . setTab ( contextArea , new phosphor_tabs_1 . Tab ( 'Demo' ) ) ;
324
339
phosphor_tabs_1 . TabPanel . setTab ( cmSource , new phosphor_tabs_1 . Tab ( 'Source' ) ) ;
325
340
phosphor_tabs_1 . TabPanel . setTab ( cmCss , new phosphor_tabs_1 . Tab ( 'CSS' ) ) ;
341
+ var contextMenu = phosphor_menus_1 . Menu . fromTemplate ( CONTEXT_MENU_TEMPLATE ) ;
342
+ contextArea . node . addEventListener ( 'contextmenu' , function ( event ) {
343
+ event . preventDefault ( ) ;
344
+ var x = event . clientX ;
345
+ var y = event . clientY ;
346
+ contextMenu . popup ( x , y ) ;
347
+ } ) ;
348
+ var menuBar = phosphor_menus_1 . MenuBar . fromTemplate ( MENU_BAR_TEMPLATE ) ;
326
349
var panel = new phosphor_tabs_1 . TabPanel ( ) ;
327
350
panel . id = 'main' ;
328
- panel . widgets = [ menuHost , cmSource , cmCss ] ;
351
+ panel . widgets = [ contextArea , cmSource , cmCss ] ;
352
+ phosphor_widget_1 . attachWidget ( menuBar , document . body ) ;
329
353
phosphor_widget_1 . attachWidget ( panel , document . body ) ;
330
354
window . onresize = function ( ) { return panel . update ( ) ; } ;
331
355
}
0 commit comments