Gathering detailed insights and metrics for svelte-macy
Gathering detailed insights and metrics for svelte-macy
npm install svelte-macy
Typescript
Module System
Node Version
NPM Version
68.2
Supply Chain
98.7
Quality
75.4
Maintenance
100
Vulnerability
100
License
Svelte (74.61%)
TypeScript (17.66%)
JavaScript (5.82%)
HTML (1.91%)
Total Downloads
3,440
Last Day
1
Last Week
7
Last Month
55
Last Year
798
3 Stars
23 Commits
1 Forks
3 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.2.1
Package Id
svelte-macy@1.2.1
Unpacked Size
9.08 kB
Size
3.67 kB
File Count
8
NPM Version
8.11.0
Node Version
16.15.1
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-66.7%
7
Compared to previous week
Last month
189.5%
55
Compared to previous month
Last year
-15.6%
798
Compared to previous year
A Svelte Masonry component which wraps macy.js
1npm install svelte-macy
1<script> 2 import Macy from 'svelte-macy'; // default export 3 import { Macy } from 'svelte-macy'; // named export 4</script> 5 6<Macy> 7 <div>Child 1</div> 8 <div>Child 2</div> 9 <div>Child 3</div> 10 <div>Child 4</div> 11</Macy>
For a basic usage example, checkout the Svelte REPL demo here
options
Since this component is a simple wrapper for macy.js, the options are close to identical (options.container
has been handled by the component so it is not exposed).
Here is a list of supported options along with their default values
1{ 2 columns: 4, 3 trueOrder: false, 4 margin: 0, 5 waitForImages: false, 6 useOwnImageLoader: false, 7 mobileFirst: false, 8 breakAt: undefined, 9 cancelLegacy: false, 10 useContainerForBreakpoints: false, 11}
You can find the full documentation for these options here
macy
You can use the macy
prop to gain access to the underlying macy instance and its methods.
Using Svelte's bind directive
1<script> 2 let macy; 3 4 function someFunction() { 5 if (macy) { 6 macy.recalculate(); 7 } 8 } 9</script> 10 11<Macy bind:macy="{macy}"> 12 <div /> 13</Macy>
Available methods are recalculate
, runOnImageLoad
, remove
, reInit
, on
, emit
. Full documentation can be found here
macy.js also provides some constants that are used with its events system, namely on
and emit
. These are re-exported for convenience.
1<script> 2 import { EVENTS } from 'svelte-macy'; 3</script>
Typescript is supported out of the box.
For the component, simply import as you would normally. This will provide typings for the component's props.
1<script lang="ts"> 2 import { Macy } from 'svelte-macy'; 3</script>
To import type definitions
1<script lang="ts"> 2 import type { MacyInit, MacyInstance, MacyOptions, MacyEvents } from 'svelte-macy'; 3</script>
1// top level import 2import type { Macy } from 'svelte-macy'; 3import type Macy from 'svelte-macy'; 4 5let MacyComponentType: typeof Macy; 6 7// type import 8let MacyComponentType: typeof import('svelte-macy').default; 9let MacyComponentType: typeof import('svelte-macy').Macy;
Unfortunately the macy.js dependency relies on window
/ document
which is not available on the server. A workaround is to
only import this component on the client.
1<script> 2 import { onMount } from "svelte"; 3 4 let MacyComponent: typeof import("svelte-macy").Macy; 5 6 onMount(async () => { 7 MacyComponent = (await import("svelte-macy")).Macy // or .default; 8 }); 9 10 let macy; 11</script> 12 13<svelte:component this="{MacyComponent}" bind:macy options="{{}}"> 14 <div /> 15</svelte:component>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
project is archived
Details
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More