Skip to content

Commit

Permalink
Give native modules a golden gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy committed Oct 19, 2024
1 parent 901fff4 commit c974582
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/ViperIDE.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
<div><input type="checkbox" id="expand-minify-json" checked/><label for="expand-minify-json">Auto expand/minify JSON</label></div>
<div><input type="checkbox" id="use-word-wrap"/><label for="use-word-wrap">Word wrapping</label></div>
<div><input type="checkbox" id="render-markdown" checked/><label for="render-markdown">Enable Markdown viewer</label></div>
<!--div><input type="checkbox" id="auto-soft-reset" checked/><label for="auto-soft-reset">Soft-reset on Run/Save File</label></div-->
<div class="title-lines" id="menu-line-pkg-mgr">package manager</div>
<div><input type="checkbox" id="force-install-package-source"/><label for="force-install-package-source">Force installing sources (.py)</label></div>
<div><input type="checkbox" id="install-package-source"/><label for="install-package-source">Prefer installing sources (.py)</label></div>
<div class="title-lines" id="menu-line-other">other</div>
<div class="space-between">
<label for="lang">Language:</label>
Expand Down
16 changes: 12 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ import { library, dom } from '@fortawesome/fontawesome-svg-core'
import { faUsb, faBluetoothB } from '@fortawesome/free-brands-svg-icons'
import { faLink, faBars, faDownload, faCirclePlay, faCircleStop, faFolder, faFile, faFileCircleExclamation, faCubes, faGear,
faCube, faTools, faSliders, faCircleInfo, faStar, faExpand, faCertificate,
faPlug, faArrowUpRightFromSquare, faTerminal, faBug,
faPlug, faArrowUpRightFromSquare, faTerminal, faBug, faGaugeHigh,
faTrashCan, faArrowsRotate, faPowerOff, faPlus, faXmark
} from '@fortawesome/free-solid-svg-icons'
import { faMessage, faCircleDown } from '@fortawesome/free-regular-svg-icons'

library.add(faUsb, faBluetoothB)
library.add(faLink, faBars, faDownload, faCirclePlay, faCircleStop, faFolder, faFile, faFileCircleExclamation, faCubes, faGear,
faCube, faTools, faSliders, faCircleInfo, faStar, faExpand, faCertificate,
faPlug, faArrowUpRightFromSquare, faTerminal, faBug,
faPlug, faArrowUpRightFromSquare, faTerminal, faBug, faGaugeHigh,
faTrashCan, faArrowsRotate, faPowerOff, faPlus, faXmark)
library.add(faMessage, faCircleDown)
dom.watch()
Expand Down Expand Up @@ -701,15 +701,23 @@ export async function loadAllPkgIndexes() {
pkgList.insertAdjacentHTML('beforeend', `<div class="title-lines">${i.name}</div>`)
for (const pkg of i.index.packages) {
let offset = ''
let icon = ''
if (pkg.name.includes('-')) {
const parent = pkg.name.split('-').slice(0, -1).join('-')
const exists = i.index.packages.some(pkg => (pkg.name === parent))
if (exists) {
offset = '&emsp;'
}
}
const keywords = pkg.keywords ? pkg.keywords.split(',').map(x => x.trim()) : [];
if (keywords.includes('__hidden__')) {
continue
}
if (keywords.includes('native')) {
icon = ' <i class="fa-solid fa-gauge-high" title="Efficient native module"></i>'
}
pkgList.insertAdjacentHTML('beforeend', `<div>
${offset}<span><i class="fa-solid fa-cube fa-fw"></i> ${pkg.name}</span>
${offset}<span><i class="fa-solid fa-cube fa-fw"></i> ${pkg.name}${icon}</span>
<a href="#" class="menu-action" onclick="app.installPkg('${pkg.name}');return false;">${pkg.version} <i class="fa-regular fa-circle-down"></i></a>
</div>`)
}
Expand All @@ -723,7 +731,7 @@ async function _raw_installPkg(raw, pkg, { version=null } = {}) {
const pkg_info = await rawInstallPkg(raw, pkg, {
version,
dev: dev_info,
prefer_source: QID('force-install-package-source').checked,
prefer_source: QID('install-package-source').checked,
})
if (pkg_info.version) {
toastr.success(`Installed ${pkg_info.name}@${pkg_info.version}`)
Expand Down
1 change: 1 addition & 0 deletions src/app_common.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ button.connected {
.fa-certificate { color: #ba0311; }
.fa-cube { color: #ba9066; }
.fa-cubes { color: #ba9066; }
.fa-gauge-high { color: #ffcc4d; }
.fa-tools { color: #ccd6dd; }
/*.fa-arrows-rotate { color: #3b88c3; }*/
.fa-sliders { color: #ccd6dd }
Expand Down

0 comments on commit c974582

Please sign in to comment.