Update NPM packages, v-tweaks

This commit is contained in:
Jose Stovall 2021-06-04 13:21:15 -05:00
commit 5e55e891ac
10 changed files with 2511 additions and 19358 deletions

View file

@ -1,6 +1,6 @@
{ {
"[javascriptreact]": { "[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "vscode.typescript-language-features",
"editor.tabSize": 2 "editor.tabSize": 2
} }
} }

21628
package-lock.json generated

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 MiB

View file

@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react';
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import semver from 'semver'; import semver from 'semver';
import Components from '../../vt-components.json'; import Components from '../../vt-components.json';
import { Tooltip } from 'bootstrap/dist/js/bootstrap.bundle.js';
const searchFeaturesByName = (query) => { const searchFeaturesByName = (query) => {
const results = Components.all.map( const results = Components.all.map(
@ -32,14 +34,16 @@ export default () => {
versionFilter: null, versionFilter: null,
}); });
const [initBtn, setInitBtn] = useState(null);
useEffect(() => { useEffect(() => {
if (initBtn) { [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
initBtn.click(); .forEach((tooltipEl) => {
} new Tooltip(tooltipEl, {
return () => {}; customClass: tooltipEl.className.includes('experimental') ? "experimental-tooltip" : ""
}, [initBtn]); });
})
return () => { };
}, []);
const onSearch = (evt) => { const onSearch = (evt) => {
const val = evt.target.value; const val = evt.target.value;
@ -67,6 +71,7 @@ export default () => {
}); });
}; };
return ( return (
<CSSTransition classNames="react-router" appear in timeout={300}> <CSSTransition classNames="react-router" appear in timeout={300}>
<div> <div>
@ -95,6 +100,7 @@ export default () => {
className={`btn ${state.versionFilter === version ? 'btn-primary' : 'btn-secondary'}`} className={`btn ${state.versionFilter === version ? 'btn-primary' : 'btn-secondary'}`}
value={version} value={version}
onClick={onVersionSet} onClick={onVersionSet}
key={`version_${version}`}
> >
{version} {version}
</button> </button>
@ -108,11 +114,10 @@ export default () => {
<h2 className="text-center"> <h2 className="text-center">
Search Results Search Results
</h2> </h2>
<div className="row row-cols-1 row-cols-xl-3 g-4"> <div className="row row-cols-1 row-cols-xl-3 g-4">
{state.searchFeatures.map((feature) => ( {state.searchFeatures.map((feature) => (
<div className={`col ${(state.versionFilter == null || feature.versions.includes(state.versionFilter)) ? '' : 'd-none'}`}> <div className={`col ${(state.versionFilter == null || feature.versions.includes(state.versionFilter)) ? '' : 'd-none'}`}>
<div className="card h-100"> <div className={`card h-100 ${feature.experimental ? 'experimental' : ''}`}>
<img src={feature.img} alt="" className="card-img-top" /> <img src={feature.img} alt="" className="card-img-top" />
<div className="card-body"> <div className="card-body">
<h5 className="text-center card-title"> <h5 className="text-center card-title">
@ -134,63 +139,80 @@ export default () => {
</div> </div>
)} )}
<ul className={`nav nav-tabs nav-fill ${state.searching ? 'd-none' : ''}`} role="tablist" style={{ cursor: 'pointer' }} id="nav-tab"> <nav>
{ <div
Components.all.map((comp, idx) => ( className={`nav nav-tabs nav-fill ${state.searching ? 'd-none' : ''}`}
<li className="nav-item" role="presentation"> id="nav-tab"
<div role="tablist"
className="nav-link" style={{ cursor: 'pointer' }}
href={`#${comp.name.toLowerCase().replace(/ /g, '-')}`} >
{
Components.all.map((comp, idx) => (
<button
className={`nav-link ${idx === 0 ? 'active' : ''}`}
id={`${comp.name.toLowerCase().replace(/ /g, '-')}-tab`} id={`${comp.name.toLowerCase().replace(/ /g, '-')}-tab`}
data-bs-toggle="tab"
data-bs-target={`#${comp.name.toLowerCase().replace(/ /g, '-')}`}
type="button"
role="tab"
aria-controls={`${comp.name.toLowerCase().replace(/ /g, '-')}`} aria-controls={`${comp.name.toLowerCase().replace(/ /g, '-')}`}
data-toggle="tab" aria-selected={idx === 0 ? "true" : "false"}
ref={(ref) => idx === 0 && setInitBtn(ref)} key={`${idx}_${comp.name}`}
> >
{comp.name} {comp.name}
</div> </button>
</li> ))
))
} }
</ul> </div>
</nav>
<div className={`tab-content ${state.searching ? 'd-none' : ''}`} role="presentation"> <div
className={`tab-content ${state.searching ? 'd-none' : ''}`}
id="nav-tabContent"
>
{ {
Components.all.map((comp) => ( Components.all.map((comp, idx) => (
<div <div
className="tab-pane fade" className={`tab-pane fade ${idx === 0 ? 'show active' : ''}`}
id={`${comp.name.toLowerCase().replace(/ /g, '-')}`} id={`${comp.name.toLowerCase().replace(/ /g, '-')}`}
aria-labelledby={`${comp.name.toLowerCase().replace(/ /g, '-')}-tab`} role="tabpanel"
role="tabpanel" aria-labelledby={`${comp.name.toLowerCase().replace(/ /g, '-')}-tab`}
> >
<div className="container-fluid my-3"> <div className="container-fluid my-3">
<h2 className="text-center"> <h2 className="text-center">
{comp.name} {comp.name}
</h2> </h2>
<div className="row row-cols-1 row-cols-xl-3 g-4"> <div className="row row-cols-1 row-cols-xl-3 g-4">
{comp.features.map((feature) => ( {comp.features.map((feature) => (
<div className={`col ${(state.versionFilter == null || feature.versions.includes(state.versionFilter)) ? '' : 'd-none'}`}> <div className={`col ${(state.versionFilter == null || feature.versions.includes(state.versionFilter)) ? '' : 'd-none'}`}>
<div className="card h-100"> <div
<img src={feature.img} alt="" className="card-img-top" /> className={`card h-100 ${feature.experimental ? 'experimental' : ''}`}
<div className="card-body">
<h5 className="text-center card-title"> data-bs-toggle={feature.experimental && "tooltip"}
{feature.name} data-bs-placement={feature.experimental && "top"}
</h5> title={feature.experimental && "This Feature is Experimental!"}
<p className="card-text mb-1"> >
{feature.desc} <img src={feature.img} alt="" className="card-img-top" />
</p> <div className="card-body">
</div> <h5 className="text-center card-title">
<div className="card-footer"> {feature.name}
<code className="text-center"> </h5>
{feature.versions.join(', ')} <p className="card-text mb-1">
</code> {feature.desc}
</p>
</div>
<div className="card-footer">
<code className="text-center">
{feature.versions.join(', ')}
</code>
</div>
</div> </div>
</div> </div>
</div> ))}
))} </div>
</div> </div>
</div> </div>
</div> ))
))
} }
</div> </div>
</div> </div>

View file

@ -54,3 +54,27 @@
color: unset !important; color: unset !important;
text-decoration: none; text-decoration: none;
} }
.experimental {
height: 250px;
width: 400px;
background: linear-gradient(white,white), repeating-linear-gradient(
45deg,
black,
black 10px,
yellow 10px,
yellow 20px
);
background-attachment: padding-box, border-box;
padding: 5px 5px;
border-radius: 8px;
background-origin: content-box, padding-box;
background-clip: content-box, padding-box;}
.experimental-tooltip .tooltip-arrow:before {
border-top-color: red;
}
.experimental-tooltip .tooltip-inner {
background-color: red;
}

View file

@ -12,7 +12,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -26,7 +26,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -40,7 +40,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -53,7 +53,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -75,6 +75,13 @@
"1.8.9", "1.8.9",
"1.9.4" "1.9.4"
] ]
},
{
"name": "Tree Falling",
"desc": "Trees actually fall down when breaking their trunk, based off of Tersnip's ChopDown Mod!",
"experimental": true,
"img": "/img/vtweaks/screenshots/tree_falling.gif",
"versions": [ "1.16.5" ]
} }
] ]
}, },
@ -104,7 +111,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -119,7 +126,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -134,7 +141,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -145,7 +152,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -183,7 +190,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -198,7 +205,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -210,7 +217,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -253,8 +260,26 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
},
{
"name": "Smaller Bees",
"desc": "This tweak makes it so that bees appear to be smaller (exactly half their size, actually!). Logistically this changes nothing about them - their bounding and hit box is the same for your convenience, but they're sooo cute!",
"img": "/img/vtweaks/screenshots/smol_bees.jpg",
"versions": [ "1.16.5" ]
},
{
"name": "Low Health Sound",
"desc": "This tweak produces a heartbeat-like sound whenever your health is below a configurable threshold. This is purely client-side and can be disabled individually by each user.",
"img": "/img/vtweaks/screenshots/low_health_sound.png",
"versions": [ "1.16.5" ]
},
{
"name": "No Pet Friendly Fire",
"desc": "This tweak prevents pet owners (or all players - this is configurable) from hurting tamed pets so that you can keep your special friend alive and healthy!",
"img": "/img/vtweaks/screenshots/npff.jpg",
"versions": [ "1.16.5" ]
} }
] ]
}, },
@ -270,7 +295,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -285,7 +310,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -300,7 +325,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -358,7 +383,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -373,7 +398,7 @@
"1.12.2", "1.12.2",
"1.14.4", "1.14.4",
"1.15.2", "1.15.2",
"1.16.4" "1.16.5"
] ]
}, },
{ {
@ -408,6 +433,12 @@
"1.8.9", "1.8.9",
"1.9.4" "1.9.4"
] ]
},
{
"name": "Cheap Anvil Repairs",
"desc": "Ever felt that it was unfair how quickly the XP cost of repairing a tool was? This tweak resets the repair cost every time so that you can reasonably maintain your tools for a long time!",
"img": "/img/vtweaks/screenshots/anvil_repair_cost.png",
"versions": [ "1.16.5" ]
} }
] ]
} }