Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@agence-webup/tiroir
Advanced tools
A simple but complete drawer menu plugin in vanilla JavaScript
⚠️ (Still in early development state)
Method | Procedure |
---|---|
NPM | coming soon |
Download | Download zip |
Then Tiroir have some css you will have to add (feel free to custom it for a better integration in your UI):
<link rel="stylesheet" href="dist/tiroir/tiroir.css">
Finally just link the Tiroir's code at the end of your document:
<!-- Browser build -->
<script src="dist/tiroir/tiroir.min.js"></script>
Or as a JS module:
// ES6 module build
import tiroir from 'Tiroir'
var tiroir = new Tiroir({
trigger: document.querySelectorAll('[data-tiroir-btn]') // If you alredy now which element clicks will open the menu
})
You can create the content by yourself or use the API to build your navigation with a JSON/JS-Object (cf. below)
You can give an HTML element
as content
option to init object. The plugin will send it into the menu.
data-tiroir-nav
attribute it gonna parse the contain and fill the stacking navigation with it.data-tiroir-footer
attribute it gonna send it into the sticky footer elementIf you have a complex navigation or don't want your link to be indexed by search engines, you can fill the stacking navigation with a JSON/JS-Object using the setItems()
function.
The object must respect this type of structure to be able to work:
const items = [
{
label: 'Home',
link: 'https://example.com/'
},
{
label: 'Blog',
items: [
{
label: 'Posts',
attributes: { // You can pass custom html attributes
class: 'test'
},
link: 'https://example.com/blog/',
items: [
{
label: 'My super post 1',
link: 'https://example.com/blog/test1',
},
{
label: 'My super post 2',
link: 'https://example.com/blog/test2',
},
{
label: 'My super post 3',
link: 'https://example.com/blog/test3',
},
]
},
{
label: 'Videos',
items: [
{
label: 'My first vlog',
link: 'https://example.com/videos/1',
},
{
label: 'My presentation video',
link: 'https://example.com/videos/2',
},
{
label: 'Vlog 2',
link: 'https://example.com/videos/3',
},
]
},
]
},
{
label: 'Contact',
link: 'https://example.com/contact'
},
]
const menu = new Tiroir()
menu.setItems(items)
Name | Type | Description |
---|---|---|
trigger | node list/element | Element(s) who will open the menu on click |
content | node element | Default menu content on load |
directionReverse | boolean | Inverse the menu opening's direction (on the right by default) |
onOpen | function | Callback to execute when tiroir is opening |
onClose | function | Callback to execute when tiroir is closing |
resetLabel | string | Custom back-home button's label in the navigation |
currentLabel | string | Custom current prefix's label in the navigation |
Example:
const menu = new Tiroir({
content: document.querySelector('[data-tiroir="menu-content"]'),
trigger: document.querySelectorAll('[data-tiroir-btn]'),
resetLabel: 'Back at first',
currentLabel: 'All the ',
onOpen: function () {
console.log('menu opened')
},
onClose: function () {
console.log('menu closed')
}
});
You can use the API to generate content and open or close your menu with JS:
Name | Parameter type(s) | Description |
---|---|---|
open() | no parameter | Open your menu |
close() | no parameter | Close your menu |
setItems(items) | JSON or JS Array | Set a custom navigation (more info on the structure below) |
parseItems(el) | HTML element | Parse a navigation container and fill the navigation with it |
setContent(el) | HTML element | Set a custom content |
setFooter(el) | HTML element | Set a custom content |
Example:
tiroir.setItems(navContent);
tiroir.open()
npm i
(or npm ci
if you don't want to impact package-lock)npm run dev
npm run build
)FAQs
A simple drawer menu vanilla plugin
We found that @agence-webup/tiroir demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.