jupyterlab_vscode_icons_extension 1.0.70 → 1.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +132 -6
- package/package.json +1 -1
- package/src/index.ts +133 -6
package/lib/index.js
CHANGED
|
@@ -229,6 +229,21 @@ const fileTypeConfigs = [
|
|
|
229
229
|
iconName: 'file-type-pdf',
|
|
230
230
|
group: 'enableDocIcons'
|
|
231
231
|
},
|
|
232
|
+
{
|
|
233
|
+
extensions: ['.doc', '.docx'],
|
|
234
|
+
iconName: 'file-type-word',
|
|
235
|
+
group: 'enableDocIcons'
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
extensions: ['.xls', '.xlsx'],
|
|
239
|
+
iconName: 'file-type-excel',
|
|
240
|
+
group: 'enableDocIcons'
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
extensions: ['.ppt', '.pptx'],
|
|
244
|
+
iconName: 'file-type-powerpoint',
|
|
245
|
+
group: 'enableDocIcons'
|
|
246
|
+
},
|
|
232
247
|
// Config Files
|
|
233
248
|
{
|
|
234
249
|
extensions: ['.env'],
|
|
@@ -337,12 +352,32 @@ const plugin = {
|
|
|
337
352
|
const { docRegistry } = app;
|
|
338
353
|
// Function to inject CSS that overrides Jupytext icons
|
|
339
354
|
const injectIconOverrideCSS = () => {
|
|
340
|
-
// Get icons:
|
|
355
|
+
// Get icons: Claude (VSCode), Office (VSCode)
|
|
341
356
|
const claudeIcon = createLabIcon('file-type-claude');
|
|
357
|
+
const wordIcon = createLabIcon('file-type-word');
|
|
358
|
+
const excelIcon = createLabIcon('file-type-excel');
|
|
359
|
+
const powerpointIcon = createLabIcon('file-type-powerpoint');
|
|
342
360
|
// Custom Markdown icon (from markdown.svg - purple M with arrow, darker #7a2491)
|
|
343
361
|
const markdownSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 309 327">
|
|
344
362
|
<path fill="#7a2491" opacity="1" stroke="none" d="m 138.68393,230.48651 c 36.58836,3.1e-4 72.68422,3.1e-4 108.78008,3.1e-4 0.13988,0.49669 0.0821,0.12537 -3.34406,3.81472 -27.34165,24.16766 -54.43119,49.41695 -81.72391,73.62893 -2.65146,2.35216 -4.5582,3.21609 -7.64686,0.37229 -26.89754,-24.76539 -75.191307,-68.40096 -80.889724,-74.12425 -0.744118,-0.74735 -1.274501,-1.57204 -2.95867,-3.69233 23.309236,0 45.299954,0 67.783144,3.3e-4 z"/>
|
|
345
363
|
<path fill="#7a2491" d="m 61.156397,14.443673 h 69.176263 q 14.81059,56.661581 23.29958,97.452667 l 5.96036,-27.150338 q 3.61233,-15.870486 7.76652,-30.954008 l 10.6564,-39.348321 H 248.6367 L 276.09047,189.5437 H 221.90541 L 207.27544,69.137838 173.50009,189.5437 H 136.47364 L 101.07273,68.875516 86.984609,189.5437 H 35.147571 Z"/>
|
|
364
|
+
</svg>`;
|
|
365
|
+
// Custom PDF icon (document with folded corner and red PDF banner)
|
|
366
|
+
const pdfSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16">
|
|
367
|
+
<g transform="matrix(.046 0 0 .046 -.67 -.73)">
|
|
368
|
+
<polygon points="52 357 52 24 205 24 283 102 283 357" fill="#e8e8e8"/>
|
|
369
|
+
<path d="m198 32v76h76v240H52V32h146m10-16H36v365h247V98z"/>
|
|
370
|
+
<polygon points="258 88 220 88 220 49 258 86"/>
|
|
371
|
+
</g>
|
|
372
|
+
<g transform="matrix(.046 0 0 .046 -.67 -.73)">
|
|
373
|
+
<polygon points="312 284 23 284 23 168 37 153 37 171 297 171 297 153 312 168" fill="#ed1c24"/>
|
|
374
|
+
<path d="m304 169l2 2v108H24V171l2-2v9h278v-9m-13-31v28H43v-28l-28 28v126h302V166z"/>
|
|
375
|
+
</g>
|
|
376
|
+
<g transform="matrix(.046 0 0 .046 1.72 11.73)" fill="#fff">
|
|
377
|
+
<path d="M9-83h30q7 0 13 1 6 1 11 5 5 3 7 9 3 5 3 13 0 8-3 13-3 6-7 9-5 4-11 5-6 2-13 2h-9v26H9zm22 39h8q7 0 10-3 3-3 3-9t-4-8-10-2h-7z"/>
|
|
378
|
+
<path d="M87-83h25q9 0 17 2 8 3 14 8 6 5 9 13 3 8 3 19t-3 19-9 13q-6 5-13 8-8 2-17 2H87zm22 66h1q5 0 9-1 4-1 7-4 3-3 5-8 2-4 2-12t-2-12-5-7q-3-3-7-4-4-1-9-1h-1z"/>
|
|
379
|
+
<path d="M169-83h54v18h-32v16h28v18h-28v31h-22z"/>
|
|
380
|
+
</g>
|
|
346
381
|
</svg>`;
|
|
347
382
|
// Custom Python icon (simplified official logo - 50% reduced fidelity)
|
|
348
383
|
const pythonSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 110 110">
|
|
@@ -363,13 +398,20 @@ const plugin = {
|
|
|
363
398
|
const readmeSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
364
399
|
<path fill="#912bac" d="m 9.5247234,11.42511 v 76.943619 l 2.1166666,2.116667 h 77.809717 l 2.116667,-2.116667 v -76.94362 l -2.116667,-2.1166662 -77.809717,0 z m 36.2115596,9.141612 h 11.01003 l 2.116667,2.116667 0,7.619586 -2.116667,2.116667 h -11.01003 l -2.116667,-2.116667 v -7.619586 z m -6.168542,19.478681 h 23.084596 l 2.116667,2.116667 v 5.700733 l -2.116597,2.09951 -3.175139,-0.02574 -2.116597,2.09951 V 67.32187 l 2.116667,2.116667 h 4.211629 l 2.116667,2.116667 v 5.567219 L 63.688967,79.23909 H 38.509408 l -2.116667,-2.116667 v -6.096386 l 2.116667,-2.116667 h 4.968955 L 45.59503,66.792703 V 52.096294 l -2.116667,-2.116667 h -3.910622 l -2.116667,-2.116667 0,-5.70089 z"/>
|
|
365
400
|
</svg>`;
|
|
366
|
-
// Get SVG content
|
|
401
|
+
// Get SVG content from VSCode icons
|
|
367
402
|
const claudeSvg = claudeIcon.svgstr;
|
|
403
|
+
const wordSvg = (wordIcon === null || wordIcon === void 0 ? void 0 : wordIcon.svgstr) || '';
|
|
404
|
+
const excelSvg = (excelIcon === null || excelIcon === void 0 ? void 0 : excelIcon.svgstr) || '';
|
|
405
|
+
const powerpointSvg = (powerpointIcon === null || powerpointIcon === void 0 ? void 0 : powerpointIcon.svgstr) || '';
|
|
368
406
|
// Create base64 encoded data URIs
|
|
369
407
|
const pythonDataUri = `data:image/svg+xml;base64,${btoa(pythonSvg)}`;
|
|
370
408
|
const markdownDataUri = `data:image/svg+xml;base64,${btoa(markdownSvg)}`;
|
|
371
409
|
const claudeDataUri = `data:image/svg+xml;base64,${btoa(claudeSvg)}`;
|
|
372
410
|
const readmeDataUri = `data:image/svg+xml;base64,${btoa(readmeSvg)}`;
|
|
411
|
+
const pdfDataUri = `data:image/svg+xml;base64,${btoa(pdfSvg)}`;
|
|
412
|
+
const wordDataUri = wordSvg ? `data:image/svg+xml;base64,${btoa(wordSvg)}` : '';
|
|
413
|
+
const excelDataUri = excelSvg ? `data:image/svg+xml;base64,${btoa(excelSvg)}` : '';
|
|
414
|
+
const powerpointDataUri = powerpointSvg ? `data:image/svg+xml;base64,${btoa(powerpointSvg)}` : '';
|
|
373
415
|
// Inject CSS that overrides icons for .py and .md files
|
|
374
416
|
// Note: Jupytext marks .py and .md files as type="notebook", so we need to
|
|
375
417
|
// use JavaScript to detect and mark these files for CSS targeting
|
|
@@ -445,6 +487,70 @@ const plugin = {
|
|
|
445
487
|
background-repeat: no-repeat;
|
|
446
488
|
background-position: center;
|
|
447
489
|
}
|
|
490
|
+
|
|
491
|
+
/* Override PDF file icon with VSCode PDF icon */
|
|
492
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon svg,
|
|
493
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon img {
|
|
494
|
+
display: none !important;
|
|
495
|
+
}
|
|
496
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon::before {
|
|
497
|
+
content: '';
|
|
498
|
+
display: inline-block;
|
|
499
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
500
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
501
|
+
background-image: url('${pdfDataUri}');
|
|
502
|
+
background-size: contain;
|
|
503
|
+
background-repeat: no-repeat;
|
|
504
|
+
background-position: center;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/* Override Word file icon with VSCode Word icon */
|
|
508
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon svg,
|
|
509
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon img {
|
|
510
|
+
display: none !important;
|
|
511
|
+
}
|
|
512
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon::before {
|
|
513
|
+
content: '';
|
|
514
|
+
display: inline-block;
|
|
515
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
516
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
517
|
+
background-image: url('${wordDataUri}');
|
|
518
|
+
background-size: contain;
|
|
519
|
+
background-repeat: no-repeat;
|
|
520
|
+
background-position: center;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/* Override Excel file icon with VSCode Excel icon */
|
|
524
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon svg,
|
|
525
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon img {
|
|
526
|
+
display: none !important;
|
|
527
|
+
}
|
|
528
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon::before {
|
|
529
|
+
content: '';
|
|
530
|
+
display: inline-block;
|
|
531
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
532
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
533
|
+
background-image: url('${excelDataUri}');
|
|
534
|
+
background-size: contain;
|
|
535
|
+
background-repeat: no-repeat;
|
|
536
|
+
background-position: center;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/* Override PowerPoint file icon with VSCode PowerPoint icon */
|
|
540
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon svg,
|
|
541
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon img {
|
|
542
|
+
display: none !important;
|
|
543
|
+
}
|
|
544
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon::before {
|
|
545
|
+
content: '';
|
|
546
|
+
display: inline-block;
|
|
547
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
548
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
549
|
+
background-image: url('${powerpointDataUri}');
|
|
550
|
+
background-size: contain;
|
|
551
|
+
background-repeat: no-repeat;
|
|
552
|
+
background-position: center;
|
|
553
|
+
}
|
|
448
554
|
`;
|
|
449
555
|
// Add CSS to make JavaScript and .env icons less bright
|
|
450
556
|
style.textContent += `
|
|
@@ -531,6 +637,26 @@ const plugin = {
|
|
|
531
637
|
// Not a shell file - always clear shell-type attribute
|
|
532
638
|
item.removeAttribute('data-shell-type');
|
|
533
639
|
}
|
|
640
|
+
// Handle PDF and Office files by extension (override native JupyterLab icons)
|
|
641
|
+
const nameLower = name.toLowerCase();
|
|
642
|
+
// Clear all office/pdf attributes first
|
|
643
|
+
item.removeAttribute('data-vscode-pdf');
|
|
644
|
+
item.removeAttribute('data-vscode-word');
|
|
645
|
+
item.removeAttribute('data-vscode-excel');
|
|
646
|
+
item.removeAttribute('data-vscode-powerpoint');
|
|
647
|
+
// Set the correct attribute based on extension
|
|
648
|
+
if (nameLower.endsWith('.pdf')) {
|
|
649
|
+
item.setAttribute('data-vscode-pdf', 'true');
|
|
650
|
+
}
|
|
651
|
+
else if (nameLower.endsWith('.doc') || nameLower.endsWith('.docx')) {
|
|
652
|
+
item.setAttribute('data-vscode-word', 'true');
|
|
653
|
+
}
|
|
654
|
+
else if (nameLower.endsWith('.xls') || nameLower.endsWith('.xlsx')) {
|
|
655
|
+
item.setAttribute('data-vscode-excel', 'true');
|
|
656
|
+
}
|
|
657
|
+
else if (nameLower.endsWith('.ppt') || nameLower.endsWith('.pptx')) {
|
|
658
|
+
item.setAttribute('data-vscode-powerpoint', 'true');
|
|
659
|
+
}
|
|
534
660
|
});
|
|
535
661
|
};
|
|
536
662
|
// Watch for changes in the file browser
|
|
@@ -593,9 +719,9 @@ const plugin = {
|
|
|
593
719
|
}
|
|
594
720
|
docRegistry.addFileType(fileTypeOptions);
|
|
595
721
|
});
|
|
596
|
-
// Register Makefile with custom icon (
|
|
597
|
-
const makefileSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="
|
|
598
|
-
<
|
|
722
|
+
// Register Makefile with custom icon (document with gears, from text-x-makefile-svgrepo-com.svg)
|
|
723
|
+
const makefileSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="19 7 90 114">
|
|
724
|
+
<path fill="#c2544f" d="m 29.09375,11.234375 c -3.183804,0 -5.71875,2.566196 -5.71875,5.75 l 0,94.031255 c 0,3.1838 2.534946,5.75 5.71875,5.75 l 69.8125,0 c 3.1838,0 5.71875,-2.5662 5.71875,-5.75 l 0,-70.656255 -21.03125,0 c -4.306108,0 -8.0625,-3.141109 -8.0625,-7.3125 l 0,-21.8125 -46.4375,0 z m 50.4375,0 0,21.8125 c 0,1.714122 1.631968,3.3125 4.0625,3.3125 l 21.03125,0 -25.09375,-25.125 z m -32.34375,29.3125 1.71875,0 1.65625,3.5 0.03125,0.75 -0.53125,2.4375 3.25,1.3125 1.3125,-2.0625 0.59375,-0.53125 3.59375,-1.25 1.25,1.21875 -1.28125,3.59375 -0.5,0.59375 -2.0625,1.3125 1.3125,3.28125 2.40625,-0.5625 0.78125,0.03125 3.46875,1.65625 0,1.75 -3.46875,1.65625 -0.78125,0 -2.40625,-0.5 -1.3125,3.21875 2.0625,1.375 0.5,0.59375 1.28125,3.59375 -1.25,1.25 -3.59375,-1.28125 -0.59375,-0.5625 -1.3125,-2.0625 -3.25,1.34375 0.53125,2.40625 -0.03125,0.78125 -1.65625,3.4375 -1.71875,0 -1.65625,-3.4375 -0.0625,-0.78125 0.53125,-2.40625 -3.25,-1.34375 -1.3125,2.0625 -0.59375,0.5625 -3.59375,1.28125 -1.25,-1.25 1.28125,-3.59375 0.5625,-0.59375 2.0625,-1.375 -1.34375,-3.21875 -2.40625,0.5 -0.8125,0 -3.46875,-1.65625 0,-1.75 3.46875,-1.65625 0.8125,-0.03125 2.40625,0.5625 1.34375,-3.28125 -2.0625,-1.3125 -0.5625,-0.59375 L 36,45.921875 l 1.25,-1.21875 3.59375,1.25 0.59375,0.53125 1.3125,2.0625 3.25,-1.3125 -0.53125,-2.4375 0.0625,-0.75 1.65625,-3.5 z m 0.875,10.875 c -2.927972,0 -5.34375,2.353278 -5.34375,5.28125 0,2.927972 2.415778,5.3125 5.34375,5.3125 2.927972,0 5.28125,-2.384528 5.28125,-5.3125 0,-2.927972 -2.353278,-5.28125 -5.28125,-5.28125 z m 18.15625,10.3125 3.09375,3.34375 0.46875,1.15625 0.40625,2.75 4.46875,0 0.40625,-2.75 0.4375,-1.15625 3.125,-3.34375 2.25,0.71875 0.53125,4.53125 -0.28125,1.21875 -1.3125,2.4375 3.625,2.65625 1.90625,-2 1.0625,-0.625 4.5,-0.90625 1.375,1.90625 -2.21875,3.96875 -0.96875,0.8125 -2.46875,1.1875 1.40625,4.28125 2.71875,-0.46875 1.21875,0.09375 4.15625,1.90625 0,2.34375 -4.15625,1.9375 -1.21875,0.09375 -2.71875,-0.46875 -1.40625,4.25 2.46875,1.21875 0.96875,0.78125 2.21875,4.03125 -1.375,1.875 -4.5,-0.875 -1.0625,-0.65625 -1.90625,-2 -3.625,2.65625 1.3125,2.406255 0.28125,1.21875 -0.53125,4.5625 -2.25,0.75 -3.125,-3.40625 -0.4375,-1.125 -0.40625,-2.71875 -4.46875,0 -0.40625,2.71875 -0.46875,1.125 -3.09375,3.40625 -2.25,-0.75 -0.53125,-4.5625 0.3125,-1.21875 1.28125,-2.406255 -3.625,-2.65625 -1.9375,2 -1.0625,0.65625 -4.46875,0.875 -1.375,-1.875 2.21875,-4.03125 0.9375,-0.78125 2.46875,-1.21875 -1.34375,-4.25 -2.71875,0.46875 -1.21875,-0.09375 -4.1875,-1.9375 0,-2.34375 4.1875,-1.90625 1.21875,-0.09375 2.71875,0.46875 1.34375,-4.28125 -2.46875,-1.1875 -0.9375,-0.8125 -2.21875,-3.96875 1.375,-1.90625 4.46875,0.90625 1.0625,0.625 1.9375,2 3.625,-2.65625 -1.28125,-2.4375 -0.3125,-1.21875 0.53125,-4.53125 2.25,-0.71875 z m 6.1875,14.09375 c -4.866236,0 -8.8125,3.946264 -8.8125,8.8125 0,4.866238 3.946264,8.8125 8.8125,8.8125 4.866237,0 8.8125,-3.946262 8.8125,-8.8125 0,-4.866236 -3.946263,-8.8125 -8.8125,-8.8125 z"/>
|
|
599
725
|
</svg>`;
|
|
600
726
|
const makefileIcon = new LabIcon({
|
|
601
727
|
name: 'makefile-icon',
|
|
@@ -606,7 +732,7 @@ const plugin = {
|
|
|
606
732
|
displayName: 'Makefile',
|
|
607
733
|
mimeTypes: ['text/x-makefile'],
|
|
608
734
|
extensions: ['.mk', '.mak', '.make'],
|
|
609
|
-
pattern: '^(Makefile|makefile|GNUmakefile
|
|
735
|
+
pattern: '^(Makefile|makefile|GNUmakefile)$',
|
|
610
736
|
fileFormat: 'text',
|
|
611
737
|
contentType: 'file',
|
|
612
738
|
icon: makefileIcon
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -260,6 +260,21 @@ const fileTypeConfigs: IFileTypeConfig[] = [
|
|
|
260
260
|
iconName: 'file-type-pdf',
|
|
261
261
|
group: 'enableDocIcons'
|
|
262
262
|
},
|
|
263
|
+
{
|
|
264
|
+
extensions: ['.doc', '.docx'],
|
|
265
|
+
iconName: 'file-type-word',
|
|
266
|
+
group: 'enableDocIcons'
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
extensions: ['.xls', '.xlsx'],
|
|
270
|
+
iconName: 'file-type-excel',
|
|
271
|
+
group: 'enableDocIcons'
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
extensions: ['.ppt', '.pptx'],
|
|
275
|
+
iconName: 'file-type-powerpoint',
|
|
276
|
+
group: 'enableDocIcons'
|
|
277
|
+
},
|
|
263
278
|
|
|
264
279
|
// Config Files
|
|
265
280
|
{
|
|
@@ -378,8 +393,11 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
378
393
|
// Function to inject CSS that overrides Jupytext icons
|
|
379
394
|
const injectIconOverrideCSS = () => {
|
|
380
395
|
|
|
381
|
-
// Get icons:
|
|
396
|
+
// Get icons: Claude (VSCode), Office (VSCode)
|
|
382
397
|
const claudeIcon = createLabIcon('file-type-claude');
|
|
398
|
+
const wordIcon = createLabIcon('file-type-word');
|
|
399
|
+
const excelIcon = createLabIcon('file-type-excel');
|
|
400
|
+
const powerpointIcon = createLabIcon('file-type-powerpoint');
|
|
383
401
|
|
|
384
402
|
// Custom Markdown icon (from markdown.svg - purple M with arrow, darker #7a2491)
|
|
385
403
|
const markdownSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 309 327">
|
|
@@ -387,6 +405,24 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
387
405
|
<path fill="#7a2491" d="m 61.156397,14.443673 h 69.176263 q 14.81059,56.661581 23.29958,97.452667 l 5.96036,-27.150338 q 3.61233,-15.870486 7.76652,-30.954008 l 10.6564,-39.348321 H 248.6367 L 276.09047,189.5437 H 221.90541 L 207.27544,69.137838 173.50009,189.5437 H 136.47364 L 101.07273,68.875516 86.984609,189.5437 H 35.147571 Z"/>
|
|
388
406
|
</svg>`;
|
|
389
407
|
|
|
408
|
+
// Custom PDF icon (document with folded corner and red PDF banner)
|
|
409
|
+
const pdfSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16">
|
|
410
|
+
<g transform="matrix(.046 0 0 .046 -.67 -.73)">
|
|
411
|
+
<polygon points="52 357 52 24 205 24 283 102 283 357" fill="#e8e8e8"/>
|
|
412
|
+
<path d="m198 32v76h76v240H52V32h146m10-16H36v365h247V98z"/>
|
|
413
|
+
<polygon points="258 88 220 88 220 49 258 86"/>
|
|
414
|
+
</g>
|
|
415
|
+
<g transform="matrix(.046 0 0 .046 -.67 -.73)">
|
|
416
|
+
<polygon points="312 284 23 284 23 168 37 153 37 171 297 171 297 153 312 168" fill="#ed1c24"/>
|
|
417
|
+
<path d="m304 169l2 2v108H24V171l2-2v9h278v-9m-13-31v28H43v-28l-28 28v126h302V166z"/>
|
|
418
|
+
</g>
|
|
419
|
+
<g transform="matrix(.046 0 0 .046 1.72 11.73)" fill="#fff">
|
|
420
|
+
<path d="M9-83h30q7 0 13 1 6 1 11 5 5 3 7 9 3 5 3 13 0 8-3 13-3 6-7 9-5 4-11 5-6 2-13 2h-9v26H9zm22 39h8q7 0 10-3 3-3 3-9t-4-8-10-2h-7z"/>
|
|
421
|
+
<path d="M87-83h25q9 0 17 2 8 3 14 8 6 5 9 13 3 8 3 19t-3 19-9 13q-6 5-13 8-8 2-17 2H87zm22 66h1q5 0 9-1 4-1 7-4 3-3 5-8 2-4 2-12t-2-12-5-7q-3-3-7-4-4-1-9-1h-1z"/>
|
|
422
|
+
<path d="M169-83h54v18h-32v16h28v18h-28v31h-22z"/>
|
|
423
|
+
</g>
|
|
424
|
+
</svg>`;
|
|
425
|
+
|
|
390
426
|
// Custom Python icon (simplified official logo - 50% reduced fidelity)
|
|
391
427
|
const pythonSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 110 110">
|
|
392
428
|
<defs>
|
|
@@ -408,14 +444,21 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
408
444
|
<path fill="#912bac" d="m 9.5247234,11.42511 v 76.943619 l 2.1166666,2.116667 h 77.809717 l 2.116667,-2.116667 v -76.94362 l -2.116667,-2.1166662 -77.809717,0 z m 36.2115596,9.141612 h 11.01003 l 2.116667,2.116667 0,7.619586 -2.116667,2.116667 h -11.01003 l -2.116667,-2.116667 v -7.619586 z m -6.168542,19.478681 h 23.084596 l 2.116667,2.116667 v 5.700733 l -2.116597,2.09951 -3.175139,-0.02574 -2.116597,2.09951 V 67.32187 l 2.116667,2.116667 h 4.211629 l 2.116667,2.116667 v 5.567219 L 63.688967,79.23909 H 38.509408 l -2.116667,-2.116667 v -6.096386 l 2.116667,-2.116667 h 4.968955 L 45.59503,66.792703 V 52.096294 l -2.116667,-2.116667 h -3.910622 l -2.116667,-2.116667 0,-5.70089 z"/>
|
|
409
445
|
</svg>`;
|
|
410
446
|
|
|
411
|
-
// Get SVG content
|
|
447
|
+
// Get SVG content from VSCode icons
|
|
412
448
|
const claudeSvg = claudeIcon.svgstr;
|
|
449
|
+
const wordSvg = wordIcon?.svgstr || '';
|
|
450
|
+
const excelSvg = excelIcon?.svgstr || '';
|
|
451
|
+
const powerpointSvg = powerpointIcon?.svgstr || '';
|
|
413
452
|
|
|
414
453
|
// Create base64 encoded data URIs
|
|
415
454
|
const pythonDataUri = `data:image/svg+xml;base64,${btoa(pythonSvg)}`;
|
|
416
455
|
const markdownDataUri = `data:image/svg+xml;base64,${btoa(markdownSvg)}`;
|
|
417
456
|
const claudeDataUri = `data:image/svg+xml;base64,${btoa(claudeSvg)}`;
|
|
418
457
|
const readmeDataUri = `data:image/svg+xml;base64,${btoa(readmeSvg)}`;
|
|
458
|
+
const pdfDataUri = `data:image/svg+xml;base64,${btoa(pdfSvg)}`;
|
|
459
|
+
const wordDataUri = wordSvg ? `data:image/svg+xml;base64,${btoa(wordSvg)}` : '';
|
|
460
|
+
const excelDataUri = excelSvg ? `data:image/svg+xml;base64,${btoa(excelSvg)}` : '';
|
|
461
|
+
const powerpointDataUri = powerpointSvg ? `data:image/svg+xml;base64,${btoa(powerpointSvg)}` : '';
|
|
419
462
|
|
|
420
463
|
// Inject CSS that overrides icons for .py and .md files
|
|
421
464
|
// Note: Jupytext marks .py and .md files as type="notebook", so we need to
|
|
@@ -492,6 +535,70 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
492
535
|
background-repeat: no-repeat;
|
|
493
536
|
background-position: center;
|
|
494
537
|
}
|
|
538
|
+
|
|
539
|
+
/* Override PDF file icon with VSCode PDF icon */
|
|
540
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon svg,
|
|
541
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon img {
|
|
542
|
+
display: none !important;
|
|
543
|
+
}
|
|
544
|
+
.jp-DirListing-item[data-vscode-pdf] .jp-DirListing-itemIcon::before {
|
|
545
|
+
content: '';
|
|
546
|
+
display: inline-block;
|
|
547
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
548
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
549
|
+
background-image: url('${pdfDataUri}');
|
|
550
|
+
background-size: contain;
|
|
551
|
+
background-repeat: no-repeat;
|
|
552
|
+
background-position: center;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/* Override Word file icon with VSCode Word icon */
|
|
556
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon svg,
|
|
557
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon img {
|
|
558
|
+
display: none !important;
|
|
559
|
+
}
|
|
560
|
+
.jp-DirListing-item[data-vscode-word] .jp-DirListing-itemIcon::before {
|
|
561
|
+
content: '';
|
|
562
|
+
display: inline-block;
|
|
563
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
564
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
565
|
+
background-image: url('${wordDataUri}');
|
|
566
|
+
background-size: contain;
|
|
567
|
+
background-repeat: no-repeat;
|
|
568
|
+
background-position: center;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/* Override Excel file icon with VSCode Excel icon */
|
|
572
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon svg,
|
|
573
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon img {
|
|
574
|
+
display: none !important;
|
|
575
|
+
}
|
|
576
|
+
.jp-DirListing-item[data-vscode-excel] .jp-DirListing-itemIcon::before {
|
|
577
|
+
content: '';
|
|
578
|
+
display: inline-block;
|
|
579
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
580
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
581
|
+
background-image: url('${excelDataUri}');
|
|
582
|
+
background-size: contain;
|
|
583
|
+
background-repeat: no-repeat;
|
|
584
|
+
background-position: center;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/* Override PowerPoint file icon with VSCode PowerPoint icon */
|
|
588
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon svg,
|
|
589
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon img {
|
|
590
|
+
display: none !important;
|
|
591
|
+
}
|
|
592
|
+
.jp-DirListing-item[data-vscode-powerpoint] .jp-DirListing-itemIcon::before {
|
|
593
|
+
content: '';
|
|
594
|
+
display: inline-block;
|
|
595
|
+
width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
596
|
+
height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
|
|
597
|
+
background-image: url('${powerpointDataUri}');
|
|
598
|
+
background-size: contain;
|
|
599
|
+
background-repeat: no-repeat;
|
|
600
|
+
background-position: center;
|
|
601
|
+
}
|
|
495
602
|
`;
|
|
496
603
|
|
|
497
604
|
// Add CSS to make JavaScript and .env icons less bright
|
|
@@ -580,6 +687,26 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
580
687
|
// Not a shell file - always clear shell-type attribute
|
|
581
688
|
item.removeAttribute('data-shell-type');
|
|
582
689
|
}
|
|
690
|
+
|
|
691
|
+
// Handle PDF and Office files by extension (override native JupyterLab icons)
|
|
692
|
+
const nameLower = name.toLowerCase();
|
|
693
|
+
|
|
694
|
+
// Clear all office/pdf attributes first
|
|
695
|
+
item.removeAttribute('data-vscode-pdf');
|
|
696
|
+
item.removeAttribute('data-vscode-word');
|
|
697
|
+
item.removeAttribute('data-vscode-excel');
|
|
698
|
+
item.removeAttribute('data-vscode-powerpoint');
|
|
699
|
+
|
|
700
|
+
// Set the correct attribute based on extension
|
|
701
|
+
if (nameLower.endsWith('.pdf')) {
|
|
702
|
+
item.setAttribute('data-vscode-pdf', 'true');
|
|
703
|
+
} else if (nameLower.endsWith('.doc') || nameLower.endsWith('.docx')) {
|
|
704
|
+
item.setAttribute('data-vscode-word', 'true');
|
|
705
|
+
} else if (nameLower.endsWith('.xls') || nameLower.endsWith('.xlsx')) {
|
|
706
|
+
item.setAttribute('data-vscode-excel', 'true');
|
|
707
|
+
} else if (nameLower.endsWith('.ppt') || nameLower.endsWith('.pptx')) {
|
|
708
|
+
item.setAttribute('data-vscode-powerpoint', 'true');
|
|
709
|
+
}
|
|
583
710
|
});
|
|
584
711
|
};
|
|
585
712
|
|
|
@@ -657,9 +784,9 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
657
784
|
docRegistry.addFileType(fileTypeOptions);
|
|
658
785
|
});
|
|
659
786
|
|
|
660
|
-
// Register Makefile with custom icon (
|
|
661
|
-
const makefileSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="
|
|
662
|
-
<
|
|
787
|
+
// Register Makefile with custom icon (document with gears, from text-x-makefile-svgrepo-com.svg)
|
|
788
|
+
const makefileSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="19 7 90 114">
|
|
789
|
+
<path fill="#c2544f" d="m 29.09375,11.234375 c -3.183804,0 -5.71875,2.566196 -5.71875,5.75 l 0,94.031255 c 0,3.1838 2.534946,5.75 5.71875,5.75 l 69.8125,0 c 3.1838,0 5.71875,-2.5662 5.71875,-5.75 l 0,-70.656255 -21.03125,0 c -4.306108,0 -8.0625,-3.141109 -8.0625,-7.3125 l 0,-21.8125 -46.4375,0 z m 50.4375,0 0,21.8125 c 0,1.714122 1.631968,3.3125 4.0625,3.3125 l 21.03125,0 -25.09375,-25.125 z m -32.34375,29.3125 1.71875,0 1.65625,3.5 0.03125,0.75 -0.53125,2.4375 3.25,1.3125 1.3125,-2.0625 0.59375,-0.53125 3.59375,-1.25 1.25,1.21875 -1.28125,3.59375 -0.5,0.59375 -2.0625,1.3125 1.3125,3.28125 2.40625,-0.5625 0.78125,0.03125 3.46875,1.65625 0,1.75 -3.46875,1.65625 -0.78125,0 -2.40625,-0.5 -1.3125,3.21875 2.0625,1.375 0.5,0.59375 1.28125,3.59375 -1.25,1.25 -3.59375,-1.28125 -0.59375,-0.5625 -1.3125,-2.0625 -3.25,1.34375 0.53125,2.40625 -0.03125,0.78125 -1.65625,3.4375 -1.71875,0 -1.65625,-3.4375 -0.0625,-0.78125 0.53125,-2.40625 -3.25,-1.34375 -1.3125,2.0625 -0.59375,0.5625 -3.59375,1.28125 -1.25,-1.25 1.28125,-3.59375 0.5625,-0.59375 2.0625,-1.375 -1.34375,-3.21875 -2.40625,0.5 -0.8125,0 -3.46875,-1.65625 0,-1.75 3.46875,-1.65625 0.8125,-0.03125 2.40625,0.5625 1.34375,-3.28125 -2.0625,-1.3125 -0.5625,-0.59375 L 36,45.921875 l 1.25,-1.21875 3.59375,1.25 0.59375,0.53125 1.3125,2.0625 3.25,-1.3125 -0.53125,-2.4375 0.0625,-0.75 1.65625,-3.5 z m 0.875,10.875 c -2.927972,0 -5.34375,2.353278 -5.34375,5.28125 0,2.927972 2.415778,5.3125 5.34375,5.3125 2.927972,0 5.28125,-2.384528 5.28125,-5.3125 0,-2.927972 -2.353278,-5.28125 -5.28125,-5.28125 z m 18.15625,10.3125 3.09375,3.34375 0.46875,1.15625 0.40625,2.75 4.46875,0 0.40625,-2.75 0.4375,-1.15625 3.125,-3.34375 2.25,0.71875 0.53125,4.53125 -0.28125,1.21875 -1.3125,2.4375 3.625,2.65625 1.90625,-2 1.0625,-0.625 4.5,-0.90625 1.375,1.90625 -2.21875,3.96875 -0.96875,0.8125 -2.46875,1.1875 1.40625,4.28125 2.71875,-0.46875 1.21875,0.09375 4.15625,1.90625 0,2.34375 -4.15625,1.9375 -1.21875,0.09375 -2.71875,-0.46875 -1.40625,4.25 2.46875,1.21875 0.96875,0.78125 2.21875,4.03125 -1.375,1.875 -4.5,-0.875 -1.0625,-0.65625 -1.90625,-2 -3.625,2.65625 1.3125,2.406255 0.28125,1.21875 -0.53125,4.5625 -2.25,0.75 -3.125,-3.40625 -0.4375,-1.125 -0.40625,-2.71875 -4.46875,0 -0.40625,2.71875 -0.46875,1.125 -3.09375,3.40625 -2.25,-0.75 -0.53125,-4.5625 0.3125,-1.21875 1.28125,-2.406255 -3.625,-2.65625 -1.9375,2 -1.0625,0.65625 -4.46875,0.875 -1.375,-1.875 2.21875,-4.03125 0.9375,-0.78125 2.46875,-1.21875 -1.34375,-4.25 -2.71875,0.46875 -1.21875,-0.09375 -4.1875,-1.9375 0,-2.34375 4.1875,-1.90625 1.21875,-0.09375 2.71875,0.46875 1.34375,-4.28125 -2.46875,-1.1875 -0.9375,-0.8125 -2.21875,-3.96875 1.375,-1.90625 4.46875,0.90625 1.0625,0.625 1.9375,2 3.625,-2.65625 -1.28125,-2.4375 -0.3125,-1.21875 0.53125,-4.53125 2.25,-0.71875 z m 6.1875,14.09375 c -4.866236,0 -8.8125,3.946264 -8.8125,8.8125 0,4.866238 3.946264,8.8125 8.8125,8.8125 4.866237,0 8.8125,-3.946262 8.8125,-8.8125 0,-4.866236 -3.946263,-8.8125 -8.8125,-8.8125 z"/>
|
|
663
790
|
</svg>`;
|
|
664
791
|
|
|
665
792
|
const makefileIcon = new LabIcon({
|
|
@@ -672,7 +799,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
672
799
|
displayName: 'Makefile',
|
|
673
800
|
mimeTypes: ['text/x-makefile'],
|
|
674
801
|
extensions: ['.mk', '.mak', '.make'],
|
|
675
|
-
pattern: '^(Makefile|makefile|GNUmakefile
|
|
802
|
+
pattern: '^(Makefile|makefile|GNUmakefile)$',
|
|
676
803
|
fileFormat: 'text',
|
|
677
804
|
contentType: 'file',
|
|
678
805
|
icon: makefileIcon
|