Installations
npm install svelte-macy
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
16.15.1
NPM Version
8.11.0
Score
68.2
Supply Chain
98.7
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
Svelte (74.61%)
TypeScript (17.66%)
JavaScript (5.82%)
HTML (1.91%)
Developer
hongkiulam
Download Statistics
Total Downloads
3,440
Last Day
1
Last Week
7
Last Month
55
Last Year
798
GitHub Statistics
3 Stars
23 Commits
1 Forks
3 Watching
1 Branches
1 Contributors
Bundle Size
11.70 kB
Minified
3.79 kB
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
3,440
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Svelte Macy
A Svelte Masonry component which wraps macy.js
Installation
1npm install svelte-macy
Usage
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
Props
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
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>
Component Type
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;
SvelteKit/ SSR
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>
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
project is archived
Details
- Warn: Repository is archived.
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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
28 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-5p75-vc5g-8rv2
- Warn: Project is vulnerable to: GHSA-gv7g-x59x-wf8f
- Warn: Project is vulnerable to: GHSA-mh2x-fcqh-fmqv
- Warn: Project is vulnerable to: GHSA-rjjv-87mx-6x3h
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-8266-84wp-wv5c
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-5r9g-qh6m-jxff
- Warn: Project is vulnerable to: GHSA-r6ch-mqf9-qc9w
- Warn: Project is vulnerable to: GHSA-wqq4-5wpv-mx2g
- Warn: Project is vulnerable to: GHSA-3787-6prv-h9w3
- Warn: Project is vulnerable to: GHSA-9qxr-qj54-h672
- Warn: Project is vulnerable to: GHSA-m4v8-wqvr-p9f7
- Warn: Project is vulnerable to: GHSA-c76h-2ccp-4975
- Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67
- Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
1.7
/10
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