Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@geoffcox/svelte-splitter
Advanced tools
A splitter for Svelte that leverages CSS grid templates for simple and consistent resizing.
A resizable splitter for Svelte that leverages CSS display:grid
npm install --save @geoffcox/svelte-splitter
To create vertical or horizontal splits you only need the Split
component.
The default creates a left(50%) | right(50%) split, no minimum pane sizes, and renders the default splitter.
<Split>
<div slot="primary">This is the left pane.</div>
<div slot="secondary">This is the right pane.<div>
</Split>
Add the horizontal
attribute to split top/bottom.
<Split horizontal>
<div slot="primary">This is the top pane.</div>
<div slot="secondary">This is the bottom pane.<div>
</Split>
Add the initialPrimarySize
property to control where the initial split occurs.
<Split initialPrimarySize='30%'>
<div slot="primary">Primary pane</div>
<div slot="secondary">Secondary pane<div>
</Split>
To support double-clicking to reset back to the initial size, add the resetOnDoubleClick
property.
<Split initialPrimarySize='30%' resetOnDoubleClick>
<div slot="primary">Primary pane</div>
<div slot="secondary">Secondary pane<div>
</Split>
Just nest Split componets to create whatever layout you like. Here is an example of a common layout for a main, detail, and output view.
<Split initialPrimarySize='30%'>
<div slot="primary">This is the left pane.</div>
<svelte:fragment slot="secondary">
<Split horizontal initialPrimarySize='60%'>
<div slot="primary">This is the right-top pane.</div>
<div slot="secondary">This is the right-bottom pane.</div>
</Split>
</svelte:fragment>
</Split>
Prevent either pane from becoming too small using the minPrimarySize
and minSecondarySize
properties.
<Split minPrimarySize='250px' minSecondarySize='15%'>
<div slot="primary">This pane won't get smaller than 250 pixels.</div>
<div slot="secondary">This pane won't get any smaller than 15% of the overall size of the split control./<div>
</Split>
Set the size of the default splitter's hit area with the splitterSize
property.
The hit area is where the user can click to start dragging the splitter.
<Split splitterSize='10px'>
<div slot="primary">Primary pane</div>
<div slot="secondary">Secondary pane<div>
</Split>
Change the colors of the default splitter by adding the DefaultSplitter
to the splitter slot.
Pass color properties to the default splitter.
<Split defaultSplitterColors={colors}>
<div slot="primary">Primary pane</div>
<svelte:fragment slot="splitter">
<DefaultSplitter color="red" hoverColor="#00FF00" dragColor="blue">
</svelte:fragment>
<div slot="secondary">Secondary pane<div>
</Split>
Substitute a custom splitter by replacing the default splitter.
<Split defaultSplitterColors={colors}>
<div slot="primary">Primary pane</div>
<svelte:fragment slot="splitter">
<MyAwesomeSplitter />
</svelte:fragment>
<div slot="secondary">Secondary pane<div>
</Split>
When building a customer splitter, leverage the context information from the parent Split
component.
let splitterContext = getContext<SplitterContextStore>(splitterContextKey);
$: dragging = $splitterContext.dragging;
$: horizontal = $splitterContext.horizontal;
};
Subscribe to the changed event to get updates.
const onChanged = (event) => {
console.log(`percent: ${event.percent}`);
console.log(`primarySize: ${event.primarySize}`);
console.log(`splitterSize: ${event.splitterSize}`);
console.log(`secondarySize: ${event.secondarySize}`);
console.log(`dragging: ${event.dragging}`);
};
```ts
```svelte
<Split on:changed={onChanged}>
...
</Split>
Get or set the percentage by calling getPercent
and setPercent
on the Split
handle.
let splitControl;
const flipSplitPercent = () => {
const percent = splitControl.getPercent();
splitControl.setPercent(100 - percent);
}
<Split
bind:this={splitControl}>
...
</Split>
FAQs
A splitter for Svelte that leverages CSS grid templates for simple and consistent resizing.
The npm package @geoffcox/svelte-splitter receives a total of 108 weekly downloads. As such, @geoffcox/svelte-splitter popularity was classified as not popular.
We found that @geoffcox/svelte-splitter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.